]> git.mxchange.org Git - flightgear.git/commitdiff
Updates to JSBsim.
authorcurt <curt>
Mon, 21 Jun 1999 03:01:57 +0000 (03:01 +0000)
committercurt <curt>
Mon, 21 Jun 1999 03:01:57 +0000 (03:01 +0000)
12 files changed:
Simulator/FDM/JSBsim.cxx
Simulator/FDM/JSBsim/FGAircraft.cpp
Simulator/FDM/JSBsim/FGAircraft.h
Simulator/FDM/JSBsim/FGAtmosphere.cpp
Simulator/FDM/JSBsim/FGAtmosphere.h
Simulator/FDM/JSBsim/FGCoefficient.cpp
Simulator/FDM/JSBsim/FGCoefficient.h
Simulator/FDM/JSBsim/FGControls.cpp
Simulator/FDM/JSBsim/FGControls.h
Simulator/FDM/JSBsim/FGFDMExec.cpp
Simulator/FDM/JSBsim/FGMain.cpp
Simulator/FDM/JSBsim/FGState.cpp

index f28cf0d4ab7c27b8494093528f2d49f770121578..934645318a35fd3ae066269be40c21756d5af982 100644 (file)
@@ -65,7 +65,7 @@ int fgJSBsimInit(double dt) {
     FGPath engine_path( current_options.get_fg_root() );
     engine_path.append( "Engine" );
 
-    FDMExec.GetAircraft()->LoadAircraftEx(aircraft_path.str(), 
+    FDMExec.GetAircraft()->LoadAircraft(aircraft_path.str(), 
                                          engine_path.str(), "X15");
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded aircraft" );
 
index 2f58ea87b06623be15676ae4d98fe22d0a0ad107..aa5bef8053bd156ec05c086d32baf537de2ae935 100644 (file)
@@ -94,43 +94,6 @@ Control
   CnDr - Yaw moment due to rudder
   CnDa - Yaw moment due to aileron
 
-This class expects to be run in a directory which contains the subdirectory
-structure shown below (where example aircraft X-15 is shown):
-
-aircraft/
-         X-15/
-              X-15.dat reset00 reset01 reset02 ...
-              CDRAG/
-                 a0 a M De
-              CSIDE/
-                 b r Dr Da
-              CLIFT/
-                 a0 a M adt De
-              CROLL/
-                 b p r Da Dr
-              CPITCH/
-                 a0 a adt q M De
-              CYAW/
-                 b p r Dr Da
-         F-16/
-              F-16.dat reset00 reset01 ...
-              CDRAG/
-                 a0 a M De
-              ...
-
-The General Idea
-
-The file structure is arranged so that various modeled aircraft are stored in
-their own subdirectory. Each aircraft subdirectory is named after the aircraft.
-There should be a file present in the specific aircraft subdirectory (e.g.
-aircraft/X-15) with the same name as the directory with a .dat appended. This
-file contains mass properties information, name of aircraft, etc. for the
-aircraft. In that same directory are reset files numbered starting from 0 (two
-digit numbers), e.g. reset03. Within each reset file are values for important
-state variables for specific flight conditions (altitude, airspeed, etc.). Also
-within this directory are the directories containing lookup tables for the
-stability derivatives for the aircraft.
-
 ********************************************************************************
 INCLUDES
 *******************************************************************************/
@@ -180,7 +143,7 @@ FGAircraft::~FGAircraft(void)
 {
 }
 
-bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string fname)
+bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string fname)
 {
   string path;
   string fullpath;
@@ -190,7 +153,11 @@ bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string
   string holding_string;
   char scratch[128];
   ifstream coeffInFile;
+  streampos gpos;
+  int axis;
+  string axis_descript;
 
+       axis = -1;
   aircraftDef = aircraft_path + "/" + fname + "/" + fname + ".cfg";
   ifstream aircraftfile(aircraftDef.c_str());
   cout << "Reading Aircraft Configuration File: " << aircraftDef << endl;
@@ -201,9 +168,11 @@ bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string
   while (!aircraftfile.fail()) {
        holding_string.erase();
     aircraftfile >> holding_string;
-    // if (holding_string.compare("//",0,2) != 0) {
-    if ( !(holding_string.substr(0, 2) == "//") ) {
-
+#ifdef __BORLANDC__
+    if (holding_string.compare(0, 2, "//") != 0) {
+#else
+    if (holding_string.compare("//",0,2) != 0) {
+#endif
       if (holding_string == "AIRCRAFT") {
        cout << "Reading in Aircraft parameters ..." << endl;
       } else if (holding_string == "AERODYNAMICS") {
@@ -269,97 +238,63 @@ bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string
 
                        } else if (holding_string == "LIFT") {
 
-                               cout << "   Lift Coefficients ..." << endl;
-        aircraftfile >> tag;
-        streampos gpos = aircraftfile.tellg();
-                               aircraftfile >> tag;
-                               if ( !(tag == "}") ) {
-                                       aircraftfile.seekg(gpos);
-               Coeff[LiftCoeff][coeff_ctr[LiftCoeff]] = new FGCoefficient(FDMExec, aircraftfile);
-             coeff_ctr[LiftCoeff]++;
-           } else {
-               cout << "      None found ..." << endl;
-           }
-
+                               axis_descript = "   Lift Coefficients ...";
+                               axis = LiftCoeff;
+                               
                        } else if (holding_string == "DRAG") {
 
-                               cout << "   Drag Coefficients ..." << endl;
-        aircraftfile >> tag;
-        streampos gpos = aircraftfile.tellg();
-                               aircraftfile >> tag;
-                               if ( !(tag == "}") ) {
-                                       aircraftfile.seekg(gpos);
-               Coeff[DragCoeff][coeff_ctr[DragCoeff]] = new FGCoefficient(FDMExec, aircraftfile);
-             coeff_ctr[DragCoeff]++;
-           } else {
-               cout << "      None found ..." << endl;
-           }
+                               axis_descript = "   Drag Coefficients ...";
+                               axis = DragCoeff;
 
                        } else if (holding_string == "SIDE") {
 
-                               cout << "   Side Coefficients ..." << endl;
-        aircraftfile >> tag;
-        streampos gpos = aircraftfile.tellg();
-                               aircraftfile >> tag;
-                               if ( !(tag == "}") ) {
-                                       aircraftfile.seekg(gpos);
-               Coeff[SideCoeff][coeff_ctr[SideCoeff]] = new FGCoefficient(FDMExec, aircraftfile);
-             coeff_ctr[SideCoeff]++;
-           } else {
-               cout << "      None found ..." << endl;
-           }
+                               axis_descript = "   Side Coefficients ...";
+                               axis = SideCoeff;
 
                        } else if (holding_string == "ROLL") {
 
-                               cout << "   Roll Coefficients ..." << endl;
-        aircraftfile >> tag;
-        streampos gpos = aircraftfile.tellg();
-                               aircraftfile >> tag;
-                               if ( !(tag == "}") ) {
-                                       aircraftfile.seekg(gpos);
-               Coeff[RollCoeff][coeff_ctr[RollCoeff]] = new FGCoefficient(FDMExec, aircraftfile);
-             coeff_ctr[RollCoeff]++;
-           } else {
-               cout << "      None found ..." << endl;
-           }
+                               axis_descript = "   Roll Coefficients ...";
+                               axis = RollCoeff;
 
                        } else if (holding_string == "PITCH") {
 
-                               cout << "   Pitch Coefficients ..." << endl;
-        aircraftfile >> tag;
-        streampos gpos = aircraftfile.tellg();
-                               aircraftfile >> tag;
-                               if ( !(tag == "}") ) {
-                                       aircraftfile.seekg(gpos);
-               Coeff[PitchCoeff][coeff_ctr[PitchCoeff]] = new FGCoefficient(FDMExec, aircraftfile);
-             coeff_ctr[PitchCoeff]++;
-           } else {
-               cout << "      None found ..." << endl;
-           }
+                               axis_descript = "   Pitch Coefficients ...";
+                               axis = PitchCoeff;
 
                        } else if (holding_string == "YAW") {
 
-                               cout << "   Yaw Coefficients ..." << endl;
-        aircraftfile >> tag;
-        streampos gpos = aircraftfile.tellg();
-                               aircraftfile >> tag;
-                               if ( !(tag == "}") ) {
-                                       aircraftfile.seekg(gpos);
-               Coeff[YawCoeff][coeff_ctr[YawCoeff]] = new FGCoefficient(FDMExec, aircraftfile);
-             coeff_ctr[YawCoeff]++;
-           } else {
-               cout << "      None found ..." << endl;
-           }
-
-                       } else {
+                               axis_descript = "   Yaw Coefficients ...";
+                               axis = YawCoeff;
+
                        }
 
+                       if (axis >= 0) {
+                               cout << axis_descript << endl;
+           aircraftfile >> tag;
+         gpos = aircraftfile.tellg();
+                               aircraftfile >> tag;
+                               if (tag != "}" ) {
+                                       while (tag != "}") {
+                                               aircraftfile.seekg(gpos);
+                   Coeff[axis][coeff_ctr[axis]] = new FGCoefficient(FDMExec, aircraftfile);
+                         coeff_ctr[axis]++;
+                       aircraftfile >> tag;
+                       gpos = aircraftfile.tellg();
+                                               aircraftfile >> tag;
+                   }
+               } else {
+                       cout << "      None found ..." << endl;
+               }
+           }
+           axis = -1;
+                       
     } else {
        aircraftfile.getline(scratch, 127);
     }
   }
        cout << "End of Configuration File Parsing." << endl;
-       return true;
+
+  return true;
 }
 
 
index 0335a8033812220613d690bb31c21566204c87d0..9e3fe974cce73b77f0bec929f00ee2cb358ea0ac 100644 (file)
@@ -129,7 +129,7 @@ public:
   ~FGAircraft(void);
 
   bool Run(void);
-  bool LoadAircraftEx(string, string, string);
+  bool LoadAircraft(string, string, string);
   inline string GetAircraftName(void) {return AircraftName;}
   inline void SetGearUp(bool tt) {GearUp = tt;}
   inline bool GetGearUp(void) {return GearUp;}
index a066b30469d80283cb08c1d7ebc8ce2a9ae11fba..151a797f10cb5a1bf3b31d98b611fbebff1ed079 100644 (file)
@@ -71,8 +71,17 @@ bool FGAtmosphere::Run(void)
         + 7.0E-13*State->Geth()*State->Geth()
         - 2.0E-18*State->Geth()*State->Geth()*State->Geth();
 
-    State->SetMach(State->GetVt()/State->Geta()); 
+    State->SetMach(State->GetVt()/State->Geta());
   } else {                               // skip Run() execution this time
   }
   return false;
 }
+
+float FGAtmosphere::CalcRho(float altitude)
+{
+  return (0.002377 - 7.0E-08*altitude
+        + 7.0E-13*altitude*altitude
+        - 2.0E-18*altitude*altitude*altitude);
+
+}
+
index 25afde57ba33a42862898bdfedb0073690206a99..a698742c81d0553029dedb9178dd7bf5725fd5df 100644 (file)
@@ -58,26 +58,12 @@ using namespace std;
 class FGAtmosphere : public FGModel
 {
 public:
-  // ***************************************************************************
-  /** @memo Constructor
-      @param FGFDMExec* - a pointer to the "owning" FDM Executive
-  */
   FGAtmosphere(FGFDMExec*);
-
-  // ***************************************************************************
-  /** @memo Destructor
-  */
   ~FGAtmosphere(void);
-
-  // ***************************************************************************
-  /** This must be called for each dt to execute the model algorithm */
   bool Run(void);
 
-  // ***************************************************************************
-  /** @memo Returns the air density
-      @return float air density in slugs/cubic foot
-  */
   inline float Getrho(void) {return rho;}
+  float CalcRho(float altitude);
 
 protected:
 
index 565b089492793230c24ee16345e67747b17b70fe..65d61edaac1303e940afb02e576993c77b34993a 100644 (file)
@@ -30,69 +30,6 @@ FUNCTIONAL DESCRIPTION
 This class models the stability derivative coefficient lookup tables or
 equations. Note that the coefficients need not be calculated each delta-t.
 
-The coefficient files are located in the axis subdirectory for each aircraft.
-For instance, for the X-15, you would find subdirectories under the
-aircraft/X-15/ directory named CLIFT, CDRAG, CSIDE, CROLL, CPITCH, CYAW. Under
-each of these directories would be files named a, a0, q, and so on. The file
-named "a" under the CLIFT directory would contain data for the stability
-derivative modeling lift due to a change in alpha. See the FGAircraft.cpp file
-for additional information. The coefficient files have the following format:
-
-<name of coefficient>
-<short description of coefficient with no embedded spaces>
-<method used in calculating the coefficient: TABLE | EQUATION | VECTOR | VALUE>
-  <parameter identifier for table row (if required)>
-  <parameter identifier for table column (if required)>
-<OR'ed list of parameter identifiers needed to turn this coefficient into a force>
-<number of rows in table (if required)>
-<number of columns in table (if required)>
-
-<value of parameter indexing into the column of a table or vector - or value
-  itself for a VALUE coefficient>
-<values of parameter indexing into row of a table if TABLE type> <Value of
-  coefficient at this row and column>
-
-<... repeat above for each column of data in table ...>
-
-As an example for the X-15, for the lift due to mach:
-
-CLa0
-Lift_at_zero_alpha
-Table 8 3
-16384
-32768
-16387
-
-0.00
-0.0 0.0
-0.5 0.4
-0.9 0.9
-1.0 1.6
-1.1 1.3
-1.4 1.0
-2.0 0.5
-3.0 0.5
-
-30000.00
-0.0 0.0
-0.5 0.5
-0.9 1.0
-1.0 1.7
-1.1 1.4
-1.4 1.1
-2.0 0.6
-3.0 0.6
-
-70000.00
-0.0 0.0
-0.5 0.6
-0.9 1.1
-1.0 1.7
-1.1 1.5
-1.4 1.2
-2.0 0.7
-3.0 0.7
-
 Note that the values in a row which index into the table must be the same value
 for each column of data, so the first column of numbers for each altitude are
 seen to be equal, and there are the same number of values for each altitude.
@@ -125,10 +62,29 @@ INCLUDES
 
 FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
 {
-  int r, c;
+  int r, c, start, end, n;
   float ftrashcan;
   string strashcan;
 
+  coeffdef["FG_QBAR"]      = 1;
+  coeffdef["FG_WINGAREA"]  = 2;
+  coeffdef["FG_WINGSPAN"]  = 4;
+  coeffdef["FG_CBAR"]      = 8;
+  coeffdef["FG_ALPHA"]     = 16;
+  coeffdef["FG_ALPHADOT"]  = 32;
+  coeffdef["FG_BETA"]      = 64;
+  coeffdef["FG_BETADOT"]   = 128;
+  coeffdef["FG_PITCHRATE"] = 256;
+  coeffdef["FG_ROLLRATE"]  = 512;
+  coeffdef["FG_YAWRATE"]   = 1024;
+  coeffdef["FG_ELEVATOR"]  = 2048;
+  coeffdef["FG_AILERON"]   = 4096;
+  coeffdef["FG_RUDDER"]    = 8192;
+  coeffdef["FG_MACH"]      = 16384;
+  coeffdef["FG_ALTITUDE"]  = 32768L;
+  coeffdef["FG_I2VEL"]     = 65536L;
+  coeffdef["FG_HALF"]      = 131072L;
+
   FDMExec     = fdex;
   State       = FDMExec->GetState();
   Atmosphere  = FDMExec->GetAtmosphere();
@@ -163,19 +119,51 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
           coeffDefFile >> columns;
           cout << "Cols: " << columns;
         }
-        coeffDefFile >> LookupR;
+
         cout << endl;
-        cout << "   Row indexing parameter: " << LookupR << endl;
+
+        coeffDefFile >> strashcan;
+        if (strashcan.substr(0,1) == "F") {
+          LookupR = coeffdef[strashcan.c_str()];
+          cout << "   Row indexing parameter: " << strashcan << endl;
+        } else {
+          LookupR = atoi(strashcan.c_str());
+          cout << "   Row indexing parameter: " << LookupR << endl;
+        }
+
       }
 
       if (type == TABLE) {
-        coeffDefFile >> LookupC;
-        cout << "   Column indexing parameter: " << LookupC << endl;
+        coeffDefFile >> strashcan;
+        if (strashcan.substr(0,1) == "F") {
+          LookupC = coeffdef[strashcan.c_str()];
+          cout << "   Column indexing parameter: " << strashcan << endl;
+        } else {
+          LookupC = atoi(strashcan.c_str());
+          cout << "   Column indexing parameter: " << LookupC << endl;
+        }
+      }
+
+      coeffDefFile >> strashcan;
+
+      end   = strashcan.length();
+      n     = strashcan.find("|");
+      start = 0;
+      multipliers = 0;
+      if (strashcan.substr(0,1) == "F") {
+        while(n < end && n >= 0) {
+          n -= start;
+          multipliers += coeffdef[strashcan.substr(start,n).c_str()];
+          start += n+1;
+          n = strashcan.find("|",start);
+        }
+        multipliers += coeffdef[strashcan.substr(start,end).c_str()];
+      } else {
+        multipliers = atoi(strashcan.c_str());
       }
 
