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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 COMMENTS, REFERENCES, and NOTES
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
35 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39 #ifndef FGSIMTURBINE_H
40 #define FGSIMTURBINE_H
42 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48 #include "FGConfigFile.h"
49 #include "FGCoefficient.h"
51 #define ID_SIMTURBINE "$Id$"
53 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63 /** This class models a turbine engine. Based on Jon Berndt's FGTurbine module.
64 Here the term "phase" signifies the engine's mode of operation. At any given
65 time the engine is in only one phase. At simulator startup the engine will be
66 placed in the Trim phase in order to provide a simplified thrust value without
67 throttle lag. When trimming is complete the engine will go to the Off phase,
68 unless the value FGEngine::Running has been previously set to true, in which
69 case the engine will go to the Run phase. Once an engine is in the Off phase
70 the full starting procedure (or airstart) must be used to get it running.
72 -STARTING (on ground):
73 -# Set the control FGEngine::Starter to true. The engine will spin up to
74 a maximum of about %25 N2 (%5.2 N1). This simulates the action of a
76 -# After reaching %15 N2 set the control FGEngine::Cutoff to false. If fuel
77 is available the engine will now accelerate to idle. The starter will
78 automatically be set to false after the start cycle.
81 -# Increase speed to obtain a minimum of %15 N2. If this is not possible,
82 the starter may be used to assist.
83 -# Place the control FGEngine::Cutoff to false.
85 Ignition is assumed to be on anytime the Cutoff control is set to false,
86 therefore a seperate ignition system is not modeled.
92 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
96 class FGSimTurbine : public FGEngine
100 @param exec pointer to executive structure
101 @param Eng_Cfg pointer to engine config file instance */
102 FGSimTurbine(FGFDMExec* exec, FGConfigFile* Eng_cfg);
106 enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
108 double Calculate(double);
109 double CalcFuelNeed(void);
110 double GetPowerAvailable(void);
111 double Seek(double* var, double target, double accel, double decel);
113 virtual phaseType GetPhase(void) { return phase; }
114 virtual void SetPhase( phaseType p ) { phase = p; }
116 virtual bool GetOvertemp(void) { return Overtemp; }
117 virtual bool GetFire(void) { return Fire; }
121 typedef vector<FGCoefficient*> CoeffArray;
122 CoeffArray ThrustTables;
124 phaseType phase; ///< Operating mode, or "phase"
125 double MilThrust; ///< Maximum Unaugmented Thrust, static @ S.L. (lbf)
126 double MaxThrust; ///< Maximum Augmented Thrust, static @ S.L. (lbf)
127 double BypassRatio; ///< Bypass Ratio
128 double TSFC; ///< Thrust Specific Fuel Consumption (lbm/hr/lbf)
129 double ATSFC; ///< Augmented TSFC (lbm/hr/lbf)
130 double IdleN1; ///< Idle N1
131 double IdleN2; ///< Idle N2
132 double MaxN1; ///< N1 at 100% throttle
133 double MaxN2; ///< N2 at 100% throttle
134 double IdleFF; ///< Idle Fuel Flow (lbm/hr)
135 double delay; ///< Inverse spool-up time from idle to 100% (seconds)
136 double dt; ///< Simulator time slice
137 double N1_factor; ///< factor to tie N1 and throttle
138 double N2_factor; ///< factor to tie N2 and throttle
139 double ThrottleCmd; ///< FCS-supplied throttle position
140 double TAT; ///< total air temperature (deg C)
141 bool Stalled; ///< true if engine is compressor-stalled
142 bool Seized; ///< true if inner spool is seized
143 bool Overtemp; ///< true if EGT exceeds limits
144 bool Fire; ///< true if engine fire detected
145 int Augmented; ///< = 1 if augmentation installed
146 int Injected; ///< = 1 if water injection installed
147 int AugMethod; ///< = 0 if using property /engine[n]/augmentation
148 ///< = 1 if using last 1% of throttle movement
158 void SetDefaults(void);
159 bool Load(FGConfigFile *ENG_cfg);
160 void Debug(int from);
164 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%