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
29 09/22/2003 DPC Added starting, stopping
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 class FGSimTurbine : public FGEngine
62 FGSimTurbine(FGFDMExec* exec, FGConfigFile* Eng_cfg);
65 enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
67 double Calculate(double);
68 double CalcFuelNeed(void);
69 double GetPowerAvailable(void);
70 double Seek(double* var, double target, double accel, double decel);
72 virtual phaseType GetPhase(void) { return phase; }
73 virtual void SetPhase( phaseType p ) { phase = p; }
75 virtual bool GetOvertemp(void) { return Overtemp; }
76 virtual bool GetFire(void) { return Fire; }
80 typedef vector<FGCoefficient*> CoeffArray;
81 CoeffArray ThrustTables;
83 phaseType phase; // Operating mode, or "phase"
84 double MaxMilThrust; // Maximum Rated Thrust, static @ S.L. (lbf)
85 double BypassRatio; // Bypass Ratio
86 double TSFC; // Thrust Specific Fuel Consumption (lbm/hr/lbf)
87 double ATSFC; // Augmented TSFC (lbm/hr/lbf)
88 double IdleN1; // Idle N1
89 double IdleN2; // Idle N2
90 double MaxN1; // N1 at 100% throttle
91 double MaxN2; // N2 at 100% throttle
92 double IdleFF; // Idle Fuel Flow (lbm/hr)
93 double delay; // Inverse spool-up time from idle to 100% (seconds)
94 double dt; // Simulator time slice
95 double N1_factor; // factor to tie N1 and throttle
96 double N2_factor; // factor to tie N2 and throttle
97 double ThrottleCmd; // FCS-supplied throttle position
98 double throttle; // virtual throttle position
99 double TAT; // total air temperature (deg C)
100 bool Stalled; // true if engine is compressor-stalled
101 bool Seized; // true if inner spool is seized
102 bool Overtemp; // true if EGT exceeds limits
103 bool Fire; // true if engine fire detected
104 bool start_running; // true if user wants engine running at start
105 int Augmented; // = 1 if augmentation installed
106 int Injected; // = 1 if water injection installed
107 int AugMethod; // = 0 if using property /engine[n]/augmentation
108 // = 1 if using last 1% of throttle movement
118 void SetDefaults(void);
119 bool Load(FGConfigFile *ENG_cfg);
120 void Debug(int from);
124 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%