X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FYASim%2FJet.cpp;h=f80cac543daee572160a6247eee53b9733672b67;hb=d66903e9ad63b91182ccc25d9bb82f18f8dd98b6;hp=200a743dbc2ae7a1b8d5475a54c20261bb122589;hpb=a682823adaf0fded092a7c6cfc5d099c27525ba8;p=flightgear.git diff --git a/src/FDM/YASim/Jet.cpp b/src/FDM/YASim/Jet.cpp index 200a743db..f80cac543 100644 --- a/src/FDM/YASim/Jet.cpp +++ b/src/FDM/YASim/Jet.cpp @@ -10,6 +10,7 @@ Jet::Jet() _reheat = 0; _rotControl = 0; _maxRot = 0; + _reverseThrust = false; // Initialize parameters for an early-ish subsonic turbojet. More // recent turbofans will typically have a lower vMax, epr0, and @@ -31,6 +32,7 @@ Jet::Jet() // And sanify the remaining junk, just in case. _running = true; _cranking = false; + _fuel = true; _epr = 1; _fuelFlow = 0; _egt = 273; @@ -140,16 +142,22 @@ void Jet::integrate(float dt) const static float T0 = Atmosphere::getStdTemperature(0); const static float D0 = Atmosphere::getStdDensity(0); - float speed = -Math::dot3(_wind, _dir); + float spd = -Math::dot3(_wind, _dir); float statT, statP, statD; - Atmosphere::calcStaticAir(_pressure, _temp, _rho, speed, + Atmosphere::calcStaticAir(_pressure, _temp, _rho, spd, &statP, &statT, &statD); _pressureCorrect = statP/P0; _tempCorrect = Math::sqrt(statT/T0); + // Handle running out of fuel. This is a hack. What should + // really happen is a simulation of ram air torque on the + // turbine. This just forces the engine into ground idle. + if(_fuel == false) + _throttle = 0; + // Linearly taper maxThrust to zero at vMax - float vCorr = 1 - (speed/_vMax); + float vCorr = spd<0 ? 1 : (spd<_vMax ? 1-spd/_vMax : 0); float maxThrust = _maxThrust * vCorr * (statD/D0); float setThrust = maxThrust * _throttle; @@ -186,6 +194,9 @@ void Jet::integrate(float dt) // 3.5 times as much // fuel per thrust unit _egt = T0 + beta*ibeta0 * (_egt0 - T0); + + // Thrust reverse handling: + if(_reverseThrust) _thrust *= -_reverseEff; } bool Jet::isRunning()