42 #include <sys/types.h> 46 #include "FGAircraft.h" 47 #include "FGFDMExec.h" 48 #include "input_output/FGPropertyManager.h" 49 #include "input_output/FGXMLElement.h" 63 IDENT(IdSrc,
"$Id: FGAircraft.cpp,v 1.43 2015/01/31 14:56:21 bcoconni Exp $");
64 IDENT(IdHdr,ID_AIRCRAFT);
76 HTailArea = VTailArea = 0.0;
77 HTailArm = VTailArm = 0.0;
97 bool FGAircraft::InitModel(
void)
99 if (!FGModel::InitModel())
return false;
101 vForces.InitMatrix();
102 vMoments.InitMatrix();
112 if (Holding)
return false;
116 vForces = in.AeroForce;
117 vForces += in.PropForce;
118 vForces += in.GroundForce;
119 vForces += in.ExternalForce;
120 vForces += in.BuoyantForce;
122 vMoments = in.AeroMoment;
123 vMoments += in.PropMoment;
124 vMoments += in.GroundMoment;
125 vMoments += in.ExternalMoment;
126 vMoments += in.BuoyantMoment;
177 lbarh = HTailArm/cbar;
178 lbarv = VTailArm/cbar;
179 if (WingArea != 0.0) {
180 vbarh = HTailArm*HTailArea / (cbar*WingArea);
181 vbarv = VTailArm*VTailArea / (WingSpan*WingArea);
185 PostLoad(el, PropertyManager);
194 void FGAircraft::bind(
void)
200 PropertyManager->
Tie(
"metrics/iw-rad",
this, &FGAircraft::GetWingIncidence);
201 PropertyManager->
Tie(
"metrics/iw-deg",
this, &FGAircraft::GetWingIncidenceDeg);
202 PropertyManager->
Tie(
"metrics/Sh-sqft",
this, &FGAircraft::GetHTailArea);
203 PropertyManager->
Tie(
"metrics/lh-ft",
this, &FGAircraft::GetHTailArm);
204 PropertyManager->
Tie(
"metrics/Sv-sqft",
this, &FGAircraft::GetVTailArea);
205 PropertyManager->
Tie(
"metrics/lv-ft",
this, &FGAircraft::GetVTailArm);
206 PropertyManager->
Tie(
"metrics/lh-norm",
this, &FGAircraft::Getlbarh);
207 PropertyManager->
Tie(
"metrics/lv-norm",
this, &FGAircraft::Getlbarv);
208 PropertyManager->
Tie(
"metrics/vbarh-norm",
this, &FGAircraft::Getvbarh);
209 PropertyManager->
Tie(
"metrics/vbarv-norm",
this, &FGAircraft::Getvbarv);
210 PropertyManager->
Tie(
"metrics/aero-rp-x-in",
this, eX, (PMF)&FGAircraft::GetXYZrp, &FGAircraft::SetXYZrp);
211 PropertyManager->
Tie(
"metrics/aero-rp-y-in",
this, eY, (PMF)&FGAircraft::GetXYZrp, &FGAircraft::SetXYZrp);
212 PropertyManager->
Tie(
"metrics/aero-rp-z-in",
this, eZ, (PMF)&FGAircraft::GetXYZrp, &FGAircraft::SetXYZrp);
213 PropertyManager->
Tie(
"metrics/eyepoint-x-in",
this, eX, (PMF)&FGAircraft::GetXYZep);
214 PropertyManager->
Tie(
"metrics/eyepoint-y-in",
this, eY,(PMF)&FGAircraft::GetXYZep);
215 PropertyManager->
Tie(
"metrics/eyepoint-z-in",
this, eZ, (PMF)&FGAircraft::GetXYZep);
216 PropertyManager->
Tie(
"metrics/visualrefpoint-x-in",
this, eX, (PMF)&FGAircraft::GetXYZvrp);
217 PropertyManager->
Tie(
"metrics/visualrefpoint-y-in",
this, eY, (PMF)&FGAircraft::GetXYZvrp);
218 PropertyManager->
Tie(
"metrics/visualrefpoint-z-in",
this, eZ, (PMF)&FGAircraft::GetXYZvrp);
240 void FGAircraft::Debug(
int from)
242 if (debug_lvl <= 0)
return;
246 cout << endl <<
" Aircraft Metrics:" << endl;
247 cout <<
" WingArea: " << WingArea << endl;
248 cout <<
" WingSpan: " << WingSpan << endl;
249 cout <<
" Incidence: " << WingIncidence << endl;
250 cout <<
" Chord: " << cbar << endl;
251 cout <<
" H. Tail Area: " << HTailArea << endl;
252 cout <<
" H. Tail Arm: " << HTailArm << endl;
253 cout <<
" V. Tail Area: " << VTailArea << endl;
254 cout <<
" V. Tail Arm: " << VTailArm << endl;
255 cout <<
" Eyepoint (x, y, z): " << vXYZep << endl;
256 cout <<
" Ref Pt (x, y, z): " << vXYZrp << endl;
257 cout <<
" Visual Ref Pt (x, y, z): " << vXYZvrp << endl;
260 if (debug_lvl & 2 ) {
261 if (from == 0) cout <<
"Instantiated: FGAircraft" << endl;
262 if (from == 1) cout <<
"Destroyed: FGAircraft" << endl;
264 if (debug_lvl & 4 ) {
266 if (debug_lvl & 8 ) {
268 if (debug_lvl & 16) {
270 if (debug_lvl & 64) {
272 cout << IdSrc << endl;
273 cout << IdHdr << endl;
Encapsulates an Aircraft and its systems.
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 * FindElement(const std::string &el="")
Searches for a specified element.
double GetWingSpan(void) const
Gets the wing span.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
Base class for all scheduled JSBSim models.
double Getcbar(void) const
Gets the average wing chord.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
bool Load(Element *el)
Loads the aircraft.
Encapsulates the JSBSim simulation executive.
bool Run(bool Holding)
Runs the Aircraft model; called by the Executive Can pass in a value indicating if the executive is d...
virtual bool Load(Element *el)
Loads this model.
FGColumnVector3 FindElementTripletConvertTo(const std::string &target_units)
Composes a 3-element column vector for the supplied location or orientation.
double GetWingArea(void) const
Gets the wing area.