]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGFDMExec.h
Typo
[flightgear.git] / src / FDM / JSBSim / FGFDMExec.h
index fefe6cd37544e425e307af2c6402549e947b0796..e440ab76365818fee8c3cf87f0d86936eae1a531 100644 (file)
@@ -40,11 +40,16 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#include "FGModel.h"
-#include "FGTrim.h"
-#include "FGInitialCondition.h"
-#include "FGJSBBase.h"
-#include "FGPropertyManager.h"
+#include <models/FGModel.h>
+#include <models/FGOutput.h>
+#include <models/FGInput.h>
+#include <initialization/FGTrim.h>
+#include <initialization/FGInitialCondition.h>
+#include <FGJSBBase.h>
+#include <input_output/FGPropertyManager.h>
+#include <input_output/FGXMLParse.h>
+#include <input_output/FGGroundCallback.h>
+#include <models/FGPropagate.h>
 
 #include <vector>
 
@@ -72,8 +77,7 @@ CLASS DOCUMENTATION
 
     When an aircraft model is loaded the config file is parsed and for each of the
     sections of the config file (propulsion, flight control, etc.) the
-    corresponding "ReadXXX()" method is called. From within this method the
-    "Load()" method of that system is called (e.g. LoadFCS).
+    corresponding Load() method is called (e.g. LoadFCS).
 
     <h4>JSBSim Debugging Directives</h4>
 
@@ -132,15 +136,12 @@ public:
 
   /** Initializes the sim from the initial condition object and executes
       each scheduled model without integrating i.e. dt=0.
-      @return true if successful
-       */
+      @return true if successful */
   bool RunIC(void);
 
-  /// Freezes the sim
-  void Freeze(void) {frozen = true;}
-
-  /// Resumes the sim
-  void Resume(void) {frozen = false;}
+  /** Sets the ground callback pointer.
+      @param gc A pointer to a ground callback object.  */
+  void SetGroundCallback(FGGroundCallback* gc);
 
   /** Loads an aircraft model.
       @param AircraftPath path to the aircraft directory. For instance:
@@ -152,9 +153,11 @@ public:
       be looked for in the directory specified in the AircraftPath variable,
       and in turn under the directory with the same name as the model. For
       instance: "aircraft/x15/x15.xml"
+      @param addModelToPath set to true to add the model name to the
+      AircraftPath, defaults to true
       @return true if successful*/
-  bool LoadModel(string AircraftPath, string EnginePath, string model);
-
+  bool LoadModel(string AircraftPath, string EnginePath, string model,
+                 bool addModelToPath = true);
 
   /** Loads an aircraft model.  The paths to the aircraft and engine
       config file directories must be set prior to calling this.  See
@@ -163,34 +166,24 @@ public:
       be looked for in the directory specified in the AircraftPath variable,
       and in turn under the directory with the same name as the model. For
       instance: "aircraft/x15/x15.xml"
+      @param addModelToPath set to true to add the model name to the
+      AircraftPath, defaults to true
       @return true if successful*/
-  bool LoadModel(string model);
-
+  bool LoadModel(string model, bool addModelToPath = true);
 
   /** Sets the path to the engine config file directories.
       @param path path to the directory under which engine config
-      files are kept, for instance "engine"
-  */
+      files are kept, for instance "engine"  */
   bool SetEnginePath(string path)   { EnginePath = path; return true; }
 
   /** Sets the path to the aircraft config file directories.
       @param path path to the aircraft directory. For instance:
       "aircraft". Under aircraft, then, would be directories for various
-      modeled aircraft such as C172/, x15/, etc.
-  */
+      modeled aircraft such as C172/, x15/, etc.  */
   bool SetAircraftPath(string path) { AircraftPath = path; return true; }
 
-  /** Sets the path to the autopilot config file directories.
-      @param path path to the control directory. For instance:
-      "control".
-  */
-//  bool SetControlPath(string path) { ControlPath = path; return true; }
-
-
   /// @name Top-level executive State and Model retrieval mechanism
   //@{
-  /// Returns the FGState pointer.
-  inline FGState* GetState(void)              {return State;}
   /// Returns the FGAtmosphere pointer.
   inline FGAtmosphere* GetAtmosphere(void)    {return Atmosphere;}
   /// Returns the FGFCS pointer.
@@ -208,44 +201,103 @@ public:
   /// Returns the FGAircraft pointer.
   inline FGAircraft* GetAircraft(void)        {return Aircraft;}
   /// Returns the FGPropagate pointer.
-  inline FGPropagate* GetPropagate(void)        {return Propagate;}
+  inline FGPropagate* GetPropagate(void)      {return Propagate;}
   /// Returns the FGAuxiliary pointer.
   inline FGAuxiliary* GetAuxiliary(void)      {return Auxiliary;}
