]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGAerodynamics.h
More turbulence tweaks and fixes.
[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 "FGState.h"
58 #include "FGMassBalance.h"
59 #include "FGTranslation.h"
60 #include "FGCoefficient.h"
61 #include "FGFactorGroup.h"
62
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 DEFINITIONS
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66
67 #define ID_AERODYNAMICS "$Id$"
68
69
70 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 FORWARD DECLARATIONS
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
73
74 namespace JSBSim {
75
76 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
79
80 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 CLASS DOCUMENTATION
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
83
84 /** Encapsulates the aerodynamic calculations.
85     This class owns and contains the list of coefficients that define the
86     aerodynamic properties of this aircraft. Here also, such unique phenomena
87     as ground effect and maximum lift curve tailoff are handled.
88     @author Jon S. Berndt
89     @version $Id$
90     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAerodynamics.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
91          Header File </a>
92     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAerodynamics.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
93          Source File </a>
94 */
95
96 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 CLASS DECLARATION
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
99
100 class FGAerodynamics : public FGModel {
101
102 public:
103   /** Constructor
104       @param Executive a pointer to the parent executive object */
105   FGAerodynamics(FGFDMExec*);
106   /// Destructor
107   ~FGAerodynamics();
108
109   /** Runs the Aerodynamics model; called by the Executive
110       @return false if no error */
111   bool Run(void);
112
113   /** Loads the Aerodynamics model
114       @return true if successful */
115   bool Load(FGConfigFile* AC_cfg);
116
117   /** Gets the total aerodynamic force vector.
118       @return a force vector reference. */
119   FGColumnVector3& GetForces(void) {return vForces;}
120   double GetForces(int n) const {return vForces(n);}
121
122   /** Gets the total aerodynamic moment vector.
123       @return a moment vector reference. */
124   FGColumnVector3& GetMoments(void) {return vMoments;}
125   double GetMoments(int n) const {return vMoments(n);}
126
127   FGColumnVector3& GetvLastFs(void) { return vLastFs; }
128   double GetvLastFs(int axis) const { return vLastFs(axis); }
129   FGColumnVector3& GetvFs(void) { return vFs; }
130   double GetvFs(int axis) const { return vFs(axis); }
131   inline double GetLoD(void) const { return lod; }
132   inline double GetClSquared(void) const { return clsq; } 
133   inline double GetAlphaCLMax(void) const { return alphaclmax; }
134   inline double GetAlphaCLMin(void) const { return alphaclmin; }
135   
136   inline double GetAlphaHystMax(void) const { return alphahystmax; }
137   inline double GetAlphaHystMin(void) const { return alphahystmin; }
138   inline double GetHysteresisParm(void) const { return stall_hyst; }
139   inline double GetStallWarn(void) const { return impending_stall; }
140   double GetAlphaW(void) const { return alphaw; }
141
142   double GetBI2Vel(void) const { return bi2vel; }
143   double GetCI2Vel(void) const { return ci2vel; }
144   
145   inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
146   inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
147
148     /** Gets the strings for the current set of coefficients.
149       @return a string containing the descriptive names for all coefficients */
150   string GetCoefficientStrings(void);
151
152   /** Gets the coefficient values.
153       @return a string containing the numeric values for the current set of
154       coefficients */
155   string GetCoefficientValues(void);
156   
157   void bind(void);
158   void bindModel(void);
159   void unbind(void);
160   
161 private:
162   typedef map<string,int> AxisIndex;
163   AxisIndex AxisIdx;
164   typedef vector<FGCoefficient*> CoeffArray;
165   CoeffArray* Coeff;
166   FGColumnVector3 vFs;
167   FGColumnVector3 vForces;
168   FGColumnVector3 vMoments;
169   FGColumnVector3 vLastFs;
170   FGColumnVector3 vDXYZcg;
171   double alphaclmax, alphaclmin;
172   double alphahystmax, alphahystmin;
173   double impending_stall, stall_hyst;
174   double bi2vel, ci2vel,alphaw;
175   double clsq,lod;
176   
177   typedef double (FGAerodynamics::*PMF)(int) const;
178
179   void Debug(int from);
180 };
181
182 } // namespace JSBSim
183
184 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
185 #endif
186