Tweaks for building with native SGI compilers.
}
-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;
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;
/*******************************************************************************
INCLUDES
*******************************************************************************/
+
#ifdef FGFS
# include <Include/compiler.h>
# ifdef FG_HAVE_STD_INCLUDES
// ***************************************************************************
/** 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
*/
#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
*******************************************************************************/
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:
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;
}
}
switch(type) {
- case 1:
+ case VALUE:
coeffDefFile >> StaticValue;
break;
- case 2:
+ case VECTOR:
Allocate(rows,2);
for (r=1;r<=rows;r++) {
coeffDefFile >> Table3D[r][1];
}
break;
- case 3:
+ case TABLE:
Allocate(rows, columns);
for (c=1;c<=columns;c++) {
# include <fstream.h>
# endif
FG_USING_STD(string);
-# ifdef FG_HAVE_NATIVE_SGI_COMPILERS
- FG_USING_NAMESPACE(std);
-# endif
#else
# include <string>
# include <fstream>
#define FG_ALTITUDE 32768L
/*******************************************************************************
-CLASS DECLARATION
+FORWARD DECLARATIONS
*******************************************************************************/
-
class FGFDMExec;
class FGState;
class FGAtmosphere;
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:
float LookupR, LookupC;
long int mult_idx[10];
int rows, columns;
- int type;
+ Type type;
int multipliers;
int mult_count;
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"
*******************************************************************************/
-FGEngine::FGEngine(FGFDMExec* fdex, string enginePath, string engineName,
- int num)
+FGEngine::FGEngine(FGFDMExec* fdex, string enginePath, string engineName, int num)
{
string fullpath;
string tag;
# 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
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)
{
# 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
*******************************************************************************/
#else
# include <iostream>
#endif
+
#ifdef HAVE_CURSES
-# include <ncurses.h>
+ #include <ncurses.h>
#endif
#include "FGOutput.h"
#else
# include <cmath>
#endif
+
#include "FGPosition.h"
#include "FGAtmosphere.h"
#include "FGState.h"
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());
# include <fstream.h>
# endif
FG_USING_STD(string);
-# ifdef FG_HAVE_NATIVE_SGI_COMPILERS
- FG_USING_NAMESPACE(std);
-# endif
#else
# include <string>
# include <fstream>
********************************************************************************
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"
/*******************************************************************************
# include <fstream.h>
# endif
FG_USING_STD(string);
-# ifdef FG_HAVE_NATIVE_SGI_COMPILERS
- FG_USING_NAMESPACE(std);
-# endif
#else
# include <string>
# include <fstream>