]> git.mxchange.org Git - flightgear.git/commitdiff
Latest changes from Jon, plus ...
authorcurt <curt>
Tue, 2 Mar 1999 01:02:51 +0000 (01:02 +0000)
committercurt <curt>
Tue, 2 Mar 1999 01:02:51 +0000 (01:02 +0000)
Tweaks for building with native SGI compilers.

15 files changed:
JSBsim/FGAircraft.cpp
JSBsim/FGAircraft.h
JSBsim/FGAtmosphere.h
JSBsim/FGCoefficient.cpp
JSBsim/FGCoefficient.h
JSBsim/FGEngine.cpp
JSBsim/FGEngine.h
JSBsim/FGMain.cpp
JSBsim/FGModel.h
JSBsim/FGOutput.cpp
JSBsim/FGPosition.cpp
JSBsim/FGState.cpp
JSBsim/FGState.h
JSBsim/FGTank.cpp
JSBsim/FGTank.h

index 3a0ad8ae8c919d06a135b3ab7d96d6a16a2c6450..d32ac26c0ffb54070a2b5734710a69dbf8e4ba01 100644 (file)
@@ -183,8 +183,7 @@ FGAircraft::~FGAircraft(void)
 }
 
 
-bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, 
-                             string fname)
+bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string fname)
 {
   string path;
   string fullpath;
@@ -240,8 +239,7 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path,
         numTanks++;
       } else if (tag == "ENGINE") {
         aircraftfile >> tag;
-        Engine[numEngines] = new FGEngine(FDMExec, engine_path, tag, 
-                                         numEngines);
+        Engine[numEngines] = new FGEngine(FDMExec, engine_path, tag, numEngines);
         numEngines++;
       }
       aircraftfile >> tag;
index 9d403177d17c246f7f407850fa11489a33bbe1e1..235b7c0b858f48cfcc45fad478457153182f2f57 100644 (file)
@@ -137,6 +137,7 @@ stability derivatives for the aircraft.
 /*******************************************************************************
 INCLUDES
 *******************************************************************************/
+
 #ifdef FGFS
 #  include <Include/compiler.h>
 #  ifdef FG_HAVE_STD_INCLUDES
@@ -180,13 +181,11 @@ public:
 
   // ***************************************************************************
   /** This function must be called with the name of an aircraft which
-      has an associated .dat file in the appropriate subdirectory. The
-      appropriate subdirectory is underneath the main fgfs binary directory
-      called "aircraft/{<i>aircraft</i>}/, where {<i>aircraft</i>} is the name of
-      specific aircraft you want to simulate.
+      has an associated .dat file in the appropriate subdirectory. The paths
+      to the appropriate subdirectories are given as the first two parameters. 
       @memo Loads the given aircraft.
-      @param string Path to the Aircraft files
-      @param string Path to the Engine files
+      @param string Path to the aircraft files
+      @param string Path to the engine files
       @param string The name of the aircraft to be loaded, e.g. "X15".
       @return True - if successful
   */
index 332a7689ffa55c78f8c7212959c6889783996a69..9993d25206ec68e7ad7791610650b145b546a4ea 100644 (file)
@@ -40,6 +40,15 @@ INCLUDES
 
 #include "FGModel.h"
 
+/*******************************************************************************
+COMMENTS, REFERENCES,  and NOTES
+*******************************************************************************/
+/**
+The equation used in this model was determined by a third order curve fit using
+Excel. The data is from the ICAO atmosphere model.
+@memo Models the atmosphere.
+@author Jon S. Berndt
+*/
 /*******************************************************************************
 CLASS DECLARATION
 *******************************************************************************/
@@ -47,13 +56,27 @@ CLASS DECLARATION
 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;}
-  
+
 protected:
 
 private:
index 15b457c3c6222cb86f63f3fc8cf961847c4d385d..89c1ca1ef25ed4b05cd6274f405c2617dee633cb 100644 (file)
@@ -164,21 +164,21 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, string fname)
       coeffDefFile >> description;
       coeffDefFile >> method;
 
-      if      (method == "EQUATION") type = 4;
-      else if (method == "TABLE")    type = 3;
-      else if (method == "VECTOR")   type = 2;
-      else if (method == "VALUE")    type = 1;
-      else                           type = 0;
+      if      (method == "EQUATION") type = EQUATION;
+      else if (method == "TABLE")    type = TABLE;
+      else if (method == "VECTOR")   type = VECTOR;
+      else if (method == "VALUE")    type = VALUE;
+      else                           type = UNKNOWN;
 
