]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/TurbineEngine.cpp
Port over remaining Point3D usage to the more type and unit safe SG* classes.
[flightgear.git] / src / FDM / YASim / TurbineEngine.cpp
index ab27c3c9d0699f41af8f885024654068fda1dc33..9d3af66091b1a586f462dcee2d22b584af6122aa 100644 (file)
@@ -30,11 +30,12 @@ void TurbineEngine::setOutputFromN2()
 {
     float frac = (_n2 - _n2Min) / (_n2Max - _n2Min);
     _torque = frac * _maxTorque * (_rho / _rho0);
-    _fuelFlow = _bsfc * _torque * _omega;
+    _fuelFlow = _running ? _bsfc * _torque * _omega : 0;
 }
 
 void TurbineEngine::stabilize()
 {
+    _fuel = true;
     _n2 = _n2Target;
     setOutputFromN2();
 }
@@ -51,11 +52,7 @@ void TurbineEngine::integrate(float dt)
 
 void TurbineEngine::calc(float pressure, float temp, float omega)
 {
-    if ( _cond_lever < 0.001 ) {
-        _running = false;
-    } else {
-        _running = true;
-    }
+    _running = _fuel && _cond_lever > 0.001;
 
     _n2Min = _n2LowIdle + (_n2HighIdle - _n2LowIdle) * _cond_lever;
     _omega = omega;
@@ -68,11 +65,7 @@ void TurbineEngine::calc(float pressure, float temp, float omega)
 
     float frac = torque / (_maxTorque * (_rho / _rho0));
 
-    if ( _running ) {
-        _n2Target = _n2Min + (_n2Max - _n2Min) * frac;
-    } else {
-        _n2Target = 0;
-    }
+    _n2Target = _running ? _n2Min + (_n2Max - _n2Min) * frac : 0;
 }
 
 }; // namespace yasim