Latest changes from Jon, plus ...
Tweaks for building with native SGI compilers.
This commit is contained in:
parent
53be443264
commit
7cc178d182
15 changed files with 225 additions and 63 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
*******************************************************************************/
|
||||
|
|
|
@ -49,8 +49,9 @@ INCLUDES
|
|||
#else
|
||||
# include <iostream>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURSES
|
||||
# include <ncurses.h>
|
||||
#include <ncurses.h>
|
||||
#endif
|
||||
|
||||
#include "FGOutput.h"
|
||||
|
|
|
@ -63,6 +63,7 @@ INCLUDES
|
|||
#else
|
||||
# include <cmath>
|
||||
#endif
|
||||
|
||||
#include "FGPosition.h"
|
||||
#include "FGAtmosphere.h"
|
||||
#include "FGState.h"
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue