]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGEngine.h
Updates from JSBSim, including new turbine engine model from David Culp
[flightgear.git] / src / FDM / JSBSim / FGEngine.h
index ba5058f8a1e84b5b7a22d55904a7464864fd8e4c..e17358f5f438735ee0597f3d3ddc31705a89fe98 100644 (file)
@@ -67,6 +67,9 @@ DEFINITIONS
 #define ID_ENGINE "$Id$"
 
 using std::string;
+using std::vector;
+
+namespace JSBSim {
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -84,8 +87,6 @@ class FGPosition;
 class FGAuxiliary;
 class FGOutput;
 
-using std::vector;
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -111,112 +112,147 @@ public:
   FGEngine(FGFDMExec* exec);
   virtual ~FGEngine();
 
-  enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet, etTurboShaft};
-
-  virtual float  GetThrottleMin(void) { return MinThrottle; }
-  virtual float  GetThrottleMax(void) { return MaxThrottle; }
-  float  GetThrottle(void) { return Throttle; }
-  float  GetMixture(void) { return Mixture; }
-  int    GetMagnetos(void) { return Magnetos; }
-  bool    GetStarter(void) { return Starter; }
-  float  GetThrust(void) { return Thrust; }
-  bool   GetStarved(void) { return Starved; }
-  bool   GetFlameout(void) { return Flameout; }
-  bool   GetRunning(void) { return Running; }
-  bool   GetCranking(void) { return Cranking; }
-  int    GetType(void) { return Type; }
-  string GetName(void) { return Name; }
-
-  virtual float getManifoldPressure_inHg () const {
+  enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etSimTurbine};
+
+  virtual double  GetThrottleMin(void) { return MinThrottle; }
+  virtual double  GetThrottleMax(void) { return MaxThrottle; }
+  virtual double  GetThrottle(void) { return Throttle; }
+  virtual double  GetMixture(void) { return Mixture; }
+  virtual int     GetMagnetos(void) { return Magnetos; }
+  virtual bool    GetStarter(void) { return Starter; }
+  virtual double  GetThrust(void) { return Thrust; }
+  virtual bool    GetStarved(void) { return Starved; }
+  virtual bool    GetFlameout(void) { return Flameout; }
+  virtual bool    GetRunning(void) { return Running; }
+  virtual bool    GetCranking(void) { return Cranking; }
+  virtual int     GetType(void) { return Type; }
+  virtual string  GetName(void) { return Name; }
+  virtual double  GetN1(void) { return N1; }
+  virtual double  GetN2(void) { return N2; }
+  virtual double  GetEGT(void) { return EGT_degC; }
+  virtual double  GetEPR(void) { return EPR; }
+  virtual double  GetInlet(void) { return InletPosition; }
+  virtual double  GetNozzle(void) { return NozzlePosition; } 
+  virtual bool    GetAugmentation(void) { return Augmentation; } 
+  virtual bool    GetInjection(void) { return Injection; }
+  virtual bool    GetIgnition(void) { return Ignition; }
+  virtual bool    GetReversed(void) { return Reversed; }
+
+  virtual double getFuelFlow_gph () const {
+    return FuelFlow_gph;
+  }
+
+  virtual double getManifoldPressure_inHg () const {
     return ManifoldPressure_inHg;
   }
