]> git.mxchange.org Git - flightgear.git/commitdiff
Wire up a "gear-ratio" attribute for geared propeller aircraft
authorandy <andy>
Sat, 24 Jan 2004 23:09:41 +0000 (23:09 +0000)
committerandy <andy>
Sat, 24 Jan 2004 23:09:41 +0000 (23:09 +0000)
src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/PropEngine.cpp
src/FDM/YASim/PropEngine.hpp

index 01e707772b87b214da16ce42a49aa9f81802b108..ed0bd150429ed01ba774b9bef50e497a065a2c68 100644 (file)
@@ -623,6 +623,8 @@ void FGFDM::parsePropeller(XMLAttributes* a)
        prop->setManualPitch();
     }
 
+    thruster->setGearRatio(attrf(a, "gear-ratio", 1));
+
     char buf[64];
     sprintf(buf, "/engines/engine[%d]", _nextEngine++);
     EngRec* er = new EngRec();
index 429ded72e6ab890a6219e09e433cd16aaa93bbe8..4c06a4d8a700b7aeaf790f7395811945c59e79e5 100644 (file)
@@ -11,6 +11,7 @@ PropEngine::PropEngine(Propeller* prop, PistonEngine* eng, float moment)
     _dir[0] = 1; _dir[1] = 0; _dir[2] = 0;
 
     _variable = false;
+    _gearRatio = 1;
 
     _prop = prop;
     _eng = eng;
@@ -154,7 +155,7 @@ void PropEngine::integrate(float dt)
     _eng->setMixture(_mixture);
     _eng->setFuelState(_fuel);
     
-    _prop->calc(_rho, speed, _omega, &thrust, &propTorque);
+    _prop->calc(_rho, speed, _omega * _gearRatio, &thrust, &propTorque);
     _eng->calc(_pressure, _temp, _omega);
     engTorque = _eng->getTorque();
     _fuelFlow = _eng->getFuelFlow();
index 7b8eac12861a668020d3f9b24e6383aa6f518375..603dee1629c91512ea2a02a008666ac56a0dc8a3 100644 (file)
@@ -17,6 +17,7 @@ public:
     void setAdvance(float advance);
     void setPropPitch(float proppitch);
     void setVariableProp(float min, float max);
+    void setGearRatio(float ratio) { _gearRatio = ratio; }
 
     virtual PropEngine* getPropEngine() { return this; }
     virtual PistonEngine* getPistonEngine() { return _eng; }
@@ -45,6 +46,7 @@ private:
 
     bool _variable;
     int _magnetos;  // 0=off, 1=right, 2=left, 3=both
+    float _gearRatio;
     float _advance; // control input, 0-1
     float _maxOmega;
     float _minOmega;