]> git.mxchange.org Git - flightgear.git/blob - JSBsim/FGState.h
d78f427c7b49790a199593bf1925019f9eea1352
[flightgear.git] / 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 Based on Flightgear code, which is based on LaRCSim. This class wraps all
30 global state variables (such as velocity, position, orientation, etc.).
31
32 HISTORY
33 --------------------------------------------------------------------------------
34 11/17/98   JSB   Created
35
36 ********************************************************************************
37 SENTRY
38 *******************************************************************************/
39
40 #ifndef FGSTATE_H
41 #define FGSTATE_H
42
43 /*******************************************************************************
44 INCLUDES
45 *******************************************************************************/
46
47 #include <stdio.h>
48 #include <fstream.h>
49 #include <string>
50 #include "FGDefs.h"
51
52 /*******************************************************************************
53 DEFINES
54 *******************************************************************************/
55
56 /*******************************************************************************
57 CLASS DECLARATION
58 *******************************************************************************/
59
60 class FGFDMExec;
61 class FGState
62 {
63 public:
64    FGState(FGFDMExec*);
65   ~FGState(void);
66
67   bool FGState::Reset(const string& path, const string& fname);
68   bool StoreData(char*);
69   bool DumpData(char*);
70   bool DisplayData(void);
71
72   inline float GetVt(void) {return Vt;}
73
74   inline float Getlatitude(void) {return latitude;}
75   inline float Getlongitude(void) {return longitude;}
76   inline float GetGeodeticLat(void) {return GeodeticLat;}
77
78   inline float Getadot(void) {return adot;}
79   inline float Getbdot(void) {return bdot;}
80
81   inline float Geth(void) {return h;}
82   inline float Geta(void) {return a;}
83   inline float GetMach(void) {return Mach;}
84
85   inline float Getsim_time(void) {return sim_time;}
86   inline float Getdt(void) {return dt;}
87
88   inline float Getqbar(void) {return qbar;}
89
90   inline void SetVt(float tt) {Vt = tt;}
91
92   inline void Setlatitude(float tt) {latitude = tt;}
93   inline void Setlongitude(float tt) {longitude = tt;}
94   inline void SetGeodeticLat(float tt) {GeodeticLat = tt;}
95
96   inline void Setadot(float tt) {adot = tt;}
97   inline void Setbdot(float tt) {bdot = tt;}
98
99   inline void Setqbar(float tt) {qbar = tt;}
100
101   inline void Seth(float tt) {h = tt;}
102   inline void Seta(float tt) {a = tt;}
103   inline void SetMach(float tt) {Mach = tt;}
104
105   inline float Setsim_time(float tt) {sim_time = tt; return sim_time;}
106   inline void  Setdt(float tt) {dt = tt;}
107
108   inline float IncrTime(void) {sim_time+=dt;return sim_time;}
109
110 private:
111
112   float Vt;                         // Total velocity
113   float latitude, longitude;        // position
114   float GeodeticLat;                // Geodetic Latitude
115   float adot, bdot;                 // alpha dot and beta dot
116   float h, a;                       // altitude above sea level, speed of sound
117   float qbar;                       // dynamic pressure
118   float sim_time, dt;
119   float Mach;                       // Mach number
120
121   FGFDMExec* FDMExec;
122
123 protected:
124
125 };
126
127 /******************************************************************************/
128 #endif