]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGCoefficient.h
Partial JSBsim update.
[flightgear.git] / src / FDM / JSBSim / FGCoefficient.h
1 /*******************************************************************************
2
3  Header:       FGCoefficient.h
4  Author:       Jon Berndt
5  Date started: 12/28/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 12/28/98   JSB   Created
29
30 ********************************************************************************
31 SENTRY
32 *******************************************************************************/
33
34 #ifndef FGCOEFFICIENT_H
35 #define FGCOEFFICIENT_H
36
37 /*******************************************************************************
38 INCLUDES
39 *******************************************************************************/
40 #ifdef FGFS
41 #  include <simgear/compiler.h>
42 #  include STL_STRING
43    FG_USING_STD(string);
44 #else
45 #  include <string>
46 #endif
47
48 #include <map>
49 #include "FGConfigFile.h"
50 #include "FGDefs.h"
51
52 /*******************************************************************************
53 DEFINES
54 *******************************************************************************/
55
56 using namespace std;
57
58 /*******************************************************************************
59 FORWARD DECLARATIONS
60 *******************************************************************************/
61 class FGFDMExec;
62 class FGState;
63 class FGAtmosphere;
64 class FGFCS;
65 class FGAircraft;
66 class FGTranslation;
67 class FGRotation;
68 class FGPosition;
69 class FGAuxiliary;
70 class FGOutput;
71
72 /*******************************************************************************
73 COMMENTS, REFERENCES,  and NOTES
74 ********************************************************************************
75
76 This class models the stability derivative coefficient lookup tables or 
77 equations. Note that the coefficients need not be calculated each delta-t.
78
79 FG_QBAR           1
80 FG_WINGAREA       2
81 FG_WINGSPAN       4
82 FG_CBAR           8
83 FG_ALPHA          16
84 FG_ALPHADOT       32
85 FG_BETA           64
86 FG_BETADOT        128
87 FG_PITCHRATE      256
88 FG_ROLLRATE       512
89 FG_YAWRATE        1024
90 FG_MACH           2048
91 FG_ALTITUDE       4096
92 FG_BI2VEL         8192
93 FG_CI2VEL         16384
94 FG_ELEVATOR_POS   32768L
95 FG_AILERON_POS    65536L
96 FG_RUDDER_POS     131072L
97 FG_SPDBRAKE_POS   262144L
98 FG_FLAPS_POS      524288L
99 FG_ELEVATOR_CMD   1048576L
100 FG_AILERON_CMD    2097152L
101 FG_RUDDER_CMD     4194304L
102 FG_SPDBRAKE_CMD   8388608L
103 FG_FLAPS_CMD      16777216L
104 FG_SPARE1         33554432L
105 FG_SPARE2         67108864L
106 FG_SPARE3         134217728L
107 FG_SPARE4         268435456L
108 FG_SPARE5         536870912L
109 FG_SPARE6         1073741824L
110
111 The above definitions are found in FGDefs.h
112
113 ********************************************************************************
114 CLASS DECLARATION
115 *******************************************************************************/
116
117 class FGCoefficient
118 {
119 public:
120   FGCoefficient(FGFDMExec*, FGConfigFile*);
121   ~FGCoefficient(void);
122   bool Allocate(int);
123   bool Allocate(int, int);
124   float Value(float, float);
125   float Value(float);
126   float Value(void);
127   float TotalValue(void);
128   inline string Getname(void) {return name;}
129   inline float GetSD(void) {return SD;}
130 //  inline float GetSDValue(void) {return SD;}
131 //  inline void SetSDValue(float tt) {SD = tt;}
132   inline long int Getmultipliers(void) {return multipliers;}
133   void DumpSD(void);
134   enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
135
136 protected:
137
138 private:
139   int numInstances;
140   string filename;
141   string description;
142   string name;
143   string method;
144   float StaticValue;
145   float *Table2D;
146   float **Table3D;
147   float LookupR, LookupC;
148   long int multipliers;
149   long int mult_idx[10];
150   int rows, columns;
151   Type type;
152   int mult_count;
153   float SD; // Actual stability derivative (or other coefficient) value
154
155   FGFDMExec*      FDMExec;
156   FGState*        State;
157   FGAtmosphere*   Atmosphere;
158   FGFCS*          FCS;
159   FGAircraft*     Aircraft;
160   FGTranslation*  Translation;
161   FGRotation*     Rotation;
162   FGPosition*     Position;
163   FGAuxiliary*    Auxiliary;
164   FGOutput*       Output;
165 };
166
167 /******************************************************************************/
168 #endif