]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGAircraft.cpp
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / FGAircraft.cpp
index 30649c6a42337b638b27a150219328983b4a9ad1..a433a56fa8812e30cc3657666452b5864c00a6af 100644 (file)
@@ -44,15 +44,7 @@ INCLUDES
 #include <cmath>
 
 #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"
 
 using namespace std;
@@ -67,7 +59,7 @@ DEFINITIONS
 GLOBAL DATA
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-static const char *IdSrc = "$Id: FGAircraft.cpp,v 1.29 2010/11/18 12:38:06 jberndt Exp $";
+static const char *IdSrc = "$Id: FGAircraft.cpp,v 1.33 2011/08/21 15:06:38 bcoconni Exp $";
 static const char *IdHdr = ID_AIRCRAFT;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -78,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;
@@ -101,48 +95,38 @@ 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 += FDMExec->GetAerodynamics()->GetForces();
-    vForces += FDMExec->GetPropulsion()->GetForces();
-    vForces += FDMExec->GetGroundReactions()->GetForces();
-    vForces += FDMExec->GetExternalReactions()->GetForces();
-    vForces += FDMExec->GetBuoyantForces()->GetForces();
+    vForces += in.AeroForce;
+    vForces += in.PropForce;
+    vForces += in.GroundForce;
+    vForces += in.ExternalForce;
+    vForces += in.BuoyantForce;
   } else {
-    const FGMatrix33& mTl2b = FDMExec->GetPropagate()->GetTl2b();
-    vForces = mTl2b * FGColumnVector3(0,0,-FDMExec->GetMassBalance()->GetWeight());
+    vForces = in.Tl2b * FGColumnVector3(0,0,-in.Weight);
   }
 
   vMoments.InitMatrix();
   if (!HoldDown) {
-    vMoments += FDMExec->GetAerodynamics()->GetMoments();
-    vMoments += FDMExec->GetPropulsion()->GetMoments();
-    vMoments += FDMExec->GetGroundReactions()->GetMoments();
-    vMoments += FDMExec->GetExternalReactions()->GetMoments();
-    vMoments += FDMExec->GetBuoyantForces()->GetMoments();
+    vMoments += in.AeroMoment;
+    vMoments += in.PropMoment;
+    vMoments += in.GroundMoment;
+    vMoments += in.ExternalMoment;
+    vMoments += in.BuoyantMoment;
   }
 
-  vBodyAccel = vForces/FDMExec->GetMassBalance()->GetMass();
-
-  vNcg = vBodyAccel/FDMExec->GetInertial()->SLgravity();
-
-  vNwcg = FDMExec->GetAerodynamics()->GetTb2w() * vNcg;
-  vNwcg(3) = 1.0 - vNwcg(3);
-
   RunPostFunctions();
 
   return false;
@@ -150,16 +134,6 @@ bool FGAircraft::Run(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-double FGAircraft::GetNlf(void) const
-{
-  if (FDMExec->GetMassBalance()->GetWeight() != 0)
-  return (-FDMExec->GetAerodynamics()->GetvFw(3))/FDMExec->GetMassBalance()->GetWeight();
-  else
-    return 0.;
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 bool FGAircraft::Load(Element* el)
 {
   string element_name;
@@ -242,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);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%