#include "FGOutput.h"
#include "FGDefs.h"
+static const char *IdSrc = "$Header$";
+static const char *IdHdr = "ID_ENGINE";
+
/*******************************************************************************
************************************ CODE **************************************
*******************************************************************************/
Output = FDMExec->GetOutput();
Name = engineName;
- fullpath = enginePath + "/" + engineName + ".dat";
+
+# ifndef macintosh
+ fullpath = enginePath + "/" + engineName + ".xml";
+# else
+ fullpath = enginePath + ";" + engineName + ".xml";
+# endif
+
+ cout << " Reading engine: " << engineName << " from file: " << fullpath << endl;
ifstream enginefile(fullpath.c_str());
if (enginefile) {
else Type = etUnknown;
switch(Type) {
+ case etTurboProp:
+ case etTurboJet:
+ cerr << "Unsupported Engine type" << tag << endl;
+ break;
case etUnknown:
cerr << "Unknown engine type: " << tag << endl;
break;
enginefile.close();
} else {
- cerr << "Unable to open engine definition file " << fullpath << endl;
+ cerr << "Unable to open engine definition file " << fullpath.c_str() << endl;
}
EngineNumber = num;
Thrust = PctPower = 0.0;
Starved = Flameout = false;
+ Running = true;
}
FGEngine::~FGEngine(void) {}
-
float FGEngine::CalcRocketThrust(void) {
float lastThrust;
}
- Thrust -= 0.8*(Thrust - lastThrust); // actual thrust
+ if(State->Getdt() > 0.0) {
+ Thrust -= 0.8*(Thrust - lastThrust); // actual thrust
+ }
return Thrust;
}
Throttle = FCS->GetThrottlePos(EngineNumber);
Throttle /= 100;
- v=Translation->GetVt();
- h=Position->Geth();
- if(v < 10)
- v=10;
- if(h < 0)
- h=0;
-
+ v = Translation->GetVt();
+ h = Position->Geth();
+
+ if (v < 10)
+ v = 10;
+ if (h < 0)
+ h = 0;
+
pa=(SpeedSlope*v + SpeedIntercept)*(1 +AltitudeSlope*h)*BrakeHorsePower;
-
- Thrust= Throttle*(pa*HPTOFTLBSSEC)/v;
+
+ Thrust = Throttle*(pa*HPTOFTLBSSEC)/v;
return Thrust;
}
float FGEngine::CalcThrust(void) {
- switch(Type) {
- case etRocket:
- return CalcRocketThrust();
- // break;
- case etPiston:
- return CalcPistonThrust();
- // break;
- default:
- return 9999.0;
- // break;
+ if(Running) {
+ switch(Type) {
+ case etRocket:
+ return CalcRocketThrust();
+ // break;
+ case etPiston:
+ return CalcPistonThrust();
+ // break;
+ default:
+ return 9999.0;
+ // break;
+ }
+ } else {
+ return 0;
}
-
}
float FGEngine::CalcFuelNeed() {