-  /// Returns the FGOutput pointer.
-  inline FGOutput* GetOutput(void)            {return Output;}
+  /// Returns the FGInput pointer.
+  inline FGInput* GetInput(void)              {return Input;}
+  /// Returns the FGGroundCallback pointer.
+  inline FGGroundCallback* GetGroundCallback(void) {return GroundCallback;}
+  /// Returns the FGState pointer.
+  inline FGState* GetState(void)              {return State;}
   // Returns a pointer to the FGInitialCondition object
   inline FGInitialCondition* GetIC(void)      {return IC;}
   // Returns a pointer to the FGTrim object
-  FGTrim* GetTrim(void);
+  inline FGTrim* GetTrim(void);
   //@}
 
   /// Retrieves the engine path.
   inline string GetEnginePath(void)          {return EnginePath;}
   /// Retrieves the aircraft path.
   inline string GetAircraftPath(void)        {return AircraftPath;}
-//  /// Retrieves the control path.
-//  inline string GetControlPath(void)        {return ControlPath;}
 
+  /// Returns the model name.
   string GetModelName(void) { return modelName; }
 
+  /// Returns a pointer to the property manager object.
   FGPropertyManager* GetPropertyManager(void);
+  /// Returns a vector of strings representing the names of all loaded models (future)
   vector <string> EnumerateFDMs(void);
+  /// Marks this instance of the Exec object as a "slave" object.
   void SetSlave(void) {IsSlave = true;}
 
+  /** Executes trimming in the selected mode.
+  *   @param mode Specifies how to trim:
+  * - tLongitudinal=0
+  * - tFull
+  * - tGround
+  * - tPullup
+  * - tCustom
+  * - tTurn
+  * - tNone
+  */
+  void DoTrim(int mode);
+
+  /// Disables data logging to all outputs.
+  void DisableOutput(void);
+  /// Enables data logging to all outputs.
+  void EnableOutput(void);
+  /// Pauses execution by preventing time from incrementing.
+  void Hold(void) {holding = true;}
+  /// Resumes execution from a "Hold".
+  void Resume(void) {holding = false;}
+  /// Returns true if the simulation is Holding (i.e. simulation time is not moving).
+  bool Holding(void) {return holding;}
+
+  struct PropertyCatalogStructure {
+    /// Name of the property.
+    string base_string;
+    /// The node for the property.
+    FGPropertyManager *node;
+  };
+
+  /** Builds a catalog of properties.
+  *   This function descends the property tree and creates a list (an STL vector)
+  *   containing the name and node for all properties.
+  *   @param pcs The "root" property catalog structure pointer.  */
+  void BuildPropertyCatalog(struct PropertyCatalogStructure* pcs);
+
+  /** Retrieves property or properties matching the supplied string.
+  *   A string is returned that contains a carriage return delimited list of all
+  *   strings in the property catalog that matches the supplied chack string.
+  *   @param check The string to search for in the property catalog.
+  *   @return the carriage-return-delimited string containing all matching strings
+  *               in the catalog.  */
+  string QueryPropertyCatalog(string check);
+
+  /// Use the MSIS atmosphere model.
+  void UseAtmosphereMSIS(void);
+
+  /// Use the Mars atmosphere model. (Not operative yet.)
+  void UseAtmosphereMars(void); 
+
 private:
   FGModel* FirstModel;
 
-  bool frozen;
   bool terminate;
+  bool holding;
+  bool Constructing;
   int  Error;
   unsigned int Frame;
   unsigned int IdFDM;
+  FGPropertyManager* Root;
   static unsigned int FDMctr;
   bool modelLoaded;
   string modelName;
   bool IsSlave;
   static FGPropertyManager *master;
   FGPropertyManager *instance;
+  vector <string> PropertyCatalog;
 
   struct slaveData {
     FGFDMExec* exec;
@@ -268,11 +320,11 @@ private:
 
   string AircraftPath;
   string EnginePath;
-//  string ControlPath;
 
   string CFGVersion;
   string Release;
 
+  FGGroundCallback*  GroundCallback;
   FGState*           State;
   FGAtmosphere*      Atmosphere;
   FGFCS*             FCS;
@@ -284,21 +336,17 @@ private:
   FGAircraft*        Aircraft;
   FGPropagate*       Propagate;
   FGAuxiliary*       Auxiliary;
-  FGOutput*          Output;
+  FGInput*           Input;
+  vector <FGOutput*> Outputs;
 
   FGInitialCondition* IC;
   FGTrim *Trim;
 
   vector <slaveData*> SlaveFDMList;
 
-  bool ReadMetrics(FGConfigFile*);
-  bool ReadSlave(FGConfigFile*);
-  bool ReadPropulsion(FGConfigFile*);
-  bool ReadFlightControls(FGConfigFile*);
-  bool ReadAerodynamics(FGConfigFile*);
-  bool ReadUndercarriage(FGConfigFile*);
-  bool ReadPrologue(FGConfigFile*);
-  bool ReadOutput(FGConfigFile*);
+  bool ReadFileHeader(Element*);
+  bool ReadSlave(Element*);
+  bool ReadPrologue(Element*);
 
   bool Allocate(void);
   bool DeAllocate(void);