]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGState.h
Fix stall widths for the "auxilliary" (reverse flow) stalls so they
[flightgear.git] / src / FDM / JSBSim / FGState.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGState.h
4  Author:       Jon S. 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 FUNCTIONAL DESCRIPTION
27 --------------------------------------------------------------------------------
28
29 HISTORY
30 --------------------------------------------------------------------------------
31 11/17/98   JSB   Created
32
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 SENTRY
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36
37 #ifndef FGSTATE_H
38 #define FGSTATE_H
39
40 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 INCLUDES
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
44 #ifdef FGFS
45 #  include <simgear/compiler.h>
46 #  ifdef SG_HAVE_STD_INCLUDES
47 #    include <fstream>
48 #  else
49 #    include <fstream.h>
50 #  endif
51 #else
52 #  if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
53 #    include <fstream.h>
54 #  else
55 #    include <fstream>
56 #  endif
57 #endif
58
59 #include <string>
60 #include <map>
61 #include "FGJSBBase.h"
62 #include "FGInitialCondition.h"
63 #include "FGMatrix33.h"
64 #include "FGColumnVector3.h"
65 #include "FGQuaternion.h"
66 #include "FGFDMExec.h"
67 #include "FGAtmosphere.h"
68 #include "FGFCS.h"
69 #include "FGPropagate.h"
70 #include "FGAuxiliary.h"
71 #include "FGAerodynamics.h"
72 #include "FGOutput.h"
73 #include "FGAircraft.h"
74 #include "FGGroundReactions.h"
75 #include "FGPropulsion.h"
76
77 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 DEFINITIONS
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
80
81 #define ID_STATE "$Id$"
82
83 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 FORWARD DECLARATIONS
85 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
86
87 namespace JSBSim {
88
89 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 CLASS DOCUMENTATION
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
92
93 /** Encapsulates the calculation of aircraft state.
94     @author Jon S. Berndt
95     @version $Id$
96 */
97
98 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99 CLASS DECLARATION
100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
101
102 class FGState : public FGJSBBase
103 {
104 public:
105   /** Constructor
106       @param Executive a pointer to the parent executive object */
107   FGState(FGFDMExec*);
108   /// Destructor
109   ~FGState();
110
111   /** Initializes the simulation state based on parameters from an Initial Conditions object.
112       @param FGIC pointer to an initial conditions object.
113       @see FGInitialConditions.
114       */
115   void Initialize(FGInitialCondition *FGIC);
116
117   /// Returns the simulation time in seconds.
118   inline double Getsim_time(void) const { return sim_time; }
119   /// Returns the simulation delta T.
120   inline double Getdt(void) { return dt; }
121
122   /// Suspends the simulation and sets the delta T to zero.
123   inline void Suspend(void) {saved_dt = dt; dt = 0.0;}
124   /// Resumes the simulation by resetting delta T to the correct value.
125   inline void Resume(void)  {dt = saved_dt;}
126
127   /** Sets the current sim time.
128       @param cur_time the current time
129       @return the current time.
130       */
131   inline double Setsim_time(double cur_time) {
132     sim_time = cur_time;
133     return sim_time;
134   }
135
136   /** Sets the integration time step for the simulation executive.
137       @param delta_t the time step in seconds.
138       */
139   inline void  Setdt(double delta_t) { dt = delta_t; }
140
141   /** Increments the simulation time.
142       @return the new simulation time.
143       */
144   inline double IncrTime(void) {
145     sim_time+=dt;
146     return sim_time;
147   }
148
149   /** Calculates and returns the stability-to-body axis transformation matrix.
150       @return a reference to the stability-to-body transformation matrix.
151       */
152   FGMatrix33& GetTs2b(void);
153
154   /** Calculates and returns the body-to-stability axis transformation matrix.
155       @return a reference to the stability-to-body transformation matrix.
156       */
157   FGMatrix33& GetTb2s(void);
158
159   /** Prints a summary of simulator state (speed, altitude,
160       configuration, etc.)
161   */
162   void ReportState(void);
163
164   void bind();
165   void unbind();
166
167 private:
168   double sim_time, dt;
169   double saved_dt;
170
171   FGFDMExec* FDMExec;
172   FGMatrix33 mTs2b;
173   FGMatrix33 mTb2s;
174
175   FGAircraft* Aircraft;
176   FGPropagate* Propagate;
177   FGOutput* Output;
178   FGAtmosphere* Atmosphere;
179   FGFCS* FCS;
180   FGAerodynamics* Aerodynamics;
181   FGGroundReactions* GroundReactions;
182   FGPropulsion* Propulsion;
183   FGAuxiliary* Auxiliary;
184   FGPropertyManager* PropertyManager;
185
186   void Debug(int from);
187 };
188 }
189 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
190
191
192 #endif
193