X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGAerodynamics.h;h=c6638b41161c627c52a799da0dccc9adb501dc5a;hb=cd24f7b6aaaa54f81655fb574bb050620c900dfe;hp=2874461616fa4150f55b9cbd48b8ea0e4060b492;hpb=9b33107551a8625d75049b711c6a1e0256fd3a66;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGAerodynamics.h b/src/FDM/JSBSim/models/FGAerodynamics.h index 287446161..c6638b411 100644 --- a/src/FDM/JSBSim/models/FGAerodynamics.h +++ b/src/FDM/JSBSim/models/FGAerodynamics.h @@ -4,23 +4,23 @@ Author: Jon S. Berndt Date started: 09/13/00 - ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) ------------- + ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------- This program is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free Software + the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU General Public License along with + You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Further information about the GNU General Public License can also be found on + Further information about the GNU Lesser General Public License can also be found on the world wide web at http://www.gnu.org. HISTORY @@ -38,29 +38,21 @@ SENTRY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#ifdef FGFS -# include -# ifdef SG_HAVE_STD_INCLUDES -# include -# include -# else -# include -# include -# endif -#else -# include -# include -#endif +#include +#include +#include #include "FGModel.h" -#include -#include +#include "math/FGFunction.h" +#include "math/FGColumnVector3.h" +#include "math/FGMatrix33.h" +#include "input_output/FGXMLFileRead.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_AERODYNAMICS "$Id$" +#define ID_AERODYNAMICS "$Id: FGAerodynamics.h,v 1.22 2011/03/11 13:02:26 jberndt Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -75,26 +67,57 @@ CLASS DOCUMENTATION /** Encapsulates the aerodynamic calculations. This class owns and contains the list of force/coefficients that define the aerodynamic properties of an aircraft. Here also, such unique phenomena - as ground effect and maximum lift curve tailoff are handled. + as ground effect, aerodynamic reference point shift, and maximum lift curve + tailoff are handled. @code - - {force coefficient definitions} + + {number} + {number} + + + {number} + {number} + + + + {function contents} + + + + {function contents} + + + {force or moment definitions} {additional axis definitions} @endcode + Optionally two other coordinate systems may be used.

