Add a *really* crude model of ITT, Oil Temp, and Oil Pressure. This
currently just returns a lagged normalized value in the range of 0-1 that is proportional to N1. It's up to the engine gauge to scale to the right range. This is for lack of a real model of these items so we can have something to drive the engine gauges.
This commit is contained in:
parent
7159e318e1
commit
91ae7ce82a
3 changed files with 27 additions and 3 deletions
|
@ -104,7 +104,7 @@ void FGFDM::iterate(float dt)
|
||||||
}
|
}
|
||||||
_airplane.calcFuelWeights();
|
_airplane.calcFuelWeights();
|
||||||
|
|
||||||
setOutputProperties();
|
setOutputProperties(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
Airplane* FGFDM::getAirplane()
|
Airplane* FGFDM::getAirplane()
|
||||||
|
@ -391,7 +391,19 @@ void FGFDM::getExternalInput(float dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGFDM::setOutputProperties()
|
// Linearly "seeks" a property by the specified fraction of the way to
|
||||||
|
// the target value. Used to emulate "slowly changing" output values.
|
||||||
|
static void moveprop(SGPropertyNode* node, const char* prop,
|
||||||
|
float target, float frac)
|
||||||
|
{
|
||||||
|
float val = node->getFloatValue(prop);
|
||||||
|
if(frac > 1) frac = 1;
|
||||||
|
if(frac < 0) frac = 0;
|
||||||
|
val += (target - val) * frac;
|
||||||
|
node->setFloatValue(prop, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FGFDM::setOutputProperties(float dt)
|
||||||
{
|
{
|
||||||
// char buf[256];
|
// char buf[256];
|
||||||
int i;
|
int i;
|
||||||
|
@ -483,6 +495,15 @@ void FGFDM::setOutputProperties()
|
||||||
node->setFloatValue("epr", j->getEPR());
|
node->setFloatValue("epr", j->getEPR());
|
||||||
node->setFloatValue("egr-degf",
|
node->setFloatValue("egr-degf",
|
||||||
j->getEGT() * K2DEGF + K2DEGFOFFSET);
|
j->getEGT() * K2DEGF + K2DEGFOFFSET);
|
||||||
|
|
||||||
|
// These are "unmodeled" values that are still needed for
|
||||||
|
// many cockpits. Tie them all to the N1 speed, but
|
||||||
|
// normalize the numbers to the range [0:1] so the
|
||||||
|
// cockpit code can scale them to the right values.
|
||||||
|
float pnorm = j->getPerfNorm();
|
||||||
|
moveprop(node, "oilp-norm", pnorm, dt/3); // 3s seek time
|
||||||
|
moveprop(node, "oilt-norm", pnorm, dt/30); // 30s
|
||||||
|
moveprop(node, "itt-norm", pnorm, dt/1); // 1s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ private:
|
||||||
struct PropOut { SGPropertyNode* prop; int handle, type; bool left;
|
struct PropOut { SGPropertyNode* prop; int handle, type; bool left;
|
||||||
float min, max; };
|
float min, max; };
|
||||||
|
|
||||||
void setOutputProperties();
|
void setOutputProperties(float dt);
|
||||||
|
|
||||||
Rotor* parseRotor(XMLAttributes* a, const char* name);
|
Rotor* parseRotor(XMLAttributes* a, const char* name);
|
||||||
Wing* parseWing(XMLAttributes* a, const char* name);
|
Wing* parseWing(XMLAttributes* a, const char* name);
|
||||||
|
|
|
@ -39,6 +39,9 @@ public:
|
||||||
float getEPR();
|
float getEPR();
|
||||||
float getEGT();
|
float getEGT();
|
||||||
|
|
||||||
|
// Normalized "performance" number. Used for fuzzy numbers in FGFDM
|
||||||
|
float getPerfNorm() { return (_n1 - _n1Min) / (_n1Max - _n1Min); }
|
||||||
|
|
||||||
// From Thruster:
|
// From Thruster:
|
||||||
virtual bool isRunning();
|
virtual bool isRunning();
|
||||||
virtual bool isCranking();
|
virtual bool isCranking();
|
||||||
|
|
Loading…
Reference in a new issue