1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 Author: Jiri "Javky" Javurek
5 based on SimTurbine and Turbine engine from David Culp
6 Date started: 05/14/2004
8 ------------- Copyright (C) 2004 (javky@email.cz)----------
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of the GNU Lesser General Public License as published by the Free Software
12 Foundation; either version 2 of the License, or (at your option) any later
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
20 You should have received a copy of the GNU Lesser General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
22 Place - Suite 330, Boston, MA 02111-1307, USA.
24 Further information about the GNU Lesser General Public License can also be found on
25 the world wide web at http://www.gnu.org.
28 --------------------------------------------------------------------------------
30 02/08/2011 T. Kreitler, added rotor support
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 #include "input_output/FGXMLElement.h"
48 #include "math/FGTable.h"
50 #define ID_TURBOPROP "$Id: FGTurboProp.h,v 1.14 2011/03/10 01:35:25 dpculp Exp $"
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
62 /** Turboprop engine model. For an example of this model in use see the file:
64 <h3>Configuration parameters:</h3>
70 if ThrottleCmd < betarangeend/100.0 then engine power=idle, propeller pitch
71 is controled by ThrottleCmd (between MINPITCH and REVERSEPITCH).
72 if ThrottleCmd > betarangeend/100.0 then engine power increases up to max reverse power
74 max engine power in reverse mode
76 psfc power specific fuel consumption [pph/HP] for N1=100%
77 n1idle_max_delay [-] time constant for N1 change
78 maxstartenginetime [sec]
79 after this time the automatic starting cycle is interrupted when the engine
80 doesn't start (0=automatic starting not present)
82 when starting starter spin up engine to this spin
84 if torque>ielumaxtorque limiters decrease the throttle
85 (ielu = Integrated Electronic Limiter Unit)
86 itt_delay [-] time constant for ITT change
87 (ITT = Inter Turbine Temperature)
91 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
95 class FGTurboProp : public FGEngine
99 @param Executive pointer to executive structure
100 @param el pointer to the XML element representing the turbine engine
101 @param engine_number engine number*/
102 FGTurboProp(FGFDMExec* Executive, Element *el, int engine_number);
106 enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
108 void Calculate(void);
109 double CalcFuelNeed(void);
111 double GetPowerAvailable(void) const { return (HP * hptoftlbssec); }
112 double GetRPM(void) const { return (RPM); }
113 double GetIeluThrottle(void) const { return (Throttle); }
114 bool GetIeluIntervent(void) const { return Ielu_intervent; }
116 double Seek(double* var, double target, double accel, double decel);
117 double ExpSeek(double* var, double target, double accel, double decel);
119 phaseType GetPhase(void) const { return phase; }
121 bool GetOvertemp(void) const {return Overtemp; }
122 bool GetFire(void) const { return Fire; }
123 bool GetReversed(void) const { return Reversed; }
124 bool GetCutoff(void) const { return Cutoff; }
125 int GetIgnition(void) const {return Ignition;}
127 double GetInlet(void) const { return InletPosition; }
128 double GetNozzle(void) const { return NozzlePosition; }
129 double GetN1(void) const {return N1;}
130 double GetN2(void) const {return N2;}
131 double GetEPR(void) const {return EPR;}
132 double GetITT(void) const {return Eng_ITT_degC;}
133 double GetEngStarting(void) const { return EngStarting; }
135 double getOilPressure_psi () const {return OilPressure_psi;}
136 double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
138 inline bool GetGeneratorPower(void) const { return GeneratorPower; }
139 inline int GetCondition(void) const { return Condition; }
141 void SetIgnition(int ignition) {Ignition = ignition;}
142 void SetPhase( phaseType p ) { phase = p; }
143 void SetEPR(double epr) {EPR = epr;}
144 void SetReverse(bool reversed) { Reversed = reversed; }
145 void SetCutoff(bool cutoff) { Cutoff = cutoff; }
147 inline void SetGeneratorPower(bool gp) { GeneratorPower=gp; }
148 inline void SetCondition(bool c) { Condition=c; }
149 int InitRunning(void);
150 std::string GetEngineLabels(const std::string& delimiter);
151 std::string GetEngineValues(const std::string& delimiter);
155 phaseType phase; ///< Operating mode, or "phase"
156 double MilThrust; ///< Maximum Unaugmented Thrust, static @ S.L. (lbf)
157 double IdleN1; ///< Idle N1
158 double IdleN2; ///< Idle N2
161 double MaxN1; ///< N1 at 100% throttle
162 double MaxN2; ///< N2 at 100% throttle
163 double IdleFF; ///< Idle Fuel Flow (lbm/hr)
164 double delay; ///< Inverse spool-up time from idle to 100% (seconds)
165 double dt; ///< Simulator time slice
166 double N1_factor; ///< factor to tie N1 and throttle
167 double N2_factor; ///< factor to tie N2 and throttle
168 double Throttle; ///< FCS-supplied throttle position
169 double TAT; ///< total air temperature (deg C)
170 bool Stalled; ///< true if engine is compressor-stalled
171 bool Seized; ///< true if inner spool is seized
172 bool Overtemp; ///< true if EGT exceeds limits
173 bool Fire; ///< true if engine fire detected
179 double OilPressure_psi;
181 double InletPosition;
182 double NozzlePosition;
184 double Ielu_max_torque; // max propeller torque (before ielu intervent)
188 double BetaRangeThrottleEnd; // coef (0-1) where is end of beta-range
189 double ReverseMaxPower; // coef (0-1) multiplies max throttle on reverse
191 double Idle_Max_Delay; // time delay for exponential
192 double MaxPower; // max engine power [HP]
193 double StarterN1; // rotates of generator maked by starter [%]
194 double MaxStartingTime; // maximal time for start [s] (-1 means not used)
195 double RPM; // shaft RPM
198 double PSFC; // Power specific fuel comsumption [lb/(HP*hr)] at best efficiency
200 double HP; // engine power output
202 double StartTime; // engine starting time [s] (0 when start button pushed)
204 double ITT_Delay; // time delay for exponential growth of ITT
206 double Eng_Temperature; // temperature inside engine
208 bool EngStarting; // logicaly output - TRUE if engine is starting
211 int thrusterType; // the attached thruster
218 void SetDefaults(void);
219 bool Load(FGFDMExec *exec, Element *el);
220 void bindmodel(void);
221 void Debug(int from);
223 FGTable* ITT_N1; // ITT temperature depending on throttle command
224 FGTable* EnginePowerRPM_N1;
225 FGTable* EnginePowerVC;
228 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%