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