-      coeffDefFile >> multipliers;
       cout << "   Non-Dimensionalized by: ";
-      
+
       mult_count = 0;
       if (multipliers & FG_QBAR) {
         mult_idx[mult_count] = FG_QBAR;
@@ -256,12 +244,18 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
         mult_idx[mult_count] = FG_ALTITUDE;
         mult_count++;
         cout << "h ";
+      }
+      if (multipliers & FG_I2VEL) {
+        mult_idx[mult_count] = FG_I2VEL;
+        mult_count++;
+        cout << "1 /(2*Vt) ";
       }
                        cout << endl;
-                       
+
       switch(type) {
       case VALUE:
         coeffDefFile >> StaticValue;
+        cout << "      Value = " << StaticValue << endl;
         break;
       case VECTOR:
         Allocate(rows,2);
@@ -283,6 +277,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
       case TABLE:
         Allocate(rows, columns);
 
+        Table3D[0][0] = 0.0;
         for (c=1;c<=columns;c++) {
           coeffDefFile >> Table3D[0][c];
           for (r=1;r<=rows;r++) {
@@ -299,7 +294,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
                }
                cout << endl;
         }
-        
+
         break;
       }
     } else {
@@ -353,15 +348,11 @@ float FGCoefficient::Value(float rVal, float cVal)
   col2temp = rFactor*(Table3D[r][c] - Table3D[r-1][c]) + Table3D[r-1][c];
 
   Value = col1temp + cFactor*(col2temp - col1temp);
-  
-//cout << "Value for " << description << " is " << Value;
+
   for (midx=0;midx<mult_count;midx++) {
     Value *= GetCoeffVal(mult_idx[midx]);
   }
 
-//cout << " after multipliers it is: " << Value << endl;
-
   return Value;
 }
 
