From: curt Date: Tue, 2 Mar 1999 01:02:51 +0000 (+0000) Subject: Latest changes from Jon, plus ... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7cc178d1827b29ffa8fc86c95f2bf0c2476ebddf;p=flightgear.git Latest changes from Jon, plus ... Tweaks for building with native SGI compilers. --- diff --git a/JSBsim/FGAircraft.cpp b/JSBsim/FGAircraft.cpp index 3a0ad8ae8..d32ac26c0 100644 --- a/JSBsim/FGAircraft.cpp +++ b/JSBsim/FGAircraft.cpp @@ -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; diff --git a/JSBsim/FGAircraft.h b/JSBsim/FGAircraft.h index 9d403177d..235b7c0b8 100644 --- a/JSBsim/FGAircraft.h +++ b/JSBsim/FGAircraft.h @@ -137,6 +137,7 @@ stability derivatives for the aircraft. /******************************************************************************* INCLUDES *******************************************************************************/ + #ifdef FGFS # include # 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/{aircraft}/, where {aircraft} 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 */ diff --git a/JSBsim/FGAtmosphere.h b/JSBsim/FGAtmosphere.h index 332a7689f..9993d2520 100644 --- a/JSBsim/FGAtmosphere.h +++ b/JSBsim/FGAtmosphere.h @@ -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: diff --git a/JSBsim/FGCoefficient.cpp b/JSBsim/FGCoefficient.cpp index 15b457c3c..89c1ca1ef 100644 --- a/JSBsim/FGCoefficient.cpp +++ b/JSBsim/FGCoefficient.cpp @@ -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++) { diff --git a/JSBsim/FGCoefficient.h b/JSBsim/FGCoefficient.h index b5995692d..918e4c201 100644 --- a/JSBsim/FGCoefficient.h +++ b/JSBsim/FGCoefficient.h @@ -46,9 +46,6 @@ INCLUDES # include # endif FG_USING_STD(string); -# ifdef FG_HAVE_NATIVE_SGI_COMPILERS - FG_USING_NAMESPACE(std); -# endif #else # include # include @@ -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: + + + + + + + + + + + + + +<... 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. + +
+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
+
+@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; diff --git a/JSBsim/FGEngine.cpp b/JSBsim/FGEngine.cpp index c14149d28..275d793e5 100644 --- a/JSBsim/FGEngine.cpp +++ b/JSBsim/FGEngine.cpp @@ -36,7 +36,16 @@ HISTORY INCLUDES *******************************************************************************/ -#include +#ifdef FGFS +# include +# ifdef FG_HAVE_STD_INCLUDES +# include +# else +# include +# endif +#else +# include +#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; diff --git a/JSBsim/FGEngine.h b/JSBsim/FGEngine.h index 05e6406df..8ea2dada3 100644 --- a/JSBsim/FGEngine.h +++ b/JSBsim/FGEngine.h @@ -48,9 +48,6 @@ INCLUDES # include # include STL_STRING FG_USING_STD(string); -# ifdef FG_HAVE_NATIVE_SGI_COMPILERS - FG_USING_NAMESPACE(std); -# endif #else # include #endif diff --git a/JSBsim/FGMain.cpp b/JSBsim/FGMain.cpp index fc0c4e6d4..93ac279ef 100644 --- a/JSBsim/FGMain.cpp +++ b/JSBsim/FGMain.cpp @@ -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) { diff --git a/JSBsim/FGModel.h b/JSBsim/FGModel.h index 47c07fb44..c5cec51c5 100644 --- a/JSBsim/FGModel.h +++ b/JSBsim/FGModel.h @@ -44,23 +44,16 @@ INCLUDES # include # include STL_STRING # ifdef FG_HAVE_STD_INCLUDES -# include # include # else -# include # include # endif FG_USING_STD(string); -# ifdef FG_HAVE_NATIVE_SGI_COMPILERS - FG_USING_NAMESPACE(std); -# endif #else # include -# include # include #endif - /******************************************************************************* DEFINES *******************************************************************************/ diff --git a/JSBsim/FGOutput.cpp b/JSBsim/FGOutput.cpp index e5e2f7624..f327e6b4f 100644 --- a/JSBsim/FGOutput.cpp +++ b/JSBsim/FGOutput.cpp @@ -49,8 +49,9 @@ INCLUDES #else # include #endif + #ifdef HAVE_CURSES -# include + #include #endif #include "FGOutput.h" diff --git a/JSBsim/FGPosition.cpp b/JSBsim/FGPosition.cpp index 8c7ee85ff..2f7eb655c 100644 --- a/JSBsim/FGPosition.cpp +++ b/JSBsim/FGPosition.cpp @@ -63,6 +63,7 @@ INCLUDES #else # include #endif + #include "FGPosition.h" #include "FGAtmosphere.h" #include "FGState.h" diff --git a/JSBsim/FGState.cpp b/JSBsim/FGState.cpp index 6309b55d6..92ffa9de4 100644 --- a/JSBsim/FGState.cpp +++ b/JSBsim/FGState.cpp @@ -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()); diff --git a/JSBsim/FGState.h b/JSBsim/FGState.h index 3324281d8..a5cf6a8f4 100644 --- a/JSBsim/FGState.h +++ b/JSBsim/FGState.h @@ -53,9 +53,6 @@ INCLUDES # include # endif FG_USING_STD(string); -# ifdef FG_HAVE_NATIVE_SGI_COMPILERS - FG_USING_NAMESPACE(std); -# endif #else # include # include diff --git a/JSBsim/FGTank.cpp b/JSBsim/FGTank.cpp index ce5d448c6..ea1180695 100644 --- a/JSBsim/FGTank.cpp +++ b/JSBsim/FGTank.cpp @@ -35,17 +35,6 @@ HISTORY ******************************************************************************** INCLUDES *******************************************************************************/ -#ifdef FGFS -# include -# ifdef FG_HAVE_STD_INCLUDES -# include -# else -# include -# endif -#else -# include -#endif - #include "FGTank.h" /******************************************************************************* diff --git a/JSBsim/FGTank.h b/JSBsim/FGTank.h index 390f14de0..a41841c85 100644 --- a/JSBsim/FGTank.h +++ b/JSBsim/FGTank.h @@ -52,9 +52,6 @@ INCLUDES # include # endif FG_USING_STD(string); -# ifdef FG_HAVE_NATIVE_SGI_COMPILERS - FG_USING_NAMESPACE(std); -# endif #else # include # include