1
0
Fork 0

Latest updates from the JSBSim project.

This commit is contained in:
curt 2001-10-30 02:51:13 +00:00
parent 7172d31e71
commit b82a5ad062
7 changed files with 51 additions and 6 deletions

View file

@ -95,6 +95,8 @@ enum eParam {
FG_THROTTLE_POS,
FG_MIXTURE_CMD,
FG_MIXTURE_POS,
FG_MAGNETO_CMD,
FG_STARTER_CMD,
FG_ACTIVE_ENGINE,
FG_HOVERB,
FG_PITCH_TRIM_CMD,

View file

@ -77,12 +77,12 @@ FGEngine::FGEngine(FGFDMExec* exec) {
Auxiliary = FDMExec->GetAuxiliary();
Output = FDMExec->GetOutput();
Mixture = 1.0; // FIXME: get actual value
Mixture = 1.0; // FIXME: get actual value
Thrust = PctPower = 0.0;
Starved = Flameout = false;
Running = false;
Cranking = false;
Cranking = Starter = false;
if (debug_lvl & 2) cout << "Instantiated: FGEngine" << endl;
TrimMode = false;

View file

@ -117,6 +117,8 @@ public:
virtual float GetThrottleMax(void) { return MaxThrottle; }
float GetThrottle(void) { return Throttle; }
float GetMixture(void) { return Mixture; }
int GetMagnetos(void) { return Magnetos; }
bool GetStarter(void) { return Starter; }
float GetThrust(void) { return Thrust; }
bool GetStarved(void) { return Starved; }
bool GetFlameout(void) { return Flameout; }

View file

@ -520,10 +520,10 @@ bool FGFDMExec::LoadScript(string script)
<< iterConditions->Comparison[i] << " "
<< iterConditions->TestValue[i] << ")";
}
cout << ") then {" << endl;
cout << ") then {";
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];
switch (iterConditions->Type[i]) {

View file

@ -151,6 +151,7 @@ void FGOutput::DelimitedOutput(string fname)
if (SubSystems & FGAircraft::ssAerosurfaces) {
outstream << ", ";
outstream << "Throttle, ";
outstream << "Mixture, ";
outstream << "Aileron Cmd, ";
outstream << "Elevator Cmd, ";
outstream << "Rudder Cmd, ";
@ -226,6 +227,7 @@ void FGOutput::DelimitedOutput(string fname)
if (SubSystems & FGAircraft::ssAerosurfaces) {
outstream << ", ";
outstream << FCS->GetThrottlePos(0) << ", ";
outstream << FCS->GetMixturePos(0) << ", ";
outstream << FCS->GetDaCmd() << ", ";
outstream << FCS->GetDeCmd() << ", ";
outstream << FCS->GetDrCmd() << ", ";

View file

@ -97,6 +97,7 @@ FGState::FGState(FGFDMExec* fdex) : mTb2l(3,3),
Atmosphere = FDMExec->GetAtmosphere();
Aerodynamics = FDMExec->GetAerodynamics();
GroundReactions = FDMExec->GetGroundReactions();
Propulsion = FDMExec->GetPropulsion();
RegisterVariable(FG_TIME, " time " );
RegisterVariable(FG_QBAR, " qbar " );
@ -132,6 +133,10 @@ FGState::FGState(FGFDMExec* fdex) : mTb2l(3,3),
RegisterVariable(FG_FLAPS_CMD, " flaps_cmd " );
RegisterVariable(FG_THROTTLE_CMD, " throttle_cmd " );
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_HOVERB, " height/span " );
RegisterVariable(FG_PITCH_TRIM_CMD, " pitch_trim_cmd " );
@ -258,12 +263,29 @@ float FGState::GetParameter(eParam val_idx) {
case FG_THROTTLE_POS:
if (ActiveEngine < 0) return FCS->GetThrottlePos(0);
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:
return Position->GetHOverB();
case FG_PITCH_TRIM_CMD:
return FCS->GetPitchTrimCmd();
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;
@ -306,6 +328,9 @@ void FGState::SetParameter(eParam val_idx, float val) {
case FG_THROTTLE_POS:
FCS->SetThrottlePos(ActiveEngine,val);
break;
case FG_MIXTURE_POS:
FCS->SetMixturePos(ActiveEngine,val);
break;
case FG_ELEVATOR_CMD:
FCS->SetDeCmd(val);
@ -328,7 +353,18 @@ void FGState::SetParameter(eParam val_idx, float val) {
case FG_THROTTLE_CMD:
FCS->SetThrottleCmd(ActiveEngine,val);
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:
ActiveEngine = (int)val;
break;

View file

@ -83,6 +83,7 @@ class FGOutput;
class FGPosition;
class FGFDMExec;
class FGGroundReactions;
class FGPropulsion;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
@ -331,6 +332,7 @@ private:
FGFCS* FCS;
FGAerodynamics* Aerodynamics;
FGGroundReactions* GroundReactions;
FGPropulsion* Propulsion;
typedef map<string, eParam> CoeffMap;
CoeffMap coeffdef;
@ -350,6 +352,7 @@ private:
#include "FGOutput.h"
#include "FGAircraft.h"
#include "FGGroundReactions.h"
#include "FGPropulsion.h"
#endif