@@ -372,7 +363,7 @@ float FGCoefficient::Value(float Val)
   int r, midx;
 
   if (rows < 2) return 0.0;
-  
+
   for (r=1;r<=rows;r++) if (Table3D[r][0] >= Val) break;
   r = r < 2 ? 2 : (r > rows    ? rows    : r);
 
@@ -385,14 +376,10 @@ float FGCoefficient::Value(float Val)
 
   Value = Factor*(Table3D[r][1] - Table3D[r-1][1]) + Table3D[r-1][1];
 
-// cout << "Value for " << description << " is " << Value;
   for (midx=0;midx<mult_count;midx++) {
     Value *= GetCoeffVal(mult_idx[midx]);
   }
 
-//cout << " after multipliers it is: " << Value << endl;
-
   return Value;
 }
 
@@ -404,14 +391,10 @@ float FGCoefficient::Value(void)
        
        Value = StaticValue;
 
-// cout << "Value for " << description << " is " << Value << endl;
   for (midx=0;midx<mult_count;midx++) {
     Value *= GetCoeffVal(mult_idx[midx]);
   }
 
-// cout << " after multipliers it is: " << Value << endl;
-
   return Value;
 }
 
@@ -436,53 +419,40 @@ float FGCoefficient::GetCoeffVal(int val_idx)
 {
   switch(val_idx) {
   case FG_QBAR:
-//cout << "Qbar: " << State->Getqbar() << endl;
     return State->Getqbar();
   case FG_WINGAREA:
-//cout << "S: " << Aircraft->GetWingArea() << endl;  
     return Aircraft->GetWingArea();
   case FG_WINGSPAN:
-//cout << "b: " << Aircraft->GetWingSpan() << endl;
     return Aircraft->GetWingSpan();
   case FG_CBAR:
-//cout << "Cbar: " << Aircraft->Getcbar() << endl;
     return Aircraft->Getcbar();
   case FG_ALPHA:
-//cout << "Alpha: " << Translation->Getalpha() << endl;
     return Translation->Getalpha();
   case FG_ALPHADOT:
-//cout << "Adot: " << State->Getadot() << endl;
     return State->Getadot();
   case FG_BETA:
-//cout << "Beta: " << Translation->Getbeta() << endl;
     return Translation->Getbeta();
   case FG_BETADOT:
-//cout << "Bdot: " << State->Getbdot() << endl;
     return State->Getbdot();
   case FG_PITCHRATE:
-//cout << "Q: " << Rotation->GetQ() << endl;
     return Rotation->GetQ();
   case FG_ROLLRATE:
-//cout << "P: " << Rotation->GetP() << endl;
     return Rotation->GetP();
   case FG_YAWRATE:
-//cout << "R: " << Rotation->GetR() << endl;
     return Rotation->GetR();
   case FG_ELEVATOR:
-//cout << "De: " << FCS->GetDe() << endl;
     return FCS->GetDe();
   case FG_AILERON:
-//cout << "Da: " << FCS->GetDa() << endl;
     return FCS->GetDa();
   case FG_RUDDER:
-//cout << "Dr: " << FCS->GetDr() << endl;
     return FCS->GetDr();
   case FG_MACH:
-//cout << "Mach: " << State->GetMach() << endl;
     return State->GetMach();
   case FG_ALTITUDE:
-//cout << "h: " << State->Geth() << endl;
     return State->Geth();
+  case FG_I2VEL:
+    return 1.0/(0.5 * State->GetVt());
   }
   return 0;
 }
