]> git.mxchange.org Git - flightgear.git/commitdiff
Latest JSBSim changes, including SGI patch.
authordavid <david>
Fri, 1 Feb 2002 02:11:13 +0000 (02:11 +0000)
committerdavid <david>
Fri, 1 Feb 2002 02:11:13 +0000 (02:11 +0000)
src/FDM/JSBSim/FGGroundReactions.cpp
src/FDM/JSBSim/FGJSBBase.h
src/FDM/JSBSim/FGLGear.cpp
src/FDM/JSBSim/FGLGear.h
src/FDM/JSBSim/FGTable.cpp
src/FDM/JSBSim/FGTranslation.cpp
src/FDM/JSBSim/JSBSim.cpp

index 3f133eeace2253605406d1a1418314abf350b4de..dde442afd1930a00b4696591fd08dd31903f76b2 100644 (file)
@@ -116,9 +116,14 @@ string FGGroundReactions::GetGroundReactionStrings(void)
   for (unsigned int i=0;i<lGear.size();i++) {
     if (!firstime) GroundReactionStrings += ", ";
     GroundReactionStrings += (lGear[i].GetName() + "_WOW, ");
-    GroundReactionStrings += (lGear[i].GetName() + "_compressLength, ");
-    GroundReactionStrings += (lGear[i].GetName() + "_compressSpeed, ");
-    GroundReactionStrings += (lGear[i].GetName() + "_Force");
+    GroundReactionStrings += (lGear[i].GetName() + "_stroke, ");
+    GroundReactionStrings += (lGear[i].GetName() + "_strokeVel, ");
+    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;
   }
