]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGRocket.cpp
Merge branch 'next' into durk-atc
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGRocket.cpp
index 52ab88cb25827b533738d2476323786a924e624b..f8fb091cb6344653e5fb35cef2e903bad1cdef54 100644 (file)
@@ -49,7 +49,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGRocket.cpp,v 1.19 2010/02/25 05:21:36 jberndt Exp $";
+static const char *IdSrc = "$Id: FGRocket.cpp,v 1.23 2011/01/24 13:01:56 jberndt Exp $";
 static const char *IdHdr = ID_ROCKET;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -59,6 +59,7 @@ CLASS IMPLEMENTATION
 FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number)
   : FGEngine(exec, el, engine_number)
 {
+  Type = etRocket;
   Element* thrust_table_element = 0;
   ThrustTable = 0L;
   BurnTime = 0.0;
@@ -72,6 +73,7 @@ FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number)
   It = 0.0;
   ThrustVariation = 0.0;
   TotalIspVariation = 0.0;
+  Flameout = false;
 
   // Defaults
    MinThrottle = 0.0;
@@ -108,10 +110,6 @@ FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number)
   bindmodel();
 
   Debug(0);
-
-  Type = etRocket;
-  Flameout = false;
-
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -124,10 +122,13 @@ FGRocket::~FGRocket(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGRocket::Calculate(void)
+void FGRocket::Calculate(void)
 {
+  if (FDMExec->IntegrationSuspended()) return;
+
   double dT = FDMExec->GetDeltaT()*Propulsion->GetRate();
-  double thrust;
+
+  RunPreFunctions();
 
   if (!Flameout && !Starved) ConsumeFuel();
 
@@ -184,10 +185,9 @@ double FGRocket::Calculate(void)
 
   } // End thrust calculations
 
-  thrust = Thruster->Calculate(VacThrust);
-  It += thrust * dT;
+  It += Thruster->Calculate(VacThrust) * dT;
 
-  return thrust;
+  RunPostFunctions();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -202,7 +202,7 @@ void FGRocket::ConsumeFuel(void)
   double Fshortage=0, Oshortage=0, TanksWithFuel=0, TanksWithOxidizer=0;
 
   if (FuelFreeze) return;
-  if (TrimMode) return;
+  if (FDMExec->GetTrimStatus()) return;
 
   // Count how many assigned tanks have fuel for this engine at this time.
   // If there is/are fuel tanks but no oxidizer tanks, this indicates
@@ -215,9 +215,9 @@ void FGRocket::ConsumeFuel(void)
         if (Tank->GetContents() > 0.0 && Tank->GetSelected() && SourceTanks[i] > 0) ++TanksWithFuel;
         break;
       case FGTank::ttOXIDIZER:
-        if (Tank->GetContents() > 0.0 && Tank->GetSelected() && SourceTanks[i] > 0) {
+        if (Tank->GetSelected() && SourceTanks[i] > 0) {
           haveOxTanks = true;
-          ++TanksWithOxidizer;
+          if (Tank->GetContents() > 0.0) ++TanksWithOxidizer;
         }
         break;
     }