]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/propulsion/FGRocket.h
Update to the latest version of JSBSim which supports Lighter Than Air craft
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGRocket.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGRocket.h
4  Author:       Jon S. Berndt
5  Date started: 09/12/2000
6
7  ------------- Copyright (C) 2000  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 Lesser 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 Lesser General Public License for more
17  details.
18
19  You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28 09/12/2000  JSB  Created
29
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGROCKET_H
35 #define FGROCKET_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include "FGEngine.h"
42 #include <math/FGTable.h>
43 #include <input_output/FGXMLElement.h>
44
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 DEFINITIONS
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
49 #define ID_ROCKET "$Id$"
50
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 FORWARD DECLARATIONS
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54
55 namespace JSBSim {
56
57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 CLASS DOCUMENTATION
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60
61 /** Models a generic rocket engine.
62     The rocket engine is modeled given the following parameters:
63     <ul>
64         <li>Chamber pressure (in psf)</li>
65         <li>Specific heat ratio (usually about 1.2 for hydrocarbon fuel and LOX)</li>
66         <li>Propulsive efficiency (in percent, from 0 to 1.0)</li>
67         <li>Variance (in percent, from 0 to 1.0, nominally 0.05)</li>
68     </ul>
69     Additionally, the following control inputs, operating characteristics, and
70     location are required, as with all other engine types:
71     <ul>
72         <li>Throttle setting (in percent, from 0 to 1.0)</li>
73         <li>Maximum allowable throttle setting</li>
74         <li>Minimum working throttle setting</li>
75         <li>Sea level fuel flow at maximum thrust</li>
76         <li>Sea level oxidizer flow at maximum thrust</li>
77         <li>X, Y, Z location in structural coordinate frame</li>
78         <li>Pitch and Yaw</li>
79     </ul>
80     The nozzle exit pressure (p2) is returned via a
81     call to FGNozzle::GetPowerRequired(). This exit pressure is used,
82     along with chamber pressure and specific heat ratio, to get the
83     thrust coefficient for the throttle setting. This thrust
84     coefficient is multiplied by the chamber pressure and then passed
85     to the nozzle Calculate() routine, where the thrust force is
86     determined.
87     
88     One can model the thrust of a solid rocket by providing a normalized thrust table
89     as a function of time. For instance, the space shuttle solid rocket booster
90     normalized thrust value looks roughly like this:
91
92 <pre>    
93  \<thrust_table name="propulsion/thrust_time" type="internal">
94    \<tableData>
95       0.0   0.00
96       0.2   0.91
97       8.0   0.97
98      16.0   0.99
99      20.0   1.00
100      21.0   1.00
101      24.0   0.95
102      32.0   0.85
103      40.0   0.78
104      48.0   0.72
105      50.0   0.71
106      52.0   0.71
107      56.0   0.73
108      64.0   0.78
109      72.0   0.82
110      80.0   0.81
111      88.0   0.73
112      96.0   0.69
113     104.0   0.59
114     112.0   0.46
115     120.0   0.09
116     132.0   0.00
117    \</tableData>
118  \</thrust_table>
119 </pre>
120
121 The left column is time, the right column is normalized thrust. Inside the
122 FGRocket class code, the maximum thrust is calculated, and multiplied by this
123 table. The Rocket class also tracks burn time. All that needs to be done is
124 for the rocket engine to be throttle up to 1. At that time, the solid rocket
125 fuel begins burning and thrust is provided.
126
127     @author Jon S. Berndt
128     $Id$
129     @see FGNozzle,
130     FGThruster,
131     FGForce,
132     FGEngine,
133     FGPropulsion,
134     FGTank
135 */
136
137 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
138 CLASS DECLARATION
139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
140
141 class FGRocket : public FGEngine
142 {
143 public:
144   /** Constructor.
145       @param exec pointer to JSBSim parent object, the FDM Executive.
146       @param el a pointer to the XML Element instance representing the engine.
147       @param engine_number engine number */
148   FGRocket(FGFDMExec* exec, Element *el, int engine_number);
149
150   /** Destructor */
151   ~FGRocket(void);
152
153   /** Determines the thrust coefficient.
154       @return thrust coefficient times chamber pressure */
155   double Calculate(void);
156
157   /** Gets the chamber pressure.
158       @return chamber pressure in psf. */
159   double GetChamberPressure(void) {return PC;}
160
161   /** Gets the flame-out status.
162       The engine will "flame out" if the throttle is set below the minimum
163       sustainable setting.
164       @return true if engine has flamed out. */
165   bool GetFlameout(void) {return Flameout;}
166   string GetEngineLabels(string delimeter);
167   string GetEngineValues(string delimeter);
168
169 private:
170   double SHR;
171   double maxPC;
172   double propEff;
173   double kFactor;
174   double Variance;
175   double PC;
176   double BurnTime;
177   bool Flameout;
178   FGTable* ThrustTable;
179
180   void Debug(int from);
181 };
182 }
183 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
184 #endif
185