JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++

FGAircraft Class Reference

Encapsulates an Aircraft and its systems. More...

#include <FGAircraft.h>

Inheritance diagram for FGAircraft:
Collaboration diagram for FGAircraft:

List of all members.


struct  Inputs

Public Member Functions

 FGAircraft (FGFDMExec *Executive)
 ~FGAircraft ()
void bind (void)
const std::string & GetAircraftName (void) const
 Gets the aircraft name.
double Getcbar (void) const
 Gets the average wing chord.
const FGColumnVector3GetForces (void) const
double GetForces (int idx) const
double GetHTailArea (void) const
double GetHTailArm (void) const
double Getlbarh (void) const
double Getlbarv (void) const
double GetMoments (int idx) const
const FGColumnVector3GetMoments (void) const
double Getvbarh (void) const
double Getvbarv (void) const
double GetVTailArea (void) const
double GetVTailArm (void) const
double GetWingArea (void) const
 Gets the wing area.
double GetWingIncidence (void) const
double GetWingIncidenceDeg (void) const
double GetWingSpan (void) const
 Gets the wing span.
double GetXYZep (int idx) const
const FGColumnVector3GetXYZep (void) const
double GetXYZrp (int idx) const
const FGColumnVector3GetXYZrp (void) const
const FGColumnVector3GetXYZvrp (void) const
double GetXYZvrp (int idx) const
bool InitModel (void)
bool Load (Element *el)
 Loads the aircraft.
bool Run (bool Holding)
 Runs the Aircraft model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold.
void SetAircraftName (const std::string &name)
void SetWingArea (double S)
void SetXYZrp (int idx, double value)
void unbind (void)

Public Attributes

struct JSBSim::FGAircraft::Inputs in

Detailed Description

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.

The <metrics> section of the aircraft configuration file is read here, and the metrical information is held by this class.

Configuration File Format for <metrics> Section:

        <wingarea unit="{FT2 | M2}"> {number} </wingarea>
        <wingspan unit="{FT | M}"> {number} </wingspan>
        <chord unit="{FT | M}"> {number} </chord>
        <htailarea unit="{FT2 | M2}"> {number} </htailarea>
        <htailarm unit="{FT | M}"> {number} </htailarm>
        <vtailarea unit="{FT2 | M}"> {number} </vtailarea>
        <vtailarm unit="{FT | M}"> {number} </vtailarm>
        <wing_incidence unit="{RAD | DEG}"> {number} </wing_incidence>
        <location name="{AERORP | EYEPOINT | VRP}" unit="{IN | M}">
            <x> {number} </x>
            <y> {number} </y>
            <z> {number} </z>
        {other location blocks}
Jon S. Berndt
FGAircraft.h,v 1.20 2012/09/15 17:00:56 bcoconni Exp
See also:
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
D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices", JSC 12960, July 1977
Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at NASA-Ames", NASA CR-2497, January 1975
Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics", Wiley & Sons, 1979 ISBN 0-471-03032-5
Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons, 1982 ISBN 0-471-08936-2

Definition at line 112 of file FGAircraft.h.

Constructor & Destructor Documentation

FGAircraft ( FGFDMExec Executive)
Executivea pointer to the parent executive object

Definition at line 69 of file FGAircraft.cpp.

                                       : FGModel(fdmex)
  Name = "FGAircraft";
  WingSpan = 0.0;
  WingArea = 0.0;
  cbar = 0.0;
  HTailArea = VTailArea = 0.0;
  HTailArm  = VTailArm  = 0.0;
  lbarh = lbarv = 0.0;
  vbarh = vbarv = 0.0;
  WingIncidence = 0.0;



Member Function Documentation

const std::string& GetAircraftName ( void  ) const [inline]
the name of the aircraft as a string type

Definition at line 141 of file FGAircraft.h.

Referenced by FGFDMExec::EnumerateFDMs(), and FGInput::Run().

{ return AircraftName; }

Here is the caller graph for this function:

bool Load ( Element el) [virtual]

The executive calls this method to load the aircraft into JSBSim.

ela pointer to the element tree
true if successful

Reimplemented from FGModel.

Definition at line 128 of file FGAircraft.cpp.

References Element::FindElement(), Element::FindElementTripletConvertTo(), Element::FindElementValueAsNumberConvertTo(), Element::FindNextElement(), and Element::GetAttributeValue().

  string element_name;
  Element* element;


  if (el->FindElement("wingarea"))
    WingArea = el->FindElementValueAsNumberConvertTo("wingarea", "FT2");
  if (el->FindElement("wingspan"))
    WingSpan = el->FindElementValueAsNumberConvertTo("wingspan", "FT");
  if (el->FindElement("chord"))
    cbar = el->FindElementValueAsNumberConvertTo("chord", "FT");
  if (el->FindElement("wing_incidence"))
    WingIncidence = el->FindElementValueAsNumberConvertTo("wing_incidence", "RAD");
  if (el->FindElement("htailarea"))
    HTailArea = el->FindElementValueAsNumberConvertTo("htailarea", "FT2");
  if (el->FindElement("htailarm"))
    HTailArm = el->FindElementValueAsNumberConvertTo("htailarm", "FT");
  if (el->FindElement("vtailarea"))
    VTailArea = el->FindElementValueAsNumberConvertTo("vtailarea", "FT2");
  if (el->FindElement("vtailarm"))
    VTailArm = el->FindElementValueAsNumberConvertTo("vtailarm", "FT");

  // Find all LOCATION elements that descend from this METRICS branch of the
  // config file. This would be CG location, eyepoint, etc.

  element = el->FindElement("location");
  while (element) {
    element_name = element->GetAttributeValue("name");

    if (element_name == "AERORP") vXYZrp = element->FindElementTripletConvertTo("IN");
    else if (element_name == "EYEPOINT") vXYZep = element->FindElementTripletConvertTo("IN");
    else if (element_name == "VRP") vXYZvrp = element->FindElementTripletConvertTo("IN");

    element = el->FindNextElement("location");

  // calculate some derived parameters
  if (cbar != 0.0) {
    lbarh = HTailArm/cbar;
    lbarv = VTailArm/cbar;
    if (WingArea != 0.0) {
      vbarh = HTailArm*HTailArea / (cbar*WingArea);
      vbarv = VTailArm*VTailArea / (WingSpan*WingArea);

  PostLoad(el, PropertyManager);


  return true;

Here is the call graph for this function:

bool Run ( bool  Holding) [virtual]
Holdingif true, the executive has been directed to hold the sim from advancing time. Some models may ignore this flag, such as the Input model, which may need to be active to listen on a socket for the "Resume" command to be given.
See also:
JSBSim.cpp documentation
false if no error

Reimplemented from FGModel.

Definition at line 102 of file FGAircraft.cpp.

References FGModel::Run().

  if (FGModel::Run(Holding)) return true;
  if (Holding) return false;


  vForces = in.AeroForce;
  vForces += in.PropForce;
  vForces += in.GroundForce;
  vForces += in.ExternalForce;
  vForces += in.BuoyantForce;

  vMoments = in.AeroMoment;
  vMoments += in.PropMoment;
  vMoments += in.GroundMoment;
  vMoments += in.ExternalMoment;
  vMoments += in.BuoyantMoment;


  return false;

Here is the call graph for this function:

The documentation for this class was generated from the following files: