JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
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 (jon@jsbsim.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 "math/FGFunction.h"
44 
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 DEFINITIONS
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48 
49 #define ID_ROCKET "$Id: FGRocket.h,v 1.22 2015/09/27 09:54:21 bcoconni Exp $"
50 
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 FORWARD DECLARATIONS
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54 
55 namespace JSBSim {
56 
57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 CLASS DOCUMENTATION
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 
128 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129 CLASS DECLARATION
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
131 
132 class FGRocket : public FGEngine
133 {
134 public:
139  FGRocket(FGFDMExec* exec, Element *el, int engine_number, struct FGEngine::Inputs& input);
140 
142  ~FGRocket(void);
143 
145  void Calculate(void);
146 
151  double CalcFuelNeed(void);
152 
157  double CalcOxidizerNeed(void);
158 
161  double GetTotalImpulse(void) const {return It;}
162 
165  double GetVacTotalImpulse(void) const {return ItVac;}
166 
171  bool GetFlameout(void) {return Flameout;}
172 
173  double GetOxiFlowRate(void) const {return OxidizerFlowRate;}
174 
175  double GetMixtureRatio(void) const {return MxR;}
176 
177  double GetIsp(void) const {return Isp;}
178 
179  void SetMixtureRatio(double mix) {MxR = mix;}
180 
181  void SetIsp(double isp) {Isp = isp;}
182 
183  std::string GetEngineLabels(const std::string& delimiter);
184  std::string GetEngineValues(const std::string& delimiter);
185 
195  void SetThrustVariation(double var) {ThrustVariation = var;}
196 
204  void SetTotalIspVariation(double var) {TotalIspVariation = var;}
205 
207  double GetThrustVariation(void) const {return ThrustVariation;}
208 
210  double GetTotalIspVariation(void) const {return TotalIspVariation;}
211 
212 private:
215  double GetVacThrust(void) const {return VacThrust;}
216 
217  void bindmodel(FGPropertyManager* pm);
218 
219  double Isp; // Vacuum Isp
220  double It; // Total actual Isp
221  double ItVac; // Total Vacuum Isp
222  double MxR; // Mixture Ratio
223  double BurnTime;
224  double ThrustVariation;
225  double TotalIspVariation;
226  double VacThrust;
227  double previousFuelNeedPerTank;
228  double previousOxiNeedPerTank;
229  double OxidizerExpended;
230  double TotalPropellantExpended;
231  double SLOxiFlowMax;
232  double PropFlowMax;
233  double OxidizerFlowRate;
234  double PropellantFlowRate;
235  bool Flameout;
236  double BuildupTime;
237  FGTable* ThrustTable;
238  FGFunction* isp_function;
239  FGFDMExec* FDMExec;
240 
241  void Debug(int from);
242 };
243 }
244 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
245 #endif
246 
~FGRocket(void)
Destructor.
Definition: FGRocket.cpp:151
double GetTotalIspVariation(void) const
Returns the Total Isp variation, if any.
Definition: FGRocket.h:210
double CalcFuelNeed(void)
The fuel need is calculated based on power levels and flow rate for that power level.
Definition: FGRocket.cpp:225
Models a generic rocket engine.
Definition: FGRocket.h:132
void Calculate(void)
Determines the thrust.
Definition: FGRocket.cpp:159
bool GetFlameout(void)
Gets the flame-out status.
Definition: FGRocket.h:171
double GetTotalImpulse(void) const
Gets the total impulse of the rocket.
Definition: FGRocket.h:161
void SetThrustVariation(double var)
Sets the thrust variation for a solid rocket engine.
Definition: FGRocket.h:195
Represents a mathematical function.
Definition: FGFunction.h:699
FGRocket(FGFDMExec *exec, Element *el, int engine_number, struct FGEngine::Inputs &input)
Constructor.
Definition: FGRocket.cpp:59
double GetThrustVariation(void) const
Returns the thrust variation, if any.
Definition: FGRocket.h:207
double CalcOxidizerNeed(void)
The oxidizer need is calculated based on power levels and flow rate for that power level...
Definition: FGRocket.cpp:241
Base class for all engines.
Definition: FGEngine.h:121
void SetTotalIspVariation(double var)
Sets the variation in total motor energy.
Definition: FGRocket.h:204
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
Lookup table class.
Definition: FGTable.h:243
double GetVacTotalImpulse(void) const
Gets the total impulse of the rocket.
Definition: FGRocket.h:165