]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGCoefficient.h
Nov. 14, 2000 JSBSim updates
[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 <vector>
46 #include <string>
47 #include "FGConfigFile.h"
48 #include "FGDefs.h"
49
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 DEFINITIONS
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53
54 #define ID_COEFFICIENT "$Header"
55
56 using std::vector;
57
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 FORWARD DECLARATIONS
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61
62 class FGFDMExec;
63 class FGState;
64 class FGAtmosphere;
65 class FGFCS;
66 class FGAircraft;
67 class FGTranslation;
68 class FGRotation;
69 class FGPosition;
70 class FGAuxiliary;
71 class FGOutput;
72
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76
77 Note that the coefficients need not be calculated each delta-t. This is
78 something that may be fixed someday.
79
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 CLASS DOCUMENTATION
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
83
84 /** This class models the stability derivative coefficient lookup tables.
85     Each coefficient for an axis is stored in that axes' vector of coefficients.
86     Each FDM execution frame the Run() method of the [currently] FGAircraft model
87     is called and the coefficient value is calculated.
88     @author Jon S. Berndt
89     @version $Id$
90     @see -
91 */
92
93 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 CLASS DECLARATION
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
96
97 class FGCoefficient
98 {
99   typedef vector <eParam> MultVec;
100   enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
101
102   int numInstances;
103   string filename;
104   string description;
105   string name;
106   string method;
107   float StaticValue;
108   float **Table;
109   eParam LookupR, LookupC;
110   MultVec multipliers;
111   int rows, columns;
112   Type type;
113   float SD; // Actual stability derivative (or other coefficient) value
114   float gain,bias;
115
116   FGFDMExec*      FDMExec;
117   FGState*        State;
118   FGAtmosphere*   Atmosphere;
119   FGFCS*          FCS;
120   FGAircraft*     Aircraft;
121   FGTranslation*  Translation;
122   FGRotation*     Rotation;
123   FGPosition*     Position;
124   FGAuxiliary*    Auxiliary;
125   FGOutput*       Output;
126   
127   bool DeAllocate(void);
128   bool Allocate(int, int);
129
130 public:
131   FGCoefficient(FGFDMExec*, FGConfigFile*);
132   ~FGCoefficient(void);
133   
134   float Value(float, float);
135   float Value(float);
136   float Value(void);
137   float TotalValue(void);
138   inline string Getname(void) {return name;}
139   inline float GetSD(void) {return SD;}
140   inline MultVec Getmultipliers(void) {return multipliers;}
141   void DumpSD(void);
142   
143   inline float GetGain(void) { return gain; }
144   inline float GetBias(void) { return bias; }
145   inline void SetGain(float tt) { gain = tt; }
146   inline void SetBias(float tt) { bias = tt; }
147   inline void ResetGB(void) { gain = 1.0; bias = 0.0; }
148
149 };
150
151 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 #endif