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 --------------------------------------------------------------------------------
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46 #include "input_output/FGXMLElement.h"
47 #include "math/FGTable.h"
49 #define ID_TURBOPROP "$Id$"
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61 /** Turboprop engine model. For an example of this model in use see the file:
63 <h3>Configuration parameters:</h3>
69 if ThrottleCmd < betarangeend/100.0 then engine power=idle, propeller pitch
70 is controled by ThrottleCmd (between MINPITCH and REVERSEPITCH).
71 if ThrottleCmd > betarangeend/100.0 then engine power increases up to max reverse power
73 max engine power in reverse mode
75 psfc power specific fuel consumption [pph/HP] for N1=100%
76 n1idle_max_delay [-] time constant for N1 change
77 maxstartenginetime [sec]
78 after this time the automatic starting cycle is interrupted when the engine
79 doesn't start (0=automatic starting not present)
81 when starting starter spin up engine to this spin
83 if torque>ielumaxtorque limiters decrease the throttle
84 (ielu = Integrated Electronic Limiter Unit)
85 itt_delay [-] time constant for ITT change
86 (ITT = Inter Turbine Temperature)
90 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
94 class FGTurboProp : public FGEngine
98 @param Executive pointer to executive structure
99 @param el pointer to the XML element representing the turbine engine
100 @param engine_number engine number*/
101 FGTurboProp(FGFDMExec* Executive, Element *el, int engine_number);
105 enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
107 double Calculate(void);
108 double CalcFuelNeed(void);
110 inline double GetPowerAvailable(void) const {return (Eng_HP * hptoftlbssec);}
111 inline double GetPowerAvailable_HP(void) const {return (Eng_HP);}
112 inline double GetPropRPM(void) const {return (Prop_RPM);}
113 inline double GetThrottleCmd(void) const {return (ThrottleCmd);}
114 inline 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 ThrottleCmd; ///< FCS-supplied throttle position
169 double TAT; ///< total air temperature (deg C)
170 double PowerAvailable;
171 bool Stalled; ///< true if engine is compressor-stalled
172 bool Seized; ///< true if inner spool is seized
173 bool Overtemp; ///< true if EGT exceeds limits
174 bool Fire; ///< true if engine fire detected
180 double OilPressure_psi;
182 double InletPosition;
183 double NozzlePosition;
185 double Ielu_max_torque; // max propeller torque (before ielu intervent)
189 double BetaRangeThrottleEnd; // coef (0-1) where is end of beta-range
190 double ReverseMaxPower; // coef (0-1) multiplies max throttle on reverse
192 double Idle_Max_Delay; // time delay for exponencial
193 double MaxPower; // max engine power [HP]
194 double StarterN1; // rotates of generator maked by starter [%]
195 double MaxStartingTime; // maximal time for start [s] (-1 means not used)
196 double Prop_RPM; // propeller RPM
199 double PSFC; // Power specific fuel comsumption [lb/(HP*hr)] at best efficiency
201 double Eng_HP; // current engine power
203 double StartTime; // engine strating time [s] (0 when start button pushed)
205 double ITT_Delay; // time delay for exponencial grow of ITT
207 double Eng_Temperature; // temperature inside engine
209 bool EngStarting; // logicaly output - TRUE if engine is starting
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 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%