]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGFDMExec.h
Sync with current JSBSim devel code.
[flightgear.git] / src / FDM / JSBSim / FGFDMExec.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGFDMExec.h
4  Author:       Jon Berndt
5  Date started: 11/17/98
6
7  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
8
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU 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 General Public License for more
17  details.
18
19  You should have received a copy of the GNU 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 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 #define ID_FDMEXEC "$Header"
45
46 #include "FGModel.h"
47 #include "FGInitialCondition.h"
48
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 CLASS DECLARATION
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
53 class FGState;
54 class FGAtmosphere;
55 class FGFCS;
56 class FGAircraft;
57 class FGTranslation;
58 class FGRotation;
59 class FGPosition;
60 class FGAuxiliary;
61 class FGOutput;
62 class FGInitialCondition;
63
64 class FGFDMExec
65 {
66 public:
67   FGFDMExec(void);
68   ~FGFDMExec(void);
69
70   FGModel* FirstModel;
71
72   bool Initialize(void);
73   int  Schedule(FGModel* model, int rate);
74   bool Run(void);
75   bool RunIC(FGInitialCondition *fgic);
76   void Freeze(void) {frozen = true;}
77   void Resume(void) {frozen = false;}
78
79   bool SetEnginePath(string path)   {EnginePath = path;}
80   bool SetAircraftPath(string path) {AircraftPath = path;}
81   bool SetScriptPath(string path)   {ScriptPath = path;}
82
83   bool LoadModel(string AircraftPath, string EnginePath, string model);
84   bool RunScript(string script);
85
86   inline FGState* GetState(void)             {return State;}
87   inline FGAtmosphere* GetAtmosphere(void)   {return Atmosphere;}
88   inline FGFCS* GetFCS(void)                 {return FCS;}
89   inline FGAircraft* GetAircraft(void)       {return Aircraft;}
90   inline FGTranslation* GetTranslation(void) {return Translation;}
91   inline FGRotation* GetRotation(void)       {return Rotation;}
92   inline FGPosition* GetPosition(void)       {return Position;}
93   inline FGAuxiliary* GetAuxiliary(void)     {return Auxiliary;}
94   inline FGOutput* GetOutput(void)           {return Output;}
95   inline string GetEnginePath(void)          {return EnginePath;}
96   inline string GetAircraftPath(void)        {return AircraftPath;}
97
98 private:
99   bool frozen;
100   bool terminate;
101   int Error;
102   bool modelLoaded;
103
104   string AircraftPath;
105   string EnginePath;
106   string ScriptPath;
107
108   FGState*       State;
109   FGAtmosphere*  Atmosphere;
110   FGFCS*         FCS;
111   FGAircraft*    Aircraft;
112   FGTranslation* Translation;
113   FGRotation*    Rotation;
114   FGPosition*    Position;
115   FGAuxiliary*   Auxiliary;
116   FGOutput*      Output;
117   
118   bool Allocate(void);
119   bool DeAllocate(void);
120
121 protected:
122 };
123
124 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125 #endif