X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGAircraft.cpp;h=75f9fba590b680eeb7b79a6273d8228e26fd2145;hb=edd83dd7e8fd7162ae49da6113ad797c68769f20;hp=5dd8612c61c1c3221cc6514e340e0f14a8fe963f;hpb=3b3f6719746e3877a3aeedbd6b944a55960ae792;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGAircraft.cpp b/src/FDM/JSBSim/models/FGAircraft.cpp index 5dd8612c6..75f9fba59 100644 --- a/src/FDM/JSBSim/models/FGAircraft.cpp +++ b/src/FDM/JSBSim/models/FGAircraft.cpp @@ -6,7 +6,7 @@ Purpose: Encapsulates an aircraft Called by: FGFDMExec - ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) ------------- + ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -50,9 +50,13 @@ INCLUDES #include "FGExternalReactions.h" #include "FGBuoyantForces.h" #include "FGAerodynamics.h" -#include +#include "FGFDMExec.h" #include "FGPropagate.h" -#include +#include "FGPropulsion.h" +#include "input_output/FGPropertyManager.h" +#include + +using namespace std; namespace JSBSim { @@ -110,6 +114,8 @@ bool FGAircraft::Run(void) if (FGModel::Run()) return true; if (FDMExec->Holding()) return false; + RunPreFunctions(); + vForces.InitMatrix(); if (!HoldDown) { vForces += Aerodynamics->GetForces(); @@ -135,12 +141,14 @@ bool FGAircraft::Run(void) vNwcg = Aerodynamics->GetTb2w() * vNcg; vNwcg(3) = -1*vNwcg(3) + 1; + RunPostFunctions(); + return false; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -double FGAircraft::GetNlf(void) +double FGAircraft::GetNlf(void) const { return -1*Aerodynamics->GetvFw(3)/MassBalance->GetWeight(); } @@ -152,6 +160,8 @@ bool FGAircraft::Load(Element* el) string element_name; Element* element; + FGModel::Load(el); + if (el->FindElement("wingarea")) WingArea = el->FindElementValueAsNumberConvertTo("wingarea", "FT2"); if (el->FindElement("wingspan")) @@ -193,6 +203,8 @@ bool FGAircraft::Load(Element* el) } } + FGModel::PostLoad(el); + Debug(2); return true; @@ -216,13 +228,6 @@ void FGAircraft::bind(void) PropertyManager->Tie("metrics/lv-norm", this, &FGAircraft::Getlbarv); PropertyManager->Tie("metrics/vbarh-norm", this, &FGAircraft::Getvbarh); PropertyManager->Tie("metrics/vbarv-norm", this, &FGAircraft::Getvbarv); - PropertyManager->Tie("forces/hold-down", this, &FGAircraft::GetHoldDown, &FGAircraft::SetHoldDown); - PropertyManager->Tie("moments/l-total-lbsft", this, eL, (PMF)&FGAircraft::GetMoments); - PropertyManager->Tie("moments/m-total-lbsft", this, eM, (PMF)&FGAircraft::GetMoments); - PropertyManager->Tie("moments/n-total-lbsft", this, eN, (PMF)&FGAircraft::GetMoments); - PropertyManager->Tie("forces/fbx-total-lbs", this, eX, (PMF)&FGAircraft::GetForces); - PropertyManager->Tie("forces/fby-total-lbs", this, eY, (PMF)&FGAircraft::GetForces); - PropertyManager->Tie("forces/fbz-total-lbs", this, eZ, (PMF)&FGAircraft::GetForces); PropertyManager->Tie("metrics/aero-rp-x-in", this, eX, (PMF)&FGAircraft::GetXYZrp); PropertyManager->Tie("metrics/aero-rp-y-in", this, eY, (PMF)&FGAircraft::GetXYZrp); PropertyManager->Tie("metrics/aero-rp-z-in", this, eZ, (PMF)&FGAircraft::GetXYZrp); @@ -232,6 +237,14 @@ void FGAircraft::bind(void) PropertyManager->Tie("metrics/visualrefpoint-x-in", this, eX, (PMF)&FGAircraft::GetXYZvrp); PropertyManager->Tie("metrics/visualrefpoint-y-in", this, eY, (PMF)&FGAircraft::GetXYZvrp); PropertyManager->Tie("metrics/visualrefpoint-z-in", this, eZ, (PMF)&FGAircraft::GetXYZvrp); + PropertyManager->Tie("forces/fbx-total-lbs", this, eX, (PMF)&FGAircraft::GetForces); + PropertyManager->Tie("forces/fby-total-lbs", this, eY, (PMF)&FGAircraft::GetForces); + PropertyManager->Tie("forces/fbz-total-lbs", this, eZ, (PMF)&FGAircraft::GetForces); + PropertyManager->Tie("forces/load-factor", this, &FGAircraft::GetNlf); + PropertyManager->Tie("forces/hold-down", this, &FGAircraft::GetHoldDown, &FGAircraft::SetHoldDown); + PropertyManager->Tie("moments/l-total-lbsft", this, eL, (PMF)&FGAircraft::GetMoments); + PropertyManager->Tie("moments/m-total-lbsft", this, eM, (PMF)&FGAircraft::GetMoments); + PropertyManager->Tie("moments/n-total-lbsft", this, eN, (PMF)&FGAircraft::GetMoments); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%