JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
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 (jon@jsbsim.org) -------------
8 
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser 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 Lesser General Public License for more
17  details.
18 
19  You should have received a copy of the GNU Lesser 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 Lesser 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 #include <string>
42 #include <vector>
43 #include <map>
44 
45 #include "FGModel.h"
46 #include "math/FGFunction.h"
47 #include "math/FGColumnVector3.h"
48 #include "math/FGMatrix33.h"
49 
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 DEFINITIONS
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53 
54 #define ID_AERODYNAMICS "$Id: FGAerodynamics.h,v 1.30 2014/09/03 17:26:28 bcoconni Exp $"
55 
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 FORWARD DECLARATIONS
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 
60 namespace JSBSim {
61 
62 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 CLASS DOCUMENTATION
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
65 
114 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115 CLASS DECLARATION
116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
117 
118 class FGAerodynamics : public FGModel
119 {
120 
121 public:
124  FGAerodynamics(FGFDMExec* Executive);
126  ~FGAerodynamics();
127 
128  bool InitModel(void);
129 
137  bool Run(bool Holding);
138 
144  bool Load(Element* element);
145 
148  const FGColumnVector3& GetForces(void) const {return vForces;}
149 
154  double GetForces(int n) const {return vForces(n);}
155 
158  const FGColumnVector3& GetMoments(void) const {return vMoments;}
159 
163  double GetMoments(int n) const {return vMoments(n);}
164 
167  const FGColumnVector3& GetMomentsMRC(void) const {return vMomentsMRC;}
168 
172  double GetMomentsMRC(int n) const {return vMomentsMRC(n);}
173 
176  const FGColumnVector3& GetvFw(void) const { return vFw; }
177 
182  double GetvFw(int axis) const { return vFw(axis); }
183 
185  double GetLoD(void) const { return lod; }
186 
188  double GetClSquared(void) const { return clsq; }
189  double GetAlphaCLMax(void) const { return alphaclmax; }
190  double GetAlphaCLMin(void) const { return alphaclmin; }
191 
192  double GetHysteresisParm(void) const { return stall_hyst; }
193  double GetStallWarn(void) const { return impending_stall; }
194  double GetAlphaW(void) const { return alphaw; }
195 
196  double GetBI2Vel(void) const { return bi2vel; }
197  double GetCI2Vel(void) const { return ci2vel; }
198 
199  void SetAlphaCLMax(double tt) { alphaclmax=tt; }
200  void SetAlphaCLMin(double tt) { alphaclmin=tt; }
201 
205  std::string GetAeroFunctionStrings(const std::string& delimeter) const;
206 
211  std::string GetAeroFunctionValues(const std::string& delimeter) const;
212 
213  std::vector <FGFunction*> * GetAeroFunctions(void) const { return AeroFunctions; }
214 
215  struct Inputs {
216  double Alpha;
217  double Beta;
218  double Vt;
219  double Qbar;
220  double Wingarea;
221  double Wingspan;
222  double Wingchord;
223  double Wingincidence;
224  FGColumnVector3 RPBody;
225  FGMatrix33 Tb2w;
226  FGMatrix33 Tw2b;
227  } in;
228 
229 private:
230  enum eAxisType {atNone, atLiftDrag, atAxialNormal, atBodyXYZ} axisType;
231  typedef std::map<std::string,int> AxisIndex;
232  AxisIndex AxisIdx;
233  FGFunction* AeroRPShift;
234  typedef std::vector <FGFunction*> AeroFunctionArray;
235  AeroFunctionArray* AeroFunctions;
236  FGColumnVector3 vFnative;
237  FGColumnVector3 vFw;
238  FGColumnVector3 vForces;
239  AeroFunctionArray* AeroFunctionsAtCG;
240  FGColumnVector3 vFwAtCG;
241  FGColumnVector3 vFnativeAtCG;
242  FGColumnVector3 vForcesAtCG;
243  FGColumnVector3 vMoments;
244  FGColumnVector3 vMomentsMRC;
245  FGColumnVector3 vDXYZcg;
246  FGColumnVector3 vDeltaRP;
247  double alphaclmax, alphaclmin;
248  double alphaclmax0, alphaclmin0;
249  double alphahystmax, alphahystmin;
250  double impending_stall, stall_hyst;
251  double bi2vel, ci2vel,alphaw;
252  double clsq, lod, qbar_area;
253 
254  typedef double (FGAerodynamics::*PMF)(int) const;
255  void DetermineAxisSystem(Element* document);
256  void bind(void);
257 
258  void Debug(int from);
259 };
260 
261 } // namespace JSBSim
262 
263 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264 #endif
265 
double GetForces(int n) const
Gets the aerodynamic force for an axis.
double GetLoD(void) const
Retrieves the lift over drag ratio.
double GetMomentsMRC(int n) const
Gets the aerodynamic moment about the Moment Reference Center for an axis.
std::string GetAeroFunctionValues(const std::string &delimeter) const
Gets the aero function values.
Encapsulates the aerodynamic calculations.
const FGColumnVector3 & GetvFw(void) const
Retrieves the aerodynamic forces in the wind axes.
const FGColumnVector3 & GetMomentsMRC(void) const
Gets the total aerodynamic moment vector about the Moment Reference Center.
double GetClSquared(void) const
Retrieves the square of the lift coefficient.
const FGColumnVector3 & GetForces(void) const
Gets the total aerodynamic force vector.
std::string GetAeroFunctionStrings(const std::string &delimeter) const
Gets the strings for the current set of aero functions.
Base class for all scheduled JSBSim models.
Definition: FGModel.h:74
Represents a mathematical function.
Definition: FGFunction.h:699
This class implements a 3 element column vector.
~FGAerodynamics()
Destructor.
double GetvFw(int axis) const
Retrieves the aerodynamic forces in the wind axes, given an axis.
Handles matrix math operations.
Definition: FGMatrix33.h:92
FGAerodynamics(FGFDMExec *Executive)
Constructor.
double GetMoments(int n) const
Gets the aerodynamic moment about the CG for an axis.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
bool Load(Element *element)
Loads the Aerodynamics model.
bool Run(bool Holding)
Runs the Aerodynamics model; called by the Executive Can pass in a value indicating if the executive ...
const FGColumnVector3 & GetMoments(void) const
Gets the total aerodynamic moment vector about the CG.