]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGFDMExec.h
Revert "Fix compilation problem with MSVC 2012"
[flightgear.git] / src / FDM / JSBSim / FGFDMExec.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2  Header:       FGFDMExec.h
3  Author:       Jon Berndt
4  Date started: 11/17/98
5  file The header file for the JSBSim executive.
6
7  ------------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) -------------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
17  details.
18
19  You should have received a copy of the GNU Lesser General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22
23  Further information about the GNU Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28 11/17/98   JSB   Created
29 7/31/99     TP   Added RunIC function that runs the sim so that every frame
30                  begins with the IC values from the given FGInitialCondition
31                  object and dt=0.
32
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 SENTRY
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36
37 #ifndef FGFDMEXEC_HEADER_H
38 #define FGFDMEXEC_HEADER_H
39
40 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 INCLUDES
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
44 #include <vector>
45 #include <string>
46
47 #include "initialization/FGTrim.h"
48 #include "FGJSBBase.h"
49 #include "input_output/FGPropertyManager.h"
50 #include "input_output/FGXMLFileRead.h"
51 #include "models/FGPropagate.h"
52 #include "math/FGColumnVector3.h"
53
54 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 DEFINITIONS
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57
58 #define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.76 2012/01/21 16:46:08 jberndt Exp $"
59
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 FORWARD DECLARATIONS
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63
64 namespace JSBSim {
65
66 class FGScript;
67 class FGTrim;
68 class FGAerodynamics;
69 class FGAircraft;
70 class FGAtmosphere;
71 class FGAccelerations;
72 class FGWinds;
73 class FGAuxiliary;
74 class FGBuoyantForces;
75 class FGExternalReactions;
76 class FGGroundReactions;
77 class FGFCS;
78 class FGInertial;
79 class FGInput;
80 class FGOutput;
81 class FGPropagate;
82 class FGPropulsion;
83 class FGMassBalance;
84
85 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86 CLASS DOCUMENTATION
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
88
89 /** Encapsulates the JSBSim simulation executive.
90     This class is the executive class through which all other simulation classes
91     are instantiated, initialized, and run. When integrated with FlightGear (or
92     other flight simulator) this class is typically instantiated by an interface
93     class on the simulator side.
94
95     At the time of simulation initialization, the interface
96     class creates an instance of this executive class. The
97     executive is subsequently directed to load the chosen aircraft specification
98     file:
99
100     @code
101     fdmex = new FGFDMExec( ... );
102     result = fdmex->LoadModel( ... );
103     @endcode
104
105     When an aircraft model is loaded, the config file is parsed and for each of the
106     sections of the config file (propulsion, flight control, etc.) the
107     corresponding Load() method is called (e.g. FGFCS::Load()).
108
109     Subsequent to the creation of the executive and loading of the model,
110     initialization is performed. Initialization involves copying control inputs
111     into the appropriate JSBSim data storage locations, configuring it for the set
112     of user supplied initial conditions, and then copying state variables from
113     JSBSim. The state variables are used to drive the instrument displays and to
114     place the vehicle model in world space for visual rendering:
115
116     @code
117     copy_to_JSBsim(); // copy control inputs to JSBSim
118     fdmex->RunIC(); // loop JSBSim once w/o integrating
119     copy_from_JSBsim(); // update the bus
120     @endcode
121
122     Once initialization is complete, cyclic execution proceeds:
123
124     @code
125     copy_to_JSBsim(); // copy control inputs to JSBSim
126     fdmex->Run(); // execute JSBSim
127     copy_from_JSBsim(); // update the bus
128     @endcode
129
130     JSBSim can be used in a standalone mode by creating a compact stub program
131     that effectively performs the same progression of steps as outlined above for
132     the integrated version, but with two exceptions. First, the copy_to_JSBSim()
133     and copy_from_JSBSim() functions are not used because the control inputs are
134     handled directly by the scripting facilities and outputs are handled by the
135     output (data logging) class. Second, the name of a script file can be supplied
136     to the stub program. Scripting (see FGScript) provides a way to supply command
137     inputs to the simulation:
138
139     @code
140     FDMExec = new JSBSim::FGFDMExec();
141     FDMExec->LoadScript( ScriptName ); // the script loads the aircraft and ICs
142     result = FDMExec->Run();
143     while (result) { // cyclic execution
144       result = FDMExec->Run(); // execute JSBSim
145     }
146     @endcode
147
148     The standalone mode has been useful for verifying changes before committing
149     updates to the source code repository. It is also useful for running sets of
150     tests that reveal some aspects of simulated aircraft performance, such as
151     range, time-to-climb, takeoff distance, etc.
152
153     <h3>JSBSim Debugging Directives</h3>
154
155     This describes to any interested entity the debug level
156     requested by setting the JSBSIM_DEBUG environment variable.
157     The bitmasked value choices are as follows:
158     - <b>unset</b>: In this case (the default) JSBSim would only print
159        out the normally expected messages, essentially echoing
160        the config files as they are read. If the environment
161        variable is not set, debug_lvl is set to 1 internally
162     - <b>0</b>: This requests JSBSim not to output any messages
163        whatsoever
164     - <b>1</b>: This value explicity requests the normal JSBSim
165        startup messages
166     - <b>2</b>: This value asks for a message to be printed out when
167        a class is instantiated
168     - <b>4</b>: When this value is set, a message is displayed when a
169        FGModel object executes its Run() method
170     - <b>8</b>: When this value is set, various runtime state variables
171        are printed out periodically
172     - <b>16</b>: When set various parameters are sanity checked and
173        a message is printed out when they go out of bounds
174
175     <h3>Properties</h3>
176     @property simulator/do_trim (write only) Can be set to the integer equivalent to one of
177                                 tLongitudinal (0), tFull (1), tGround (2), tPullup (3),
178                                 tCustom (4), tTurn (5). Setting this to a legal value
179                                 (such as by a script) causes a trim to be performed. This
180                                 property actually maps toa function call of DoTrim().
181
182     @author Jon S. Berndt
183     @version $Revision: 1.76 $
184 */
185
186 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187 CLASS DECLARATION
188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
189
190 class FGFDMExec : public FGJSBBase, public FGXMLFileRead
191 {
192   struct childData {
193     FGFDMExec* exec;
194     string info;
195     FGColumnVector3 Loc;
196     FGColumnVector3 Orient;
197     bool mated;
198     bool internal;
199
200     childData(void) {
201       info = "";
202       Loc = FGColumnVector3(0,0,0);
203       Orient = FGColumnVector3(0,0,0);
204       mated = true;
205       internal = false;
206     }
207     
208     void Run(void) {exec->Run();}
209     void AssignState(FGPropagate* source_prop) {
210       exec->GetPropagate()->SetVState(source_prop->GetVState());
211     }
212
213     ~childData(void) {
214       delete exec;
215     }
216   };
217
218 public:
219
220   /// Default constructor
221   FGFDMExec(FGPropertyManager* root = 0, unsigned int* fdmctr = 0);
222
223   /// Default destructor
224   ~FGFDMExec();
225
226   // This list of enums is very important! The order in which models are listed here
227   // determines the order of execution of the models.
228   enum eModels { ePropagate=0,
229                  eInput,
230                  eInertial,
231                  eAtmosphere,
232                  eWinds,
233                  eAuxiliary,
234                  eSystems,
235                  ePropulsion,
236                  eAerodynamics,
237                  eGroundReactions,
238                  eExternalReactions,
239                  eBuoyantForces,
240                  eMassBalance,
241                  eAircraft,
242                  eAccelerations,
243                  eNumStandardModels };
244
245   /** Unbind all tied JSBSim properties. */
246   void Unbind(void) {instance->Unbind();}
247
248   /** This routine places a model into the runlist at the specified rate. The
249       "rate" is not really a clock rate. It represents how many calls to the
250       FGFDMExec::Run() method must be made before the model is executed. A
251       value of 1 means that the model will be executed for each call to the
252       exec's Run() method. A value of 5 means that the model will only be
253       executed every 5th call to the exec's Run() method. Use of a rate other than
254       one is at this time not recommended.
255       @param model A pointer to the model being scheduled.
256       @param rate The rate at which to execute the model as described above.
257                   Default is every frame (rate=1).
258       @return Currently returns 0 always. */
259   void Schedule(FGModel* model, int rate=1);
260
261   /** This function executes each scheduled model in succession.
262       @return true if successful, false if sim should be ended  */
263   bool Run(void);
264
265   /** Initializes the sim from the initial condition object and executes
266       each scheduled model without integrating i.e. dt=0.
267       @return true if successful */
268   bool RunIC(void);
269
270   /** Sets the ground callback pointer. For optimal memory management, a shared
271       pointer is used internally that maintains a reference counter. The calling
272       application must therefore use FGGroundCallback_ptr 'smart pointers' to
273       manage their copy of the ground callback.
274       @param gc A pointer to a ground callback object
275       @see FGGroundCallback
276    */
277   void SetGroundCallback(FGGroundCallback* gc) { FGLocation::SetGroundCallback(gc); }
278
279   /** Loads an aircraft model.
280       @param AircraftPath path to the aircraft/ directory. For instance:
281       "aircraft". Under aircraft, then, would be directories for various
282       modeled aircraft such as C172/, x15/, etc.
283       @param EnginePath path to the directory under which engine config
284       files are kept, for instance "engine"
285       @param SystemsPath path to the directory under which systems config
286       files are kept, for instance "systems"
287       @param model the name of the aircraft model itself. This file will
288       be looked for in the directory specified in the AircraftPath variable,
289       and in turn under the directory with the same name as the model. For
290       instance: "aircraft/x15/x15.xml"
291       @param addModelToPath set to true to add the model name to the
292       AircraftPath, defaults to true
293       @return true if successful */
294   bool LoadModel(const string& AircraftPath, const string& EnginePath, const string& SystemsPath,
295                  const string& model, bool addModelToPath = true);
296
297   /** Loads an aircraft model.  The paths to the aircraft and engine
298       config file directories must be set prior to calling this.  See
299       below.
300       @param model the name of the aircraft model itself. This file will
301       be looked for in the directory specified in the AircraftPath variable,
302       and in turn under the directory with the same name as the model. For
303       instance: "aircraft/x15/x15.xml"
304       @param addModelToPath set to true to add the model name to the
305       AircraftPath, defaults to true
306       @return true if successful*/
307   bool LoadModel(const string& model, bool addModelToPath = true);
308
309   /** Loads a script
310       @param Script the full path name and file name for the script to be loaded.
311       @param deltaT The simulation integration step size, if given.  If no value is supplied
312                     then 0.0 is used and the value is expected to be supplied in
313                     the script file itself.
314       @return true if successfully loadsd; false otherwise. */
315   bool LoadScript(const string& Script, double deltaT=0.0);
316
317   /** Sets the path to the engine config file directories.
318       @param path path to the directory under which engine config
319       files are kept, for instance "engine"  */
320   bool SetEnginePath(const string& path)   { EnginePath = RootDir + path; return true; }
321
322   /** Sets the path to the aircraft config file directories.
323       @param path path to the aircraft directory. For instance:
324       "aircraft". Under aircraft, then, would be directories for various
325       modeled aircraft such as C172/, x15/, etc.  */
326   bool SetAircraftPath(const string& path) { AircraftPath = RootDir + path; return true; }
327   
328   /** Sets the path to the systems config file directories.
329       @param path path to the directory under which systems config
330       files are kept, for instance "systems"  */
331   bool SetSystemsPath(const string& path)   { SystemsPath = RootDir + path; return true; }
332   
333   /// @name Top-level executive State and Model retrieval mechanism
334   ///@{
335   /// Returns the FGAtmosphere pointer.
336   FGAtmosphere* GetAtmosphere(void)    {return (FGAtmosphere*)Models[eAtmosphere];}
337   /// Returns the FGAccelerations pointer.
338   FGAccelerations* GetAccelerations(void)    {return (FGAccelerations*)Models[eAccelerations];}
339   /// Returns the FGWinds pointer.
340   FGWinds* GetWinds(void)    {return (FGWinds*)Models[eWinds];}
341   /// Returns the FGFCS pointer.
342   FGFCS* GetFCS(void)                  {return (FGFCS*)Models[eSystems];}
343   /// Returns the FGPropulsion pointer.
344   FGPropulsion* GetPropulsion(void)    {return (FGPropulsion*)Models[ePropulsion];}
345   /// Returns the FGAircraft pointer.
346   FGMassBalance* GetMassBalance(void)  {return (FGMassBalance*)Models[eMassBalance];}
347   /// Returns the FGAerodynamics pointer
348   FGAerodynamics* GetAerodynamics(void){return (FGAerodynamics*)Models[eAerodynamics];}
349   /// Returns the FGInertial pointer.
350   FGInertial* GetInertial(void)        {return (FGInertial*)Models[eInertial];}
351   /// Returns the FGGroundReactions pointer.
352   FGGroundReactions* GetGroundReactions(void) {return (FGGroundReactions*)Models[eGroundReactions];}
353   /// Returns the FGExternalReactions pointer.
354   FGExternalReactions* GetExternalReactions(void) {return (FGExternalReactions*)Models[eExternalReactions];}
355   /// Returns the FGBuoyantForces pointer.
356   FGBuoyantForces* GetBuoyantForces(void) {return (FGBuoyantForces*)Models[eBuoyantForces];}
357   /// Returns the FGAircraft pointer.
358   FGAircraft* GetAircraft(void)        {return (FGAircraft*)Models[eAircraft];}
359   /// Returns the FGPropagate pointer.
360   FGPropagate* GetPropagate(void)      {return (FGPropagate*)Models[ePropagate];}
361   /// Returns the FGAuxiliary pointer.
362   FGAuxiliary* GetAuxiliary(void)      {return (FGAuxiliary*)Models[eAuxiliary];}
363   /// Returns the FGInput pointer.
364   FGInput* GetInput(void)              {return (FGInput*)Models[eInput];}
365   /** Get a pointer to the ground callback currently used. It is recommanded
366       to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
367       @return A pointer to the current ground callback object.
368       @see FGGroundCallback
369    */
370   FGGroundCallback* GetGroundCallback(void) {return FGLocation::GetGroundCallback();}
371   /// Retrieves the script object
372   FGScript* GetScript(void) {return Script;}
373   /// Returns a pointer to the FGInitialCondition object
374   FGInitialCondition* GetIC(void)      {return IC;}
375   /// Returns a pointer to the FGTrim object
376   FGTrim* GetTrim(void);
377   ///@}
378
379   /// Retrieves the engine path.
380   const string& GetEnginePath(void)    {return EnginePath;}
381   /// Retrieves the aircraft path.
382   const string& GetAircraftPath(void)  {return AircraftPath;}
383   /// Retrieves the systems path.
384   const string& GetSystemsPath(void)   {return SystemsPath;}
385   /// Retrieves the full aircraft path name.
386   const string& GetFullAircraftPath(void) {return FullAircraftPath;}
387
388   /** Retrieves the value of a property.
389       @param property the name of the property
390       @result the value of the specified property */
391   inline double GetPropertyValue(const string& property) {return instance->GetDouble(property);}
392
393   /** Sets a property value.
394       @param property the property to be set
395       @param value the value to set the property to */
396   inline void SetPropertyValue(const string& property, double value) {
397     instance->SetDouble(property, value);
398   }
399
400   /// Returns the model name.
401   const string& GetModelName(void) const { return modelName; }
402 /*
403   /// Returns the current time.
404   double GetSimTime(void);
405
406   /// Returns the current frame time (delta T).
407   double GetDeltaT(void);
408 */  
409   /// Returns a pointer to the property manager object.
410   FGPropertyManager* GetPropertyManager(void);
411   /// Returns a vector of strings representing the names of all loaded models (future)
412   vector <string> EnumerateFDMs(void);
413   /// Gets the number of child FDMs.
414   int GetFDMCount(void) const {return (int)ChildFDMList.size();}
415   /// Gets a particular child FDM.
416   childData* GetChildFDM(int i) const {return ChildFDMList[i];}
417   /// Marks this instance of the Exec object as a "child" object.
418   void SetChild(bool ch) {IsChild = ch;}
419
420   /** Sets the output (logging) mechanism for this run.
421       Calling this function passes the name of an output directives file to
422       the FGOutput object associated with this run. The call to this function
423       should be made prior to loading an aircraft model. This call results in an
424       FGOutput object being built as the first Output object in the FDMExec-managed
425       list of Output objects that may be created for an aircraft model. If this call
426       is made after an aircraft model is loaded, there is no effect. Any Output
427       objects added by the aircraft model itself (in an &lt;output> element) will be
428       added after this one. Care should be taken not to refer to the same file
429       name.
430       An output directives file contains an &lt;output> &lt;/output> element, within
431       which should be specified the parameters or parameter groups that should
432       be logged.
433       @param fname the filename of an output directives file.
434     */
435   bool SetOutputDirectives(const string& fname);
436
437   /** Forces the specified output object to print its items once */
438   void ForceOutput(int idx=0);
439
440   /** Sets (or overrides) the output filename
441       @param fname the name of the file to output data to
442       @return true if successful, false if there is no output specified for the flight model */
443   bool SetOutputFileName(const string& fname);
444
445   /** Retrieves the current output filename.
446       @return the name of the output file for the first output specified by the flight model.
447               If none is specified, the empty string is returned. */
448   string GetOutputFileName(void);
449
450   /** Executes trimming in the selected mode.
451   *   @param mode Specifies how to trim:
452   * - tLongitudinal=0
453   * - tFull
454   * - tGround
455   * - tPullup
456   * - tCustom
457   * - tTurn
458   * - tNone  */
459   void DoTrim(int mode);
460
461   /// Disables data logging to all outputs.
462   void DisableOutput(void);
463   /// Enables data logging to all outputs.
464   void EnableOutput(void);
465   /// Pauses execution by preventing time from incrementing.
466   void Hold(void) {holding = true;}
467   /// Turn on hold after increment
468   void EnableIncrementThenHold(int Timesteps) {TimeStepsUntilHold = Timesteps; IncrementThenHolding = true;}
469   /// Checks if required to hold afer increment
470   void CheckIncrementalHold(void);
471   /// Resumes execution from a "Hold".
472   void Resume(void) {holding = false;}
473   /// Returns true if the simulation is Holding (i.e. simulation time is not moving).
474   bool Holding(void) {return holding;}
475   /// Resets the initial conditions object and prepares the simulation to run again.
476   void ResetToInitialConditions(void);
477   /// Sets the debug level.
478   void SetDebugLevel(int level) {debug_lvl = level;}
479
480   struct PropertyCatalogStructure {
481     /// Name of the property.
482     string base_string;
483     /// The node for the property.
484     FGPropertyManager *node;
485   };
486
487   /** Builds a catalog of properties.
488   *   This function descends the property tree and creates a list (an STL vector)
489   *   containing the name and node for all properties.
490   *   @param pcs The "root" property catalog structure pointer.  */
491   void BuildPropertyCatalog(struct PropertyCatalogStructure* pcs);
492
493   /** Retrieves property or properties matching the supplied string.
494   *   A string is returned that contains a carriage return delimited list of all
495   *   strings in the property catalog that matches the supplied check string.
496   *   @param check The string to search for in the property catalog.
497   *   @return the carriage-return-delimited string containing all matching strings
498   *               in the catalog.  */
499   string QueryPropertyCatalog(const string& check);
500
501   // Print the contents of the property catalog for the loaded aircraft.
502   void PrintPropertyCatalog(void);
503
504   vector<string>& GetPropertyCatalog(void) {return PropertyCatalog;}
505
506   void SetTrimStatus(bool status){ trim_status = status; }
507   bool GetTrimStatus(void) const { return trim_status; }
508   void SetTrimMode(int mode){ ta_mode = mode; }
509   int GetTrimMode(void) const { return ta_mode; }
510
511   string GetPropulsionTankReport();
512
513   /// Returns the cumulative simulation time in seconds.
514   double GetSimTime(void) const { return sim_time; }
515
516   /// Returns the simulation delta T.
517   double GetDeltaT(void) const {return dT;}
518
519   /// Suspends the simulation and sets the delta T to zero.
520   void SuspendIntegration(void) {saved_dT = dT; dT = 0.0;}
521
522   /// Resumes the simulation by resetting delta T to the correct value.
523   void ResumeIntegration(void)  {dT = saved_dT;}
524
525   /** Returns the simulation suspension state.
526       @return true if suspended, false if executing  */
527   bool IntegrationSuspended(void) const {return dT == 0.0;}
528
529   /** Sets the current sim time.
530       @param cur_time the current time
531       @return the current simulation time.      */
532   double Setsim_time(double cur_time) {
533     sim_time = cur_time;
534     return sim_time;
535   }
536
537   /** Sets the integration time step for the simulation executive.
538       @param delta_t the time step in seconds.     */
539   void Setdt(double delta_t) { dT = delta_t; }
540
541   /** Sets the root directory where JSBSim starts looking for its system directories.
542       @param rootDir the string containing the root directory. */
543   void SetRootDir(const string& rootDir) {RootDir = rootDir;}
544
545   /** Retrieves the Root Directory.
546       @return the string representing the root (base) JSBSim directory. */
547   const string& GetRootDir(void) const {return RootDir;}
548
549   /** Increments the simulation time if not in Holding mode. The Frame counter
550       is also incremented.
551       @return the new simulation time.     */
552   double IncrTime(void) {
553     if (!holding) sim_time += dT;
554     Frame++;
555     return sim_time;
556   }
557
558   /** Retrieves the current debug level setting. */
559   int GetDebugLevel(void) const {return debug_lvl;};
560
561 private:
562   int Error;
563   unsigned int Frame;
564   unsigned int IdFDM;
565   unsigned short Terminate;
566   double dT;
567   double saved_dT;
568   double sim_time;
569   bool holding;
570   bool IncrementThenHolding;
571   int TimeStepsUntilHold;
572   bool Constructing;
573   bool modelLoaded;
574   bool IsChild;
575   bool firstPass;
576   string modelName;
577   string AircraftPath;
578   string FullAircraftPath;
579   string EnginePath;
580   string SystemsPath;
581   string CFGVersion;
582   string Release;
583   string RootDir;
584
585   // Standard Model pointers - shortcuts for internal executive use only.
586   FGPropagate* Propagate;
587   FGInertial* Inertial;
588   FGAtmosphere* Atmosphere;
589   FGWinds* Winds;
590   FGAuxiliary* Auxiliary;
591   FGFCS* FCS;
592   FGPropulsion* Propulsion;
593   FGAerodynamics* Aerodynamics;
594   FGGroundReactions* GroundReactions;
595   FGExternalReactions* ExternalReactions;
596   FGBuoyantForces* BuoyantForces;
597   FGMassBalance* MassBalance;
598   FGAircraft* Aircraft;
599   FGAccelerations* Accelerations;
600
601   bool trim_status;
602   int ta_mode;
603
604   FGScript*           Script;
605   FGInitialCondition* IC;
606   FGTrim*             Trim;
607
608   FGPropertyManager* Root;
609   bool StandAlone;
610   FGPropertyManager* instance;
611   
612   // The FDM counter is used to give each child FDM an unique ID. The root FDM has the ID 0
613   unsigned int*      FDMctr;
614
615   vector <string> PropertyCatalog;
616   vector <FGOutput*> Outputs;
617   vector <childData*> ChildFDMList;
618   vector <FGModel*> Models;
619
620   bool ReadFileHeader(Element*);
621   bool ReadChild(Element*);
622   bool ReadPrologue(Element*);
623   void ResetToInitialConditions(int mode);
624   void SRand(int sr);
625   void LoadInputs(unsigned int idx);
626   void LoadPlanetConstants(void);
627   void LoadModelConstants(void);
628   bool Allocate(void);
629   bool DeAllocate(void);
630   void Initialize(FGInitialCondition *FGIC);
631
632   void Debug(int from);
633 };
634 }
635 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
636 #endif