]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGSimTurbine.h
David Culp:
[flightgear.git] / src / FDM / JSBSim / FGSimTurbine.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGSimTurbine.h
4  Author:       David Culp
5  Date started: 03/11/2003
6
7  ------------- Copyright (C) 2003  David Culp (davidculp2@comcast.net)----------
8
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
12  version.
13
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
17  details.
18
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.
22
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28 03/11/2003  DPC  Created
29 09/22/2003  DPC  Added starting, stopping 
30
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 COMMENTS, REFERENCES,  and NOTES
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36 SENTRY
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
38
39 #ifndef FGSIMTURBINE_H
40 #define FGSIMTURBINE_H
41
42 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 INCLUDES
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
45
46 #include <vector>
47 #include "FGEngine.h"
48 #include "FGConfigFile.h"
49 #include "FGCoefficient.h"
50
51 #define ID_SIMTURBINE "$Id$"
52
53 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 CLASS DECLARATION
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56
57 namespace JSBSim {
58
59 class FGSimTurbine : public FGEngine
60 {
61 public:
62   FGSimTurbine(FGFDMExec* exec, FGConfigFile* Eng_cfg);
63   ~FGSimTurbine();
64
65   enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
66
67   double Calculate(double);
68   double CalcFuelNeed(void);
69   double GetPowerAvailable(void);
70   double Seek(double* var, double target, double accel, double decel);
71
72   virtual phaseType GetPhase(void) { return phase; }
73   virtual void SetPhase( phaseType p ) { phase = p; } 
74
75   virtual bool GetOvertemp(void) { return Overtemp; }
76   virtual bool GetFire(void) { return Fire; }
77   
78 private:
79
80   typedef vector<FGCoefficient*> CoeffArray;
81   CoeffArray ThrustTables;
82
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
109
110   double Off(void);
111   double Run(void);
112   double SpinUp(void);
113   double Start(void);
114   double Stall(void);
115   double Seize(void);
116   double Trim(void);
117
118   void SetDefaults(void);
119   bool Load(FGConfigFile *ENG_cfg);
120   void Debug(int from);
121
122 };
123 }
124 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125 #endif
126