From: curt Date: Wed, 20 Jun 2001 22:29:31 +0000 (+0000) Subject: Synced to latest version of JSBSim which [hopefully] includes all of Erik's X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d99b8fb2bac1529e8e7c55d130561d1c525c71d1;p=flightgear.git Synced to latest version of JSBSim which [hopefully] includes all of Erik's Irix patches. --- diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index 301f60553..c3fa97bf1 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -77,7 +77,9 @@ FGJSBsim::FGJSBsim( double dt ) Position = fdmex->GetPosition(); Auxiliary = fdmex->GetAuxiliary(); Aerodynamics = fdmex->GetAerodynamics(); - + + Atmosphere->UseInternal(); + fgic=new FGInitialCondition(fdmex); needTrim=true; @@ -130,15 +132,12 @@ FGJSBsim::~FGJSBsim(void) { // each subsequent iteration through the EOM void FGJSBsim::init() { - // Explicitly call the superclass's - // init method first. - FGInterface::init(); - - bool result; - + SG_LOG( SG_FLIGHT, SG_INFO, "Starting and initializing JSBsim" ); - - Atmosphere->UseInternal(); + + // Explicitly call the superclass's + // init method first. + FGInterface::init(); SG_LOG( SG_FLIGHT, SG_INFO, " Initializing JSBSim with:" ); diff --git a/src/FDM/JSBSim/FGAerodynamics.cpp b/src/FDM/JSBSim/FGAerodynamics.cpp index 778dd9538..1e18f3bb7 100644 --- a/src/FDM/JSBSim/FGAerodynamics.cpp +++ b/src/FDM/JSBSim/FGAerodynamics.cpp @@ -137,12 +137,12 @@ bool FGAerodynamics::LoadAerodynamics(FGConfigFile* AC_cfg) AC_cfg->GetNextConfigLine(); - while ((token = AC_cfg->GetValue()) != string("/AERODYNAMICS")) { + while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") { if (token == "AXIS") { CoeffArray ca; axis = AC_cfg->GetValue("NAME"); AC_cfg->GetNextConfigLine(); - while ((token = AC_cfg->GetValue()) != string("/AXIS")) { + while ((token = AC_cfg->GetValue()) != "/AXIS") { ca.push_back(new FGCoefficient(FDMExec, AC_cfg)); if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers()); } diff --git a/src/FDM/JSBSim/FGAircraft.cpp b/src/FDM/JSBSim/FGAircraft.cpp index 19294eaaf..65b863f88 100644 --- a/src/FDM/JSBSim/FGAircraft.cpp +++ b/src/FDM/JSBSim/FGAircraft.cpp @@ -210,8 +210,8 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f ReadPrologue(&AC_cfg); - while ((AC_cfg.GetNextConfigLine() != string("EOF")) && - (token = AC_cfg.GetValue()) != string("/FDM_CONFIG")) { + while ((AC_cfg.GetNextConfigLine() != "EOF") && + (token = AC_cfg.GetValue()) != "/FDM_CONFIG") { if (token == "METRICS") { if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl; ReadMetrics(&AC_cfg); @@ -318,9 +318,9 @@ void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg) AC_cfg->GetNextConfigLine(); - while ((token = AC_cfg->GetValue()) != string("/METRICS")) { + while ((token = AC_cfg->GetValue()) != "/METRICS") { *AC_cfg >> parameter; - if (parameter == string("AC_WINGAREA")) { + if (parameter == "AC_WINGAREA") { *AC_cfg >> WingArea; if (debug_lvl > 0) cout << " WingArea: " << WingArea << endl; } else if (parameter == "AC_WINGSPAN") { @@ -405,7 +405,7 @@ void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg) { AC_cfg->GetNextConfigLine(); - while ((token = AC_cfg->GetValue()) != string("/UNDERCARRIAGE")) { + while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") { lGear.push_back(FGLGear(AC_cfg, FDMExec)); } } @@ -423,7 +423,7 @@ void FGAircraft::ReadOutput(FGConfigFile* AC_cfg) { Output->SetType(token); AC_cfg->GetNextConfigLine(); - while ((token = AC_cfg->GetValue()) != string("/OUTPUT")) { + while ((token = AC_cfg->GetValue()) != "/OUTPUT") { *AC_cfg >> parameter; if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate; if (parameter == "SIMULATION") { @@ -501,7 +501,7 @@ void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg) { if (debug_lvl > 0) cout << " Version: " << highint << CFGVersion << normint << endl; - if (CFGVersion != string(NEEDED_CFG_VERSION)) { + if (CFGVersion != NEEDED_CFG_VERSION) { cerr << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT." " RESULTS WILL BE UNPREDICTABLE !!" << endl; cerr << "Current version needed is: " << NEEDED_CFG_VERSION << endl; diff --git a/src/FDM/JSBSim/FGConfigFile.cpp b/src/FDM/JSBSim/FGConfigFile.cpp index 2aa97e12a..4676353ad 100644 --- a/src/FDM/JSBSim/FGConfigFile.cpp +++ b/src/FDM/JSBSim/FGConfigFile.cpp @@ -32,11 +32,19 @@ CLASS IMPLEMENTATION FGConfigFile::FGConfigFile(string cfgFileName) { +#if defined ( sgi ) && !defined( __GNUC__ ) + cfgfile.open(cfgFileName.c_str(), ios::in ); +#else cfgfile.open(cfgFileName.c_str(), ios::in | ios::binary ); +#endif CommentsOn = false; CurrentIndex = 0; Opened = true; +#if defined ( sgi ) && !defined( __GNUC__ ) + if (!cfgfile.fail() && !cfgfile.eof()) GetNextConfigLine(); +#else if (cfgfile.is_open()) GetNextConfigLine(); +#endif else Opened = false; if (debug_lvl & 2) cout << "Instantiated: FGConfigFile" << endl; @@ -167,7 +175,11 @@ string FGConfigFile::GetLine(void) scratch += (char)test; } else { if ((test = cfgfile.get()) != EOF) { +#if defined ( sgi ) && !defined( __GNUC__ ) + if (test >= 0x20) cfgfile.putback(test); +#else if (test >= 0x20) cfgfile.unget(); +#endif break; } } diff --git a/src/FDM/JSBSim/FGConfigFile.h b/src/FDM/JSBSim/FGConfigFile.h index 5a458bea9..017498970 100644 --- a/src/FDM/JSBSim/FGConfigFile.h +++ b/src/FDM/JSBSim/FGConfigFile.h @@ -44,13 +44,15 @@ INCLUDES # include STL_FSTREAM # include STL_IOSTREAM SG_USING_STD(string); - SG_USING_STD(ostream); - SG_USING_STD(istream); - SG_USING_STD(ifstream); - SG_USING_STD(cerr); - SG_USING_STD(endl); - SG_USING_STD(ios); - SG_USING_STD(cout); +# if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) + SG_USING_STD(ostream); + SG_USING_STD(istream); + SG_USING_STD(ifstream); + SG_USING_STD(cerr); + SG_USING_STD(endl); + SG_USING_STD(ios); + SG_USING_STD(cout); +# endif #else # include # include diff --git a/src/FDM/JSBSim/FGDefs.h b/src/FDM/JSBSim/FGDefs.h index 72ed411dd..2b1ec119c 100644 --- a/src/FDM/JSBSim/FGDefs.h +++ b/src/FDM/JSBSim/FGDefs.h @@ -59,6 +59,10 @@ SENTRY #define HPTOFTLBSSEC 550 #define METERS_TO_FEET 3.2808 +#if defined ( sgi ) && !defined( __GNUC__ ) +#define __STL_FUNCTION_TMPL_PARTIAL_ORDER +#endif + enum eParam { FG_UNDEF = 0, FG_TIME, diff --git a/src/FDM/JSBSim/FGFCS.cpp b/src/FDM/JSBSim/FGFCS.cpp index bb92800b6..466e0147f 100644 --- a/src/FDM/JSBSim/FGFCS.cpp +++ b/src/FDM/JSBSim/FGFCS.cpp @@ -37,6 +37,8 @@ HISTORY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#include "FGDefs.h" + #include "FGFCS.h" #include "FGState.h" #include "FGFDMExec.h" diff --git a/src/FDM/JSBSim/FGMatrix.h b/src/FDM/JSBSim/FGMatrix.h index 99673444e..9d46522e3 100644 --- a/src/FDM/JSBSim/FGMatrix.h +++ b/src/FDM/JSBSim/FGMatrix.h @@ -28,11 +28,13 @@ INCLUDES # include STL_FSTREAM # include STL_IOSTREAM SG_USING_STD(string); - SG_USING_STD(ostream); - SG_USING_STD(istream); - SG_USING_STD(cerr); - SG_USING_STD(cout); - SG_USING_STD(endl); +# if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) + SG_USING_STD(ostream); + SG_USING_STD(istream); + SG_USING_STD(cerr); + SG_USING_STD(cout); + SG_USING_STD(endl); +# endif #else # include # include diff --git a/src/FDM/JSBSim/FGPiston.cpp b/src/FDM/JSBSim/FGPiston.cpp index e60a65fa3..805200f18 100644 --- a/src/FDM/JSBSim/FGPiston.cpp +++ b/src/FDM/JSBSim/FGPiston.cpp @@ -38,6 +38,7 @@ HISTORY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#include "FGDefs.h" #include "FGPiston.h" static const char *IdSrc = "$Id$"; diff --git a/src/FDM/JSBSim/FGRocket.cpp b/src/FDM/JSBSim/FGRocket.cpp index 080dff9d5..0b0a0c30f 100644 --- a/src/FDM/JSBSim/FGRocket.cpp +++ b/src/FDM/JSBSim/FGRocket.cpp @@ -38,6 +38,7 @@ HISTORY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#include "FGDefs.h" #include "FGRocket.h" static const char *IdSrc = "$Id$"; diff --git a/src/FDM/JSBSim/FGState.cpp b/src/FDM/JSBSim/FGState.cpp index 58ca50ab5..d97dfb439 100644 --- a/src/FDM/JSBSim/FGState.cpp +++ b/src/FDM/JSBSim/FGState.cpp @@ -344,7 +344,11 @@ bool FGState::Reset(string path, string acname, string fname) { resetDef = path + "/" + acname + "/" + fname + ".xml"; +#if defined ( sgi ) && !defined( __GNUC__ ) + ifstream resetfile(resetDef.c_str(), ios::in ); +#else ifstream resetfile(resetDef.c_str(), ios::in | ios::binary ); +#endif if (resetfile) { resetfile >> U; diff --git a/src/FDM/JSBSim/FGTable.cpp b/src/FDM/JSBSim/FGTable.cpp index 54ddab0b6..0ef6f3242 100644 --- a/src/FDM/JSBSim/FGTable.cpp +++ b/src/FDM/JSBSim/FGTable.cpp @@ -37,7 +37,12 @@ INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #include "FGTable.h" + +#if defined ( sgi ) && !defined( __GNUC__ ) +#include +#else #include +#endif static const char *IdSrc = "$Id$"; static const char *IdHdr = ID_TABLE; diff --git a/src/FDM/JSBSim/FGTank.cpp b/src/FDM/JSBSim/FGTank.cpp index 7162dd88e..6efda6821 100644 --- a/src/FDM/JSBSim/FGTank.cpp +++ b/src/FDM/JSBSim/FGTank.cpp @@ -36,6 +36,7 @@ HISTORY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#include "FGDefs.h" #include "FGTank.h" static const char *IdSrc = "$Id$"; @@ -47,9 +48,11 @@ extern short debug_lvl; CLASS IMPLEMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#if !defined ( sgi ) || defined( __GNUC__ ) using std::cerr; using std::endl; using std::cout; +#endif FGTank::FGTank(FGConfigFile* AC_cfg) { diff --git a/src/FDM/JSBSim/FGTank.h b/src/FDM/JSBSim/FGTank.h index 05790440a..d70933ce9 100644 --- a/src/FDM/JSBSim/FGTank.h +++ b/src/FDM/JSBSim/FGTank.h @@ -50,9 +50,11 @@ INCLUDES # include # include STL_STRING SG_USING_STD(string); - SG_USING_STD(cerr); - SG_USING_STD(endl); - SG_USING_STD(cout); +# if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) + SG_USING_STD(cerr); + SG_USING_STD(endl); + SG_USING_STD(cout); +# endif #else # include using std::string; diff --git a/src/FDM/JSBSim/FGfdmSocket.h b/src/FDM/JSBSim/FGfdmSocket.h index 803c01f57..f2009d46f 100644 --- a/src/FDM/JSBSim/FGfdmSocket.h +++ b/src/FDM/JSBSim/FGfdmSocket.h @@ -49,8 +49,10 @@ INCLUDES # include STL_STRING # include STL_IOSTREAM # include STL_FSTREAM - SG_USING_STD(cout); - SG_USING_STD(endl); +# if !defined(SG_HAVE_NATIVE_SGI_COMPILERS) + SG_USING_STD(cout); + SG_USING_STD(endl); +# endif #else # include # include diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 39e012382..1ef2fbb68 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -48,34 +48,17 @@ FGLaRCsim::FGLaRCsim( double dt ) { lsic=new LaRCsimIC; //this needs to be brought up after LaRCsim is copy_to_LaRCsim(); // initialize all of LaRCsim's vars + //this should go away someday -- formerly done in fg_init.cxx Mass = 8.547270E+01; I_xx = 1.048000E+03; I_yy = 3.000000E+03; I_zz = 3.530000E+03; I_xz = 0.000000E+00; - //current_aircraft.fdm_state->set_Tank1Fuel(15.0); - //current_aircraft.fdm_state->set_Tank2Fuel(15.0); - //Tank1Fuel = 15.0; - //Tank2Fuel = 15.0; -} - -FGLaRCsim::~FGLaRCsim(void) { - if(lsic != NULL) { - delete lsic; - } -} - -// Initialize the LaRCsim flight model, dt is the time increment for -// each subsequent iteration through the EOM -void FGLaRCsim::init() { - - // Explicitly call the superclass's - // init method first. - FGInterface::init(); - + ls_set_model_dt( get_delta_t() ); - // Initialize our little engine that hopefully might + + // Initialize our little engine that hopefully might eng.init( get_delta_t() ); // dcl - in passing dt to init rather than update I am assuming // that the LaRCsim dt is fixed at one value (yes it is 120hz CLO) @@ -91,31 +74,22 @@ void FGLaRCsim::init() { set_Tank1Fuel(28.0); set_Tank2Fuel(28.0); - // SG_LOG( SG_FLIGHT, SG_INFO, "FGLaRCsim::init()" ); - double save_alt = 0.0; +} - if ( get_Altitude() < -9000.0 ) { - save_alt = get_Altitude(); - set_Altitude( 0.0 ); +FGLaRCsim::~FGLaRCsim(void) { + if(lsic != NULL) { + delete lsic; } +} - // translate FG to LaRCsim structure - copy_to_LaRCsim(); - - // actual LaRCsim top level init - // ls_toplevel_init( dt, (char *)fgGetString("/sim/aircraft").c_str() ); - - SG_LOG( SG_FLIGHT, SG_INFO, "FG pos = " << - get_Latitude() ); - - // translate LaRCsim back to FG structure - copy_from_LaRCsim(); +// Initialize the LaRCsim flight model, dt is the time increment for +// each subsequent iteration through the EOM +void FGLaRCsim::init() { - // but lets restore our original bogus altitude when we are done - if ( save_alt < -9000.0 ) { - set_Altitude( save_alt ); - } + // Explicitly call the superclass's + // init method first. + FGInterface::init(); }