191 lines
7.1 KiB
C++
191 lines
7.1 KiB
C++
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
Header: FGAircraft.h
|
|
Author: Jon S. Berndt
|
|
Date started: 12/12/98
|
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.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
|
|
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
|
|
details.
|
|
|
|
You should have received a copy of the GNU 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
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
HISTORY
|
|
--------------------------------------------------------------------------------
|
|
12/12/98 JSB Created
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
SENTRY
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
#ifndef FGAIRCRAFT_H
|
|
#define FGAIRCRAFT_H
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
INCLUDES
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
#ifdef FGFS
|
|
# include <simgear/compiler.h>
|
|
# ifdef SG_HAVE_STD_INCLUDES
|
|
# include <vector>
|
|
# include <iterator>
|
|
# else
|
|
# include <vector.h>
|
|
# include <iterator.h>
|
|
# endif
|
|
#else
|
|
# include <vector>
|
|
# include <iterator>
|
|
#endif
|
|
|
|
#include "FGModel.h"
|
|
#include "FGPropulsion.h"
|
|
#include "FGConfigFile.h"
|
|
#include "FGMatrix33.h"
|
|
#include "FGColumnVector3.h"
|
|
#include "FGColumnVector4.h"
|
|
#include "FGLGear.h"
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
DEFINITIONS
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
#define ID_AIRCRAFT "$Id$"
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
FORWARD DECLARATIONS
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
CLASS DOCUMENTATION
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
/** Encapsulates an Aircraft and its systems.
|
|
Owns all the parts (other classes) which make up this aircraft. This includes
|
|
the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
|
|
landing gear, etc. These constituent parts may actually run as separate
|
|
JSBSim models themselves, but the responsibility for initializing them and
|
|
for retrieving their force and moment contributions falls to FGAircraft.<br>
|
|
|
|
@author Jon S. Berndt
|
|
@version $Id$
|
|
@see
|
|
<ol><li>Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
|
|
Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
|
|
School, January 1994</li>
|
|
<li>D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
|
|
JSC 12960, July 1977</li>
|
|
<li>Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
|
|
NASA-Ames", NASA CR-2497, January 1975</li>
|
|
<li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
|
|
Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
|
|
<li>Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
|
|
1982 ISBN 0-471-08936-2</li></ol>
|
|
*/
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
CLASS DECLARATION
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
class FGAircraft : public FGModel {
|
|
public:
|
|
/** Constructor
|
|
@param Executive a pointer to the parent executive object */
|
|
FGAircraft(FGFDMExec *Executive);
|
|
|
|
/// Destructor
|
|
~FGAircraft();
|
|
|
|
/** Runs the Aircraft model; called by the Executive
|
|
@see JSBSim.cpp documentation
|
|
@return false if no error */
|
|
bool Run(void);
|
|
|
|
/** Loads the aircraft.
|
|
The executive calls this method to load the aircraft into JSBSim.
|
|
@param AC_cfg a pointer to the config file instance
|
|
@return true if successful */
|
|
bool Load(FGConfigFile* AC_cfg);
|
|
|
|
/** Gets the aircraft name
|
|
@return the name of the aircraft as a string type */
|
|
inline string GetAircraftName(void) { return AircraftName; }
|
|
|
|
/// Gets the wing area
|
|
inline double GetWingArea(void) { return WingArea; }
|
|
/// Gets the wing span
|
|
inline double GetWingSpan(void) { return WingSpan; }
|
|
/// Gets the average wing chord
|
|
inline double Getcbar(void) { return cbar; }
|
|
inline double GetWingIncidence(void) { return WingIncidence; }
|
|
inline double GetHTailArea(void) { return HTailArea; }
|
|
inline double GetHTailArm(void) { return HTailArm; }
|
|
inline double GetVTailArea(void) { return VTailArea; }
|
|
inline double GetVTailArm(void) { return VTailArm; }
|
|
inline double Getlbarh(void) { return lbarh; } // HTailArm / cbar
|
|
inline double Getlbarv(void) { return lbarv; } // VTailArm / cbar
|
|
inline double Getvbarh(void) { return vbarh; } // H. Tail Volume
|
|
inline double Getvbarv(void) { return vbarv; } // V. Tail Volume
|
|
inline FGColumnVector3& GetMoments(void) { return vMoments; }
|
|
inline FGColumnVector3& GetForces(void) { return vForces; }
|
|
inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
|
|
inline FGColumnVector3& GetNcg (void) { return vNcg; }
|
|
inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
|
|
inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
|
|
inline double GetXYZrp(int idx) { return vXYZrp(idx); }
|
|
inline double GetXYZep(int idx) { return vXYZep(idx); }
|
|
inline double GetAlphaCLMax(void) { return alphaclmax; }
|
|
inline double GetAlphaCLMin(void) { return alphaclmin; }
|
|
|
|
inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
|
|
inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
|
|
inline void SetAircraftName(string name) {AircraftName = name;}
|
|
|
|
inline double GetStallWarn(void) { return impending_stall; }
|
|
|
|
float GetNlf(void);
|
|
|
|
inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
|
|
|
|
private:
|
|
FGColumnVector3 vMoments;
|
|
FGColumnVector3 vForces;
|
|
FGColumnVector3 vXYZrp;
|
|
FGColumnVector3 vXYZep;
|
|
FGColumnVector3 vEuler;
|
|
FGColumnVector3 vDXYZcg;
|
|
FGColumnVector3 vBodyAccel;
|
|
FGColumnVector3 vNcg;
|
|
FGColumnVector3 vNwcg;
|
|
|
|
double WingArea, WingSpan, cbar, WingIncidence;
|
|
double HTailArea, VTailArea, HTailArm, VTailArm;
|
|
double lbarh,lbarv,vbarh,vbarv;
|
|
double alphaclmax,alphaclmin;
|
|
double impending_stall;
|
|
string AircraftName;
|
|
|
|
void Debug(int from);
|
|
};
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
#endif
|
|
|