From 38fdd4c4173f7700861c0b9fb1d802eae364447b Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sun, 17 Jul 2016 11:30:07 +0200 Subject: [PATCH] Brendan Black: when active does not touch the way the YASim jet calculates fuel flow, but separates out the afterburning component of thrust, calculates the TSFC of that component and uses the same method of fuel flow calculation for the afterburning component then adds it to the existing fuel flow When inactive (atsfc doesn't exist or is zero) it just behaves exactly as before I finally got around to testing this small patch thoroughly, and I'm satisfied that it doesn't affect anything else & works across many different versions (i've been testing it with current as it has changed over the last 7 months) --- src/FDM/YASim/FGFDM.cpp | 1 + src/FDM/YASim/Jet.cpp | 19 +++++++++++++++++-- src/FDM/YASim/Jet.hpp | 4 ++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 907166171..36eec1534 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -306,6 +306,7 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts) j->setRPMs(n1min, n1max, n2min, n2max); j->setTSFC(attrf(a, "tsfc", 0.8)); + j->setATSFC(attrf(a, "atsfc", 0.0)); if(a->hasAttribute("egt")) j->setEGT(attrf(a, "egt")); if(a->hasAttribute("epr")) j->setEPR(attrf(a, "epr")); if(a->hasAttribute("exhaust-speed")) diff --git a/src/FDM/YASim/Jet.cpp b/src/FDM/YASim/Jet.cpp index f80cac543..ca69b88a5 100644 --- a/src/FDM/YASim/Jet.cpp +++ b/src/FDM/YASim/Jet.cpp @@ -6,6 +6,7 @@ namespace yasim { Jet::Jet() { _maxThrust = 0; + _abThrust = 0; _abFactor = 1; _reheat = 0; _rotControl = 0; @@ -18,6 +19,8 @@ Jet::Jet() _vMax = 800; _epr0 = 3.0; _tsfc = 0.8f; + _atsfc = 0.0f; + _abFuelFactor = 3.5f; //previously was constant in code below _egt0 = 1050; _n1Min = 55; _n1Max = 102; @@ -51,7 +54,9 @@ void Jet::setMaxThrust(float thrust, float afterburner) { _maxThrust = thrust; if(afterburner == 0) _abFactor = 1; - else _abFactor = afterburner/thrust; + else { _abFactor = afterburner/thrust; + _abThrust = afterburner - thrust; + } } void Jet::setVMax(float spd) @@ -64,6 +69,11 @@ void Jet::setTSFC(float tsfc) _tsfc = tsfc; } +void Jet::setATSFC(float atsfc) +{ + _atsfc = atsfc; +} + void Jet::setRPMs(float idleN1, float maxN1, float idleN2, float maxN2) { _n1Min = idleN1; @@ -190,9 +200,14 @@ void Jet::integrate(float dt) _epr = beta + 1; float ff0 = _maxThrust*_tsfc*(1/(3600.0f*9.8f)); // takeoff fuel flow, kg/s _fuelFlow = ff0 * beta*ibeta0; - _fuelFlow *= 1 + (3.5f * _reheat * _abFactor); // Afterburners take + //Calc afterburner only tsfc if atsfc is set + if(_atsfc > 0) _abFuelFactor = ((_maxThrust*_abFactor*_atsfc)-(_maxThrust*_tsfc))/_abThrust; + if(_atsfc == 0 ) _fuelFlow *= 1 + (_abFuelFactor * _reheat * _abFactor); // Afterburners take // 3.5 times as much // fuel per thrust unit + else _fuelFlow += _abThrust*_abFuelFactor*(1/(3600.0f*9.8f))*beta*ibeta0*_reheat; + // add afterburning only component of fuel flow + _egt = T0 + beta*ibeta0 * (_egt0 - T0); // Thrust reverse handling: diff --git a/src/FDM/YASim/Jet.hpp b/src/FDM/YASim/Jet.hpp index 9bfe6512e..227407223 100644 --- a/src/FDM/YASim/Jet.hpp +++ b/src/FDM/YASim/Jet.hpp @@ -14,6 +14,7 @@ public: void setMaxThrust(float thrust, float afterburner=0); void setVMax(float spd); void setTSFC(float tsfc); + void setATSFC(float atsfc); void setRPMs(float idleN1, float maxN1, float idleN2, float maxN2); void setEGT(float takeoffEGT); void setEPR(float takeoffEPR); @@ -57,6 +58,7 @@ private: bool _reverseThrust; float _maxThrust; // Max dry thrust at sea level + float _abThrust; // Max ab component of thrust at sea level float _abFactor; // Afterburner thrust multiplier float _maxRot; @@ -66,6 +68,8 @@ private: float _vMax; // speed at which thrust is zero float _epr0; // EPR at takeoff thrust float _tsfc; // TSFC ((lb/hr)/lb) at takeoff thrust and zero airspeed + float _atsfc; // Afterburning TSFC ((lb/hr)/lb) at takeoff thrust and zero airspeed (total TSFC) + float _abFuelFactor; // Afterburner Only Fuel Factor at takeoff thrust and zero airspeed float _egt0; // EGT at takeoff thrust float _n1Min; // N1 at ground idle float _n1Max; // N1 at takeoff thrust -- 2.39.5