+
index 4bfc91acfd59c5a74312b38f86804ebab22c0f62..c28af0dfeeb6341fd14aaa6bcdaaef7d2d35126e 100644 (file)
@@ -51,6 +51,8 @@ INCLUDES
 #  include <fstream>
 #endif
 
+#include <map>
+
 /*******************************************************************************
 DEFINES
 *******************************************************************************/
@@ -73,6 +75,7 @@ using namespace std;
 #define FG_RUDDER    8192
 #define FG_MACH     16384
 #define FG_ALTITUDE 32768L
+#define FG_I2VEL    65536L
 
 /*******************************************************************************
 FORWARD DECLARATIONS
@@ -90,81 +93,11 @@ class FGOutput;
 
 /*******************************************************************************
 COMMENTS, REFERENCES,  and NOTES
-*******************************************************************************/
-/**
+********************************************************************************
+
 This class models the stability derivative coefficient lookup tables or 
 equations. Note that the coefficients need not be calculated each delta-t.
 
-The coefficient files are located in the axis subdirectory for each aircraft.
-For instance, for the X-15, you would find subdirectories under the
-aircraft/X-15/ directory named CLIFT, CDRAG, CSIDE, CROLL, CPITCH, CYAW. Under
-each of these directories would be files named a, a0, q, and so on. The file
-named "a" under the CLIFT directory would contain data for the stability
-derivative modeling lift due to a change in alpha. See the FGAircraft.cpp file
-for additional information. The coefficient files have the following format:
-
-<name of coefficient>
-<short description of coefficient with no embedded spaces>
-<method used in calculating the coefficient: TABLE | EQUATION | VECTOR | VALUE>
-  <parameter identifier for table row (if required)>
-  <parameter identifier for table column (if required)>
-<OR'ed list of parameter identifiers needed to turn this coefficient into a force>
-<number of rows in table (if required)>
-<number of columns in table (if required)>
-
-<value of parameter indexing into the column of a table or vector - or value
-  itself for a VALUE coefficient>
-<values of parameter indexing into row of a table if TABLE type> <Value of
-  coefficient at this row and column>
-
-<... repeat above for each column of data in table ...>
-
-As an example for the X-15, for the lift due to mach:
-<PRE>
-
-CLa0
-Lift_at_zero_alpha
-Table 8 3
-16384
-32768
-16387
-
-0.00
-0.0 0.0
-0.5 0.4
-0.9 0.9
-1.0 1.6
-1.1 1.3
-1.4 1.0
-2.0 0.5
-3.0 0.5
-
-30000.00
-0.0 0.0
-0.5 0.5
-0.9 1.0
-1.0 1.7
-1.1 1.4
-1.4 1.1
-2.0 0.6
-3.0 0.6
-
-70000.00
-0.0 0.0
-0.5 0.6
-0.9 1.1
-1.0 1.7
-1.1 1.5
-1.4 1.2
-2.0 0.7
-3.0 0.7
-</PRE>
-
-Note that the values in a row which index into the table must be the same value
-for each column of data, so the first column of numbers for each altitude are
-seen to be equal, and there are the same number of values for each altitude.
-
-<PRE>
 FG_QBAR         1
 FG_WINGAREA     2
 FG_WINGSPAN     4
@@ -181,83 +114,30 @@ FG_AILERON   4096
 FG_RUDDER    8192
 FG_MACH     16384
 FG_ALTITUDE 32768L
-</PRE>
-@author Jon S. Berndt
-@memo This class models the stability derivative coefficient lookup tables or equations.
-*/
-/*******************************************************************************
+FG_I2VEL    65536L
+
+********************************************************************************
 CLASS DECLARATION
 *******************************************************************************/
 
 class FGCoefficient
 {
 public:
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   FGCoefficient(FGFDMExec*, ifstream&);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   ~FGCoefficient(void);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   bool Allocate(int);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   bool Allocate(int, int);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   float Value(float, float);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   float Value(float);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   float Value(void);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   float TotalValue(void);
-
-  // ***************************************************************************
-  /** @memo
-      @param
-      @return
-  */
   enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
 
 protected:
 
 private:
+  typedef map<string, long> CoeffMap;
+  CoeffMap coeffdef;
   string filename;
   string description;
   string name;
index ce509a11a1e65cfca5ecaa7cba608dbca41c7f0e..01d8327a70bd0e80fd7e2f135c6851a3199e412e 100644 (file)
@@ -51,15 +51,8 @@ FGControls::~FGControls() {
 
 
 // $Log$
-// Revision 1.4  1999/06/20 02:12:07  curt
-// Updated JSBsim from Jon Berndt
-// Fixed a typo in hud.cxx.
-//
-// Revision 1.1.1.1  1999/06/17 18:07:34  curt
-// Start of 0.7.x branch
-//
-// Revision 1.3  1999/05/08 03:19:15  curt
-// Incorporated latest JSBsim updates.
+// Revision 1.5  1999/06/21 03:02:05  curt
+// Updates to JSBsim.
 //
 // Revision 1.1  1999/02/13 01:12:03  curt
 // Initial Revision.
index 165ad26590aefa71643f4ec159a20c25c9244186..62af3ecabb8268de570397a299e6ef5407c81100 100644 (file)
@@ -177,15 +177,8 @@ extern FGControls controls;
 
 
 // $Log$
-// Revision 1.4  1999/06/20 02:12:08  curt
-// Updated JSBsim from Jon Berndt
-// Fixed a typo in hud.cxx.
-//
-// Revision 1.1.1.1  1999/06/17 18:07:34  curt
-// Start of 0.7.x branch
-//
-// Revision 1.3  1999/05/08 03:19:16  curt
-// Incorporated latest JSBsim updates.
+// Revision 1.5  1999/06/21 03:02:06  curt
+// Updates to JSBsim.
 //
 // Revision 1.1  1999/02/13 01:12:03  curt
 // Initial Revision.
index 9f4adfa80eaabe15242519689b812d81b70220d7..e89ee88446e27d7b2d0ef2669df941e67502dadb 100644 (file)
@@ -115,7 +115,7 @@ FGFDMExec::FGFDMExec(void)
   Schedule(Translation, 1);
   Schedule(Position,    1);
   Schedule(Auxiliary,   1);
-  Schedule(Output,      5);
+  Schedule(Output,      1);
 
   terminate = false;
   frozen = false;
index 1783fce901a09495a3653df33d647ec8aa913657..93843bdceefa9d4db62afe8e0d9ecb3dc7ccda2c 100644 (file)
@@ -16,8 +16,8 @@ void main(int argc, char** argv)
 {
        FGFDMExec* FDMExec;
        
-  struct timespec short_wait = {0,100000000};
-  struct timespec no_wait    = {0,100000000};
+//  struct timespec short_wait = {0,100000000};
+//  struct timespec no_wait    = {0,100000000};
 
   if (argc != 3) {
     cout << endl
@@ -28,7 +28,7 @@ void main(int argc, char** argv)
 
   FDMExec = new FGFDMExec();
 
-  FDMExec->GetAircraft()->LoadAircraftEx("aircraft", "engine", string(argv[1]));
+  FDMExec->GetAircraft()->LoadAircraft("aircraft", "engine", string(argv[1]));
   FDMExec->GetState()->Reset("aircraft", string(argv[2]));
 
   while (FDMExec->GetState()->Getsim_time() <= 25.0)
@@ -39,12 +39,12 @@ void main(int argc, char** argv)
 
                if (FDMExec->GetState()->Getsim_time() > 5.0) {
                        FDMExec->GetFCS()->SetDa(0.05);
-                       FDMExec->GetFCS()->SetDr(0.05);
-                       FDMExec->GetFCS()->SetDe(0.05);
+//                     FDMExec->GetFCS()->SetDr(0.05);
+//                     FDMExec->GetFCS()->SetDe(0.05);
                }
                
     FDMExec->Run();
-    nanosleep(&short_wait,&no_wait);
+//    nanosleep(&short_wait,&no_wait);
   }
 
   delete FDMExec;
index 92ffa9de41a946335c1ed534ac10fcde7541937f..a55abf3b5e2a6a1f55398ab9c0bc44d824d74993 100644 (file)
@@ -130,7 +130,7 @@ bool FGState::Reset(string path, string fname)
     FDMExec->GetTranslation()->SetABG(alpha, beta, gamma);
 
     Vt = sqrt(U*U + V*V + W*W);
-    qbar = sqrt(U*U + V*V + W*W);
+    qbar = 0.5*(U*U + V*V + W*W)*FDMExec->GetAtmosphere()->CalcRho(h);
 
     Q0 =  sin(psi*0.5)*sin(tht*0.5)*sin(phi*0.5) + cos(psi*0.5)*cos(tht*0.5)*cos(phi*0.5);
     Q1 = -sin(psi*0.5)*sin(tht*0.5)*cos(phi*0.5) + cos(psi*0.5)*cos(tht*0.5)*sin(phi*0.5);