+ 1) Body coordinate system: + @code + + @endcode +
+ 2) Axial-Normal coordinate system: + @code + + @endcode +
+ Systems may NOT be combined, or a load error will occur. + @author Jon S. Berndt, Tony Peden - @Id $Revision$ + @version $Revision: 1.22 $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -class FGAerodynamics : public FGModel { +class FGAerodynamics : public FGModel, public FGXMLFileRead +{ public: /** Constructor @@ -103,6 +126,8 @@ public: /// Destructor ~FGAerodynamics(); + bool InitModel(void); + /** Runs the Aerodynamics model; called by the Executive @return false if no error */ bool Run(void); @@ -116,7 +141,7 @@ public: /** Gets the total aerodynamic force vector. @return a force vector reference. */ - FGColumnVector3& GetForces(void) {return vForces;} + const FGColumnVector3& GetForces(void) const {return vForces;} /** Gets the aerodynamic force for an axis. @param n Axis index. This could be 0, 1, or 2, or one of the @@ -126,56 +151,79 @@ public: /** Gets the total aerodynamic moment vector. @return a moment vector reference. */ - FGColumnVector3& GetMoments(void) {return vMoments;} + const FGColumnVector3& GetMoments(void) const {return vMoments;} /** Gets the aerodynamic moment for an axis. @return the moment about a single axis (as described also in the similar call to GetForces(int n).*/ double GetMoments(int n) const {return vMoments(n);} - FGColumnVector3& GetvLastFs(void) { return vLastFs; } - double GetvLastFs(int axis) const { return vLastFs(axis); } - FGColumnVector3& GetvFs(void) { return vFs; } - double GetvFs(int axis) const { return vFs(axis); } - inline double GetLoD(void) const { return lod; } - inline double GetClSquared(void) const { return clsq; } - inline double GetAlphaCLMax(void) const { return alphaclmax; } - inline double GetAlphaCLMin(void) const { return alphaclmin; } - - inline double GetAlphaHystMax(void) const { return alphahystmax; } - inline double GetAlphaHystMin(void) const { return alphahystmin; } - inline double GetHysteresisParm(void) const { return stall_hyst; } - inline double GetStallWarn(void) const { return impending_stall; } + /** Retrieves the aerodynamic forces in the wind axes. + @return a reference to a column vector containing the wind axis forces. */ + const FGColumnVector3& GetvFw(void) const { return vFw; } + + /** Retrieves the aerodynamic forces in the wind axes, given an axis. + @param axis the axis to return the force for (eX, eY, eZ). + @return a reference to a column vector containing the requested wind + axis force. */ + double GetvFw(int axis) const { return vFw(axis); } + + /** Retrieves the lift over drag ratio */ + double GetLoD(void) const { return lod; } + + /** Retrieves the square of the lift coefficient. */ + double GetClSquared(void) const { return clsq; } + double GetAlphaCLMax(void) const { return alphaclmax; } + double GetAlphaCLMin(void) const { return alphaclmin; } + + double GetHysteresisParm(void) const { return stall_hyst; } + double GetStallWarn(void) const { return impending_stall; } double GetAlphaW(void) const { return alphaw; } double GetBI2Vel(void) const { return bi2vel; } double GetCI2Vel(void) const { return ci2vel; } - inline void SetAlphaCLMax(double tt) { alphaclmax=tt; } - inline void SetAlphaCLMin(double tt) { alphaclmin=tt; } + void SetAlphaCLMax(double tt) { alphaclmax=tt; } + void SetAlphaCLMin(double tt) { alphaclmin=tt; } - /** Gets the strings for the current set of coefficients. + /** Gets the strings for the current set of aero functions. @param delimeter either a tab or comma string depending on output type - @return a string containing the descriptive names for all coefficients */ - string GetCoefficientStrings(string delimeter); + @return a string containing the descriptive names for all aero functions */ + std::string GetAeroFunctionStrings(const std::string& delimeter) const; - /** Gets the coefficient values. + /** Gets the aero function values. @param delimeter either a tab or comma string depending on output type @return a string containing the numeric values for the current set of - coefficients */ - string GetCoefficientValues(string delimeter); + aero functions */ + std::string GetAeroFunctionValues(const std::string& delimeter) const; + + /** Calculates and returns the wind-to-body axis transformation matrix. + @return a reference to the wind-to-body transformation matrix. + */ + FGMatrix33& GetTw2b(void); + + /** Calculates and returns the body-to-wind axis transformation matrix. + @return a reference to the wind-to-body transformation matrix. + */ + FGMatrix33& GetTb2w(void); + + std::vector * GetAeroFunctions(void) const { return AeroFunctions; } private: - typedef map AxisIndex; + enum eAxisType {atNone, atLiftDrag, atAxialNormal, atBodyXYZ} axisType; + typedef std::map AxisIndex; AxisIndex AxisIdx; - vector variables; - typedef vector CoeffArray; - CoeffArray* Coeff; - FGColumnVector3 vFs; + FGFunction* AeroRPShift; + typedef vector AeroFunctionArray; + AeroFunctionArray* AeroFunctions; + FGColumnVector3 vFnative; + FGColumnVector3 vFw; FGColumnVector3 vForces; FGColumnVector3 vMoments; - FGColumnVector3 vLastFs; FGColumnVector3 vDXYZcg; + FGColumnVector3 vDeltaRP; + FGMatrix33 mTw2b; + FGMatrix33 mTb2w; double alphaclmax, alphaclmin; double alphahystmax, alphahystmin; double impending_stall, stall_hyst; @@ -183,8 +231,8 @@ private: double clsq, lod, qbar_area; typedef double (FGAerodynamics::*PMF)(int) const; + void DetermineAxisSystem(void); void bind(void); - void unbind(void); void Debug(int from); };