Latest updates from the JSBSim project.
This commit is contained in:
parent
7172d31e71
commit
b82a5ad062
7 changed files with 51 additions and 6 deletions
|
@ -95,6 +95,8 @@ enum eParam {
|
||||||
FG_THROTTLE_POS,
|
FG_THROTTLE_POS,
|
||||||
FG_MIXTURE_CMD,
|
FG_MIXTURE_CMD,
|
||||||
FG_MIXTURE_POS,
|
FG_MIXTURE_POS,
|
||||||
|
FG_MAGNETO_CMD,
|
||||||
|
FG_STARTER_CMD,
|
||||||
FG_ACTIVE_ENGINE,
|
FG_ACTIVE_ENGINE,
|
||||||
FG_HOVERB,
|
FG_HOVERB,
|
||||||
FG_PITCH_TRIM_CMD,
|
FG_PITCH_TRIM_CMD,
|
||||||
|
|
|
@ -77,12 +77,12 @@ FGEngine::FGEngine(FGFDMExec* exec) {
|
||||||
Auxiliary = FDMExec->GetAuxiliary();
|
Auxiliary = FDMExec->GetAuxiliary();
|
||||||
Output = FDMExec->GetOutput();
|
Output = FDMExec->GetOutput();
|
||||||
|
|
||||||
Mixture = 1.0; // FIXME: get actual value
|
Mixture = 1.0; // FIXME: get actual value
|
||||||
|
|
||||||
Thrust = PctPower = 0.0;
|
Thrust = PctPower = 0.0;
|
||||||
Starved = Flameout = false;
|
Starved = Flameout = false;
|
||||||
Running = false;
|
Running = false;
|
||||||
Cranking = false;
|
Cranking = Starter = false;
|
||||||
|
|
||||||
if (debug_lvl & 2) cout << "Instantiated: FGEngine" << endl;
|
if (debug_lvl & 2) cout << "Instantiated: FGEngine" << endl;
|
||||||
TrimMode = false;
|
TrimMode = false;
|
||||||
|
|
|
@ -117,6 +117,8 @@ public:
|
||||||
virtual float GetThrottleMax(void) { return MaxThrottle; }
|
virtual float GetThrottleMax(void) { return MaxThrottle; }
|
||||||
float GetThrottle(void) { return Throttle; }
|
float GetThrottle(void) { return Throttle; }
|
||||||
float GetMixture(void) { return Mixture; }
|
float GetMixture(void) { return Mixture; }
|
||||||
|
int GetMagnetos(void) { return Magnetos; }
|
||||||
|
bool GetStarter(void) { return Starter; }
|
||||||
float GetThrust(void) { return Thrust; }
|
float GetThrust(void) { return Thrust; }
|
||||||
bool GetStarved(void) { return Starved; }
|
bool GetStarved(void) { return Starved; }
|
||||||
bool GetFlameout(void) { return Flameout; }
|
bool GetFlameout(void) { return Flameout; }
|
||||||
|
|
|
@ -520,10 +520,10 @@ bool FGFDMExec::LoadScript(string script)
|
||||||
<< iterConditions->Comparison[i] << " "
|
<< iterConditions->Comparison[i] << " "
|
||||||
<< iterConditions->TestValue[i] << ")";
|
<< iterConditions->TestValue[i] << ")";
|
||||||
}
|
}
|
||||||
cout << ") then {" << endl;
|
cout << ") then {";
|
||||||
|
|
||||||
for (i=0; i<iterConditions->SetValue.size(); i++) {
|
for (i=0; i<iterConditions->SetValue.size(); i++) {
|
||||||
cout << " set" << State->paramdef[iterConditions->SetParam[i]]
|
cout << endl << " set" << State->paramdef[iterConditions->SetParam[i]]
|
||||||
<< "to " << iterConditions->SetValue[i];
|
<< "to " << iterConditions->SetValue[i];
|
||||||
|
|
||||||
switch (iterConditions->Type[i]) {
|
switch (iterConditions->Type[i]) {
|
||||||
|
|
|
@ -151,6 +151,7 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
||||||
outstream << ", ";
|
outstream << ", ";
|
||||||
outstream << "Throttle, ";
|
outstream << "Throttle, ";
|
||||||
|
outstream << "Mixture, ";
|
||||||
outstream << "Aileron Cmd, ";
|
outstream << "Aileron Cmd, ";
|
||||||
outstream << "Elevator Cmd, ";
|
outstream << "Elevator Cmd, ";
|
||||||
outstream << "Rudder Cmd, ";
|
outstream << "Rudder Cmd, ";
|
||||||
|
@ -226,6 +227,7 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
||||||
outstream << ", ";
|
outstream << ", ";
|
||||||
outstream << FCS->GetThrottlePos(0) << ", ";
|
outstream << FCS->GetThrottlePos(0) << ", ";
|
||||||
|
outstream << FCS->GetMixturePos(0) << ", ";
|
||||||
outstream << FCS->GetDaCmd() << ", ";
|
outstream << FCS->GetDaCmd() << ", ";
|
||||||
outstream << FCS->GetDeCmd() << ", ";
|
outstream << FCS->GetDeCmd() << ", ";
|
||||||
outstream << FCS->GetDrCmd() << ", ";
|
outstream << FCS->GetDrCmd() << ", ";
|
||||||
|
|
|
@ -97,6 +97,7 @@ FGState::FGState(FGFDMExec* fdex) : mTb2l(3,3),
|
||||||
Atmosphere = FDMExec->GetAtmosphere();
|
Atmosphere = FDMExec->GetAtmosphere();
|
||||||
Aerodynamics = FDMExec->GetAerodynamics();
|
Aerodynamics = FDMExec->GetAerodynamics();
|
||||||
GroundReactions = FDMExec->GetGroundReactions();
|
GroundReactions = FDMExec->GetGroundReactions();
|
||||||
|
Propulsion = FDMExec->GetPropulsion();
|
||||||
|
|
||||||
RegisterVariable(FG_TIME, " time " );
|
RegisterVariable(FG_TIME, " time " );
|
||||||
RegisterVariable(FG_QBAR, " qbar " );
|
RegisterVariable(FG_QBAR, " qbar " );
|
||||||
|
@ -132,6 +133,10 @@ FGState::FGState(FGFDMExec* fdex) : mTb2l(3,3),
|
||||||
RegisterVariable(FG_FLAPS_CMD, " flaps_cmd " );
|
RegisterVariable(FG_FLAPS_CMD, " flaps_cmd " );
|
||||||
RegisterVariable(FG_THROTTLE_CMD, " throttle_cmd " );
|
RegisterVariable(FG_THROTTLE_CMD, " throttle_cmd " );
|
||||||
RegisterVariable(FG_THROTTLE_POS, " throttle_pos " );
|
RegisterVariable(FG_THROTTLE_POS, " throttle_pos " );
|
||||||
|
RegisterVariable(FG_MIXTURE_CMD, " mixture_cmd " );
|
||||||
|
RegisterVariable(FG_MIXTURE_POS, " mixture_pos " );
|
||||||
|
RegisterVariable(FG_MAGNETO_CMD, " magneto_cmd " );
|
||||||
|
RegisterVariable(FG_STARTER_CMD, " starter_cmd " );
|
||||||
RegisterVariable(FG_ACTIVE_ENGINE, " active_engine " );
|
RegisterVariable(FG_ACTIVE_ENGINE, " active_engine " );
|
||||||
RegisterVariable(FG_HOVERB, " height/span " );
|
RegisterVariable(FG_HOVERB, " height/span " );
|
||||||
RegisterVariable(FG_PITCH_TRIM_CMD, " pitch_trim_cmd " );
|
RegisterVariable(FG_PITCH_TRIM_CMD, " pitch_trim_cmd " );
|
||||||
|
@ -258,12 +263,29 @@ float FGState::GetParameter(eParam val_idx) {
|
||||||
case FG_THROTTLE_POS:
|
case FG_THROTTLE_POS:
|
||||||
if (ActiveEngine < 0) return FCS->GetThrottlePos(0);
|
if (ActiveEngine < 0) return FCS->GetThrottlePos(0);
|
||||||
else return FCS->GetThrottlePos(ActiveEngine);
|
else return FCS->GetThrottlePos(ActiveEngine);
|
||||||
|
case FG_MAGNETO_CMD:
|
||||||
|
if (ActiveEngine < 0) return Propulsion->GetEngine(0)->GetMagnetos();
|
||||||
|
else return Propulsion->GetEngine(ActiveEngine)->GetMagnetos();
|
||||||
|
case FG_STARTER_CMD:
|
||||||
|
if (ActiveEngine < 0) {
|
||||||
|
if (Propulsion->GetEngine(0)->GetStarter()) return 1.0;
|
||||||
|
else return 0.0;
|
||||||
|
} else {
|
||||||
|
if (Propulsion->GetEngine(ActiveEngine)->GetStarter()) return 1.0;
|
||||||
|
else return 0.0;
|
||||||
|
}
|
||||||
|
case FG_MIXTURE_CMD:
|
||||||
|
if (ActiveEngine < 0) return FCS->GetMixtureCmd(0);
|
||||||
|
else return FCS->GetMixtureCmd(ActiveEngine);
|
||||||
|
case FG_MIXTURE_POS:
|
||||||
|
if (ActiveEngine < 0) return FCS->GetMixturePos(0);
|
||||||
|
else return FCS->GetMixturePos(ActiveEngine);
|
||||||
case FG_HOVERB:
|
case FG_HOVERB:
|
||||||
return Position->GetHOverB();
|
return Position->GetHOverB();
|
||||||
case FG_PITCH_TRIM_CMD:
|
case FG_PITCH_TRIM_CMD:
|
||||||
return FCS->GetPitchTrimCmd();
|
return FCS->GetPitchTrimCmd();
|
||||||
default:
|
default:
|
||||||
cerr << "FGState::GetParameter() - No handler for parameter " << val_idx << endl;
|
cerr << "FGState::GetParameter() - No handler for parameter " << paramdef[val_idx] << endl;
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -306,6 +328,9 @@ void FGState::SetParameter(eParam val_idx, float val) {
|
||||||
case FG_THROTTLE_POS:
|
case FG_THROTTLE_POS:
|
||||||
FCS->SetThrottlePos(ActiveEngine,val);
|
FCS->SetThrottlePos(ActiveEngine,val);
|
||||||
break;
|
break;
|
||||||
|
case FG_MIXTURE_POS:
|
||||||
|
FCS->SetMixturePos(ActiveEngine,val);
|
||||||
|
break;
|
||||||
|
|
||||||
case FG_ELEVATOR_CMD:
|
case FG_ELEVATOR_CMD:
|
||||||
FCS->SetDeCmd(val);
|
FCS->SetDeCmd(val);
|
||||||
|
@ -328,7 +353,18 @@ void FGState::SetParameter(eParam val_idx, float val) {
|
||||||
case FG_THROTTLE_CMD:
|
case FG_THROTTLE_CMD:
|
||||||
FCS->SetThrottleCmd(ActiveEngine,val);
|
FCS->SetThrottleCmd(ActiveEngine,val);
|
||||||
break;
|
break;
|
||||||
|
case FG_MIXTURE_CMD:
|
||||||
|
FCS->SetMixtureCmd(ActiveEngine,val);
|
||||||
|
break;
|
||||||
|
case FG_MAGNETO_CMD:
|
||||||
|
Propulsion->GetEngine(ActiveEngine)->SetMagnetos(val); // need to account for -1
|
||||||
|
break;
|
||||||
|
case FG_STARTER_CMD:
|
||||||
|
if (val < 0.001)
|
||||||
|
Propulsion->GetEngine(ActiveEngine)->SetStarter(false); // need to account for -1
|
||||||
|
else if (val >= 0.001)
|
||||||
|
Propulsion->GetEngine(ActiveEngine)->SetStarter(true); // need to account for -1
|
||||||
|
break;
|
||||||
case FG_ACTIVE_ENGINE:
|
case FG_ACTIVE_ENGINE:
|
||||||
ActiveEngine = (int)val;
|
ActiveEngine = (int)val;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -83,6 +83,7 @@ class FGOutput;
|
||||||
class FGPosition;
|
class FGPosition;
|
||||||
class FGFDMExec;
|
class FGFDMExec;
|
||||||
class FGGroundReactions;
|
class FGGroundReactions;
|
||||||
|
class FGPropulsion;
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||||
|
@ -331,6 +332,7 @@ private:
|
||||||
FGFCS* FCS;
|
FGFCS* FCS;
|
||||||
FGAerodynamics* Aerodynamics;
|
FGAerodynamics* Aerodynamics;
|
||||||
FGGroundReactions* GroundReactions;
|
FGGroundReactions* GroundReactions;
|
||||||
|
FGPropulsion* Propulsion;
|
||||||
|
|
||||||
typedef map<string, eParam> CoeffMap;
|
typedef map<string, eParam> CoeffMap;
|
||||||
CoeffMap coeffdef;
|
CoeffMap coeffdef;
|
||||||
|
@ -350,6 +352,7 @@ private:
|
||||||
#include "FGOutput.h"
|
#include "FGOutput.h"
|
||||||
#include "FGAircraft.h"
|
#include "FGAircraft.h"
|
||||||
#include "FGGroundReactions.h"
|
#include "FGGroundReactions.h"
|
||||||
|
#include "FGPropulsion.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue