1 #include "Atmosphere.hpp"
3 #include "TurbineEngine.hpp"
7 TurbineEngine::TurbineEngine(float power, float omega, float alt,
10 _rho0 = Atmosphere::getStdDensity(0);
11 _maxTorque = (power/omega) * _rho0 / Atmosphere::getStdDensity(alt);
12 _flatRating = flatRating;
13 _bsfc = 0.047; // == 0.5 lb/hr per hp
19 _n2 = _n2Target = _n2Min;
24 void TurbineEngine::setOutputFromN2()
26 float frac = (_n2 - _n2Min) / (_n2Max - _n2Min);
27 _torque = frac * _maxTorque * (_rho / _rho0);
28 _fuelFlow = _bsfc * _torque * _omega;
31 void TurbineEngine::stabilize()
37 void TurbineEngine::integrate(float dt)
39 // Low-pass the N2 speed to give a realistic spooling time. See
40 // the notes in Jet::setSpooling() for details; this corresponds
41 // to a hard-coded spool time of 2 seconds.
42 const float DECAY = 1.15;
43 _n2 = (_n2 + dt * DECAY * _n2Target)/(1 + dt * DECAY);
47 void TurbineEngine::calc(float pressure, float temp, float omega)
51 _rho = Atmosphere::calcStdDensity(pressure, temp);
53 float torque = _throttle * _maxTorque * _rho / _rho0;
54 float power = torque * omega;
55 if(power > _flatRating)
56 torque = _flatRating / omega;
58 float frac = torque / (_maxTorque * (_rho / _rho0));
59 _n2Target = _n2Min + (_n2Max - _n2Min) * frac;