]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGFDMExec.h
Initial revision.
[flightgear.git] / src / FDM / JSBSim / FGFDMExec.h
index 973bc37b3d559d9684c244a6ff28454f4d6356f5..dd9e633000730497f37992a26bc7f6718c00705e 100644 (file)
@@ -40,19 +40,10 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#ifdef FGFS
-#  include <simgear/compiler.h>
-#  ifdef FG_HAVE_STD_INCLUDES
-#    include <vector>
-#  else
-#    include <vector.h>
-#  endif
-#else
-#  include <vector>
-#endif
-
 #include "FGModel.h"
 #include "FGInitialCondition.h"
+#include "FGJSBBase.h"
+#include <vector>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -68,6 +59,10 @@ class FGState;
 class FGAtmosphere;
 class FGFCS;
 class FGPropulsion;
+class FGMassBalance;
+class FGAerodynamics;
+class FGInertial;
+class FGGroundReactions;
 class FGAircraft;
 class FGTranslation;
 class FGRotation;
@@ -76,26 +71,6 @@ class FGAuxiliary;
 class FGOutput;
 class FGInitialCondition;
 
-struct condition {
-  vector <eParam>  TestParam;
-  vector <eParam>  SetParam;
-  vector <float>   TestValue;
-  vector <float>   SetValue;
-  vector <string>  Comparison;
-  vector <float>   TC;
-  vector <bool>    Persistent;
-  vector <eAction> Action;
-  vector <eType>   Type;
-  vector <bool>    Triggered;
-  vector <float>   newValue;
-  vector <float>   OriginalValue;
-  vector <float>   StartTime;
-  vector <float>   EndTime;
-
-  condition() {
-  }
-};
-
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -191,6 +166,8 @@ CLASS DOCUMENTATION
        FGModel object executes its Run() method</li>
     <li><b>8</b>: When this value is set, various runtime state variables
        are printed out periodically</li>
+    <li><b>16</b>: When set various parameters are sanity checked and
+       a message is printed out when they go out of bounds</li>
     </ol>
 
 */
@@ -199,7 +176,7 @@ CLASS DOCUMENTATION
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGFDMExec
+class FGFDMExec : public FGJSBBase
 {
 public:
   /// Default constructor
@@ -275,6 +252,14 @@ public:
   /// Returns the FGPropulsion pointer.
   inline FGPropulsion* GetPropulsion(void)    {return Propulsion;}
   /// Returns the FGAircraft pointer.
+  inline FGMassBalance* GetMassBalance(void)  {return MassBalance;}
+  /// Returns the FGAerodynamics pointer
+  inline FGAerodynamics* GetAerodynamics(void){return Aerodynamics;}
+  /// Returns the FGInertial pointer.
+  inline FGInertial* GetInertial(void)        {return Inertial;}
+  /// Returns the FGGroundReactions pointer.
+  inline FGGroundReactions* GetGroundReactions(void) {return GroundReactions;}
+  /// Returns the FGAircraft pointer.
   inline FGAircraft* GetAircraft(void)        {return Aircraft;}
   /// Returns the FGTranslation pointer.
   inline FGTranslation* GetTranslation(void)  {return Translation;}
@@ -294,12 +279,46 @@ public:
   inline string GetAircraftPath(void)        {return AircraftPath;}
 
 private:
+  enum eAction {
+    FG_RAMP  = 1,
+    FG_STEP  = 2,
+    FG_EXP   = 3
+  };
+
+  enum eType {
+    FG_VALUE = 1,
+    FG_DELTA = 2,
+    FG_BOOL  = 3
+  };
+
+  struct condition {
+    vector <eParam>  TestParam;
+    vector <eParam>  SetParam;
+    vector <double>  TestValue;
+    vector <double>  SetValue;
+    vector <string>  Comparison;
+    vector <double>  TC;
+    vector <bool>    Persistent;
+    vector <eAction> Action;
+    vector <eType>   Type;
+    vector <bool>    Triggered;
+    vector <double>  newValue;
+    vector <double>  OriginalValue;
+    vector <double>  StartTime;
+    vector <double>  EndTime;
+
+    condition() {
+    }
+  };
+
   FGModel* FirstModel;
 
   bool frozen;
   bool terminate;
   int  Error;
-  int  Frame;
+  unsigned int Frame;
+  unsigned int IdFDM;
+  static unsigned int FDMctr;
   bool modelLoaded;
   bool Scripted;
 
@@ -307,24 +326,28 @@ private:
   string EnginePath;
   string ScriptPath;
   string ScriptName;
-  float  StartTime;
-  float  EndTime;
+  double  StartTime;
+  double  EndTime;
   vector <struct condition> Conditions;
 
-  FGState*       State;
-  FGAtmosphere*  Atmosphere;
-  FGFCS*         FCS;
-  FGPropulsion*  Propulsion;
-  FGAircraft*    Aircraft;
-  FGTranslation* Translation;
-  FGRotation*    Rotation;
-  FGPosition*    Position;
-  FGAuxiliary*   Auxiliary;
-  FGOutput*      Output;
+  FGState*           State;
+  FGAtmosphere*      Atmosphere;
+  FGFCS*             FCS;
+  FGPropulsion*      Propulsion;
+  FGMassBalance*     MassBalance;
+  FGAerodynamics*    Aerodynamics;
+  FGInertial*        Inertial;
+  FGGroundReactions* GroundReactions;
+  FGAircraft*        Aircraft;
+  FGTranslation*     Translation;
+  FGRotation*        Rotation;
+  FGPosition*        Position;
+  FGAuxiliary*       Auxiliary;
+  FGOutput*          Output;
 
   bool Allocate(void);
   bool DeAllocate(void);
-  void Debug(void);
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%