]> git.mxchange.org Git - flightgear.git/commitdiff
Add a *really* crude model of ITT, Oil Temp, and Oil Pressure. This
authorcurt <curt>
Tue, 23 Nov 2004 21:35:30 +0000 (21:35 +0000)
committercurt <curt>
Tue, 23 Nov 2004 21:35:30 +0000 (21:35 +0000)
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.

src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/FGFDM.hpp
src/FDM/YASim/Jet.hpp

index 57d95c041571e5e58d2b296c7d922f31f80f655c..332ebd6383f16995f4e17950a3c32e36d073f1d1 100644 (file)
@@ -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
         }
     }
 }
index 66a842ba1350d640589b4725e76fc2b95687b146..e6503581e0e781af36c1e77c37748cadeb42568d 100644 (file)
@@ -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);
index 2376aa950e9c72eac08b28a748b8b07b7520c6a0..9bfe6512e15ba90a1801ee49669468177789e2de 100644 (file)
@@ -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();