]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGRocket.h
Andreas Gaeb: fix #222 (JSBSIm reset problems)
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGRocket.h
index 3e44794065f598ea8668bd7e355e9eeeae120849..38e367510645e7f88ef94e907ef7c5de00198ccc 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon S. Berndt
  Date started: 09/12/2000
 
- ------------- Copyright (C) 2000  Jon S. Berndt (jsb@hal-pc.org) --------------
+ ------------- Copyright (C) 2000  Jon S. Berndt (jon@jsbsim.org) --------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -39,14 +39,14 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGEngine.h"
-#include <math/FGTable.h>
-#include <input_output/FGXMLElement.h>
+#include "math/FGTable.h"
+#include "input_output/FGXMLElement.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_ROCKET "$Id$"
+#define ID_ROCKET "$Id: FGRocket.h,v 1.14 2010/08/21 18:08:25 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -61,10 +61,7 @@ CLASS DOCUMENTATION
 /** Models a generic rocket engine.
     The rocket engine is modeled given the following parameters:
     <ul>
-        <li>Chamber pressure (in psf)</li>
-        <li>Specific heat ratio (usually about 1.2 for hydrocarbon fuel and LOX)</li>
-        <li>Propulsive efficiency (in percent, from 0 to 1.0)</li>
-        <li>Variance (in percent, from 0 to 1.0, nominally 0.05)</li>
+        <li>Specific Impulse (in sec)</li>
     </ul>
     Additionally, the following control inputs, operating characteristics, and
     location are required, as with all other engine types:
@@ -78,12 +75,8 @@ CLASS DOCUMENTATION
         <li>Pitch and Yaw</li>
     </ul>
     The nozzle exit pressure (p2) is returned via a
-    call to FGNozzle::GetPowerRequired(). This exit pressure is used,
-    along with chamber pressure and specific heat ratio, to get the
-    thrust coefficient for the throttle setting. This thrust
-    coefficient is multiplied by the chamber pressure and then passed
-    to the nozzle Calculate() routine, where the thrust force is
-    determined.
+    call to FGNozzle::GetPowerRequired(). This exit pressure is used
+    to get the at-altitude thrust level.
     
     One can model the thrust of a solid rocket by providing a normalized thrust table
     as a function of time. For instance, the space shuttle solid rocket booster
@@ -125,7 +118,7 @@ for the rocket engine to be throttle up to 1. At that time, the solid rocket
 fuel begins burning and thrust is provided.
 
     @author Jon S. Berndt
-    $Id$
+    $Id: FGRocket.h,v 1.14 2010/08/21 18:08:25 jberndt Exp $
     @see FGNozzle,
     FGThruster,
     FGForce,
@@ -150,31 +143,91 @@ public:
   /** Destructor */
   ~FGRocket(void);
 
-  /** Determines the thrust coefficient.
-      @return thrust coefficient times chamber pressure */
-  double Calculate(void);
+  /** Determines the thrust.*/
+  void Calculate(void);
 
-  /** Gets the chamber pressure.
-      @return chamber pressure in psf. */
-  double GetChamberPressure(void) {return PC;}
+  /** Gets the total impulse of the rocket.
+      @return The cumulative total impulse of the rocket up to this time.*/
+  double GetTotalImpulse(void) const {return It;}
 
   /** Gets the flame-out status.
       The engine will "flame out" if the throttle is set below the minimum
-      sustainable setting.
+      sustainable-thrust setting.
       @return true if engine has flamed out. */
   bool GetFlameout(void) {return Flameout;}
-  string GetEngineLabels(string delimeter);
-  string GetEngineValues(string delimeter);
+
+  double GetOxiFlowRate(void) const {return OxidizerFlowRate;}
+
+  std::string GetEngineLabels(const std::string& delimiter);
+  std::string GetEngineValues(const std::string& delimiter);
+
+  /** Sets the thrust variation for a solid rocket engine. 
+      Solid propellant rocket motor thrust characteristics are typically
+      defined at 70 degrees F temperature. At any other temperature,
+      performance will be different. Warmer propellant grain will
+      burn quicker and at higher thrust.  Total motor impulse is
+      not changed for change in thrust.
+      @param var the variation in percent. That is, a 2 percent
+      variation would be specified as 0.02. A positive 2% variation
+      in thrust would increase the thrust by 2%, and shorten the burn time. */
+  void SetThrustVariation(double var) {ThrustVariation = var;}
+
+  /** Sets the variation in total motor energy.
+      The total energy present in a solid rocket motor can be modified
+      (such as might happen with manufacturing variations) by setting
+      the total Isp variation. 
+      @param var the variation in percent. That is, a 2 percent
+      variation would be specified as 0.02. This variation will 
+      affect the total thrust, but not the burn time.*/
+  void SetTotalIspVariation(double var) {TotalIspVariation = var;}
+
+  /** Returns the thrust variation, if any. */
+  double GetThrustVariation(void) const {return ThrustVariation;}
+
+  /** Returns the Total Isp variation, if any. */
+  double GetTotalIspVariation(void) const {return TotalIspVariation;}
 
 private:
-  double SHR;
-  double maxPC;
-  double propEff;
-  double kFactor;
-  double Variance;
-  double PC;
+  /** Reduces the fuel in the active tanks by the amount required.
+      This function should be called from within the
+      derived class' Calculate() function before any other calculations are
+      done. This base class method removes fuel from the fuel tanks as
+      appropriate, and sets the starved flag if necessary. */
+  void ConsumeFuel(void);
+
+  /** The fuel need is calculated based on power levels and flow rate for that
+      power level. It is also turned from a rate into an actual amount (pounds)
+      by multiplying it by the delta T and the rate.
+      @return Total fuel requirement for this engine in pounds. */
+  double CalcFuelNeed(void);
+
+  /** The oxidizer need is calculated based on power levels and flow rate for that
+      power level. It is also turned from a rate into an actual amount (pounds)
+      by multiplying it by the delta T and the rate.
+      @return Total oxidizer requirement for this engine in pounds. */
+  double CalcOxidizerNeed(void);
+
+  /** Returns the vacuum thrust.
+      @return The vacuum thrust in lbs. */
+  double GetVacThrust(void) const {return VacThrust;}
+
+  void bindmodel(void);
+
+  double Isp; // Vacuum Isp
+  double It;
+  double MxR; // Mixture Ratio
   double BurnTime;
+  double ThrustVariation;
+  double TotalIspVariation;
+  double VacThrust;
+  double previousFuelNeedPerTank;
+  double previousOxiNeedPerTank;
+  double OxidizerExpended;
+  double SLOxiFlowMax;
+  double OxidizerFlowRate;
+  double PropellantFlowRate;
   bool Flameout;
+  double BuildupTime;
   FGTable* ThrustTable;
 
   void Debug(int from);