#else
if (holding_string.compare("//",0,2) != 0) {
#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;
} else if (holding_string == "AERODYNAMICS") {
cout << "Reading in Aerodynamic parameters ..." << endl;
- F[SideCoeff]*sin(alpha)*sin(beta)
- F[LiftCoeff]*cos(alpha);
- dxcg = (Xcg - Xrp)/12; //cg and rp values are in inches
- dycg = (Ycg - Yrp)/12;
- dzcg = (Zcg - Zrp)/12;
+ // The d*cg distances below, given in inches, are the distances FROM the c.g.
+ // TO the reference point. Since the c.g. and ref point are given in inches in
+ // 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.
+
+ 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[0] += Fzaero*dycg - Fyaero*dzcg; //rolling 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 (ctr = 0; ctr < coeff_ctr[axis_ctr+3]; ctr++) {
float phi, tht, psi;
float Weight, EmptyWeight;
float dt;
-
+ float CFGVersion;
+
int numTanks;
int numEngines;
int numSelectedOxiTanks;
#define DEGTORAD 1.745329E-2
#define KTSTOFPS 1.68781
#define FPSTOKTS 0.592484
+#define NEEDED_CFG_VERSION 1.10
#define HPTOFTLBSSEC 550
bool FGOutput::Run(void)
{
if (!FGModel::Run()) {
- SocketOutput();
-// DelimitedOutput("JSBSimData.csv");
+// SocketOutput();
+ DelimitedOutput("JSBSimData.csv");
} else {
}
return false;
cout << "Alpha,";
cout << "L,";
cout << "M,";
- cout << "N";
+ cout << "N,";
+ cout << "Throttle,";
+ cout << "Aileron,";
+ cout << "Elevator,";
+ cout << "Rudder";
cout << endl;
dFirstPass = false;
}
cout << Translation->Getalpha() << ",";
cout << Aircraft->GetL() << ",";
cout << Aircraft->GetM() << ",";
- cout << Aircraft->GetN() << "";
+ cout << Aircraft->GetN() << ",";
+ cout << FCS->GetThrottle(0) << ",";
+ cout << FCS->GetDa() << ",";
+ cout << FCS->GetDe() << ",";
+ cout << FCS->GetDr() << "";
cout << endl;
}
datafile << "Alpha,";
datafile << "L,";
datafile << "M,";
- datafile << "N";
+ datafile << "N,";
+ datafile << "Throttle,";
+ datafile << "Aileron,";
+ datafile << "Elevator,";
+ datafile << "Rudder";
datafile << endl;
sFirstPass = false;
}
datafile << Translation->Getalpha() << ",";
datafile << Aircraft->GetL() << ",";
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.flush();
}
}
} else if ( arg.find( "--uBody=" ) != string::npos ) {
if ( units == FG_UNITS_FEET ) {
- uBody = atof( arg.substr(8) ) * FEET_TO_METER;
- } else {
uBody = atof( arg.substr(8) );
+ } else {
+ uBody = atof( arg.substr(8) ) * FEET_TO_METER;
}
} else if ( arg.find( "--vBody=" ) != string::npos ) {
if ( units == FG_UNITS_FEET ) {
- vBody = atof( arg.substr(8) ) * FEET_TO_METER;
- } else {
vBody = atof( arg.substr(8) );
+ } else {
+ vBody = atof( arg.substr(8) ) * FEET_TO_METER;
}
} else if ( arg.find( "--wBody=" ) != string::npos ) {
if ( units == FG_UNITS_FEET ) {
- wBody = atof( arg.substr(8) ) * FEET_TO_METER;
- } else {
wBody = atof( arg.substr(8) );
+ } else {
+ wBody = atof( arg.substr(8) ) * FEET_TO_METER;
}
} else if ( arg.find( "--heading=" ) != string::npos ) {
heading = atof( arg.substr(10) );