]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGAerodynamics.h
Expose the strut compression.
[flightgear.git] / src / FDM / JSBSim / FGAerodynamics.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGAerodynamics.h
4  Author:       Jon S. Berndt
5  Date started: 09/13/00
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 09/13/00   JSB   Created
29
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGAERODYNAMICS_H
35 #define FGAERODYNAMICS_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #ifdef FGFS
42 #  include <simgear/compiler.h>
43 #  ifdef SG_HAVE_STD_INCLUDES
44 #    include <vector>
45 #    include <map>
46 #  else
47 #    include <vector.h>
48 #    include <map.h>
49 #  endif
50 #else
51 #  include <vector>
52 #  include <map>
53 #endif
54
55 #include "FGModel.h"
56 #include "FGConfigFile.h"
57 #include "FGCoefficient.h"
58 #include "FGColumnVector3.h"
59
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 DEFINITIONS
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63
64 #define ID_AERODYNAMICS "$Id$"
65
66 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 FORWARD DECLARATIONS
68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
69
70 namespace JSBSim {
71
72 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 CLASS DOCUMENTATION
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75
76 /** Encapsulates the aerodynamic calculations.
77     This class owns and contains the list of coefficients that define the
78     aerodynamic properties of this aircraft. Here also, such unique phenomena
79     as ground effect and maximum lift curve tailoff are handled.
80     @config
81     <pre>
82     \<AERODYNAMICS>
83        \<AXIS NAME="{LIFT|DRAG|SIDE|ROLL|PITCH|YAW}">
84          {Coefficient definitions}
85        \</AXIS>
86        {Additional axis definitions}
87     \</AERODYNAMICS> </pre>
88     
89     @author Jon S. Berndt, Tony Peden
90     $Id$
91 */
92
93 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 CLASS DECLARATION
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
96
97 class FGAerodynamics : public FGModel {
98
99 public:
100   /** Constructor
101       @param Executive a pointer to the parent executive object */
102   FGAerodynamics(FGFDMExec* Executive);
103   /// Destructor
104   ~FGAerodynamics();
105
106   /** Runs the Aerodynamics model; called by the Executive
107       @return false if no error */
108   bool Run(void);
109
110   /** Loads the Aerodynamics model.
111       The Load function for this class expects the configuration file to
112       have found the AERODYNAMICS keyword in the configution file and to
113       have set that line to the current line.
114       @param AC_cfg pointer to the current configuration file.
115       @return true if successful */
116   bool Load(FGConfigFile* AC_cfg);
117
118   /** Gets the total aerodynamic force vector.
119       @return a force vector reference. */
120   FGColumnVector3& GetForces(void) {return vForces;}
121
122   /** Gets the aerodynamic force for an axis.
123       @param n Axis index. This could be 0, 1, or 2, or one of the 
124                axis enums: eX, eY, eZ.
125       @return the force acting on an axis */
126   double GetForces(int n) const {return vForces(n);}
127
128   /** Gets the total aerodynamic moment vector.
129       @return a moment vector reference. */
130   FGColumnVector3& GetMoments(void) {return vMoments;}
131
132   /** Gets the aerodynamic moment for an axis.
133       @return the moment about a single axis (as described also in the
134               similar call to GetForces(int n).*/
135   double GetMoments(int n) const {return vMoments(n);}
136
137   FGColumnVector3& GetvLastFs(void) { return vLastFs; }
138   double GetvLastFs(int axis) const { return vLastFs(axis); }
139   FGColumnVector3& GetvFs(void) { return vFs; }
140   double GetvFs(int axis) const { return vFs(axis); }
141   inline double GetLoD(void) const { return lod; }
142   inline double GetClSquared(void) const { return clsq; } 
143   inline double GetAlphaCLMax(void) const { return alphaclmax; }
144   inline double GetAlphaCLMin(void) const { return alphaclmin; }
145   
146   inline double GetAlphaHystMax(void) const { return alphahystmax; }
147   inline double GetAlphaHystMin(void) const { return alphahystmin; }
148   inline double GetHysteresisParm(void) const { return stall_hyst; }
149   inline double GetStallWarn(void) const { return impending_stall; }
150   double GetAlphaW(void) const { return alphaw; }
151
152   double GetBI2Vel(void) const { return bi2vel; }
153   double GetCI2Vel(void) const { return ci2vel; }
154   
155   inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
156   inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
157
158   /** Gets the strings for the current set of coefficients.
159       @param delimeter either a tab or comma string depending on output type
160       @return a string containing the descriptive names for all coefficients */
161   string GetCoefficientStrings(string delimeter);
162
163   /** Gets the coefficient values.
164       @param delimeter either a tab or comma string depending on output type
165       @return a string containing the numeric values for the current set of
166       coefficients */
167   string GetCoefficientValues(string delimeter);
168   
169   void bind(void);
170   void bindModel(void);
171   void unbind(void);
172   void convert(void);
173   
174 private:
175   typedef map<string,int> AxisIndex;
176   AxisIndex AxisIdx;
177   typedef vector<FGCoefficient*> CoeffArray;
178   CoeffArray* Coeff;
179   FGColumnVector3 vFs;
180   FGColumnVector3 vForces;
181   FGColumnVector3 vMoments;
182   FGColumnVector3 vLastFs;
183   FGColumnVector3 vDXYZcg;
184   double alphaclmax, alphaclmin;
185   double alphahystmax, alphahystmin;
186   double impending_stall, stall_hyst;
187   double bi2vel, ci2vel,alphaw;
188   double clsq,lod;
189   
190   typedef double (FGAerodynamics::*PMF)(int) const;
191
192   void Debug(int from);
193 };
194
195 } // namespace JSBSim
196
197 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
198 #endif
199