@@ -140,7 +145,12 @@ string FGGroundReactions::GetGroundReactionValues(void)
     GroundReactionValues += string( lGear[i].GetWOW()?"1":"0" ) + ", ";
     GroundReactionValues += (string(gcvt(lGear[i].GetCompLen(),    5, 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;
   }
index ee55600d2f0a23d118b5b0c2907b6d4d5fc21529..e515a91629f27d9988a1b17cc72c12e8f78f456a 100644 (file)
@@ -256,6 +256,7 @@ public:
       @return pointer to a Message structure (or NULL if no mesage) */
   Message* ProcessMessage(void);
   //@}
+  string GetVersion(void) {return JSBSim_version;}
 
 protected:
   static Message localMsg;
index 1ddc4a9a35654617f8a19498358f35b1094caa89..e824f6d49a7c975cb89f74ad6bed87a720c60131 100644 (file)
@@ -181,6 +181,9 @@ FGLGear::~FGLGear()
 
 FGColumnVector3& FGLGear::Force(void)
 {
+  double SteerGain = 0;
+  double SinWheel, CosWheel;
+
   vForce.InitMatrix();
   vMoment.InitMatrix();
 
@@ -201,10 +204,6 @@ FGColumnVector3& FGLGear::Force(void)
   }         
       
   if (GearDown) {
-    double SteerGain = 0;
-    double SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
-    double RollingForce, SideForce, FCoeff;
-    double WheelSlip;
 
     vWhlBodyVec     = (vXYZ - MassBalance->GetXYZcg()) / 12.0;
     vWhlBodyVec(eX) = -vWhlBodyVec(eX);
index 1c4857b169fcfc9f2edce65f86a9c8f6342a1505..84520b5e7b863477639a3e88edb36582d5eb4f07 100644 (file)
@@ -232,9 +232,14 @@ public:
   inline int GetBrakeGroup(void) { return (int)eBrakeGrp; }
   inline int GetSteerType(void)  { return (int)eSteerType; }
   
-  inline bool GetRetractable(void)  { return isRetractable; }
-  inline bool GetGearUnitUp(void)   { return GearUp; }
-  inline bool GetGearUnitDown(void) { return GearDown; }
+  inline bool GetRetractable(void)         { return isRetractable;   }
+  inline bool GetGearUnitUp(void)          { return GearUp;          }
+  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:
   FGColumnVector3 vXYZ;
@@ -258,6 +263,9 @@ private:
   double DistanceTraveled;
   double MaximumStrutForce;
   double MaximumStrutTravel;
+  double SideWhlVel, RollingWhlVel;
+  double RollingForce, SideForce, FCoeff;
+  double WheelSlip;
   bool WOW;
   bool lastWOW;
   bool FirstContact;
index d9256decbc53a9cdf3e79bd2c525bef3d456a6b5..20e0fdd18320cbb51c205e53a40190ffc299624e 100644 (file)
@@ -211,7 +211,12 @@ void FGTable::Print(void)
   if (Type == tt1D) startRow = 1;
   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
+#endif
+
   cout.precision(4);
 
   for (int r=startRow; r<=nRows; r++) {
index fe6714dfe97dd24cef98762f6eedd3d00865fc60..9b36f81cf9adb929ce36b03063aca774b1ff8a67 100644 (file)
@@ -116,7 +116,8 @@ bool FGTranslation::Run(void)
 
     vUVWdot = mVel*Rotation->GetPQR() + Aircraft->GetBodyAccel();
 
-    vUVW += Tc * (vlastUVWdot + vUVWdot);
+    vUVW += Tc*(vUVWdot + vlastUVWdot);
+
     vAeroUVW = vUVW + State->GetTl2b()*Atmosphere->GetWindNED();
 
     Vt = vAeroUVW.Magnitude();
index e79d96fc78c212208482d3a64cc857af6f641831..cbe40ff0b126c360182612031d241bf2e80393b6 100644 (file)
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
- Module:       JSBSim.cpp
- Author:       Jon S. Berndt
- Date started: 08/17/99
- Purpose:      Standalone version of JSBSim.
- Called by:    The USER.
-
- ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
-
- 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
- Foundation; either version 2 of the License, or (at your option) any later
- version.
-
- 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
- FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
- details.
-
- 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
- Place - Suite 330, Boston, MA  02111-1307, USA.
-
- Further information about the GNU General Public License can also be found on
- the world wide web at http://www.gnu.org.
-
-FUNCTIONAL DESCRIPTION
---------------------------------------------------------------------------------
-
-This class Handles calling JSBSim standalone. It is set up for compilation under
-Borland C+Builder or other compiler.
-
-HISTORY
---------------------------------------------------------------------------------
-08/17/99   JSB   Created
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-INCLUDES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-#include "FGFDMExec.h"
-#include "FGRotation.h"
-#include "FGAtmosphere.h"
-#include "FGState.h"
-#include "FGFCS.h"
-#include "FGAircraft.h"
-#include "FGTranslation.h"
-#include "FGPosition.h"
-#include "FGAuxiliary.h"
-#include "FGOutput.h"
-#include "FGConfigFile.h"
-#include "FGScript.h"
-
-#ifdef FGFS
-#include <simgear/compiler.h>
-#include STL_IOSTREAM
-#else
-#  if defined(sgi) && !defined(__GNUC__)
-#    include <iostream.h>
-#  else
-#    include <iostream>
-#  endif
-#endif
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINITIONS
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-GLOBAL DATA
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-static const char *IdSrc = "$Id$";
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DOCUMENTATION
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-/** Standalone JSBSim main program
-    This is the wrapper program used to instantiate the JSBSim system and control
-    it. Use this program to build a version of JSBSim that can be run from the
-    command line. To get any use out of this, you will have to create a script
-    to run a test case and specify what kind of output you would like.
-    @author Jon S. Berndt
-    @version $Id$
-    @see -
-*/
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-IMPLEMENTATION
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-int main(int argc, char** argv)
-{
-  FGFDMExec* FDMExec;
-  bool result = false;
-  bool Scripted = false;
-  FGScript* Script;
-
-  if (argc != 3 && argc != 2) {
-    cerr << endl
-         << "  You must enter the name of a registered aircraft and reset point:"
-         << endl << endl << "  FDM <aircraft name> <reset file>" << endl;
-    cerr << endl << "  Alternatively, you may specify only the name of a script file:"
-         << endl << endl << "  FDM <script file>" << endl << endl;
-    exit(0);
-  }
-
-  FDMExec = new FGFDMExec();
-
-  if (argc == 2) { // SCRIPTED CASE
-
-    Script = new FGScript(FDMExec);
-    result = Script->LoadScript(argv[1]);
-
-    if (!result) {
-      cerr << "Script file " << argv[1] << " was not successfully loaded" << endl;
-      exit(-1);
-    }
-
-    Scripted = true;
-
-  } else {        // form jsbsim <acname> <resetfile>
-
-    if ( ! FDMExec->LoadModel("aircraft", "engine", string(argv[1]))) {
-       cerr << "  JSBSim could not be started" << endl << endl;
-      exit(-1);
-    }                   
-
-    FGInitialCondition IC(FDMExec);
-    if ( ! IC.Load("aircraft",string(argv[1]),string(argv[2]))) {
-       cerr << "Initialization unsuccessful" << 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;
-}
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+\r
+ Module:       JSBSim.cpp\r
+ Author:       Jon S. Berndt\r
+ Date started: 08/17/99\r
+ Purpose:      Standalone version of JSBSim.\r
+ Called by:    The USER.\r
+\r
+ ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------\r
+\r
+ This program is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License as published by the Free Software\r
+ Foundation; either version 2 of the License, or (at your option) any later\r
+ version.\r
+\r
+ This program is distributed in the hope that it will be useful, but WITHOUT\r
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
+ details.\r
+\r
+ You should have received a copy of the GNU General Public License along with\r
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple\r
+ Place - Suite 330, Boston, MA  02111-1307, USA.\r
+\r
+ Further information about the GNU General Public License can also be found on\r
+ the world wide web at http://www.gnu.org.\r
+\r
+FUNCTIONAL DESCRIPTION\r
+--------------------------------------------------------------------------------\r
+\r
+This class Handles calling JSBSim standalone. It is set up for compilation under\r
+Borland C+Builder or other compiler.\r
+\r
+HISTORY\r
+--------------------------------------------------------------------------------\r
+08/17/99   JSB   Created\r
+\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+INCLUDES\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+#include "FGFDMExec.h"\r
+#include "FGRotation.h"\r
+#include "FGAtmosphere.h"\r
+#include "FGState.h"\r
+#include "FGFCS.h"\r
+#include "FGAircraft.h"\r
+#include "FGTranslation.h"\r
+#include "FGPosition.h"\r
+#include "FGAuxiliary.h"\r
+#include "FGOutput.h"\r
+#include "FGConfigFile.h"\r
+#include "FGScript.h"\r
+#include "FGJSBBase.h"\r
+\r
+#ifdef FGFS\r
+#include <simgear/compiler.h>\r
+#include STL_IOSTREAM\r
+#else\r
+#  if defined(sgi) && !defined(__GNUC__)\r
+#    include <iostream.h>\r
+#  else\r
+#    include <iostream>\r
+#  endif\r
+#endif\r
+\r
+#if __BCPLUSPLUS__ == 0x540\r
+#pragma hdrstop\r
+#include <condefs.h>\r
+//---------------------------------------------------------------------------\r
+USERES("JSBSim.res");\r
+USEUNIT("FGUtility.cpp");\r
+USEUNIT("FGAircraft.cpp");\r
+USEUNIT("FGAtmosphere.cpp");\r
+USEUNIT("FGAuxiliary.cpp");\r
+USEUNIT("FGCoefficient.cpp");\r
+USEUNIT("FGColumnVector3.cpp");\r
+USEUNIT("FGColumnVector4.cpp");\r
+USEUNIT("FGConfigFile.cpp");\r
+USEUNIT("FGEngine.cpp");\r
+USEUNIT("FGFactorGroup.cpp");\r
+USEUNIT("FGFCS.cpp");\r
+USEUNIT("FGFDMExec.cpp");\r
+USEUNIT("FGfdmSocket.cpp");\r
+USEUNIT("FGForce.cpp");\r
+USEUNIT("FGGroundReactions.cpp");\r
+USEUNIT("FGInertial.cpp");\r
+USEUNIT("FGInitialCondition.cpp");\r
+USEUNIT("FGJSBBase.cpp");\r
+USEUNIT("FGLGear.cpp");\r
+USEUNIT("FGMassBalance.cpp");\r
+USEUNIT("FGMatrix33.cpp");\r
+USEUNIT("FGModel.cpp");\r
+USEUNIT("FGNozzle.cpp");\r
+USEUNIT("FGOutput.cpp");\r
+USEUNIT("FGPiston.cpp");\r
+USEUNIT("FGPosition.cpp");\r
+USEUNIT("FGPropeller.cpp");\r
+USEUNIT("FGPropulsion.cpp");\r
+USEUNIT("FGRocket.cpp");\r
+USEUNIT("FGRotation.cpp");\r
+USEUNIT("FGRotor.cpp");\r
+USEUNIT("FGScript.cpp");\r
+USEUNIT("FGState.cpp");\r
+USEUNIT("FGTable.cpp");\r
+USEUNIT("FGTank.cpp");\r
+USEUNIT("FGThruster.cpp");\r
+USEUNIT("FGTranslation.cpp");\r
+USEUNIT("FGTrim.cpp");\r
+USEUNIT("FGTrimAxis.cpp");\r
+USEUNIT("FGTurboJet.cpp");\r
+USEUNIT("FGTurboProp.cpp");\r
+USEUNIT("FGTurboShaft.cpp");\r
+USEUNIT("FGAerodynamics.cpp");\r
+USEUNIT("filtersjb\FGSwitch.cpp");\r
+USEUNIT("filtersjb\FGFCSComponent.cpp");\r
+USEUNIT("filtersjb\FGFilter.cpp");\r
+USEUNIT("filtersjb\FGGain.cpp");\r
+USEUNIT("filtersjb\FGGradient.cpp");\r
+USEUNIT("filtersjb\FGKinemat.cpp");\r
+USEUNIT("filtersjb\FGSummer.cpp");\r
+USEUNIT("filtersjb\FGDeadBand.cpp");\r
+//---------------------------------------------------------------------------\r
+#pragma argsused\r
+#endif\r
+\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+DEFINITIONS\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+GLOBAL DATA\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+static const char *IdSrc = "$Id$";\r
+\r
+string ScriptName;\r
+string AircraftName;\r
+string ResetName;\r
+string LogOutputName;\r
+string LogDirectiveName;\r
+FGFDMExec* FDMExec;\r
+\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+FORWARD DECLARATIONS\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+void options(int, char**);\r
+\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+DOCUMENTATION\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+/** Standalone JSBSim main program\r
+    This is the wrapper program used to instantiate the JSBSim system and control\r
+    it. Use this program to build a version of JSBSim that can be run from the\r
+    command line. To get any use out of this, you will have to create a script\r
+    to run a test case and specify what kind of output you would like.\r
+    @author Jon S. Berndt\r
+    @version $Id$\r
+    @see -\r
+*/\r
+\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+IMPLEMENTATION\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+int main(int argc, char* argv[])\r
+{\r
+  ScriptName = "";\r
+  AircraftName = "";\r
+  ResetName = "";\r
+  LogOutputName = "";\r
+  LogDirectiveName = "";\r
+  bool result = false;\r
+  bool Scripted = false;\r
+  FGScript* Script;\r
+\r
+  options(argc, argv);\r
+\r
+  FDMExec = new FGFDMExec();\r
+\r
+  if (!ScriptName.empty()) { // SCRIPTED CASE\r
+\r
+    Script = new FGScript(FDMExec);\r
+    result = Script->LoadScript(ScriptName);\r
+\r
+    if (!result) {\r
+      cerr << "Script file " << ScriptName << " was not successfully loaded" << endl;\r
+      exit(-1);\r
+    }\r
+\r
+    Scripted = true;\r
+\r
+  } else if (!AircraftName.empty() || !ResetName.empty()) {        // form jsbsim <acname> <resetfile>\r
+\r
+    if ( ! FDMExec->LoadModel("aircraft", "engine", AircraftName)) {\r
+       cerr << "  JSBSim could not be started" << endl << endl;\r
+      exit(-1);\r
+    }\r
+\r
+    FGInitialCondition IC(FDMExec);\r
+    if ( ! IC.Load("aircraft",AircraftName,ResetName)) {\r
+       cerr << "Initialization unsuccessful" << endl;\r
+      exit(-1);\r
+    }\r
+  } else {\r
+    cout << "  No Aircraft, Script, or Reset information given" << endl << endl;\r
+    exit(-1);\r
+  }\r
+\r
+//\r
+// RUN loop. MESSAGES are read inside the Run() loop and output as necessary.\r
+//\r
+\r
+  FGJSBBase::Message* msg;\r
+  result = FDMExec->Run();\r
+  while (result) {\r
+    while (FDMExec->ReadMessage()) {\r
+      msg = FDMExec->ProcessMessage();\r
+      switch (msg->type) {\r
+      case FGJSBBase::Message::eText:\r
+        cout << msg->messageId << ": " << msg->text << endl;\r
+        break;\r
+      case FGJSBBase::Message::eBool:\r
+        cout << msg->messageId << ": " << msg->text << " " << msg->bVal << endl;\r
+        break;\r
+      case FGJSBBase::Message::eInteger:\r
+        cout << msg->messageId << ": " << msg->text << " " << msg->iVal << endl;\r
+        break;\r
+      case FGJSBBase::Message::eDouble:\r
+        cout << msg->messageId << ": " << msg->text << " " << msg->dVal << endl;\r
+        break;\r
+      default:\r
+        cerr << "Unrecognized message type." << endl;\r
+             break;\r
+      }\r
+    }\r
+\r
+    if (Scripted) {\r
+      if (!Script->RunScript()) break;\r
+    }\r
+\r
+    result = FDMExec->Run();\r
+  }\r
+\r
+  delete FDMExec;\r
+\r
+  return 0;\r
+}\r
+\r
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+\r
+void options(int count, char **arg)\r
+{\r
+  int i;\r
+\r
+  if (count == 1) {\r
+    cout << endl << "  JSBSim version " << FDMExec->GetVersion() << endl << endl;\r
+    cout << "  Usage: jsbsim <options>" << endl << endl;\r
+    cout << "  options:" << endl;\r
+      cout << "    --help  returns this message" << endl;\r
+      cout << "    --version  returns the version number" << endl;\r
+      cout << "    --outputlogfile=<filename>  sets the name of the data output file" << endl;\r
+      cout << "    --logdirectivefile=<filename>  specifies the name of the data logging directives file" << endl;\r
+      cout << "    --aircraft=<filename>  specifies the name of the aircraft to be modeled" << endl;\r
+      cout << "    --script=<filename>  specifies a script to run" << endl;\r
+      cout << "    --initfile=<filename>  specifies an initilization file" << endl << endl;\r
+    cout << "  NOTE: There can be no spaces around the = sign when" << endl;\r
+    cout << "        an option is followed by a filename" << endl << endl;\r
+  }\r
+\r
+  for (i=1; i<count; i++) {\r
+    string argument = string(arg[i]);\r
+    int n=0;\r
+    if (argument.find("--help") != string::npos) {\r
+      cout << endl << "  JSBSim version " << FDMExec->GetVersion() << endl << endl;\r
+      cout << "  Usage: jsbsim <options>" << endl << endl;\r
+      cout << "  options:" << endl;\r
+      cout << "    --help  returns this message" << endl;\r
+      cout << "    --version  returns the version number" << endl;\r
+      cout << "    --outputlogfile=<filename>  sets the name of the data output file" << endl;\r
+      cout << "    --logdirectivefile=<filename>  specifies the name of the data logging directives file" << endl;\r
+      cout << "    --aircraft=<filename>  specifies the name of the aircraft to be modeled" << endl;\r
+      cout << "    --script=<filename>  specifies a script to run" << endl;\r
+      cout << "    --initfile=<filename>  specifies an initilization file" << endl << endl;\r
+      cout << "  NOTE: There can be no spaces around the = sign when" << endl;\r
+      cout << "        an option is followed by a filename" << endl << endl;\r
+      exit(0);\r
+    } else if (argument.find("--version") != string::npos) {\r
+      cout << endl << "  JSBSim Version: " << FDMExec->GetVersion() << endl << endl;\r
+      exit (0);\r
+    } else if (argument.find("--outputlogfile") != string::npos) {\r
+      n = argument.find("=")+1;\r
+      if (n > 0) {\r
+        LogOutputName = argument.substr(argument.find("=")+1);\r
+      } else {\r
+        LogOutputName = "JSBout.csv";\r
+        cerr << "  Output log file name not valid or not understood. Using JSBout.csv as default";\r
+      }\r
+    } else if (argument.find("--logdirectivefile") != string::npos) {\r
+      n = argument.find("=")+1;\r
+      if (n > 0) {\r
+        LogDirectiveName = argument.substr(argument.find("=")+1);\r
+      } else {\r
+        cerr << "  Log directives file not valid or not understood." << endl << endl;\r
+        exit(1);\r
+      }\r
+    } else if (argument.find("--aircraft") != string::npos) {\r
+      n = argument.find("=")+1;\r
+      if (n > 0) {\r
+        AircraftName = argument.substr(argument.find("=")+1);\r
+      } else {\r
+        cerr << "  Aircraft name not valid or not understood." << endl << endl;\r
+        exit(1);\r
+      }\r
+    } else if (argument.find("--script") != string::npos) {\r
+      n = argument.find("=")+1;\r
+      if (n > 0) {\r
+        ScriptName = argument.substr(argument.find("=")+1);\r
+      } else {\r
+        cerr << "  Script name not valid or not understood." << endl << endl;\r
+        exit(1);\r
+      }\r
+    } else if (argument.find("--initfile") != string::npos) {\r
+      n = argument.find("=")+1;\r
+      if (n > 0) {\r
+        ResetName = argument.substr(argument.find("=")+1);\r
+      } else {\r
+        cerr << "  Reset name not valid or not understood." << endl << endl;\r
+        exit(1);\r
+      }\r
+    } else {\r
+      cerr << endl << "  Parameter: " << argument << " not understood" << endl;\r
+    }\r
+  }\r
+\r
+}\r
+\r