X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGAircraft.cpp;h=a433a56fa8812e30cc3657666452b5864c00a6af;hb=1575fad886a0b18825363d41d53a287e8d36b9c8;hp=83a1bf1779b9f8feff5e401f7bb35115bf2f800e;hpb=8933486a564f84d4a64008dca2a800396a6fc684;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGAircraft.cpp b/src/FDM/JSBSim/models/FGAircraft.cpp index 83a1bf177..a433a56fa 100644 --- a/src/FDM/JSBSim/models/FGAircraft.cpp +++ b/src/FDM/JSBSim/models/FGAircraft.cpp @@ -40,21 +40,12 @@ INCLUDES #include #include - +#include #include #include "FGAircraft.h" -#include "FGMassBalance.h" -#include "FGInertial.h" -#include "FGGroundReactions.h" -#include "FGExternalReactions.h" -#include "FGBuoyantForces.h" -#include "FGAerodynamics.h" #include "FGFDMExec.h" -#include "FGPropagate.h" -#include "FGPropulsion.h" #include "input_output/FGPropertyManager.h" -#include using namespace std; @@ -68,7 +59,7 @@ DEFINITIONS GLOBAL DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -static const char *IdSrc = "$Id$"; +static const char *IdSrc = "$Id: FGAircraft.cpp,v 1.33 2011/08/21 15:06:38 bcoconni Exp $"; static const char *IdHdr = ID_AIRCRAFT; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -79,6 +70,8 @@ FGAircraft::FGAircraft(FGFDMExec* fdmex) : 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; @@ -102,55 +95,45 @@ FGAircraft::~FGAircraft() bool FGAircraft::InitModel(void) { - if (!FGModel::InitModel()) return false; - return true; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -bool FGAircraft::Run(void) +bool FGAircraft::Run(bool Holding) { - if (FGModel::Run()) return true; - if (FDMExec->Holding()) return false; + if (FGModel::Run(Holding)) return true; + if (Holding) return false; + + RunPreFunctions(); vForces.InitMatrix(); if (!HoldDown) { - vForces += Aerodynamics->GetForces(); - vForces += Propulsion->GetForces(); - vForces += GroundReactions->GetForces(); - vForces += ExternalReactions->GetForces(); - vForces += BuoyantForces->GetForces(); + vForces += in.AeroForce; + vForces += in.PropForce; + vForces += in.GroundForce; + vForces += in.ExternalForce; + vForces += in.BuoyantForce; + } else { + vForces = in.Tl2b * FGColumnVector3(0,0,-in.Weight); } vMoments.InitMatrix(); if (!HoldDown) { - vMoments += Aerodynamics->GetMoments(); - vMoments += Propulsion->GetMoments(); - vMoments += GroundReactions->GetMoments(); - vMoments += ExternalReactions->GetMoments(); - vMoments += BuoyantForces->GetMoments(); + vMoments += in.AeroMoment; + vMoments += in.PropMoment; + vMoments += in.GroundMoment; + vMoments += in.ExternalMoment; + vMoments += in.BuoyantMoment; } - vBodyAccel = vForces/MassBalance->GetMass(); - - vNcg = vBodyAccel/Inertial->gravity(); - - vNwcg = Aerodynamics->GetTb2w() * vNcg; - vNwcg(3) = -1*vNwcg(3) + 1; + RunPostFunctions(); return false; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -double FGAircraft::GetNlf(void) const -{ - return -1*Aerodynamics->GetvFw(3)/MassBalance->GetWeight(); -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - bool FGAircraft::Load(Element* el) { string element_name; @@ -199,6 +182,8 @@ bool FGAircraft::Load(Element* el) } } + PostLoad(el, PropertyManager); + Debug(2); return true; @@ -231,14 +216,7 @@ 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); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%