]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGEngine.h
Updated to latest JSBSim, including preliminary support for
[flightgear.git] / src / FDM / JSBSim / FGEngine.h
index becf4a3d8bdd5282be9a35a2da986680540cbffd..8e2f92471d9ce6714ebc0836c9b7bae1708f5a9e 100644 (file)
@@ -48,7 +48,7 @@ INCLUDES
 #  include <simgear/compiler.h>
 #  include STL_STRING
    SG_USING_STD(string);
-#  ifdef FG_HAVE_STD_INCLUDES
+#  ifdef SG_HAVE_STD_INCLUDES
 #    include <vector>
 #  else
 #    include <vector.h>
@@ -58,6 +58,8 @@ INCLUDES
 #  include <string>
 #endif
 
+#include "FGJSBBase.h"
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -103,22 +105,43 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGEngine {
+class FGEngine : public FGJSBBase
+{
 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  GetThrust(void) { return Thrust; }
-  bool   GetStarved(void) { return Starved; }
-  bool   GetFlameout(void) { return Flameout; }
-  bool   GetRunning(void) { return Running; }
-  int    GetType(void) { return Type; }
-  string GetName(void) { return Name; }
+  virtual double  GetThrottleMin(void) { return MinThrottle; }
+  virtual double  GetThrottleMax(void) { return MaxThrottle; }
+  double  GetThrottle(void) { return Throttle; }
+  double  GetMixture(void) { return Mixture; }
+  int     GetMagnetos(void) { return Magnetos; }
+  bool    GetStarter(void) { return Starter; }
+  double  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 double getManifoldPressure_inHg () const {
+    return ManifoldPressure_inHg;
+  }
+  virtual double getExhaustGasTemp_degF () const {
+    return (ExhaustGasTemp_degK - 273) * (9.0 / 5.0) + 32.0;
+  }
+  virtual double getCylinderHeadTemp_degF () const {
+    return (CylinderHeadTemp_degK - 273) * (9.0 / 5.0) + 32.0;
+  }
+  virtual double getOilPressure_psi () const {
+    return OilPressure_psi;
+  }
+  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;}
@@ -127,12 +150,15 @@ public:
   void SetName(string name) {Name = name;}
   void AddFeedTank(int tkID);
 
+  void SetMagnetos(int m) { Magnetos = m; }
+  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
@@ -145,18 +171,21 @@ public:
       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);
+  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);
+  double CalcOxidizerNeed(void);
 
   /// Sets engine placement information
-  void SetPlacement(float x, float y, float z, float pitch, float yaw);
+  void SetPlacement(double x, double y, double z, double pitch, double yaw);
 
-  virtual float GetPowerAvailable(void) {return 0.0;};
+  /// Sets the engine number
+  void SetEngineNumber(int nn) {EngineNumber = nn;}
+
+  virtual double GetPowerAvailable(void) {return 0.0;};
 
   bool GetTrimMode(void) {return TrimMode;}
   void SetTrimMode(bool state) {TrimMode = state;}
@@ -164,24 +193,34 @@ public:
 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 FuelNeed, OxidizerNeed;
+  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;
+  double FuelNeed, OxidizerNeed;
   bool  Starved;
   bool  Flameout;
   bool  Running;
-  float PctPower;
+  bool  Cranking;
+  double PctPower;
   int   EngineNumber;
   bool  TrimMode;
 
+  double ManifoldPressure_inHg;
+  double ExhaustGasTemp_degK;
+  double CylinderHeadTemp_degK;
+  double OilPressure_psi;
+  double OilTemp_degK;
+
   FGFDMExec*      FDMExec;
   FGState*        State;
   FGAtmosphere*   Atmosphere;
@@ -195,7 +234,7 @@ protected:
   FGOutput*       Output;
 
   vector <int> SourceTanks;
-  void Debug(void);
+  virtual void Debug(int from);
 };
 
 #include "FGState.h"
@@ -209,7 +248,6 @@ protected:
 #include "FGPosition.h"
 #include "FGAuxiliary.h"
 #include "FGOutput.h"
-#include "FGDefs.h"
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif