]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGEngine.h
Oct 2, 2000 JSBSim sync.
[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   bool   GetRunning(void) { return Running; }
90   int    GetType(void) { return Type; }
91   string GetName() { return Name; }
92
93   void SetStarved(bool tt) {
94     Starved = tt;
95   }
96   void SetStarved(void) {
97     Starved = true;
98   }
99   
100   void SetRunning(bool bb) { Running=bb; }
101   
102   float CalcThrust(void);
103   float CalcFuelNeed(void);
104   float CalcOxidizerNeed(void);
105
106 private:
107   string Name;
108   EngineType Type;
109   float X, Y, Z;
110   float EnginePitch;
111   float EngineYaw;
112   float SLThrustMax;
113   float VacThrustMax;
114   float SLFuelFlowMax;
115   float SLOxiFlowMax;
116   float MaxThrottle;
117   float MinThrottle;
118
119   float BrakeHorsePower;
120   float SpeedSlope;
121   float SpeedIntercept;
122   float AltitudeSlope;
123
124   float Thrust;
125   float Throttle;
126   float FuelNeed, OxidizerNeed;
127   bool  Starved;
128   bool  Flameout;
129   bool  Running;
130   float PctPower;
131   int   EngineNumber;
132
133   FGFDMExec*      FDMExec;
134   FGState*        State;
135   FGAtmosphere*   Atmosphere;
136   FGFCS*          FCS;
137   FGAircraft*     Aircraft;
138   FGTranslation*  Translation;
139   FGRotation*     Rotation;
140   FGPosition*     Position;
141   FGAuxiliary*    Auxiliary;
142   FGOutput*       Output;
143
144 protected:
145   float CalcRocketThrust(void);
146   float CalcPistonThrust(void);
147
148 };
149
150 /******************************************************************************/
151 #endif