]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGEngine.h
Check return value of FDM::init().
[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 #define ID_ENGINE "$Header"
60
61 using std::string;
62
63 /*******************************************************************************
64 CLASS DECLARATION
65 *******************************************************************************/
66
67 class FGFDMExec;
68 class FGState;
69 class FGAtmosphere;
70 class FGFCS;
71 class FGAircraft;
72 class FGTranslation;
73 class FGRotation;
74 class FGPosition;
75 class FGAuxiliary;
76 class FGOutput;
77
78 class FGEngine {
79 public:
80   FGEngine(FGFDMExec*, string, string, int);
81   ~FGEngine(void);
82
83   enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet};
84
85   float  GetThrottle(void) { return Throttle; }
86   float  GetThrust(void) { return Thrust; }
87   float  GetThrottleMin(void) { return MinThrottle; }
88   float  GetThrottleMax(void) { return MaxThrottle; }
89   bool   GetStarved(void) { return Starved; }
90   bool   GetFlameout(void) { return Flameout; }
91   bool   GetRunning(void) { return Running; }
92   int    GetType(void) { return Type; }
93   string GetName() { return Name; }
94
95   void SetStarved(bool tt) {
96     Starved = tt;
97   }
98   void SetStarved(void) {
99     Starved = true;
100   }
101   
102   void SetRunning(bool bb) { Running=bb; }
103   
104   float CalcThrust(void);
105   float CalcFuelNeed(void);
106   float CalcOxidizerNeed(void);
107
108 private:
109   string Name;
110   EngineType Type;
111   float X, Y, Z;
112   float EnginePitch;
113   float EngineYaw;
114   float SLThrustMax;
115   float VacThrustMax;
116   float SLFuelFlowMax;
117   float SLOxiFlowMax;
118   float MaxThrottle;
119   float MinThrottle;
120
121   float BrakeHorsePower;
122   float SpeedSlope;
123   float SpeedIntercept;
124   float AltitudeSlope;
125
126   float Thrust;
127   float Throttle;
128   float FuelNeed, OxidizerNeed;
129   bool  Starved;
130   bool  Flameout;
131   bool  Running;
132   float PctPower;
133   int   EngineNumber;
134
135   FGFDMExec*      FDMExec;
136   FGState*        State;
137   FGAtmosphere*   Atmosphere;
138   FGFCS*          FCS;
139   FGAircraft*     Aircraft;
140   FGTranslation*  Translation;
141   FGRotation*     Rotation;
142   FGPosition*     Position;
143   FGAuxiliary*    Auxiliary;
144   FGOutput*       Output;
145
146 protected:
147   float CalcRocketThrust(void);
148   float CalcPistonThrust(void);
149
150 };
151
152 /******************************************************************************/
153 #endif