]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGElectric.cpp
Bugfix: no automatic runway selection with --parkpos=
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGElectric.cpp
index 1ab17c7b60c0a9529908f553d04d41f042c110f4..1138d820cceed7fe97b849229c8057af6eb1f8d9 100644 (file)
@@ -40,7 +40,6 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGElectric.h"
-#include "FGState.h"
 #include "models/FGPropulsion.h"
 #include "models/propulsion/FGThruster.h"
 
@@ -51,7 +50,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id$";
+static const char *IdSrc = "$Id: FGElectric.cpp,v 1.9 2010/08/21 17:13:48 jberndt Exp $";
 static const char *IdHdr = ID_ELECTRIC;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -67,7 +66,7 @@ FGElectric::FGElectric(FGFDMExec* exec, Element *el, int engine_number)
   PowerWatts = 745.7;
   hptowatts = 745.7;
 
-  dt = State->Getdt();
+  dt = FDMExec->GetDeltaT();
 
   if (el->FindElement("power"))
     PowerWatts = el->FindElementValueAsNumberConvertTo("power","WATTS");
@@ -84,8 +83,10 @@ FGElectric::~FGElectric()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGElectric::Calculate(void)
+void FGElectric::Calculate(void)
 {
+  RunPreFunctions();
+
   Throttle = FCS->GetThrottlePos(EngineNumber);
 
   RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
@@ -94,7 +95,9 @@ double FGElectric::Calculate(void)
 
   PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
 
-  return Thruster->Calculate(PowerAvailable);
+  Thruster->Calculate(PowerAvailable);
+
+  RunPostFunctions();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%