]> git.mxchange.org Git - flightgear.git/commitdiff
Updates to help work the kinks out of JSBsim.
authorcurt <curt>
Thu, 30 Dec 1999 17:42:24 +0000 (17:42 +0000)
committercurt <curt>
Thu, 30 Dec 1999 17:42:24 +0000 (17:42 +0000)
src/FDM/JSBSim/FGAircraft.cpp
src/FDM/JSBSim/FGAircraft.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGOutput.cpp
src/Main/options.cxx

index 43e9a4b265a84b20cfeb3d99085b714b96db2b29..f49e9dd98877db0717f63a95c87c68dea513f93e 100644 (file)
@@ -177,7 +177,14 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
 #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;
@@ -451,13 +458,19 @@ void FGAircraft::FMAero(void)
                - 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++) {
index 93180d633c8a0fc206d8ebf8238ffa50bb621614..c95762389c8ab4cebca330221c6663ad69eb10e7 100644 (file)
@@ -179,7 +179,8 @@ private:
   float phi, tht, psi;
   float Weight, EmptyWeight;
   float dt;
-
+  float CFGVersion;
+  
   int numTanks;
   int numEngines;
   int numSelectedOxiTanks;
index 28072e4f3a8cf833c26ed2dec81f798c67fade05..0447675f4e813bc05f0f5759b1984505d39c3f97 100644 (file)
@@ -52,6 +52,7 @@ SENTRY
 #define DEGTORAD        1.745329E-2
 #define KTSTOFPS        1.68781
 #define FPSTOKTS        0.592484
+#define NEEDED_CFG_VERSION 1.10
 
 #define HPTOFTLBSSEC 550
 
index 25481c1f7aa21f59392576113067dc729f05b0f1..014a8de05935aee22a9f749b67a5b6199a5d8642 100644 (file)
@@ -74,8 +74,8 @@ FGOutput::~FGOutput(void)
 bool FGOutput::Run(void)
 {
   if (!FGModel::Run()) {
-    SocketOutput();
-//    DelimitedOutput("JSBSimData.csv");
+//    SocketOutput();
+    DelimitedOutput("JSBSimData.csv");
   } else {
   }
   return false;
@@ -116,7 +116,11 @@ void FGOutput::DelimitedOutput(void)
     cout << "Alpha,";
     cout << "L,";
     cout << "M,";
-    cout << "N";
+    cout << "N,";
+    cout << "Throttle,";
+    cout << "Aileron,";
+    cout << "Elevator,";
+    cout << "Rudder";
     cout << endl;
     dFirstPass = false;
   }
@@ -152,7 +156,11 @@ void FGOutput::DelimitedOutput(void)
   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;
 
 }
@@ -193,7 +201,11 @@ void FGOutput::DelimitedOutput(string fname)
     datafile << "Alpha,";
     datafile << "L,";
     datafile << "M,";
-    datafile << "N";
+    datafile << "N,";
+    datafile << "Throttle,";
+    datafile << "Aileron,";
+    datafile << "Elevator,";
+    datafile << "Rudder";
     datafile << endl;
     sFirstPass = false;
   }
@@ -229,7 +241,11 @@ void FGOutput::DelimitedOutput(string fname)
   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();
 }
index d2273470addebb02b49c42cc95d2e3d63f761be6..6cd82a8c76b585dec3d291cd3f78f0ded08fd221 100644 (file)
@@ -625,21 +625,21 @@ int fgOPTIONS::parse_option( const string& arg ) {
        }
     } 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) );