1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 Date started: 03/11/2003
7 ------------- Copyright (C) 2003 David Culp (davidculp2@comcast.net)----------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
28 03/11/2003 DPC Created, based on FGTurbine
29 09/22/2003 DPC Added starting, stopping, new framework
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
35 #ifndef FGSIMTURBINE_H
36 #define FGSIMTURBINE_H
38 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
44 #include "FGConfigFile.h"
45 #include "FGCoefficient.h"
47 #define ID_SIMTURBINE "$Id$"
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 /** This class models a turbine engine. Based on Jon Berndt's FGTurbine module.
60 Here the term "phase" signifies the engine's mode of operation. At any given
61 time the engine is in only one phase. At simulator startup the engine will be
62 placed in the Trim phase in order to provide a simplified thrust value without
63 throttle lag. When trimming is complete the engine will go to the Off phase,
64 unless the value FGEngine::Running has been previously set to true, in which
65 case the engine will go to the Run phase. Once an engine is in the Off phase
66 the full starting procedure (or airstart) must be used to get it running.
68 - STARTING (on ground):
69 -# Set the control FGEngine::Starter to true. The engine will spin up to
70 a maximum of about %25 N2 (%5.2 N1). This simulates the action of a
72 -# After reaching %15 N2 set the control FGEngine::Cutoff to false. If fuel
73 is available the engine will now accelerate to idle. The starter will
74 automatically be set to false after the start cycle.
77 -# Increase speed to obtain a minimum of %15 N2. If this is not possible,
78 the starter may be used to assist.
79 -# Place the control FGEngine::Cutoff to false.
81 Ignition is assumed to be on anytime the Cutoff control is set to false,
82 therefore a seperate ignition system is not modeled.
84 Configuration File Format
86 \<FG_SIMTURBINE NAME="<name>">
89 BYPASSRATIO \<bypass ratio>
90 TSFC \<thrust specific fuel consumption>
91 ATSFC \<afterburning thrust specific fuel consumption>
102 Definition of the turbine engine configuration file parameters:
104 <b>MILTHRUST</b> - Maximum thrust, static, at sea level, lbf.
105 <b>MAXTHRUST</b> - Afterburning thrust, static, at sea level, lbf
106 [this value will be ignored when AUGMENTED is zero (false)].
107 <b>BYPASSRATIO</b> - Ratio of bypass air flow to core air flow.
108 <b>TSFC</b> - Thrust-specific fuel consumption, lbm/hr/lbf
109 [i.e. fuel flow divided by thrust].
110 <b>ATSFC</b> - Afterburning TSFC, lbm/hr/lbf
111 [this value will be ignored when AUGMENTED is zero (false)]
112 <b>IDLEN1</b> - Fan rotor rpm (% of max) at idle
113 <b>IDLEN2</b> - Core rotor rpm (% of max) at idle
114 <b>MAXN1</b> - Fan rotor rpm (% of max) at full throttle [not always 100!]
115 <b>MAXN2</b> - Core rotor rpm (% of max) at full throttle [not always 100!]
117 0 == afterburner not installed
118 1 == afterburner installed
120 0 == afterburner activated by property /engines/engine[n]/augmentation
121 1 == afterburner activated by pushing throttle above 99% position
122 [this item will be ignored when AUGMENTED == 0]
124 0 == Water injection not installed
125 1 == Water injection installed
127 @author David P. Culp
131 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
135 class FGSimTurbine : public FGEngine
139 @param Executive pointer to executive structure
140 @param Eng_cfg pointer to engine config file instance */
141 FGSimTurbine(FGFDMExec* Executive, FGConfigFile* Eng_cfg);
145 enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
147 double Calculate(double PowerRequired);
148 double CalcFuelNeed(void);
149 double GetPowerAvailable(void);
150 double Seek(double* var, double target, double accel, double decel);
152 phaseType GetPhase(void) { return phase; }
154 bool GetOvertemp(void) {return Overtemp; }
155 bool GetInjection(void) {return Injection;}
156 bool GetFire(void) { return Fire; }
157 bool GetAugmentation(void) {return Augmentation;}
158 bool GetReversed(void) { return Reversed; }
159 bool GetCutoff(void) { return Cutoff; }
160 int GetIgnition(void) {return Ignition;}
162 double GetInlet(void) { return InletPosition; }
163 double GetNozzle(void) { return NozzlePosition; }
164 double GetBleedDemand(void) {return BleedDemand;}
165 double GetN1(void) {return N1;}
166 double GetN2(void) {return N2;}
167 double GetEPR(void) {return EPR;}
168 double GetEGT(void) {return EGT_degC;}
170 double getOilPressure_psi () const {return OilPressure_psi;}
171 double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
173 void SetInjection(bool injection) {Injection = injection;}
174 void SetIgnition(int ignition) {Ignition = ignition;}
175 void SetAugmentation(bool augmentation) {Augmentation = augmentation;}
176 void SetPhase( phaseType p ) { phase = p; }
177 void SetEPR(double epr) {EPR = epr;}
178 void SetBleedDemand(double bleedDemand) {BleedDemand = bleedDemand;}
179 void SetReverse(bool reversed) { Reversed = reversed; }
180 void SetCutoff(bool cutoff) { Cutoff = cutoff; }
184 typedef vector<FGCoefficient*> CoeffArray;
185 CoeffArray ThrustTables;
187 phaseType phase; ///< Operating mode, or "phase"
188 double MilThrust; ///< Maximum Unaugmented Thrust, static @ S.L. (lbf)
189 double MaxThrust; ///< Maximum Augmented Thrust, static @ S.L. (lbf)
190 double BypassRatio; ///< Bypass Ratio
191 double TSFC; ///< Thrust Specific Fuel Consumption (lbm/hr/lbf)
192 double ATSFC; ///< Augmented TSFC (lbm/hr/lbf)
193 double IdleN1; ///< Idle N1
194 double IdleN2; ///< Idle N2
197 double MaxN1; ///< N1 at 100% throttle
198 double MaxN2; ///< N2 at 100% throttle
199 double IdleFF; ///< Idle Fuel Flow (lbm/hr)
200 double delay; ///< Inverse spool-up time from idle to 100% (seconds)
201 double dt; ///< Simulator time slice
202 double N1_factor; ///< factor to tie N1 and throttle
203 double N2_factor; ///< factor to tie N2 and throttle
204 double ThrottleCmd; ///< FCS-supplied throttle position
205 double TAT; ///< total air temperature (deg C)
206 bool Stalled; ///< true if engine is compressor-stalled
207 bool Seized; ///< true if inner spool is seized
208 bool Overtemp; ///< true if EGT exceeds limits
209 bool Fire; ///< true if engine fire detected
214 int Injected; ///< = 1 if water injection installed
216 int Augmented; ///< = 1 if augmentation installed
217 int AugMethod; ///< = 0 if using property /engine[n]/augmentation
218 ///< = 1 if using last 1% of throttle movement
221 double OilPressure_psi;
224 double InletPosition;
225 double NozzlePosition;
235 void SetDefaults(void);
236 bool Load(FGConfigFile *ENG_cfg);
237 void Debug(int from);
241 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%