1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 Header: FGAerodynamics.h
7 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
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
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
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.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
34 #ifndef FGAERODYNAMICS_H
35 #define FGAERODYNAMICS_H
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 # include <simgear/compiler.h>
43 # ifdef SG_HAVE_STD_INCLUDES
56 #include "FGConfigFile.h"
58 #include "FGMassBalance.h"
59 #include "FGTranslation.h"
60 #include "FGCoefficient.h"
61 #include "FGFactorGroup.h"
63 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 #define ID_AERODYNAMICS "$Id$"
70 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
74 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
75 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
78 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
82 /** Encapsulates the aerodynamic calculations.
83 This class owns and contains the list of coefficients that define the
84 aerodynamic properties of this aircraft. Here also, such unique phenomena
85 as ground effect and maximum lift curve tailoff are handled.
88 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAerodynamics.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
90 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAerodynamics.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
94 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
98 class FGAerodynamics : public FGModel {
102 @param Executive a pointer to the parent executive object */
103 FGAerodynamics(FGFDMExec*);
107 /** Runs the Aerodynamics model; called by the Executive
108 @return false if no error */
111 /** Loads the Aerodynamics model
112 @return true if successful */
113 bool Load(FGConfigFile* AC_cfg);
115 /** Gets the total aerodynamic force vector.
116 @return a force vector reference. */
117 FGColumnVector3& GetForces(void) {return vForces;}
118 double GetForces(int n) const {return vForces(n);}
120 /** Gets the total aerodynamic moment vector.
121 @return a moment vector reference. */
122 FGColumnVector3& GetMoments(void) {return vMoments;}
123 double GetMoments(int n) const {return vMoments(n);}
125 FGColumnVector3& GetvLastFs(void) { return vLastFs; }
126 double GetvLastFs(int axis) const { return vLastFs(axis); }
127 FGColumnVector3& GetvFs(void) { return vFs; }
128 double GetvFs(int axis) const { return vFs(axis); }
129 inline double GetLoD(void) const { return lod; }
130 inline double GetClSquared(void) const { return clsq; }
131 inline double GetAlphaCLMax(void) const { return alphaclmax; }
132 inline double GetAlphaCLMin(void) const { return alphaclmin; }
134 inline double GetAlphaHystMax(void) const { return alphahystmax; }
135 inline double GetAlphaHystMin(void) const { return alphahystmin; }
136 inline double GetHysteresisParm(void) const { return stall_hyst; }
137 inline double GetStallWarn(void) const { return impending_stall; }
138 double GetAlphaW(void) const { return alphaw; }
140 double GetBI2Vel(void) const { return bi2vel; }
141 double GetCI2Vel(void) const { return ci2vel; }
143 inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
144 inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
146 /** Gets the strings for the current set of coefficients.
147 @return a string containing the descriptive names for all coefficients */
148 string GetCoefficientStrings(void);
150 /** Gets the coefficient values.
151 @return a string containing the numeric values for the current set of
153 string GetCoefficientValues(void);
156 void bindModel(void);
160 typedef map<string,int> AxisIndex;
162 typedef vector<FGCoefficient*> CoeffArray;
165 FGColumnVector3 vForces;
166 FGColumnVector3 vMoments;
167 FGColumnVector3 vLastFs;
168 FGColumnVector3 vDXYZcg;
169 double alphaclmax, alphaclmin;
170 double alphahystmax, alphahystmin;
171 double impending_stall, stall_hyst;
172 double bi2vel, ci2vel,alphaw;
175 typedef double (FGAerodynamics::*PMF)(int) const;
177 void Debug(int from);
180 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%