1
0
Fork 0

Latest JSBSim changes, including SGI patch.

This commit is contained in:
david 2002-02-01 02:11:13 +00:00
parent 83711bfd82
commit d3db1e622b
7 changed files with 379 additions and 192 deletions

View file

@ -116,9 +116,14 @@ string FGGroundReactions::GetGroundReactionStrings(void)
for (unsigned int i=0;i<lGear.size();i++) { for (unsigned int i=0;i<lGear.size();i++) {
if (!firstime) GroundReactionStrings += ", "; if (!firstime) GroundReactionStrings += ", ";
GroundReactionStrings += (lGear[i].GetName() + "_WOW, "); GroundReactionStrings += (lGear[i].GetName() + "_WOW, ");
GroundReactionStrings += (lGear[i].GetName() + "_compressLength, "); GroundReactionStrings += (lGear[i].GetName() + "_stroke, ");
GroundReactionStrings += (lGear[i].GetName() + "_compressSpeed, "); GroundReactionStrings += (lGear[i].GetName() + "_strokeVel, ");
GroundReactionStrings += (lGear[i].GetName() + "_Force"); GroundReactionStrings += (lGear[i].GetName() + "_CompressForce, ");
GroundReactionStrings += (lGear[i].GetName() + "_WhlSideForce, ");
GroundReactionStrings += (lGear[i].GetName() + "_WhlRollForce, ");
GroundReactionStrings += (lGear[i].GetName() + "_BodyXForce, ");
GroundReactionStrings += (lGear[i].GetName() + "_BodyYForce, ");
GroundReactionStrings += (lGear[i].GetName() + "_WhlSlipDegrees");
firstime = false; firstime = false;
} }
@ -140,7 +145,12 @@ string FGGroundReactions::GetGroundReactionValues(void)
GroundReactionValues += string( lGear[i].GetWOW()?"1":"0" ) + ", "; GroundReactionValues += string( lGear[i].GetWOW()?"1":"0" ) + ", ";
GroundReactionValues += (string(gcvt(lGear[i].GetCompLen(), 5, buff)) + ", "); GroundReactionValues += (string(gcvt(lGear[i].GetCompLen(), 5, buff)) + ", ");
GroundReactionValues += (string(gcvt(lGear[i].GetCompVel(), 6, buff)) + ", "); GroundReactionValues += (string(gcvt(lGear[i].GetCompVel(), 6, buff)) + ", ");
GroundReactionValues += (string(gcvt(lGear[i].GetCompForce(), 10, buff))); GroundReactionValues += (string(gcvt(lGear[i].GetCompForce(), 10, buff)) + ", ");
GroundReactionValues += (string(gcvt(lGear[i].GetWheelSideForce(), 6, buff)) + ", ");
GroundReactionValues += (string(gcvt(lGear[i].GetWheelRollForce(), 6, buff)) + ", ");
GroundReactionValues += (string(gcvt(lGear[i].GetBodyXForce(), 6, buff)) + ", ");
GroundReactionValues += (string(gcvt(lGear[i].GetBodyYForce(), 6, buff)) + ", ");
GroundReactionValues += (string(gcvt(lGear[i].GetWheelSlipAngle(), 6, buff)));
firstime = false; firstime = false;
} }

View file

@ -256,6 +256,7 @@ public:
@return pointer to a Message structure (or NULL if no mesage) */ @return pointer to a Message structure (or NULL if no mesage) */
Message* ProcessMessage(void); Message* ProcessMessage(void);
//@} //@}
string GetVersion(void) {return JSBSim_version;}
protected: protected:
static Message localMsg; static Message localMsg;

View file

@ -181,6 +181,9 @@ FGLGear::~FGLGear()
FGColumnVector3& FGLGear::Force(void) FGColumnVector3& FGLGear::Force(void)
{ {
double SteerGain = 0;
double SinWheel, CosWheel;
vForce.InitMatrix(); vForce.InitMatrix();
vMoment.InitMatrix(); vMoment.InitMatrix();
@ -201,10 +204,6 @@ FGColumnVector3& FGLGear::Force(void)
} }
if (GearDown) { if (GearDown) {
double SteerGain = 0;
double SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
double RollingForce, SideForce, FCoeff;
double WheelSlip;
vWhlBodyVec = (vXYZ - MassBalance->GetXYZcg()) / 12.0; vWhlBodyVec = (vXYZ - MassBalance->GetXYZcg()) / 12.0;
vWhlBodyVec(eX) = -vWhlBodyVec(eX); vWhlBodyVec(eX) = -vWhlBodyVec(eX);

View file

@ -232,9 +232,14 @@ public:
inline int GetBrakeGroup(void) { return (int)eBrakeGrp; } inline int GetBrakeGroup(void) { return (int)eBrakeGrp; }
inline int GetSteerType(void) { return (int)eSteerType; } inline int GetSteerType(void) { return (int)eSteerType; }
inline bool GetRetractable(void) { return isRetractable; } inline bool GetRetractable(void) { return isRetractable; }
inline bool GetGearUnitUp(void) { return GearUp; } inline bool GetGearUnitUp(void) { return GearUp; }
inline bool GetGearUnitDown(void) { return GearDown; } inline bool GetGearUnitDown(void) { return GearDown; }
inline double GetWheelSideForce(void) { return SideForce; }
inline double GetWheelRollForce(void) { return RollingForce; }
inline double GetBodyXForce(void) { return vLocalForce(eX); }
inline double GetBodyYForce(void) { return vLocalForce(eY); }
inline double GetWheelSlipAngle(void) { return WheelSlip; }
private: private:
FGColumnVector3 vXYZ; FGColumnVector3 vXYZ;
@ -258,6 +263,9 @@ private:
double DistanceTraveled; double DistanceTraveled;
double MaximumStrutForce; double MaximumStrutForce;
double MaximumStrutTravel; double MaximumStrutTravel;
double SideWhlVel, RollingWhlVel;
double RollingForce, SideForce, FCoeff;
double WheelSlip;
bool WOW; bool WOW;
bool lastWOW; bool lastWOW;
bool FirstContact; bool FirstContact;

View file

@ -211,7 +211,12 @@ void FGTable::Print(void)
if (Type == tt1D) startRow = 1; if (Type == tt1D) startRow = 1;
else startRow = 0; else startRow = 0;
#if defined (sgi) && !defined(__GNUC__)
unsigned long flags = cout.setf(ios::fixed);
#else
ios::fmtflags flags = cout.setf(ios::fixed); // set up output stream ios::fmtflags flags = cout.setf(ios::fixed); // set up output stream
#endif
cout.precision(4); cout.precision(4);
for (int r=startRow; r<=nRows; r++) { for (int r=startRow; r<=nRows; r++) {

View file

@ -116,7 +116,8 @@ bool FGTranslation::Run(void)
vUVWdot = mVel*Rotation->GetPQR() + Aircraft->GetBodyAccel(); vUVWdot = mVel*Rotation->GetPQR() + Aircraft->GetBodyAccel();
vUVW += Tc * (vlastUVWdot + vUVWdot); vUVW += Tc*(vUVWdot + vlastUVWdot);
vAeroUVW = vUVW + State->GetTl2b()*Atmosphere->GetWindNED(); vAeroUVW = vUVW + State->GetTl2b()*Atmosphere->GetWindNED();
Vt = vAeroUVW.Magnitude(); Vt = vAeroUVW.Magnitude();

View file

@ -1,180 +1,343 @@
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Module: JSBSim.cpp Module: JSBSim.cpp
Author: Jon S. Berndt Author: Jon S. Berndt
Date started: 08/17/99 Date started: 08/17/99
Purpose: Standalone version of JSBSim. Purpose: Standalone version of JSBSim.
Called by: The USER. Called by: The USER.
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) ------------- ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later Foundation; either version 2 of the License, or (at your option) any later
version. version.
This program is distributed in the hope that it will be useful, but WITHOUT This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. details.
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA. Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU General Public License can also be found on Further information about the GNU General Public License can also be found on
the world wide web at http://www.gnu.org. the world wide web at http://www.gnu.org.
FUNCTIONAL DESCRIPTION FUNCTIONAL DESCRIPTION
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
This class Handles calling JSBSim standalone. It is set up for compilation under This class Handles calling JSBSim standalone. It is set up for compilation under
Borland C+Builder or other compiler. Borland C+Builder or other compiler.
HISTORY HISTORY
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
08/17/99 JSB Created 08/17/99 JSB Created
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGFDMExec.h" #include "FGFDMExec.h"
#include "FGRotation.h" #include "FGRotation.h"
#include "FGAtmosphere.h" #include "FGAtmosphere.h"
#include "FGState.h" #include "FGState.h"
#include "FGFCS.h" #include "FGFCS.h"
#include "FGAircraft.h" #include "FGAircraft.h"
#include "FGTranslation.h" #include "FGTranslation.h"
#include "FGPosition.h" #include "FGPosition.h"
#include "FGAuxiliary.h" #include "FGAuxiliary.h"
#include "FGOutput.h" #include "FGOutput.h"
#include "FGConfigFile.h" #include "FGConfigFile.h"
#include "FGScript.h" #include "FGScript.h"
#include "FGJSBBase.h"
#ifdef FGFS
#include <simgear/compiler.h> #ifdef FGFS
#include STL_IOSTREAM #include <simgear/compiler.h>
#else #include STL_IOSTREAM
# if defined(sgi) && !defined(__GNUC__) #else
# include <iostream.h> # if defined(sgi) && !defined(__GNUC__)
# else # include <iostream.h>
# include <iostream> # else
# endif # include <iostream>
#endif # endif
#endif
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS #if __BCPLUSPLUS__ == 0x540
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ #pragma hdrstop
#include <condefs.h>
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //---------------------------------------------------------------------------
GLOBAL DATA USERES("JSBSim.res");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ USEUNIT("FGUtility.cpp");
USEUNIT("FGAircraft.cpp");
static const char *IdSrc = "$Id$"; USEUNIT("FGAtmosphere.cpp");
USEUNIT("FGAuxiliary.cpp");
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% USEUNIT("FGCoefficient.cpp");
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs] USEUNIT("FGColumnVector3.cpp");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ USEUNIT("FGColumnVector4.cpp");
USEUNIT("FGConfigFile.cpp");
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% USEUNIT("FGEngine.cpp");
DOCUMENTATION USEUNIT("FGFactorGroup.cpp");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ USEUNIT("FGFCS.cpp");
USEUNIT("FGFDMExec.cpp");
/** Standalone JSBSim main program USEUNIT("FGfdmSocket.cpp");
This is the wrapper program used to instantiate the JSBSim system and control USEUNIT("FGForce.cpp");
it. Use this program to build a version of JSBSim that can be run from the USEUNIT("FGGroundReactions.cpp");
command line. To get any use out of this, you will have to create a script USEUNIT("FGInertial.cpp");
to run a test case and specify what kind of output you would like. USEUNIT("FGInitialCondition.cpp");
@author Jon S. Berndt USEUNIT("FGJSBBase.cpp");
@version $Id$ USEUNIT("FGLGear.cpp");
@see - USEUNIT("FGMassBalance.cpp");
*/ USEUNIT("FGMatrix33.cpp");
USEUNIT("FGModel.cpp");
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% USEUNIT("FGNozzle.cpp");
IMPLEMENTATION USEUNIT("FGOutput.cpp");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ USEUNIT("FGPiston.cpp");
USEUNIT("FGPosition.cpp");
int main(int argc, char** argv) USEUNIT("FGPropeller.cpp");
{ USEUNIT("FGPropulsion.cpp");
FGFDMExec* FDMExec; USEUNIT("FGRocket.cpp");
bool result = false; USEUNIT("FGRotation.cpp");
bool Scripted = false; USEUNIT("FGRotor.cpp");
FGScript* Script; USEUNIT("FGScript.cpp");
USEUNIT("FGState.cpp");
if (argc != 3 && argc != 2) { USEUNIT("FGTable.cpp");
cerr << endl USEUNIT("FGTank.cpp");
<< " You must enter the name of a registered aircraft and reset point:" USEUNIT("FGThruster.cpp");
<< endl << endl << " FDM <aircraft name> <reset file>" << endl; USEUNIT("FGTranslation.cpp");
cerr << endl << " Alternatively, you may specify only the name of a script file:" USEUNIT("FGTrim.cpp");
<< endl << endl << " FDM <script file>" << endl << endl; USEUNIT("FGTrimAxis.cpp");
exit(0); USEUNIT("FGTurboJet.cpp");
} USEUNIT("FGTurboProp.cpp");
USEUNIT("FGTurboShaft.cpp");
FDMExec = new FGFDMExec(); USEUNIT("FGAerodynamics.cpp");
USEUNIT("filtersjb\FGSwitch.cpp");
if (argc == 2) { // SCRIPTED CASE USEUNIT("filtersjb\FGFCSComponent.cpp");
USEUNIT("filtersjb\FGFilter.cpp");
Script = new FGScript(FDMExec); USEUNIT("filtersjb\FGGain.cpp");
result = Script->LoadScript(argv[1]); USEUNIT("filtersjb\FGGradient.cpp");
USEUNIT("filtersjb\FGKinemat.cpp");
if (!result) { USEUNIT("filtersjb\FGSummer.cpp");
cerr << "Script file " << argv[1] << " was not successfully loaded" << endl; USEUNIT("filtersjb\FGDeadBand.cpp");
exit(-1); //---------------------------------------------------------------------------
} #pragma argsused
#endif
Scripted = true;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
} else { // form jsbsim <acname> <resetfile> DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
if ( ! FDMExec->LoadModel("aircraft", "engine", string(argv[1]))) {
cerr << " JSBSim could not be started" << endl << endl; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
exit(-1); GLOBAL DATA
} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGInitialCondition IC(FDMExec); static const char *IdSrc = "$Id$";
if ( ! IC.Load("aircraft",string(argv[1]),string(argv[2]))) {
cerr << "Initialization unsuccessful" << endl; string ScriptName;
exit(-1); string AircraftName;
} string ResetName;
} string LogOutputName;
string LogDirectiveName;
// FGFDMExec* FDMExec;
// RUN loop. MESSAGES are read inside the Run() loop and output as necessary.
// /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
FGJSBBase::Message* msg; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
result = FDMExec->Run();
while (result) { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
while (FDMExec->ReadMessage()) { FORWARD DECLARATIONS
msg = FDMExec->ProcessMessage(); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
switch (msg->type) {
case FGJSBBase::Message::eText: void options(int, char**);
cout << msg->messageId << ": " << msg->text << endl;
break; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
case FGJSBBase::Message::eBool: DOCUMENTATION
cout << msg->messageId << ": " << msg->text << " " << msg->bVal << endl; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
break;
case FGJSBBase::Message::eInteger: /** Standalone JSBSim main program
cout << msg->messageId << ": " << msg->text << " " << msg->iVal << endl; This is the wrapper program used to instantiate the JSBSim system and control
break; it. Use this program to build a version of JSBSim that can be run from the
case FGJSBBase::Message::eDouble: command line. To get any use out of this, you will have to create a script
cout << msg->messageId << ": " << msg->text << " " << msg->dVal << endl; to run a test case and specify what kind of output you would like.
break; @author Jon S. Berndt
default: @version $Id$
cerr << "Unrecognized message type." << endl; @see -
break; */
}
} /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IMPLEMENTATION
if (Scripted) { %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
if (!Script->RunScript()) break;
} int main(int argc, char* argv[])
{
result = FDMExec->Run(); ScriptName = "";
} AircraftName = "";
ResetName = "";
delete FDMExec; LogOutputName = "";
LogDirectiveName = "";
return 0; bool result = false;
} bool Scripted = false;
FGScript* Script;
options(argc, argv);
FDMExec = new FGFDMExec();
if (!ScriptName.empty()) { // SCRIPTED CASE
Script = new FGScript(FDMExec);
result = Script->LoadScript(ScriptName);
if (!result) {
cerr << "Script file " << ScriptName << " was not successfully loaded" << endl;
exit(-1);
}
Scripted = true;
} else if (!AircraftName.empty() || !ResetName.empty()) { // form jsbsim <acname> <resetfile>
if ( ! FDMExec->LoadModel("aircraft", "engine", AircraftName)) {
cerr << " JSBSim could not be started" << endl << endl;
exit(-1);
}
FGInitialCondition IC(FDMExec);
if ( ! IC.Load("aircraft",AircraftName,ResetName)) {
cerr << "Initialization unsuccessful" << endl;
exit(-1);
}
} else {
cout << " No Aircraft, Script, or Reset information given" << endl << endl;
exit(-1);
}
//
// RUN loop. MESSAGES are read inside the Run() loop and output as necessary.
//
FGJSBBase::Message* msg;
result = FDMExec->Run();
while (result) {
while (FDMExec->ReadMessage()) {
msg = FDMExec->ProcessMessage();
switch (msg->type) {
case FGJSBBase::Message::eText:
cout << msg->messageId << ": " << msg->text << endl;
break;
case FGJSBBase::Message::eBool:
cout << msg->messageId << ": " << msg->text << " " << msg->bVal << endl;
break;
case FGJSBBase::Message::eInteger:
cout << msg->messageId << ": " << msg->text << " " << msg->iVal << endl;
break;
case FGJSBBase::Message::eDouble:
cout << msg->messageId << ": " << msg->text << " " << msg->dVal << endl;
break;
default:
cerr << "Unrecognized message type." << endl;
break;
}
}
if (Scripted) {
if (!Script->RunScript()) break;
}
result = FDMExec->Run();
}
delete FDMExec;
return 0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void options(int count, char **arg)
{
int i;
if (count == 1) {
cout << endl << " JSBSim version " << FDMExec->GetVersion() << endl << endl;
cout << " Usage: jsbsim <options>" << endl << endl;
cout << " options:" << endl;
cout << " --help returns this message" << endl;
cout << " --version returns the version number" << endl;
cout << " --outputlogfile=<filename> sets the name of the data output file" << endl;
cout << " --logdirectivefile=<filename> specifies the name of the data logging directives file" << endl;
cout << " --aircraft=<filename> specifies the name of the aircraft to be modeled" << endl;
cout << " --script=<filename> specifies a script to run" << endl;
cout << " --initfile=<filename> specifies an initilization file" << endl << endl;
cout << " NOTE: There can be no spaces around the = sign when" << endl;
cout << " an option is followed by a filename" << endl << endl;
}
for (i=1; i<count; i++) {
string argument = string(arg[i]);
int n=0;
if (argument.find("--help") != string::npos) {
cout << endl << " JSBSim version " << FDMExec->GetVersion() << endl << endl;
cout << " Usage: jsbsim <options>" << endl << endl;
cout << " options:" << endl;
cout << " --help returns this message" << endl;
cout << " --version returns the version number" << endl;
cout << " --outputlogfile=<filename> sets the name of the data output file" << endl;
cout << " --logdirectivefile=<filename> specifies the name of the data logging directives file" << endl;
cout << " --aircraft=<filename> specifies the name of the aircraft to be modeled" << endl;
cout << " --script=<filename> specifies a script to run" << endl;
cout << " --initfile=<filename> specifies an initilization file" << endl << endl;
cout << " NOTE: There can be no spaces around the = sign when" << endl;
cout << " an option is followed by a filename" << endl << endl;
exit(0);
} else if (argument.find("--version") != string::npos) {
cout << endl << " JSBSim Version: " << FDMExec->GetVersion() << endl << endl;
exit (0);
} else if (argument.find("--outputlogfile") != string::npos) {
n = argument.find("=")+1;
if (n > 0) {
LogOutputName = argument.substr(argument.find("=")+1);
} else {
LogOutputName = "JSBout.csv";
cerr << " Output log file name not valid or not understood. Using JSBout.csv as default";
}
} else if (argument.find("--logdirectivefile") != string::npos) {
n = argument.find("=")+1;
if (n > 0) {
LogDirectiveName = argument.substr(argument.find("=")+1);
} else {
cerr << " Log directives file not valid or not understood." << endl << endl;
exit(1);
}
} else if (argument.find("--aircraft") != string::npos) {
n = argument.find("=")+1;
if (n > 0) {
AircraftName = argument.substr(argument.find("=")+1);
} else {
cerr << " Aircraft name not valid or not understood." << endl << endl;
exit(1);
}
} else if (argument.find("--script") != string::npos) {
n = argument.find("=")+1;
if (n > 0) {
ScriptName = argument.substr(argument.find("=")+1);
} else {
cerr << " Script name not valid or not understood." << endl << endl;
exit(1);
}
} else if (argument.find("--initfile") != string::npos) {
n = argument.find("=")+1;
if (n > 0) {
ResetName = argument.substr(argument.find("=")+1);
} else {
cerr << " Reset name not valid or not understood." << endl << endl;
exit(1);
}
} else {
cerr << endl << " Parameter: " << argument << " not understood" << endl;
}
}
}