41#include "FGAircraft.h"
43#include "input_output/FGXMLElement.h"
44#include "input_output/FGLog.h"
60 HTailArea = VTailArea = 0.0;
61 HTailArm = VTailArm = 0.0;
80bool FGAircraft::InitModel(
void)
82 if (!FGModel::InitModel())
return false;
85 vMoments.InitMatrix();
95 if (Holding)
return false;
99 vForces = in.AeroForce;
100 vForces += in.PropForce;
101 vForces += in.GroundForce;
102 vForces += in.ExternalForce;
103 vForces += in.BuoyantForce;
105 vMoments = in.AeroMoment;
106 vMoments += in.PropMoment;
107 vMoments += in.GroundMoment;
108 vMoments += in.ExternalMoment;
109 vMoments += in.BuoyantMoment;
158 lbarh = HTailArm/cbar;
159 lbarv = VTailArm/cbar;
160 if (WingArea != 0.0) {
161 vbarh = HTailArm*HTailArea / (cbar*WingArea);
162 vbarv = VTailArm*VTailArea / (WingSpan*WingArea);
166 PostLoad(el, FDMExec);
175void FGAircraft::bind(
void)
180 PropertyManager->Tie(
"metrics/iw-rad",
this, &FGAircraft::GetWingIncidence);
181 PropertyManager->Tie(
"metrics/iw-deg",
this, &FGAircraft::GetWingIncidenceDeg);
182 PropertyManager->Tie(
"metrics/Sh-sqft",
this, &FGAircraft::GetHTailArea);
183 PropertyManager->Tie(
"metrics/lh-ft",
this, &FGAircraft::GetHTailArm);
184 PropertyManager->Tie(
"metrics/Sv-sqft",
this, &FGAircraft::GetVTailArea);
185 PropertyManager->Tie(
"metrics/lv-ft",
this, &FGAircraft::GetVTailArm);
186 PropertyManager->Tie(
"metrics/lh-norm",
this, &FGAircraft::Getlbarh);
187 PropertyManager->Tie(
"metrics/lv-norm",
this, &FGAircraft::Getlbarv);
188 PropertyManager->Tie(
"metrics/vbarh-norm",
this, &FGAircraft::Getvbarh);
189 PropertyManager->Tie(
"metrics/vbarv-norm",
this, &FGAircraft::Getvbarv);
190 PropertyManager->Tie(
"metrics/aero-rp-x-in",
this, eX, &
FGAircraft::GetXYZrp, &FGAircraft::SetXYZrp);
191 PropertyManager->Tie(
"metrics/aero-rp-y-in",
this, eY, &
FGAircraft::GetXYZrp, &FGAircraft::SetXYZrp);
192 PropertyManager->Tie(
"metrics/aero-rp-z-in",
this, eZ, &
FGAircraft::GetXYZrp, &FGAircraft::SetXYZrp);
193 PropertyManager->Tie(
"metrics/eyepoint-x-in",
this, eX, &FGAircraft::GetXYZep);
194 PropertyManager->Tie(
"metrics/eyepoint-y-in",
this, eY,&FGAircraft::GetXYZep);
195 PropertyManager->Tie(
"metrics/eyepoint-z-in",
this, eZ, &FGAircraft::GetXYZep);
196 PropertyManager->Tie(
"metrics/visualrefpoint-x-in",
this, eX, &FGAircraft::GetXYZvrp);
197 PropertyManager->Tie(
"metrics/visualrefpoint-y-in",
this, eY, &FGAircraft::GetXYZvrp);
198 PropertyManager->Tie(
"metrics/visualrefpoint-z-in",
this, eZ, &FGAircraft::GetXYZvrp);
220void FGAircraft::Debug(
int from)
222 if (debug_lvl <= 0)
return;
226 FGLogging log(LogLevel::DEBUG);
227 log <<
"\n Aircraft Metrics:\n" << fixed;
228 log <<
" WingArea: " << WingArea <<
"\n";
229 log <<
" WingSpan: " << WingSpan <<
"\n";
230 log <<
" Incidence: " << WingIncidence <<
"\n";
231 log <<
" Chord: " << cbar <<
"\n";
232 log <<
" H. Tail Area: " << HTailArea <<
"\n";
233 log <<
" H. Tail Arm: " << HTailArm <<
"\n";
234 log <<
" V. Tail Area: " << VTailArea <<
"\n";
235 log <<
" V. Tail Arm: " << VTailArm <<
"\n";
236 log <<
" Eyepoint (x, y, z): " << vXYZep <<
"\n";
237 log <<
" Ref Pt (x, y, z): " << vXYZrp <<
"\n";
238 log <<
" Visual Ref Pt (x, y, z): " << vXYZvrp <<
"\n";
241 if (debug_lvl & 2 ) {
242 FGLogging log(LogLevel::DEBUG);
243 if (from == 0) log <<
"Instantiated: FGAircraft\n";
244 if (from == 1) log <<
"Destroyed: FGAircraft\n";
246 if (debug_lvl & 4 ) {
248 if (debug_lvl & 8 ) {
250 if (debug_lvl & 16) {
252 if (debug_lvl & 64) {
Element * FindElement(const std::string &el="")
Searches for a specified element.
FGColumnVector3 FindElementTripletConvertTo(const std::string &target_units)
Composes a 3-element column vector for the supplied location or orientation.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
double FindElementValueAsNumberConvertTo(const std::string &el, const std::string &target_units)
Searches for the named element and converts and returns the data belonging to it.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
double Getcbar(void) const
Gets the average wing chord.
bool Load(Element *el) override
Loads the aircraft.
FGAircraft(FGFDMExec *Executive)
Constructor.
double GetWingArea(void) const
Gets the wing area.
bool Run(bool Holding) override
Runs the Aircraft model; called by the Executive Can pass in a value indicating if the executive is d...
double GetWingSpan(void) const
Gets the wing span.
const FGColumnVector3 & GetXYZrp(void) const
Gets the the aero reference point (RP) coordinates.
~FGAircraft() override
Destructor.
Encapsulates the JSBSim simulation executive.
Base class for all scheduled JSBSim models.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
bool Upload(Element *el, bool preLoad)
Uploads this model in memory.
Main namespace for the JSBSim Flight Dynamics Model.