# 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>
# include <string>
#endif
+#include "FGJSBBase.h"
+#include "FGThruster.h"
+#include "FGPropertyManager.h"
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ENGINE "$Id$"
using std::string;
+using std::vector;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFDMExec;
class FGState;
class FGAtmosphere;
class FGFCS;
class FGAircraft;
-class FGTranslation;
-class FGRotation;
+class FGPropagate;
class FGPropulsion;
-class FGPosition;
class FGAuxiliary;
class FGOutput;
-
-using std::vector;
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+class FGThruster;
+class FGConfigFile;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
This base class contains methods and members common to all engines, such as
logic to drain fuel from the appropriate tank, etc.
@author Jon S. Berndt
- @version $Id$
+ @version $Id$
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class FGEngine {
+class FGEngine : public FGJSBBase
+{
public:
- FGEngine(FGFDMExec* exec);
+ FGEngine(FGFDMExec* exec, int engine_number);
virtual ~FGEngine();
- enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet};
+ enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etElectric};
- 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; }
+ EngineType GetType(void) { return Type; }
+ virtual string GetName(void) { return Name; }
- void SetStarved(bool tt) {Starved = tt;}
- void SetStarved(void) {Starved = true;}
+ // Engine controls
+ 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 bool GetStarter(void) { return Starter; }
- void SetRunning(bool bb) { Running=bb; }
- void SetName(string name) {Name = name;}
- void AddFeedTank(int tkID);
+ virtual double getFuelFlow_gph () const {return FuelFlow_gph;}
+ virtual double getFuelFlow_pph () const {return FuelFlow_pph;}
+ virtual double GetThrust(void) { return Thrust; }
+ virtual bool GetStarved(void) { return Starved; }
+ virtual bool GetRunning(void) { return Running; }
+ virtual bool GetCranking(void) { return Cranking; }
+
+ virtual void SetStarved(bool tt) { Starved = tt; }
+ virtual void SetStarved(void) { Starved = true; }
+
+ virtual void SetRunning(bool bb) { Running=bb; }
+ virtual void SetName(string name) { Name = name; }
+ virtual void AddFeedTank(int tkID);
+ virtual void SetFuelFreeze(bool f) { FuelFreeze = f; }
+
+ 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(void) {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 double GetPowerAvailable(void) {return 0.0;};
- virtual float GetPowerAvailable(void) {return 0.0;};
+ virtual bool GetTrimMode(void) {return TrimMode;}
+ virtual void SetTrimMode(bool state) {TrimMode = state;}
- bool GetTrimMode(void) {return TrimMode;}
- void SetTrimMode(bool state) {TrimMode = state;}
+ virtual FGColumnVector3& GetBodyForces(void);
+ virtual FGColumnVector3& GetMoments(void);
+
+ bool LoadThruster(FGConfigFile* AC_cfg);
+ FGThruster* GetThruster(void) {return Thruster;}
+
+ virtual string GetEngineLabels(string delimeter) = 0;
+ virtual string GetEngineValues(string delimeter) = 0;
protected:
+ FGPropertyManager* PropertyManager;
string Name;
+ const int EngineNumber;
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;
+ double FuelNeed;
+ double OxidizerNeed;
+ double PctPower;
+ bool Starter;
bool Starved;
- bool Flameout;
bool Running;
- float PctPower;
- int EngineNumber;
+ bool Cranking;
bool TrimMode;
+ bool FuelFreeze;
+
+ double FuelFlow_gph;
+ double FuelFlow_pph;
FGFDMExec* FDMExec;
FGState* State;
FGFCS* FCS;
FGPropulsion* Propulsion;
FGAircraft* Aircraft;
- FGTranslation* Translation;
- FGRotation* Rotation;
- FGPosition* Position;
+ FGPropagate* Propagate;
FGAuxiliary* Auxiliary;
FGOutput* Output;
+ FGThruster* Thruster;
vector <int> SourceTanks;
- void Debug(void);
+ void Debug(int from);
};
-
+}
#include "FGState.h"
#include "FGFDMExec.h"
#include "FGAtmosphere.h"
#include "FGFCS.h"
#include "FGAircraft.h"
-#include "FGTranslation.h"
-#include "FGRotation.h"
+#include "FGPropagate.h"
#include "FGPropulsion.h"
-#include "FGPosition.h"
#include "FGAuxiliary.h"
#include "FGOutput.h"
-#include "FGDefs.h"
+#include "FGThruster.h"
+#include "FGConfigFile.h"
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif