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$"
69 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
79 /** Encapsulates the aerodynamic calculations.
80 This class owns and contains the list of coefficients that define the
81 aerodynamic properties of this aircraft. Here also, such unique phenomena
82 as ground effect and maximum lift curve tailoff are handled.
86 \<AXIS NAME="{LIFT|DRAG|SIDE|ROLL|PITCH|YAW}">
87 {Coefficient definitions}
89 {Additional axis definitions}
90 \</AERODYNAMICS> </pre>
92 @author Jon S. Berndt, Tony Peden
96 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
100 class FGAerodynamics : public FGModel {
104 @param Executive a pointer to the parent executive object */
105 FGAerodynamics(FGFDMExec* Executive);
109 /** Runs the Aerodynamics model; called by the Executive
110 @return false if no error */
113 /** Loads the Aerodynamics model.
114 The Load function for this class expects the configuration file to
115 have found the AERODYNAMICS keyword in the configution file and to
116 have set that line to the current line.
117 @param AC_cfg pointer to the current configuration file.
118 @return true if successful */
119 bool Load(FGConfigFile* AC_cfg);
121 /** Gets the total aerodynamic force vector.
122 @return a force vector reference. */
123 FGColumnVector3& GetForces(void) {return vForces;}
125 /** Gets the aerodynamic force for an axis.
126 @param n Axis index. This could be 0, 1, or 2, or one of the
127 axis enums: eX, eY, eZ.
128 @return the force acting on an axis */
129 double GetForces(int n) const {return vForces(n);}
131 /** Gets the total aerodynamic moment vector.
132 @return a moment vector reference. */
133 FGColumnVector3& GetMoments(void) {return vMoments;}
135 /** Gets the aerodynamic moment for an axis.
136 @return the moment about a single axis (as described also in the
137 similar call to GetForces(int n).*/
138 double GetMoments(int n) const {return vMoments(n);}
140 FGColumnVector3& GetvLastFs(void) { return vLastFs; }
141 double GetvLastFs(int axis) const { return vLastFs(axis); }
142 FGColumnVector3& GetvFs(void) { return vFs; }
143 double GetvFs(int axis) const { return vFs(axis); }
144 inline double GetLoD(void) const { return lod; }
145 inline double GetClSquared(void) const { return clsq; }
146 inline double GetAlphaCLMax(void) const { return alphaclmax; }
147 inline double GetAlphaCLMin(void) const { return alphaclmin; }
149 inline double GetAlphaHystMax(void) const { return alphahystmax; }
150 inline double GetAlphaHystMin(void) const { return alphahystmin; }
151 inline double GetHysteresisParm(void) const { return stall_hyst; }
152 inline double GetStallWarn(void) const { return impending_stall; }
153 double GetAlphaW(void) const { return alphaw; }
155 double GetBI2Vel(void) const { return bi2vel; }
156 double GetCI2Vel(void) const { return ci2vel; }
158 inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
159 inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
161 /** Gets the strings for the current set of coefficients.
162 @return a string containing the descriptive names for all coefficients */
163 string GetCoefficientStrings(void);
165 /** Gets the coefficient values.
166 @return a string containing the numeric values for the current set of
168 string GetCoefficientValues(void);
171 void bindModel(void);
175 typedef map<string,int> AxisIndex;
177 typedef vector<FGCoefficient*> CoeffArray;
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;
190 typedef double (FGAerodynamics::*PMF)(int) const;
192 void Debug(int from);
195 } // namespace JSBSim
197 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%