]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGEngine.cpp
Rob Deters: UIUC updates from March 1, 2004.
[flightgear.git] / src / FDM / JSBSim / FGEngine.cpp
index f977a8846bcbf6808ef4ad509cca5a336ef8e572..bc73911a8630af43e1d3871c2a41b003d6adbb72 100644 (file)
@@ -46,7 +46,7 @@ INCLUDES
 #    include <fstream.h>
 #  endif
 #else
-#  if defined(sgi) && !defined(__GNUC__)
+#  if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
 #    include <fstream.h>
 #  else
 #    include <fstream>
@@ -56,6 +56,8 @@ INCLUDES
 #include "FGEngine.h"
 #include "FGTank.h"
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_ENGINE;
 
@@ -65,40 +67,40 @@ CLASS IMPLEMENTATION
 
 
 FGEngine::FGEngine(FGFDMExec* exec)
-  : Name(""),
-    Type(etUnknown),
-    X(0), Y(0), Z(0),
-    EnginePitch(0), EngineYaw(0),
-    SLFuelFlowMax(0), SLOxiFlowMax(0),
-    MaxThrottle(1.0), MinThrottle(0.0),
-    Thrust(0.0),
-    Throttle(0.0),
-    Mixture(1.0),
-    Magnetos(0),
-    Starter(false),
-    FuelNeed(0.0), OxidizerNeed(0.0),
-    Starved(false), Flameout(false), Running(false), Cranking(false),
-    PctPower(0.0),
-    EngineNumber(-1),
-    TrimMode(false),
-    FuelFlow_gph(0.0),
-    ManifoldPressure_inHg(0.0),
-    ExhaustGasTemp_degK(0.0),
-    CylinderHeadTemp_degK(0.0),
-    OilPressure_psi(0.0),
-    OilTemp_degK(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())
 {
+  Name = "";
+  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();
+  
+  PropertyManager = FDMExec->GetPropertyManager();
+
   Debug(0);
 }
 
@@ -123,7 +125,7 @@ void FGEngine::ConsumeFuel(void)
   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 {
@@ -137,21 +139,24 @@ void FGEngine::ConsumeFuel(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-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;
@@ -211,4 +216,4 @@ void FGEngine::Debug(int from)
     }
   }
 }
-
+}