-      if (type == 2 || type == 3) {
+      if (type == VECTOR || type == TABLE) {
         coeffDefFile >> rows;
-        if (type == 3) {
+        if (type == TABLE) {
           coeffDefFile >> columns;
         }
         coeffDefFile >> LookupR;
       }
 
-      if (type == 3) {
+      if (type == TABLE) {
         coeffDefFile >> LookupC;
       }
 
@@ -251,10 +251,10 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, string fname)
       }
 
       switch(type) {
-      case 1:
+      case VALUE:
         coeffDefFile >> StaticValue;
         break;
-      case 2:
+      case VECTOR:
         Allocate(rows,2);
 
         for (r=1;r<=rows;r++) {
@@ -262,7 +262,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, string fname)
           coeffDefFile >> Table3D[r][1];
         }
         break;
-      case 3:
+      case TABLE:
         Allocate(rows, columns);
 
         for (c=1;c<=columns;c++) {
index b5995692dbe1d8162493d1b0b14ea98de326e5ae..918e4c2015bec3de8f82bef91ad5ba6cbd7aa164 100644 (file)
@@ -46,9 +46,6 @@ INCLUDES
 #    include <fstream.h>
 #  endif
    FG_USING_STD(string);
-#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
-     FG_USING_NAMESPACE(std);
-#  endif
 #else
 #  include <string>
 #  include <fstream>
@@ -75,9 +72,8 @@ DEFINES
 #define FG_ALTITUDE 32768L
 
 /*******************************************************************************
-CLASS DECLARATION
+FORWARD DECLARATIONS
 *******************************************************************************/
-
 class FGFDMExec;
 class FGState;
 class FGAtmosphere;
@@ -89,22 +85,186 @@ class FGPosition;
 class FGAuxiliary;
 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
+FG_CBAR         8
+FG_ALPHA       16
+FG_ALPHADOT    32
+FG_BETA        64
+FG_BETADOT    128
+FG_PITCHRATE  256
+FG_ROLLRATE   512
+FG_YAWRATE   1024
+FG_ELEVATOR  2048
+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.
+*/
+/*******************************************************************************
+CLASS DECLARATION
+*******************************************************************************/
+
 class FGCoefficient
 {
 public:
+  // ***************************************************************************
+  /** @memo Constructor
+      @param FGFDMExec* - pointer to owning simulation executive
+  */
   FGCoefficient(FGFDMExec*);
+
+  // ***************************************************************************
+  /** @memo Constructor for two independent variable table
+      @param
+      @return
+  */
   FGCoefficient(FGFDMExec*, int, int);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   FGCoefficient(FGFDMExec*, int);
+
+  // ***************************************************************************
+  /** @memo
+      @param
+      @return
+  */
   FGCoefficient(FGFDMExec*, string);
+
+  // ***************************************************************************
+  /** @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
+  */
+  enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
+
 protected:
 
 private:
@@ -118,7 +278,7 @@ private:
   float LookupR, LookupC;
   long int mult_idx[10];
   int rows, columns;
-  int type;
+  Type type;
   int multipliers;
   int mult_count;
 
index c14149d28fac354fa01a983d2fee92acaad3bce4..275d793e511bb59643157ea07ef759d6d283aa68 100644 (file)
@@ -36,7 +36,16 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#include <fstream.h>
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <fstream>
+#  else
+#    include <fstream.h>
+#  endif
+#else
+#  include <fstream>
+#endif
 
 #include "FGEngine.h"
 #include "FGState.h"
@@ -55,8 +64,7 @@ INCLUDES
 *******************************************************************************/
 
 
-FGEngine::FGEngine(FGFDMExec* fdex, string enginePath, string engineName, 
-                  int num)
+FGEngine::FGEngine(FGFDMExec* fdex, string enginePath, string engineName, int num)
 {
   string fullpath;
   string tag;
index 05e6406df2e10904cb622efd588574618892e832..8ea2dada3f4c2914ffe19bfca61e42fc1692e403 100644 (file)
@@ -48,9 +48,6 @@ INCLUDES
 #  include <Include/compiler.h>
 #  include STL_STRING
    FG_USING_STD(string);
-#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
-     FG_USING_NAMESPACE(std);
-#  endif
 #else
 #  include <string>
 #endif
index fc0c4e6d4c53ddf335c0716152df8e56143617cf..93ac279ef8ac9296aa476c14e826e97f8250b698 100644 (file)
@@ -28,8 +28,8 @@ void main(int argc, char** argv)
 
   FDMExec = new FGFDMExec();
 
-  FDMExec->GetAircraft()->LoadAircraft(string(argv[1]));
-  FDMExec->GetState()->Reset(string(argv[2]));
+  FDMExec->GetAircraft()->LoadAircraft("aircraft", "engine", string(argv[1]));
+  FDMExec->GetState()->Reset("aircraft", string(argv[2]));
 
   while (FDMExec->GetState()->Getsim_time() <= 25.0)
   {
index 47c07fb44a77109d0efdca22dbdefe65da8af04e..c5cec51c5fc974e653119832f244601a3f2b42fc 100644 (file)
@@ -44,23 +44,16 @@ INCLUDES
 #  include <Include/compiler.h>
 #  include STL_STRING
 #  ifdef FG_HAVE_STD_INCLUDES
-#    include <cstring>
 #    include <iostream>
 #  else
-#    include <string.h>
 #    include <iostream.h>
 #  endif
    FG_USING_STD(string);
-#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
-     FG_USING_NAMESPACE(std);
-#  endif
 #else
 #  include <string>
-#  include <cstring>
 #  include <iostream>
 #endif
 
-
 /*******************************************************************************
 DEFINES
 *******************************************************************************/
index e5e2f7624f71c348e66dfd4ee9adb5e3a40d712d..f327e6b4f81189c6408339985aa2d59613f41ab7 100644 (file)
@@ -49,8 +49,9 @@ INCLUDES
 #else
 #  include <iostream>
 #endif
+
 #ifdef HAVE_CURSES
-#  include <ncurses.h>
+  #include <ncurses.h>
 #endif
 
 #include "FGOutput.h"
index 8c7ee85ffc5ee5151812ddcc081b69fd0554576a..2f7eb655c03fa6b5679383a277ea2449b55b0c63 100644 (file)
@@ -63,6 +63,7 @@ INCLUDES
 #else
 #  include <cmath>
 #endif
+
 #include "FGPosition.h"
 #include "FGAtmosphere.h"
 #include "FGState.h"
index 6309b55d647ce3fb2f5f0bc09cfbc7363172e857..92ffa9de41a946335c1ed534ac10fcde7541937f 100644 (file)
@@ -91,8 +91,7 @@ bool FGState::Reset(string path, string fname)
   float Q0, Q1, Q2, Q3;
   float T[4][4];
 
-  resetDef = path + "/" + FDMExec->GetAircraft()->GetAircraftName() + 
-      "/" + fname;
+  resetDef = path + "/" + FDMExec->GetAircraft()->GetAircraftName() + "/" + fname;
 
   ifstream resetfile(resetDef.c_str());
 
index 3324281d842ce1e4f4b7e0699ddbaeb171373050..a5cf6a8f4e0623351c7d7e10463b83848046ee74 100644 (file)
@@ -53,9 +53,6 @@ INCLUDES
 #    include <fstream.h>
 #  endif
    FG_USING_STD(string);
-#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
-     FG_USING_NAMESPACE(std);
-#  endif
 #else
 #  include <string>
 #  include <fstream>
index ce5d448c63fa76ea5bdbdb532728f41350be781b..ea118069547dfd3046e5f94f5b4d7b8b6894d993 100644 (file)
@@ -35,17 +35,6 @@ HISTORY
 ********************************************************************************
 INCLUDES
 *******************************************************************************/
-#ifdef FGFS
-#  include <Include/compiler.h>
-#  ifdef FG_HAVE_STD_INCLUDES
-#    include <fstream>
-#  else
-#    include <fstream.h>
-#  endif
-#else
-#  include <fstream>
-#endif
-
 #include "FGTank.h"
 
 /*******************************************************************************
index 390f14de096f97824f259123e0298547cb3e73cc..a41841c8555f87ebc2981479ff512d11c632279f 100644 (file)
@@ -52,9 +52,6 @@ INCLUDES
 #    include <fstream.h>
 #  endif
    FG_USING_STD(string);
-#  ifdef FG_HAVE_NATIVE_SGI_COMPILERS
-     FG_USING_NAMESPACE(std);
-#  endif
 #else
 #  include <string>
 #  include <fstream>