FlightGear next
FGAerodynamics.h
Go to the documentation of this file.
1/*
2 * SPDX-FileName: FGAerodynamics.h
3 * SPDX-FileCopyrightText: Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org)
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8HISTORY
9--------------------------------------------------------------------------------
1009/13/00 JSB Created
11
12%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13SENTRY
14%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
15
16#pragma once
17
18/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19INCLUDES
20%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
21
22#include <map>
23#include <string>
24#include <vector>
25
26#include "FGModel.h"
28#include "math/FGFunction.h"
29#include "math/FGMatrix33.h"
30
31/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32FORWARD DECLARATIONS
33%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
34
35namespace JSBSim {
36
37/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38CLASS DOCUMENTATION
39%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
89
90/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91CLASS DECLARATION
92%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
93
94class FGAerodynamics : public FGModel
95{
96public:
99 FGAerodynamics(FGFDMExec* Executive);
101 ~FGAerodynamics() override;
102
103 bool InitModel(void) override;
104
112 bool Run(bool Holding) override;
113
119 bool Load(Element* element) override;
120
123 const FGColumnVector3& GetForces(void) const { return vForces; }
124
129 double GetForces(int n) const { return vForces(n); }
130
133 const FGColumnVector3& GetMoments(void) const { return vMoments; }
134
138 double GetMoments(int n) const { return vMoments(n); }
139
142 const FGColumnVector3& GetMomentsMRC(void) const { return vMomentsMRC; }
143
147 double GetMomentsMRC(int n) const { return vMomentsMRC(n); }
148
151 const FGColumnVector3& GetvFw(void) const { return vFw; }
152
157 double GetvFw(int axis) const { return vFw(axis); }
158
162
167 double GetForcesInStabilityAxes(int n) const { return GetForcesInStabilityAxes()(n); }
168
171 FGColumnVector3 GetMomentsInStabilityAxes(void) const { return Tb2s * vMoments; }
172
176 double GetMomentsInStabilityAxes(int n) const { return GetMomentsInStabilityAxes()(n); }
177
180 FGColumnVector3 GetMomentsInWindAxes(void) const { return in.Tb2w * vMoments; }
181
185 double GetMomentsInWindAxes(int n) const { return GetMomentsInWindAxes()(n); }
186
188 double GetLoD(void) const { return lod; }
189
191 double GetClSquared(void) const { return clsq; }
192 double GetAlphaCLMax(void) const { return alphaclmax; }
193 double GetAlphaCLMin(void) const { return alphaclmin; }
194
195 double GetHysteresisParm(void) const { return stall_hyst; }
196 double GetStallWarn(void) const { return impending_stall; }
197 double GetAlphaW(void) const { return alphaw; }
198
199 double GetBI2Vel(void) const { return bi2vel; }
200 double GetCI2Vel(void) const { return ci2vel; }
201
202 void SetAlphaCLMax(double tt) { alphaclmax = tt; }
203 void SetAlphaCLMin(double tt) { alphaclmin = tt; }
204
208 std::string GetAeroFunctionStrings(const std::string& delimeter) const;
209
214 std::string GetAeroFunctionValues(const std::string& delimeter) const;
215
216 std::vector<FGFunction*>* GetAeroFunctions(void) const { return AeroFunctions; }
217
231
232private:
233 enum eAxisType { atNone,
234 atWind,
235 atBodyAxialNormal,
236 atBodyXYZ,
237 atStability } forceAxisType,
238 momentAxisType;
239 typedef std::map<std::string, int> AxisIndex;
240 AxisIndex AxisIdx;
241 FGFunction* AeroRPShift;
242 typedef std::vector<FGFunction*> AeroFunctionArray;
243 AeroFunctionArray* AeroFunctions;
244 FGMatrix33 Ts2b, Tb2s;
245 FGColumnVector3 vFnative;
246 FGColumnVector3 vFw;
247 FGColumnVector3 vForces;
248 AeroFunctionArray* AeroFunctionsAtCG;
249 FGColumnVector3 vFnativeAtCG;
250 FGColumnVector3 vForcesAtCG;
251 FGColumnVector3 vMoments;
252 FGColumnVector3 vMomentsMRC;
253 FGColumnVector3 vMomentsMRCBodyXYZ;
254 FGColumnVector3 vDXYZcg;
255 FGColumnVector3 vDeltaRP;
256 double alphaclmax, alphaclmin;
257 double alphaclmax0, alphaclmin0;
258 double alphahystmax, alphahystmin;
259 double impending_stall, stall_hyst;
260 double bi2vel, ci2vel, alphaw;
261 double clsq, lod, qbar_area;
262
263 typedef double (FGAerodynamics::*PMF)(int) const;
264 void DetermineAxisSystem(Element* document);
265 void ProcessAxesNameAndFrame(FGAerodynamics::eAxisType& axisType,
266 const std::string& name, const std::string& frame,
267 Element* el, const std::string& validNames);
268 void bind(void);
269 void BuildStabilityTransformMatrices(void);
270
271 void Debug(int from) override;
272};
273
274} // namespace JSBSim
275
276//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void SetAlphaCLMin(double tt)
FGAerodynamics(FGFDMExec *Executive)
Constructor.
bool InitModel(void) override
const FGColumnVector3 & GetMomentsMRC(void) const
Gets the total aerodynamic moment vector about the Moment Reference Center.
~FGAerodynamics() override
Destructor.
const FGColumnVector3 & GetMoments(void) const
Gets the total aerodynamic moment vector about the CG.
FGColumnVector3 GetForcesInStabilityAxes(void) const
Retrieves the aerodynamic forces in the stability axes.
double GetForces(int n) const
Gets the aerodynamic force for an axis.
double GetMomentsInStabilityAxes(int n) const
Gets the aerodynamic moment about the CG for an axis.
double GetAlphaCLMin(void) const
const FGColumnVector3 & GetvFw(void) const
Retrieves the aerodynamic forces in the wind axes.
double GetStallWarn(void) const
bool Load(Element *element) override
Loads the Aerodynamics model.
double GetvFw(int axis) const
Retrieves the aerodynamic forces in the wind axes, given an axis.
std::vector< FGFunction * > * GetAeroFunctions(void) const
double GetAlphaW(void) const
void SetAlphaCLMax(double tt)
double GetMomentsInWindAxes(int n) const
Gets the aerodynamic moment about the CG for an axis.
double GetClSquared(void) const
Retrieves the square of the lift coefficient.
double GetHysteresisParm(void) const
bool Run(bool Holding) override
Runs the Aerodynamics model; called by the Executive Can pass in a value indicating if the executive ...
double GetLoD(void) const
Retrieves the lift over drag ratio.
std::string GetAeroFunctionValues(const std::string &delimeter) const
Gets the aero function values.
FGColumnVector3 GetMomentsInWindAxes(void) const
Gets the total aerodynamic moment vector about the CG in the wind axes.
const FGColumnVector3 & GetForces(void) const
Gets the total aerodynamic force vector.
double GetMoments(int n) const
Gets the aerodynamic moment about the CG for an axis.
double GetCI2Vel(void) const
double GetAlphaCLMax(void) const
double GetMomentsMRC(int n) const
Gets the aerodynamic moment about the Moment Reference Center for an axis.
struct JSBSim::FGAerodynamics::Inputs in
double GetBI2Vel(void) const
double GetForcesInStabilityAxes(int n) const
Retrieves the aerodynamic forces in the stability axes, given an axis.
std::string GetAeroFunctionStrings(const std::string &delimeter) const
Gets the strings for the current set of aero functions.
FGColumnVector3 GetMomentsInStabilityAxes(void) const
Gets the total aerodynamic moment vector about the CG in the stability axes.
This class implements a 3 element column vector.
Handles matrix math operations.
Definition FGMatrix33.h:70
FGModel(FGFDMExec *)
Constructor.
Definition FGModel.cpp:57
const char * name