]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGEngine.h
Updates from the Jon and Tony show.
[flightgear.git] / src / FDM / JSBSim / FGEngine.h
1 /*******************************************************************************
2  
3  Header:       FGEngine.h
4  Author:       Jon S. Berndt
5  Date started: 01/21/99
6  
7  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
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 FUNCTIONAL DESCRIPTION
27 --------------------------------------------------------------------------------
28  
29 Based on Flightgear code, which is based on LaRCSim. This class simulates
30 a generic engine.
31  
32 HISTORY
33 --------------------------------------------------------------------------------
34 01/21/99   JSB   Created
35  
36 ********************************************************************************
37 SENTRY
38 *******************************************************************************/
39
40 #ifndef FGEngine_H
41 #define FGEngine_H
42
43 /*******************************************************************************
44 INCLUDES
45 *******************************************************************************/
46
47 #ifdef FGFS
48 #  include <simgear/compiler.h>
49 #  include STL_STRING
50 FG_USING_STD(string);
51 #else
52 #  include <string>
53 #endif
54
55 /*******************************************************************************
56 DEFINES
57 *******************************************************************************/
58
59 using std::string;
60
61 /*******************************************************************************
62 CLASS DECLARATION
63 *******************************************************************************/
64
65 class FGFDMExec;
66 class FGState;
67 class FGAtmosphere;
68 class FGFCS;
69 class FGAircraft;
70 class FGTranslation;
71 class FGRotation;
72 class FGPosition;
73 class FGAuxiliary;
74 class FGOutput;
75
76 class FGEngine {
77 public:
78   FGEngine(FGFDMExec*, string, string, int);
79   ~FGEngine(void);
80
81   enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet};
82
83   float  GetThrottle(void) { return Throttle; }
84   float  GetThrust(void) { return Thrust; }
85   float  GetThrottleMin(void) { return MinThrottle; }
86   float  GetThrottleMax(void) { return MaxThrottle; }
87   bool   GetStarved(void) { return Starved; }
88   bool   GetFlameout(void) { return Flameout; }
89   int    GetType(void) { return Type; }
90   string GetName() { return Name; }
91
92   void SetStarved(bool tt) {
93     Starved = tt;
94   }
95   void SetStarved(void) {
96     Starved = true;
97   }
98
99   float CalcThrust(void);
100   float CalcFuelNeed(void);
101   float CalcOxidizerNeed(void);
102
103 private:
104   string Name;
105   EngineType Type;
106   float X, Y, Z;
107   float SLThrustMax;
108   float VacThrustMax;
109   float SLFuelFlowMax;
110   float SLOxiFlowMax;
111   float MaxThrottle;
112   float MinThrottle;
113
114   float BrakeHorsePower;
115   float SpeedSlope;
116   float SpeedIntercept;
117   float AltitudeSlope;
118
119   float Thrust;
120   float Throttle;
121   float FuelNeed, OxidizerNeed;
122   bool  Starved;
123   bool  Flameout;
124   float PctPower;
125   int   EngineNumber;
126
127   FGFDMExec*      FDMExec;
128   FGState*        State;
129   FGAtmosphere*   Atmosphere;
130   FGFCS*          FCS;
131   FGAircraft*     Aircraft;
132   FGTranslation*  Translation;
133   FGRotation*     Rotation;
134   FGPosition*     Position;
135   FGAuxiliary*    Auxiliary;
136   FGOutput*       Output;
137
138 protected:
139   float CalcRocketThrust(void);
140   float CalcPistonThrust(void);
141
142 };
143
144 /******************************************************************************/
145 #endif