-  virtual float getExhaustGasTemp_degF () const {
+  virtual double getExhaustGasTemp_degF () const {
     return (ExhaustGasTemp_degK - 273) * (9.0 / 5.0) + 32.0;
   }
-  virtual float getCylinderHeadTemp_degF () const {
+  virtual double getCylinderHeadTemp_degF () const {
     return (CylinderHeadTemp_degK - 273) * (9.0 / 5.0) + 32.0;
   }
-  virtual float getOilPressure_psi () const {
+  virtual double getOilPressure_psi () const {
     return OilPressure_psi;
   }
-  virtual float getOilTemp_degF () const {
+  virtual double getOilTemp_degF () const {
     return (OilTemp_degK - 273.0) * (9.0 / 5.0) + 32.0;
   }
 
-  void SetStarved(bool tt) {Starved = tt;}
-  void SetStarved(void)    {Starved = true;}
+  virtual double getFuelFlow_pph () const {
+    return FuelFlow_pph;
+  }
+
+  virtual void SetStarved(bool tt) {Starved = tt;}
+  virtual void SetStarved(void)    {Starved = true;}
 
-  void SetRunning(bool bb) { Running=bb; }
-  void SetName(string name) {Name = name;}
-  void AddFeedTank(int tkID);
+  virtual void SetRunning(bool bb) { Running=bb; }
+  virtual void SetName(string name) {Name = name;}
+  virtual void AddFeedTank(int tkID);
 
-  void SetMagnetos(int m) { Magnetos = m; }
-  void SetStarter(bool s) { Starter = s;}
+  virtual void SetMagnetos(int m) { Magnetos = m; }
+  virtual void SetStarter(bool s) { Starter = s;}
 
   /** Calculates the thrust of the engine, and other engine functions.
       @param PowerRequired this is the power required to run the thrusting device
              such as a propeller. This resisting effect must be provided to the 
              engine model.
       @return Thrust in pounds */
-  virtual float Calculate(float PowerRequired) {return 0.0;};
+  virtual double Calculate(double PowerRequired) {return 0.0;};
 
   /** 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);
+  virtual 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. */
-  float CalcFuelNeed(void);
+  virtual 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. */
-  float CalcOxidizerNeed(void);
+  virtual double CalcOxidizerNeed(void);
 
   /// Sets engine placement information
-  void SetPlacement(float x, float y, float z, float pitch, float yaw);
+  virtual void SetPlacement(double x, double y, double z, double pitch, double yaw);
 
-  virtual float GetPowerAvailable(void) {return 0.0;};
+  /// Sets the engine number
+  virtual void SetEngineNumber(int nn) {EngineNumber = nn;}
 
-  bool GetTrimMode(void) {return TrimMode;}
-  void SetTrimMode(bool state) {TrimMode = state;}
+  virtual double GetPowerAvailable(void) {return 0.0;};
+
+  virtual bool GetTrimMode(void) {return TrimMode;}
+  virtual void SetTrimMode(bool state) {TrimMode = state;}
 
 protected:
   string Name;
   EngineType Type;
-  float X, Y, Z;
-  float EnginePitch;
-  float EngineYaw;
-  float SLFuelFlowMax;
-  float SLOxiFlowMax;
-  float MaxThrottle;
-  float MinThrottle;
-
-  float Thrust;
-  float Throttle;
-  float Mixture;
+  double X, Y, Z;
+  double EnginePitch;
+  double EngineYaw;
+  double SLFuelFlowMax;
+  double SLOxiFlowMax;
+  double MaxThrottle;
+  double MinThrottle;
+
+  double Thrust;
+  double Throttle;
+  double Mixture;
   int   Magnetos;
   bool  Starter;
-  float FuelNeed, OxidizerNeed;
+  double FuelNeed, OxidizerNeed;
   bool  Starved;
   bool  Flameout;
   bool  Running;
   bool  Cranking;
-  float PctPower;
+  double PctPower;
   int   EngineNumber;
   bool  TrimMode;
 
-  float ManifoldPressure_inHg;
-  float ExhaustGasTemp_degK;
-  float CylinderHeadTemp_degK;
-  float OilPressure_psi;
-  float OilTemp_degK;
+  double FuelFlow_gph;
+  double ManifoldPressure_inHg;
+  double ExhaustGasTemp_degK;
+  double CylinderHeadTemp_degK;
+  double OilPressure_psi;
+  double OilTemp_degK;
+
+  double FuelFlow_pph;
+  double N1;
+  double N2;
+  double EGT_degC;
+  double EPR;
+  double BleedDemand;
+  double InletPosition;
+  double NozzlePosition;
+  bool Augmentation;
+  bool Injection;
+  bool Ignition;
+  bool Reversed;
 
   FGFDMExec*      FDMExec;
   FGState*        State;
@@ -231,9 +267,9 @@ protected:
   FGOutput*       Output;
 
   vector <int> SourceTanks;
-  void Debug(void);
+  virtual void Debug(int from);
 };
-
+}
 #include "FGState.h"
 #include "FGFDMExec.h"
 #include "FGAtmosphere.h"
@@ -245,7 +281,6 @@ protected:
 #include "FGPosition.h"
 #include "FGAuxiliary.h"
 #include "FGOutput.h"
-#include "FGDefs.h"
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif