1 #include "Atmosphere.hpp"
3 #include "TurbineEngine.hpp"
7 TurbineEngine::TurbineEngine(float power, float omega, float alt,
12 _rho0 = Atmosphere::getStdDensity(0);
13 _maxTorque = (power/omega) * _rho0 / Atmosphere::getStdDensity(alt);
14 _flatRating = flatRating;
15 _bsfc = 0.047; // == 0.5 lb/hr per hp
21 _n2 = _n2Target = _n2Min;
28 void TurbineEngine::setOutputFromN2()
30 float frac = (_n2 - _n2Min) / (_n2Max - _n2Min);
31 _torque = frac * _maxTorque * (_rho / _rho0);
32 _fuelFlow = _bsfc * _torque * _omega;
35 void TurbineEngine::stabilize()
41 void TurbineEngine::integrate(float dt)
43 // Low-pass the N2 speed to give a realistic spooling time. See
44 // the notes in Jet::setSpooling() for details; this corresponds
45 // to a hard-coded spool time of 2 seconds.
46 const float DECAY = 1.15;
47 _n2 = (_n2 + dt * DECAY * _n2Target)/(1 + dt * DECAY);
51 void TurbineEngine::calc(float pressure, float temp, float omega)
53 if ( _cond_lever < 0.001 ) {
60 _rho = Atmosphere::calcStdDensity(pressure, temp);
62 float torque = _throttle * _maxTorque * _rho / _rho0;
63 float power = torque * omega;
64 if(power > _flatRating)
65 torque = _flatRating / omega;
67 float frac = torque / (_maxTorque * (_rho / _rho0));
70 _n2Target = _n2Min + (_n2Max - _n2Min) * frac;