Sync. with JSBSim CVS again. This fixes some small issues.
This commit is contained in:
parent
25ac349fe4
commit
5c685b34de
18 changed files with 93 additions and 52 deletions
|
@ -50,12 +50,12 @@ static const char *IdHdr = ID_ELECTRIC;
|
||||||
CLASS IMPLEMENTATION
|
CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
FGElectric::FGElectric(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec)
|
FGElectric::FGElectric(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number)
|
||||||
|
: FGEngine(exec, engine_number)
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
|
|
||||||
Type = etElectric;
|
Type = etElectric;
|
||||||
EngineNumber = 0;
|
|
||||||
PowerWatts = 745.7;
|
PowerWatts = 745.7;
|
||||||
hptowatts = 745.7;
|
hptowatts = 745.7;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class FGElectric : public FGEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
FGElectric(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
FGElectric(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number);
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~FGElectric();
|
~FGElectric();
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGEngine::FGEngine(FGFDMExec* exec)
|
FGEngine::FGEngine(FGFDMExec* exec, int engine_number) : EngineNumber(engine_number)
|
||||||
{
|
{
|
||||||
Name = "";
|
Name = "";
|
||||||
Type = etUnknown;
|
Type = etUnknown;
|
||||||
|
@ -84,7 +84,6 @@ FGEngine::FGEngine(FGFDMExec* exec)
|
||||||
FuelNeed = OxidizerNeed = 0.0;
|
FuelNeed = OxidizerNeed = 0.0;
|
||||||
Starved = Running = Cranking = false;
|
Starved = Running = Cranking = false;
|
||||||
PctPower = 0.0;
|
PctPower = 0.0;
|
||||||
EngineNumber = -1;
|
|
||||||
TrimMode = false;
|
TrimMode = false;
|
||||||
FuelFlow_gph = 0.0;
|
FuelFlow_gph = 0.0;
|
||||||
FuelFlow_pph = 0.0;
|
FuelFlow_pph = 0.0;
|
||||||
|
@ -124,7 +123,7 @@ void FGEngine::ConsumeFuel(void)
|
||||||
|
|
||||||
if (TrimMode) return;
|
if (TrimMode) return;
|
||||||
Fshortage = Oshortage = TanksWithFuel = 0.0;
|
Fshortage = Oshortage = TanksWithFuel = 0.0;
|
||||||
|
|
||||||
// count how many assigned tanks have fuel
|
// count how many assigned tanks have fuel
|
||||||
for (unsigned int i=0; i<SourceTanks.size(); i++) {
|
for (unsigned int i=0; i<SourceTanks.size(); i++) {
|
||||||
Tank = Propulsion->GetTank(SourceTanks[i]);
|
Tank = Propulsion->GetTank(SourceTanks[i]);
|
||||||
|
|
|
@ -107,7 +107,7 @@ CLASS DECLARATION
|
||||||
class FGEngine : public FGJSBBase
|
class FGEngine : public FGJSBBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGEngine(FGFDMExec* exec);
|
FGEngine(FGFDMExec* exec, int engine_number);
|
||||||
virtual ~FGEngine();
|
virtual ~FGEngine();
|
||||||
|
|
||||||
enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etElectric};
|
enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etElectric};
|
||||||
|
@ -164,9 +164,6 @@ public:
|
||||||
/// Sets engine placement information
|
/// Sets engine placement information
|
||||||
virtual void SetPlacement(double x, double y, double z, double pitch, double yaw);
|
virtual void SetPlacement(double x, double y, double z, double pitch, double yaw);
|
||||||
|
|
||||||
/// Sets the engine number
|
|
||||||
virtual void SetEngineNumber(int nn) {EngineNumber = nn;}
|
|
||||||
|
|
||||||
virtual double GetPowerAvailable(void) {return 0.0;};
|
virtual double GetPowerAvailable(void) {return 0.0;};
|
||||||
|
|
||||||
virtual bool GetTrimMode(void) {return TrimMode;}
|
virtual bool GetTrimMode(void) {return TrimMode;}
|
||||||
|
@ -184,6 +181,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
FGPropertyManager* PropertyManager;
|
FGPropertyManager* PropertyManager;
|
||||||
string Name;
|
string Name;
|
||||||
|
const int EngineNumber;
|
||||||
EngineType Type;
|
EngineType Type;
|
||||||
double X, Y, Z;
|
double X, Y, Z;
|
||||||
double EnginePitch;
|
double EnginePitch;
|
||||||
|
@ -199,7 +197,6 @@ protected:
|
||||||
double FuelNeed;
|
double FuelNeed;
|
||||||
double OxidizerNeed;
|
double OxidizerNeed;
|
||||||
double PctPower;
|
double PctPower;
|
||||||
int EngineNumber;
|
|
||||||
bool Starter;
|
bool Starter;
|
||||||
bool Starved;
|
bool Starved;
|
||||||
bool Running;
|
bool Running;
|
||||||
|
|
|
@ -747,7 +747,6 @@ void FGFCS::bindModel(void)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char tmp[80];
|
char tmp[80];
|
||||||
|
|
||||||
|
|
||||||
for (i=0; i<ThrottleCmd.size(); i++) {
|
for (i=0; i<ThrottleCmd.size(); i++) {
|
||||||
snprintf(tmp,80,"fcs/throttle-cmd-norm[%u]",i);
|
snprintf(tmp,80,"fcs/throttle-cmd-norm[%u]",i);
|
||||||
PropertyManager->Tie( tmp,this,i,
|
PropertyManager->Tie( tmp,this,i,
|
||||||
|
|
|
@ -384,18 +384,22 @@ vector <string> FGFDMExec::EnumerateFDMs(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGFDMExec::LoadModel(string AircraftPath, string EnginePath, string model)
|
bool FGFDMExec::LoadModel(string AircraftPath, string EnginePath, string model,
|
||||||
|
bool addModelToPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
FGFDMExec::AircraftPath = AircraftPath;
|
FGFDMExec::AircraftPath = AircraftPath;
|
||||||
FGFDMExec::EnginePath = EnginePath;
|
FGFDMExec::EnginePath = EnginePath;
|
||||||
|
|
||||||
return LoadModel(model);
|
return LoadModel(model, addModelToPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGFDMExec::LoadModel(string model)
|
|
||||||
|
bool FGFDMExec::LoadModel(string model, bool addModelToPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool result = true;
|
bool result = true;
|
||||||
string token;
|
string token;
|
||||||
string aircraftCfgFileName;
|
string aircraftCfgFileName;
|
||||||
|
@ -406,10 +410,13 @@ bool FGFDMExec::LoadModel(string model)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aircraftCfgFileName = AircraftPath;
|
||||||
# ifndef macintosh
|
# ifndef macintosh
|
||||||
aircraftCfgFileName = AircraftPath + "/" + model + ".xml";
|
if (addModelToPath) aircraftCfgFileName += "/" + model;
|
||||||
|
aircraftCfgFileName += "/" + model + ".xml";
|
||||||
# else
|
# else
|
||||||
aircraftCfgFileName = AircraftPath + ";" + model + ".xml";
|
if (addModelToPath) aircraftCfgFileName += ";" + model;
|
||||||
|
aircraftCfgFileName += ";" + model + ".xml";
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
FGConfigFile AC_cfg(aircraftCfgFileName);
|
FGConfigFile AC_cfg(aircraftCfgFileName);
|
||||||
|
|
|
@ -152,8 +152,11 @@ public:
|
||||||
be looked for in the directory specified in the AircraftPath variable,
|
be looked for in the directory specified in the AircraftPath variable,
|
||||||
and in turn under the directory with the same name as the model. For
|
and in turn under the directory with the same name as the model. For
|
||||||
instance: "aircraft/x15/x15.xml"
|
instance: "aircraft/x15/x15.xml"
|
||||||
|
@param addModelToPath set to true to add the model name to the
|
||||||
|
AircraftPath, defaults to true
|
||||||
@return true if successful*/
|
@return true if successful*/
|
||||||
bool LoadModel(string AircraftPath, string EnginePath, string model);
|
bool LoadModel(string AircraftPath, string EnginePath, string model,
|
||||||
|
bool addModelToPath = true);
|
||||||
|
|
||||||
|
|
||||||
/** Loads an aircraft model. The paths to the aircraft and engine
|
/** Loads an aircraft model. The paths to the aircraft and engine
|
||||||
|
@ -163,8 +166,10 @@ public:
|
||||||
be looked for in the directory specified in the AircraftPath variable,
|
be looked for in the directory specified in the AircraftPath variable,
|
||||||
and in turn under the directory with the same name as the model. For
|
and in turn under the directory with the same name as the model. For
|
||||||
instance: "aircraft/x15/x15.xml"
|
instance: "aircraft/x15/x15.xml"
|
||||||
|
@param addModelToPath set to true to add the model name to the
|
||||||
|
AircraftPath, defaults to true
|
||||||
@return true if successful*/
|
@return true if successful*/
|
||||||
bool LoadModel(string model);
|
bool LoadModel(string model, bool addModelToPath = true);
|
||||||
|
|
||||||
|
|
||||||
/** Sets the path to the engine config file directories.
|
/** Sets the path to the engine config file directories.
|
||||||
|
|
|
@ -199,7 +199,6 @@ public:
|
||||||
return celsius * 1.8 + 32.0;
|
return celsius * 1.8 + 32.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Finite precision comparison.
|
/** Finite precision comparison.
|
||||||
@param a first value to compare
|
@param a first value to compare
|
||||||
@param b second value to compare
|
@param b second value to compare
|
||||||
|
|
|
@ -353,9 +353,9 @@ FGColumnVector3& FGLGear::Force(void)
|
||||||
if (RollingWhlVel == 0.0 && SideWhlVel == 0.0) {
|
if (RollingWhlVel == 0.0 && SideWhlVel == 0.0) {
|
||||||
WheelSlip = 0.0;
|
WheelSlip = 0.0;
|
||||||
} else if (fabs(RollingWhlVel) < 1.0) {
|
} else if (fabs(RollingWhlVel) < 1.0) {
|
||||||
WheelSlip = 0.05*radtodeg*atan2(SideWhlVel, RollingWhlVel) + 0.95*WheelSlip;
|
WheelSlip = 0.05*radtodeg*atan2(SideWhlVel, fabs(RollingWhlVel)) + 0.95*WheelSlip;
|
||||||
} else {
|
} else {
|
||||||
WheelSlip = radtodeg*atan2(SideWhlVel, RollingWhlVel);
|
WheelSlip = radtodeg*atan2(SideWhlVel, fabs(RollingWhlVel));
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
double maxdeltaSlip = 0.5*deltaT;
|
double maxdeltaSlip = 0.5*deltaT;
|
||||||
|
|
|
@ -54,7 +54,8 @@ static const char *IdHdr = ID_PISTON;
|
||||||
CLASS IMPLEMENTATION
|
CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec),
|
FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number)
|
||||||
|
: FGEngine(exec, engine_number),
|
||||||
R_air(287.3),
|
R_air(287.3),
|
||||||
rho_fuel(800), // estimate
|
rho_fuel(800), // estimate
|
||||||
calorific_value_fuel(47.3e6),
|
calorific_value_fuel(47.3e6),
|
||||||
|
@ -65,7 +66,6 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec),
|
||||||
|
|
||||||
Type = etPiston;
|
Type = etPiston;
|
||||||
crank_counter = 0;
|
crank_counter = 0;
|
||||||
EngineNumber = 0;
|
|
||||||
OilTemp_degK = 298;
|
OilTemp_degK = 298;
|
||||||
MinManifoldPressure_inHg = 6.5;
|
MinManifoldPressure_inHg = 6.5;
|
||||||
MaxManifoldPressure_inHg = 28.5;
|
MaxManifoldPressure_inHg = 28.5;
|
||||||
|
|
|
@ -142,7 +142,7 @@ class FGPiston : public FGEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number);
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~FGPiston();
|
~FGPiston();
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ bool FGPropulsion::Run(void)
|
||||||
|
|
||||||
for (unsigned int i=0; i<numTanks; i++) {
|
for (unsigned int i=0; i<numTanks; i++) {
|
||||||
Tanks[i]->Calculate( dt * rate );
|
Tanks[i]->Calculate( dt * rate );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refuel) DoRefuel( dt * rate );
|
if (refuel) DoRefuel( dt * rate );
|
||||||
|
|
||||||
|
@ -231,20 +231,20 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
|
||||||
ThrottleAdded = true;
|
ThrottleAdded = true;
|
||||||
|
|
||||||
if (engType == "FG_ROCKET") {
|
if (engType == "FG_ROCKET") {
|
||||||
Engines.push_back(new FGRocket(FDMExec, Cfg_ptr));
|
Engines.push_back(new FGRocket(FDMExec, Cfg_ptr, numEngines));
|
||||||
} else if (engType == "FG_PISTON") {
|
} else if (engType == "FG_PISTON") {
|
||||||
Engines.push_back(new FGPiston(FDMExec, Cfg_ptr));
|
Engines.push_back(new FGPiston(FDMExec, Cfg_ptr, numEngines));
|
||||||
} else if (engType == "FG_TURBINE") {
|
} else if (engType == "FG_TURBINE") {
|
||||||
Engines.push_back(new FGTurbine(FDMExec, Cfg_ptr));
|
Engines.push_back(new FGTurbine(FDMExec, Cfg_ptr, numEngines));
|
||||||
} else if (engType == "FG_SIMTURBINE") {
|
} else if (engType == "FG_SIMTURBINE") {
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
cerr << "The FG_SIMTURBINE engine type has been renamed to FG_TURBINE." << endl;
|
cerr << "The FG_SIMTURBINE engine type has been renamed to FG_TURBINE." << endl;
|
||||||
cerr << "To fix this problem, simply replace the FG_SIMTURBINE name " << endl;
|
cerr << "To fix this problem, simply replace the FG_SIMTURBINE name " << endl;
|
||||||
cerr << "in your engine file to FG_TURBINE." << endl;
|
cerr << "in your engine file to FG_TURBINE." << endl;
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
Engines.push_back(new FGTurbine(FDMExec, Cfg_ptr));
|
Engines.push_back(new FGTurbine(FDMExec, Cfg_ptr, numEngines));
|
||||||
} else if (engType == "FG_ELECTRIC") {
|
} else if (engType == "FG_ELECTRIC") {
|
||||||
Engines.push_back(new FGElectric(FDMExec, Cfg_ptr));
|
Engines.push_back(new FGElectric(FDMExec, Cfg_ptr, numEngines));
|
||||||
} else {
|
} else {
|
||||||
cerr << fgred << " Unrecognized engine type: " << underon << engType
|
cerr << fgred << " Unrecognized engine type: " << underon << engType
|
||||||
<< underoff << " found in config file." << fgdef << endl;
|
<< underoff << " found in config file." << fgdef << endl;
|
||||||
|
@ -281,7 +281,6 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
Engines[numEngines]->SetPlacement(xLoc, yLoc, zLoc, Pitch, Yaw);
|
Engines[numEngines]->SetPlacement(xLoc, yLoc, zLoc, Pitch, Yaw);
|
||||||
Engines[numEngines]->SetEngineNumber(numEngines);
|
|
||||||
numEngines++;
|
numEngines++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -328,7 +327,7 @@ string FGPropulsion::GetPropulsionStrings(void)
|
||||||
if (firstime) firstime = false;
|
if (firstime) firstime = false;
|
||||||
else PropulsionStrings += ", ";
|
else PropulsionStrings += ", ";
|
||||||
|
|
||||||
PropulsionStrings += Engines[i]->GetEngineLabels() + ", ";
|
PropulsionStrings += Engines[i]->GetEngineLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PropulsionStrings;
|
return PropulsionStrings;
|
||||||
|
@ -345,7 +344,7 @@ string FGPropulsion::GetPropulsionValues(void)
|
||||||
if (firstime) firstime = false;
|
if (firstime) firstime = false;
|
||||||
else PropulsionValues += ", ";
|
else PropulsionValues += ", ";
|
||||||
|
|
||||||
PropulsionValues += Engines[i]->GetEngineValues() + ", ";
|
PropulsionValues += Engines[i]->GetEngineValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PropulsionValues;
|
return PropulsionValues;
|
||||||
|
@ -494,7 +493,7 @@ void FGPropulsion::DoRefuel(double time_slice)
|
||||||
if (Tanks[i]->GetPctFull() < 99.99)
|
if (Tanks[i]->GetPctFull() < 99.99)
|
||||||
Transfer(-1, i, fillrate/TanksNotFull);
|
Transfer(-1, i, fillrate/TanksNotFull);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -51,7 +51,8 @@ static const char *IdHdr = ID_ROCKET;
|
||||||
CLASS IMPLEMENTATION
|
CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
FGRocket::FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec)
|
FGRocket::FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number)
|
||||||
|
: FGEngine(exec, engine_number)
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
|
|
||||||
|
@ -73,7 +74,6 @@ FGRocket::FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec)
|
||||||
|
|
||||||
Debug(0);
|
Debug(0);
|
||||||
|
|
||||||
EngineNumber = 0;
|
|
||||||
Type = etRocket;
|
Type = etRocket;
|
||||||
Flameout = false;
|
Flameout = false;
|
||||||
|
|
||||||
|
@ -105,6 +105,10 @@ double FGRocket::Calculate(void)
|
||||||
} else {
|
} else {
|
||||||
PctPower = Throttle / MaxThrottle;
|
PctPower = Throttle / MaxThrottle;
|
||||||
PC = maxPC*PctPower * (1.0 + Variance * ((double)rand()/(double)RAND_MAX - 0.5));
|
PC = maxPC*PctPower * (1.0 + Variance * ((double)rand()/(double)RAND_MAX - 0.5));
|
||||||
|
// The Cf (below) is CF from Eqn. 3-30, "Rocket Propulsion Elements", Fifth Edition,
|
||||||
|
// George P. Sutton. Note that the thruster function GetPowerRequired() might
|
||||||
|
// be better called GetResistance() or something; this function returns the
|
||||||
|
// nozzle exit pressure.
|
||||||
Cf = sqrt(kFactor*(1 - pow(Thruster->GetPowerRequired()/(PC), (SHR-1)/SHR)));
|
Cf = sqrt(kFactor*(1 - pow(Thruster->GetPowerRequired()/(PC), (SHR-1)/SHR)));
|
||||||
Flameout = false;
|
Flameout = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,8 +103,9 @@ class FGRocket : public FGEngine
|
||||||
public:
|
public:
|
||||||
/** Constructor.
|
/** Constructor.
|
||||||
@param exec pointer to JSBSim parent object, the FDM Executive.
|
@param exec pointer to JSBSim parent object, the FDM Executive.
|
||||||
@param Eng_cfg pointer to the config file object. */
|
@param Eng_cfg pointer to the config file object.
|
||||||
FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
@param engine_number engine number */
|
||||||
|
FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number);
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
~FGRocket(void);
|
~FGRocket(void);
|
||||||
|
|
|
@ -54,7 +54,8 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGTurbine::FGTurbine(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
|
FGTurbine::FGTurbine(FGFDMExec* exec, FGConfigFile* cfg, int engine_number)
|
||||||
|
: FGEngine(exec, engine_number)
|
||||||
{
|
{
|
||||||
SetDefaults();
|
SetDefaults();
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ FGTurbine::FGTurbine(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
|
||||||
|
|
||||||
FGTurbine::~FGTurbine()
|
FGTurbine::~FGTurbine()
|
||||||
{
|
{
|
||||||
|
unbind();
|
||||||
Debug(1);
|
Debug(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,14 +185,16 @@ double FGTurbine::Run(void)
|
||||||
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((AugmentCmd > 0.0) && (AugMethod == 2)) {
|
if (AugMethod == 2) {
|
||||||
Augmentation = true;
|
if (AugmentCmd > 0.0) {
|
||||||
double tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
|
Augmentation = true;
|
||||||
thrust += (tdiff * AugmentCmd);
|
double tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
|
||||||
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
|
thrust += (tdiff * AugmentCmd);
|
||||||
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
|
||||||
} else {
|
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
||||||
Augmentation = false;
|
} else {
|
||||||
|
Augmentation = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Injected == 1) && Injection)
|
if ((Injected == 1) && Injection)
|
||||||
|
@ -402,6 +406,7 @@ bool FGTurbine::Load(FGConfigFile *Eng_cfg)
|
||||||
OilTemp_degK = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556 + 273.0;
|
OilTemp_degK = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556 + 273.0;
|
||||||
IdleFF = pow(MilThrust, 0.2) * 107.0; // just an estimate
|
IdleFF = pow(MilThrust, 0.2) * 107.0; // just an estimate
|
||||||
|
|
||||||
|
bindmodel();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,6 +436,30 @@ string FGTurbine::GetEngineValues(void)
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void FGTurbine::bindmodel()
|
||||||
|
{
|
||||||
|
char property_name[80];
|
||||||
|
|
||||||
|
snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
|
||||||
|
PropertyManager->Tie( property_name, &N1);
|
||||||
|
snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
|
||||||
|
PropertyManager->Tie( property_name, &N2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void FGTurbine::unbind()
|
||||||
|
{
|
||||||
|
char property_name[80];
|
||||||
|
|
||||||
|
snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
|
||||||
|
PropertyManager->Untie(property_name);
|
||||||
|
snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
|
||||||
|
PropertyManager->Untie(property_name);
|
||||||
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
// The bitmasked value choices are as follows:
|
// The bitmasked value choices are as follows:
|
||||||
// unset: In this case (the default) JSBSim would only print
|
// unset: In this case (the default) JSBSim would only print
|
||||||
|
|
|
@ -139,8 +139,9 @@ class FGTurbine : public FGEngine
|
||||||
public:
|
public:
|
||||||
/** Constructor
|
/** Constructor
|
||||||
@param Executive pointer to executive structure
|
@param Executive pointer to executive structure
|
||||||
@param Eng_cfg pointer to engine config file instance */
|
@param Eng_cfg pointer to engine config file instance
|
||||||
FGTurbine(FGFDMExec* Executive, FGConfigFile* Eng_cfg);
|
@param engine_number engine number*/
|
||||||
|
FGTurbine(FGFDMExec* Executive, FGConfigFile* Eng_cfg, int engine_number);
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~FGTurbine();
|
~FGTurbine();
|
||||||
|
|
||||||
|
@ -241,6 +242,8 @@ private:
|
||||||
|
|
||||||
void SetDefaults(void);
|
void SetDefaults(void);
|
||||||
bool Load(FGConfigFile *ENG_cfg);
|
bool Load(FGConfigFile *ENG_cfg);
|
||||||
|
void bindmodel(void);
|
||||||
|
void unbind(void);
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -133,7 +133,7 @@ FGJSBsim::FGJSBsim( double dt )
|
||||||
|
|
||||||
result = fdmex->LoadModel( aircraft_path.str(),
|
result = fdmex->LoadModel( aircraft_path.str(),
|
||||||
engine_path.str(),
|
engine_path.str(),
|
||||||
fgGetString("/sim/aero") );
|
fgGetString("/sim/aero"), false );
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
SG_LOG( SG_FLIGHT, SG_INFO, " loaded aero.");
|
SG_LOG( SG_FLIGHT, SG_INFO, " loaded aero.");
|
||||||
|
|
|
@ -165,7 +165,6 @@ bool FGFilter::Run(void)
|
||||||
} else if (Trigger != 0) {
|
} else if (Trigger != 0) {
|
||||||
test = Trigger->getIntValue();
|
test = Trigger->getIntValue();
|
||||||
if (test < 0) {
|
if (test < 0) {
|
||||||
Output = PreviousOutput1 = PreviousOutput2 = 0.0;
|
|
||||||
Input = PreviousInput1 = PreviousInput2 = 0.0;
|
Input = PreviousInput1 = PreviousInput2 = 0.0;
|
||||||
} else {
|
} else {
|
||||||
Output = PreviousOutput1 = PreviousOutput2 = 0.0;
|
Output = PreviousOutput1 = PreviousOutput2 = 0.0;
|
||||||
|
|
Loading…
Reference in a new issue