From: curt Date: Tue, 23 Nov 2004 21:35:30 +0000 (+0000) Subject: Add a *really* crude model of ITT, Oil Temp, and Oil Pressure. This X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=91ae7ce82a14de5b999d9630885d0234f2a58b14;p=flightgear.git 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. --- diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 57d95c041..332ebd638 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -104,7 +104,7 @@ void FGFDM::iterate(float dt) } _airplane.calcFuelWeights(); - setOutputProperties(); + setOutputProperties(dt); } 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]; int i; @@ -483,6 +495,15 @@ void FGFDM::setOutputProperties() node->setFloatValue("epr", j->getEPR()); node->setFloatValue("egr-degf", 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 } } } diff --git a/src/FDM/YASim/FGFDM.hpp b/src/FDM/YASim/FGFDM.hpp index 66a842ba1..e6503581e 100644 --- a/src/FDM/YASim/FGFDM.hpp +++ b/src/FDM/YASim/FGFDM.hpp @@ -34,7 +34,7 @@ private: struct PropOut { SGPropertyNode* prop; int handle, type; bool left; float min, max; }; - void setOutputProperties(); + void setOutputProperties(float dt); Rotor* parseRotor(XMLAttributes* a, const char* name); Wing* parseWing(XMLAttributes* a, const char* name); diff --git a/src/FDM/YASim/Jet.hpp b/src/FDM/YASim/Jet.hpp index 2376aa950..9bfe6512e 100644 --- a/src/FDM/YASim/Jet.hpp +++ b/src/FDM/YASim/Jet.hpp @@ -39,6 +39,9 @@ public: float getEPR(); float getEGT(); + // Normalized "performance" number. Used for fuzzy numbers in FGFDM + float getPerfNorm() { return (_n1 - _n1Min) / (_n1Max - _n1Min); } + // From Thruster: virtual bool isRunning(); virtual bool isCranking();