From 85fe50dcc5a00aab3a4fc2b52819d828db1c081d Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 27 Jul 2004 20:39:56 +0000 Subject: [PATCH] Add support for a turbo prop condition lever. Add support in the aircraft config file for a low idle and high idle n2. --- src/FDM/YASim/FGFDM.cpp | 5 +++-- src/FDM/YASim/TurbineEngine.cpp | 8 +++++--- src/FDM/YASim/TurbineEngine.hpp | 10 ++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 258a3424b..57d95c041 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -634,8 +634,9 @@ void FGFDM::parseTurbineEngine(XMLAttributes* a) float flatRating = attrf(a, "flat-rating") * HP2W; TurbineEngine* eng = new TurbineEngine(power, omega, alt, flatRating); - if(a->hasAttribute("min-n2")) - eng->setN2Range(attrf(a, "min-n2"), attrf(a, "max-n2")); + if(a->hasAttribute("n2-low-idle")) + eng->setN2Range(attrf(a, "n2-low-idle"), attrf(a, "n2-high-idle"), + attrf(a, "n2-max")); // Nasty units conversion: lbs/hr per hp -> kg/s per watt if(a->hasAttribute("bsfc")) diff --git a/src/FDM/YASim/TurbineEngine.cpp b/src/FDM/YASim/TurbineEngine.cpp index ee79fcdb1..6e489bbb4 100644 --- a/src/FDM/YASim/TurbineEngine.cpp +++ b/src/FDM/YASim/TurbineEngine.cpp @@ -7,18 +7,19 @@ namespace yasim { TurbineEngine::TurbineEngine(float power, float omega, float alt, float flatRating) { - // _cond_lever = 1.0; + _cond_lever = 1.0; _rho0 = Atmosphere::getStdDensity(0); _maxTorque = (power/omega) * _rho0 / Atmosphere::getStdDensity(alt); _flatRating = flatRating; _bsfc = 0.047; // == 0.5 lb/hr per hp - _n2Min = 65; + _n2LowIdle = 50; + _n2HighIdle = 70; _n2Max = 100; _rho = _rho0; _omega = 0; - _n2 = _n2Target = _n2Min; + _n2 = _n2Target = _n2Min = _n2LowIdle; _torque = 0; _fuelFlow = 0; @@ -56,6 +57,7 @@ void TurbineEngine::calc(float pressure, float temp, float omega) _running = true; } + _n2Min = _n2LowIdle + (_n2HighIdle - _n2LowIdle) * _cond_lever; _omega = omega; _rho = Atmosphere::calcStdDensity(pressure, temp); diff --git a/src/FDM/YASim/TurbineEngine.hpp b/src/FDM/YASim/TurbineEngine.hpp index 3f14edb21..ab496ebde 100644 --- a/src/FDM/YASim/TurbineEngine.hpp +++ b/src/FDM/YASim/TurbineEngine.hpp @@ -10,7 +10,11 @@ public: virtual TurbineEngine* isTurbineEngine() { return this; } TurbineEngine(float power, float omega, float alt, float flatRating); - void setN2Range(float min, float max) { _n2Min = min; _n2Max = max; } + void setN2Range(float low_idle, float high_idle, float max) { + _n2LowIdle = low_idle; + _n2HighIdle = high_idle; + _n2Max = max; + } void setFuelConsumption(float bsfc) { _bsfc = bsfc; } virtual void calc(float pressure, float temp, float speed); @@ -33,9 +37,11 @@ private: float _flatRating; float _rho0; float _bsfc; // SI units! kg/s per watt - float _n2Min; + float _n2LowIdle; + float _n2HighIdle; float _n2Max; + float _n2Min; float _n2Target; float _torqueTarget; float _fuelFlowTarget; -- 2.39.5