![]() |
JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++
|
Encapsulates an Aircraft and its systems. More...
#include <FGAircraft.h>
Inheritance diagram for FGAircraft:
Collaboration diagram for FGAircraft:Classes | |
| struct | Inputs |
Public Member Functions | |
| FGAircraft (FGFDMExec *Executive) | |
| Constructor. | |
| ~FGAircraft () | |
| Destructor. | |
| void | bind (void) |
| const std::string & | GetAircraftName (void) const |
| Gets the aircraft name. | |
| double | Getcbar (void) const |
| Gets the average wing chord. | |
| const FGColumnVector3 & | GetForces (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 FGColumnVector3 & | GetMoments (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 FGColumnVector3 & | GetXYZep (void) const |
| double | GetXYZrp (int idx) const |
| const FGColumnVector3 & | GetXYZrp (void) const |
| const FGColumnVector3 & | GetXYZvrp (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 |
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.
<metrics>
<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>
</location>
{other location blocks}
</metrics>
Definition at line 112 of file FGAircraft.h.
| FGAircraft | ( | FGFDMExec * | Executive | ) |
| Executive | a 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; bind(); Debug(0); }
| const std::string& GetAircraftName | ( | void | ) | const [inline] |
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.
| el | a pointer to the element tree |
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;
FGModel::Load(el);
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);
Debug(2);
return true;
}
Here is the call graph for this function:| bool Run | ( | bool | Holding | ) | [virtual] |
| Holding | if 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. |
Reimplemented from FGModel.
Definition at line 102 of file FGAircraft.cpp.
References FGModel::Run().
{
if (FGModel::Run(Holding)) return true;
if (Holding) return false;
RunPreFunctions();
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;
RunPostFunctions();
return false;
}
Here is the call graph for this function: