Updates to help work the kinks out of JSBsim.
This commit is contained in:
parent
817279c7a8
commit
871e4e8319
5 changed files with 50 additions and 19 deletions
|
@ -177,7 +177,14 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
|
||||||
#else
|
#else
|
||||||
if (holding_string.compare("//",0,2) != 0) {
|
if (holding_string.compare("//",0,2) != 0) {
|
||||||
#endif
|
#endif
|
||||||
if (holding_string == "AIRCRAFT") {
|
if (holding_string == "CFG_VERSION") {
|
||||||
|
aircraftfile >> CFGVersion;
|
||||||
|
cout << "Config file version: " << CFGVersion << endl;
|
||||||
|
if (CFGVersion < NEEDED_CFG_VERSION) {
|
||||||
|
cout << endl << "YOU HAVE AN OLD CFG FILE FOR THIS AIRCRAFT."
|
||||||
|
" RESULTS WILL BE UNPREDICTABLE !!" << endl << endl;
|
||||||
|
}
|
||||||
|
} else if (holding_string == "AIRCRAFT") {
|
||||||
cout << "Reading in Aircraft parameters ..." << endl;
|
cout << "Reading in Aircraft parameters ..." << endl;
|
||||||
} else if (holding_string == "AERODYNAMICS") {
|
} else if (holding_string == "AERODYNAMICS") {
|
||||||
cout << "Reading in Aerodynamic parameters ..." << endl;
|
cout << "Reading in Aerodynamic parameters ..." << endl;
|
||||||
|
@ -451,13 +458,19 @@ void FGAircraft::FMAero(void)
|
||||||
- F[SideCoeff]*sin(alpha)*sin(beta)
|
- F[SideCoeff]*sin(alpha)*sin(beta)
|
||||||
- F[LiftCoeff]*cos(alpha);
|
- F[LiftCoeff]*cos(alpha);
|
||||||
|
|
||||||
dxcg = (Xcg - Xrp)/12; //cg and rp values are in inches
|
// The d*cg distances below, given in inches, are the distances FROM the c.g.
|
||||||
dycg = (Ycg - Yrp)/12;
|
// TO the reference point. Since the c.g. and ref point are given in inches in
|
||||||
dzcg = (Zcg - Zrp)/12;
|
// the structural system (X positive rearwards) and the body coordinate system
|
||||||
|
// is given with X positive out the nose, the dxcg and dzcg values are
|
||||||
|
// *rotated* 180 degrees about the Y axis.
|
||||||
|
|
||||||
Moments[0] += -Fzaero*dycg - Fyaero*dzcg; //rolling moment
|
dxcg = -(Xrp - Xcg)/12; //cg and rp values are in inches
|
||||||
|
dycg = (Yrp - Ycg)/12;
|
||||||
|
dzcg = -(Zrp - Zcg)/12;
|
||||||
|
|
||||||
|
Moments[0] += Fzaero*dycg - Fyaero*dzcg; //rolling moment
|
||||||
Moments[1] += Fxaero*dzcg - Fzaero*dxcg; //pitching moment
|
Moments[1] += Fxaero*dzcg - Fzaero*dxcg; //pitching moment
|
||||||
Moments[2] += Fxaero*dycg + Fyaero*dxcg; //yawing moment
|
Moments[2] += -Fxaero*dycg + Fyaero*dxcg; //yawing moment
|
||||||
|
|
||||||
for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
|
for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
|
||||||
for (ctr = 0; ctr < coeff_ctr[axis_ctr+3]; ctr++) {
|
for (ctr = 0; ctr < coeff_ctr[axis_ctr+3]; ctr++) {
|
||||||
|
|
|
@ -179,7 +179,8 @@ private:
|
||||||
float phi, tht, psi;
|
float phi, tht, psi;
|
||||||
float Weight, EmptyWeight;
|
float Weight, EmptyWeight;
|
||||||
float dt;
|
float dt;
|
||||||
|
float CFGVersion;
|
||||||
|
|
||||||
int numTanks;
|
int numTanks;
|
||||||
int numEngines;
|
int numEngines;
|
||||||
int numSelectedOxiTanks;
|
int numSelectedOxiTanks;
|
||||||
|
|
|
@ -52,6 +52,7 @@ SENTRY
|
||||||
#define DEGTORAD 1.745329E-2
|
#define DEGTORAD 1.745329E-2
|
||||||
#define KTSTOFPS 1.68781
|
#define KTSTOFPS 1.68781
|
||||||
#define FPSTOKTS 0.592484
|
#define FPSTOKTS 0.592484
|
||||||
|
#define NEEDED_CFG_VERSION 1.10
|
||||||
|
|
||||||
#define HPTOFTLBSSEC 550
|
#define HPTOFTLBSSEC 550
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ FGOutput::~FGOutput(void)
|
||||||
bool FGOutput::Run(void)
|
bool FGOutput::Run(void)
|
||||||
{
|
{
|
||||||
if (!FGModel::Run()) {
|
if (!FGModel::Run()) {
|
||||||
SocketOutput();
|
// SocketOutput();
|
||||||
// DelimitedOutput("JSBSimData.csv");
|
DelimitedOutput("JSBSimData.csv");
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -116,7 +116,11 @@ void FGOutput::DelimitedOutput(void)
|
||||||
cout << "Alpha,";
|
cout << "Alpha,";
|
||||||
cout << "L,";
|
cout << "L,";
|
||||||
cout << "M,";
|
cout << "M,";
|
||||||
cout << "N";
|
cout << "N,";
|
||||||
|
cout << "Throttle,";
|
||||||
|
cout << "Aileron,";
|
||||||
|
cout << "Elevator,";
|
||||||
|
cout << "Rudder";
|
||||||
cout << endl;
|
cout << endl;
|
||||||
dFirstPass = false;
|
dFirstPass = false;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +156,11 @@ void FGOutput::DelimitedOutput(void)
|
||||||
cout << Translation->Getalpha() << ",";
|
cout << Translation->Getalpha() << ",";
|
||||||
cout << Aircraft->GetL() << ",";
|
cout << Aircraft->GetL() << ",";
|
||||||
cout << Aircraft->GetM() << ",";
|
cout << Aircraft->GetM() << ",";
|
||||||
cout << Aircraft->GetN() << "";
|
cout << Aircraft->GetN() << ",";
|
||||||
|
cout << FCS->GetThrottle(0) << ",";
|
||||||
|
cout << FCS->GetDa() << ",";
|
||||||
|
cout << FCS->GetDe() << ",";
|
||||||
|
cout << FCS->GetDr() << "";
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -193,7 +201,11 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
datafile << "Alpha,";
|
datafile << "Alpha,";
|
||||||
datafile << "L,";
|
datafile << "L,";
|
||||||
datafile << "M,";
|
datafile << "M,";
|
||||||
datafile << "N";
|
datafile << "N,";
|
||||||
|
datafile << "Throttle,";
|
||||||
|
datafile << "Aileron,";
|
||||||
|
datafile << "Elevator,";
|
||||||
|
datafile << "Rudder";
|
||||||
datafile << endl;
|
datafile << endl;
|
||||||
sFirstPass = false;
|
sFirstPass = false;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +241,11 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
datafile << Translation->Getalpha() << ",";
|
datafile << Translation->Getalpha() << ",";
|
||||||
datafile << Aircraft->GetL() << ",";
|
datafile << Aircraft->GetL() << ",";
|
||||||
datafile << Aircraft->GetM() << ",";
|
datafile << Aircraft->GetM() << ",";
|
||||||
datafile << Aircraft->GetN() << "";
|
datafile << Aircraft->GetN() << ",";
|
||||||
|
datafile << FCS->GetThrottle(0) << ",";
|
||||||
|
datafile << FCS->GetDa() << ",";
|
||||||
|
datafile << FCS->GetDe() << ",";
|
||||||
|
datafile << FCS->GetDr() << "";
|
||||||
datafile << endl;
|
datafile << endl;
|
||||||
datafile.flush();
|
datafile.flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -625,21 +625,21 @@ int fgOPTIONS::parse_option( const string& arg ) {
|
||||||
}
|
}
|
||||||
} else if ( arg.find( "--uBody=" ) != string::npos ) {
|
} else if ( arg.find( "--uBody=" ) != string::npos ) {
|
||||||
if ( units == FG_UNITS_FEET ) {
|
if ( units == FG_UNITS_FEET ) {
|
||||||
uBody = atof( arg.substr(8) ) * FEET_TO_METER;
|
|
||||||
} else {
|
|
||||||
uBody = atof( arg.substr(8) );
|
uBody = atof( arg.substr(8) );
|
||||||
|
} else {
|
||||||
|
uBody = atof( arg.substr(8) ) * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
} else if ( arg.find( "--vBody=" ) != string::npos ) {
|
} else if ( arg.find( "--vBody=" ) != string::npos ) {
|
||||||
if ( units == FG_UNITS_FEET ) {
|
if ( units == FG_UNITS_FEET ) {
|
||||||
vBody = atof( arg.substr(8) ) * FEET_TO_METER;
|
|
||||||
} else {
|
|
||||||
vBody = atof( arg.substr(8) );
|
vBody = atof( arg.substr(8) );
|
||||||
|
} else {
|
||||||
|
vBody = atof( arg.substr(8) ) * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
} else if ( arg.find( "--wBody=" ) != string::npos ) {
|
} else if ( arg.find( "--wBody=" ) != string::npos ) {
|
||||||
if ( units == FG_UNITS_FEET ) {
|
if ( units == FG_UNITS_FEET ) {
|
||||||
wBody = atof( arg.substr(8) ) * FEET_TO_METER;
|
|
||||||
} else {
|
|
||||||
wBody = atof( arg.substr(8) );
|
wBody = atof( arg.substr(8) );
|
||||||
|
} else {
|
||||||
|
wBody = atof( arg.substr(8) ) * FEET_TO_METER;
|
||||||
}
|
}
|
||||||
} else if ( arg.find( "--heading=" ) != string::npos ) {
|
} else if ( arg.find( "--heading=" ) != string::npos ) {
|
||||||
heading = atof( arg.substr(10) );
|
heading = atof( arg.substr(10) );
|
||||||
|
|
Loading…
Add table
Reference in a new issue