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 <math/FGFunction.h>
57 #include <math/FGColumnVector3.h>
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63 #define ID_AERODYNAMICS "$Id$"
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
71 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 /** Encapsulates the aerodynamic calculations.
76 This class owns and contains the list of force/coefficients that define the
77 aerodynamic properties of an aircraft. Here also, such unique phenomena
78 as ground effect and maximum lift curve tailoff are handled.
82 <axis name="{LIFT|DRAG|SIDE|ROLL|PITCH|YAW}">
83 {force coefficient definitions}
85 {additional axis definitions}
89 @author Jon S. Berndt, Tony Peden
93 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
97 class FGAerodynamics : public FGModel {
101 @param Executive a pointer to the parent executive object */
102 FGAerodynamics(FGFDMExec* Executive);
106 /** Runs the Aerodynamics model; called by the Executive
107 @return false if no error */
110 /** Loads the Aerodynamics model.
111 The Load function for this class expects the XML parser to
112 have found the aerodynamics keyword in the configuration file.
113 @param element pointer to the current XML element for aerodynamics parameters.
114 @return true if successful */
115 bool Load(Element* element);
117 /** Gets the total aerodynamic force vector.
118 @return a force vector reference. */
119 FGColumnVector3& GetForces(void) {return vForces;}
121 /** Gets the aerodynamic force for an axis.
122 @param n Axis index. This could be 0, 1, or 2, or one of the
123 axis enums: eX, eY, eZ.
124 @return the force acting on an axis */
125 double GetForces(int n) const {return vForces(n);}
127 /** Gets the total aerodynamic moment vector.
128 @return a moment vector reference. */
129 FGColumnVector3& GetMoments(void) {return vMoments;}
131 /** Gets the aerodynamic moment for an axis.
132 @return the moment about a single axis (as described also in the
133 similar call to GetForces(int n).*/
134 double GetMoments(int n) const {return vMoments(n);}
136 FGColumnVector3& GetvLastFs(void) { return vLastFs; }
137 double GetvLastFs(int axis) const { return vLastFs(axis); }
138 FGColumnVector3& GetvFs(void) { return vFs; }
139 double GetvFs(int axis) const { return vFs(axis); }
140 inline double GetLoD(void) const { return lod; }
141 inline double GetClSquared(void) const { return clsq; }
142 inline double GetAlphaCLMax(void) const { return alphaclmax; }
143 inline double GetAlphaCLMin(void) const { return alphaclmin; }
145 inline double GetAlphaHystMax(void) const { return alphahystmax; }
146 inline double GetAlphaHystMin(void) const { return alphahystmin; }
147 inline double GetHysteresisParm(void) const { return stall_hyst; }
148 inline double GetStallWarn(void) const { return impending_stall; }
149 double GetAlphaW(void) const { return alphaw; }
151 double GetBI2Vel(void) const { return bi2vel; }
152 double GetCI2Vel(void) const { return ci2vel; }
154 inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
155 inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
157 /** Gets the strings for the current set of coefficients.
158 @param delimeter either a tab or comma string depending on output type
159 @return a string containing the descriptive names for all coefficients */
160 string GetCoefficientStrings(string delimeter);
162 /** Gets the coefficient values.
163 @param delimeter either a tab or comma string depending on output type
164 @return a string containing the numeric values for the current set of
166 string GetCoefficientValues(string delimeter);
169 typedef map<string,int> AxisIndex;
171 vector <FGFunction*> variables;
172 typedef vector <FGFunction*> CoeffArray;
175 FGColumnVector3 vForces;
176 FGColumnVector3 vMoments;
177 FGColumnVector3 vLastFs;
178 FGColumnVector3 vDXYZcg;
179 double alphaclmax, alphaclmin;
180 double alphahystmax, alphahystmin;
181 double impending_stall, stall_hyst;
182 double bi2vel, ci2vel,alphaw;
183 double clsq, lod, qbar_area;
185 typedef double (FGAerodynamics::*PMF)(int) const;
189 void Debug(int from);
192 } // namespace JSBSim
194 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%