# include <fstream.h>
# endif
#else
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <fstream.h>
# else
# include <fstream>
#include "FGEngine.h"
#include "FGTank.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_ENGINE;
FGEngine::FGEngine(FGFDMExec* exec)
{
- FDMExec = exec;
- State = FDMExec->GetState();
- Atmosphere = FDMExec->GetAtmosphere();
- FCS = FDMExec->GetFCS();
- Propulsion = FDMExec->GetPropulsion();
- Aircraft = FDMExec->GetAircraft();
+ Name.clear();
+ Type = etUnknown;
+ X = Y = Z = 0.0;
+ EnginePitch = EngineYaw = 0.0;
+ SLFuelFlowMax = SLOxiFlowMax = 0.0;
+ MaxThrottle = 1.0;
+ MinThrottle = 0.0;
+ Thrust = 0.0;
+ Throttle = 0.0;
+ Mixture = 1.0;
+ Starter = false;
+ FuelNeed = OxidizerNeed = 0.0;
+ Starved = Running = Cranking = false;
+ PctPower = 0.0;
+ EngineNumber = -1;
+ TrimMode = false;
+ FuelFlow_gph = 0.0;
+ FuelFlow_pph = 0.0;
+
+ FDMExec = exec;
+ State = FDMExec->GetState();
+ Atmosphere = FDMExec->GetAtmosphere();
+ FCS = FDMExec->GetFCS();
+ Propulsion = FDMExec->GetPropulsion();
+ Aircraft = FDMExec->GetAircraft();
Translation = FDMExec->GetTranslation();
- Rotation = FDMExec->GetRotation();
- Position = FDMExec->GetPosition();
- Auxiliary = FDMExec->GetAuxiliary();
- Output = FDMExec->GetOutput();
-
- Mixture = 1.0; // FIXME: get actual value
-
- Thrust = PctPower = 0.0;
- Starved = Flameout = false;
- Running = false;
- Cranking = Starter = false;
+ Rotation = FDMExec->GetRotation();
+ Position = FDMExec->GetPosition();
+ Auxiliary = FDMExec->GetAuxiliary();
+ Output = FDMExec->GetOutput();
+
+ PropertyManager = FDMExec->GetPropertyManager();
Debug(0);
- TrimMode = false;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (TrimMode) return;
Fshortage = Oshortage = 0.0;
for (unsigned int i=0; i<SourceTanks.size(); i++) {
- Tank = Propulsion->GetTank(i);
+ Tank = Propulsion->GetTank(SourceTanks[i]);
if (Tank->GetType() == FGTank::ttFUEL) {
Fshortage += Tank->Reduce(CalcFuelNeed()/Propulsion->GetnumSelectedFuelTanks());
} else {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGEngine::CalcFuelNeed(void) {
+double FGEngine::CalcFuelNeed(void)
+{
FuelNeed = SLFuelFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
return FuelNeed;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGEngine::CalcOxidizerNeed(void) {
+double FGEngine::CalcOxidizerNeed(void)
+{
OxidizerNeed = SLOxiFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
return OxidizerNeed;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGEngine::SetPlacement(double x, double y, double z, double pitch, double yaw) {
+void FGEngine::SetPlacement(double x, double y, double z, double pitch, double yaw)
+{
X = x;
Y = y;
Z = z;
}
}
}
-
+}