]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGAircraft.cpp
Updated to match changes in radiostack.[ch]xx
[flightgear.git] / src / FDM / JSBSim / FGAircraft.cpp
index 20dd46854b51fd3c9d2a15ab11412e8ad2b31584..5ee4979c07952e1642e4ab89ba3d2b043731f021 100644 (file)
@@ -82,6 +82,7 @@ INCLUDES
 #include "FGPosition.h"
 #include "FGAuxiliary.h"
 #include "FGOutput.h"
+#include "FGPropertyManager.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -101,11 +102,12 @@ CLASS IMPLEMENTATION
 FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
 {
   Name = "FGAircraft";
-  alphaclmin = alphaclmax = 0;
-  HTailArea = VTailArea = HTailArm = VTailArm = 0.0;
-  lbarh = lbarv = vbarh = vbarv = 0.0;
-  WingIncidence=0;
-  impending_stall = 0;
+  HTailArea = VTailArea = 0.0;
+  HTailArm  = VTailArm  = 0.0;
+  lbarh = lbarv = 0.0;
+  vbarh = vbarv = 0.0;
+
+  bind();
 
   Debug(0);
 }
@@ -114,6 +116,7 @@ FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
 
 FGAircraft::~FGAircraft()
 {
+  unbind();
   Debug(1);
 }
 
@@ -140,14 +143,6 @@ bool FGAircraft::Run(void)
     vNwcg = State->GetTb2s() * vNcg;
     vNwcg(3) = -1*vNwcg(3) + 1;
     
-    if (alphaclmax != 0) {
-      if (Translation->Getalpha() > 0.85*alphaclmax) {
-        impending_stall = 10*(Translation->Getalpha()/alphaclmax - 0.85);
-      } else {
-        impending_stall = 0;
-      }
-    }      
-    
     return false;
   } else {                               // skip Run() execution this time
     return true;
@@ -233,13 +228,9 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg)
     } else if (parameter == "AC_AERORP") {
       *AC_cfg >> vXYZrp(eX) >> vXYZrp(eY) >> vXYZrp(eZ);
       if (debug_lvl > 0) cout << "    Ref Pt (x, y, z): " << vXYZrp << endl;
-    } else if (parameter == "AC_ALPHALIMITS") {
-      *AC_cfg >> alphaclmin >> alphaclmax;
-      if (debug_lvl > 0) cout << "    Maximum Alpha: " << alphaclmax
-             << "    Minimum Alpha: " << alphaclmin
-             << endl;
     } else if (parameter == "AC_POINTMASS") {
       *AC_cfg >> pmWt >> pmX >> pmY >> pmZ;
+      MassBalance->AddPointMass(pmWt, pmX, pmY, pmZ);
       if (debug_lvl > 0) cout << "    Point Mass Object: " << pmWt << " lbs. at "
                          << "X, Y, Z (in.): " << pmX << "  " << pmY << "  " << pmZ
                          << endl;
@@ -258,6 +249,91 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg)
   return true;
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGAircraft::bind(void)
+{
+  typedef double (FGAircraft::*PMF)(int) const;
+  PropertyManager->Tie("metrics/Sw-sqft", this,
+                       &FGAircraft::GetWingArea);
+  PropertyManager->Tie("metrics/bw-ft", this,
+                       &FGAircraft::GetWingSpan);
+  PropertyManager->Tie("metrics/cbarw-ft", this,
+                       &FGAircraft::Getcbar);
+  PropertyManager->Tie("metrics/iw-deg", this,
+                       &FGAircraft::GetWingIncidence);
+  PropertyManager->Tie("metrics/Sh-sqft", this,
+                       &FGAircraft::GetHTailArea);
+  PropertyManager->Tie("metrics/lh-ft", this,
+                       &FGAircraft::GetHTailArm);
+  PropertyManager->Tie("metrics/Sv-sqft", this,
+                       &FGAircraft::GetVTailArea);
+  PropertyManager->Tie("metrics/lv-ft", this,
+                       &FGAircraft::GetVTailArm);
+  PropertyManager->Tie("metrics/lh-norm", this,
+                       &FGAircraft::Getlbarh);
+  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("moments/l-total-lbsft", this,1,
+                       (PMF)&FGAircraft::GetMoments);
+  PropertyManager->Tie("moments/m-total-lbsft", this,2,
+                       (PMF)&FGAircraft::GetMoments);
+  PropertyManager->Tie("moments/n-total-lbsft", this,3,
+                       (PMF)&FGAircraft::GetMoments);
+  PropertyManager->Tie("forces/fbx-total-lbs", this,1,
+                       (PMF)&FGAircraft::GetForces);
+  PropertyManager->Tie("forces/fby-total-lbs", this,2,
+                       (PMF)&FGAircraft::GetForces);
+  PropertyManager->Tie("forces/fbz-total-lbs", this,3,
+                       (PMF)&FGAircraft::GetForces);
+  PropertyManager->Tie("metrics/aero-rp-x-ft", this,1,
+                       (PMF)&FGAircraft::GetXYZrp);
+  PropertyManager->Tie("metrics/aero-rp-y-ft", this,2,
+                       (PMF)&FGAircraft::GetXYZrp);
+  PropertyManager->Tie("metrics/aero-rp-z-ft", this,3,
+                       (PMF)&FGAircraft::GetXYZrp);
+  PropertyManager->Tie("metrics/eyepoint-x-ft", this,1,
+                       (PMF)&FGAircraft::GetXYZep);
+  PropertyManager->Tie("metrics/eyepoint-y-ft", this,2,
+                       (PMF)&FGAircraft::GetXYZep);
+  PropertyManager->Tie("metrics/eyepoint-z-ft", this,3,
+                       (PMF)&FGAircraft::GetXYZep);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGAircraft::unbind(void)
+{
+  PropertyManager->Untie("metrics/Sw-sqft");
+  PropertyManager->Untie("metrics/bw-ft");
+  PropertyManager->Untie("metrics/cbarw-ft");
+  PropertyManager->Untie("metrics/iw-deg");
+  PropertyManager->Untie("metrics/Sh-sqft");
+  PropertyManager->Untie("metrics/lh-ft");
+  PropertyManager->Untie("metrics/Sv-sqft");
+  PropertyManager->Untie("metrics/lv-ft");
+  PropertyManager->Untie("metrics/lh-norm");
+  PropertyManager->Untie("metrics/lv-norm");
+  PropertyManager->Untie("metrics/vbarh-norm");
+  PropertyManager->Untie("metrics/vbarv-norm");
+  PropertyManager->Untie("moments/l-total-lbsft");
+  PropertyManager->Untie("moments/m-total-lbsft");
+  PropertyManager->Untie("moments/n-total-lbsft");
+  PropertyManager->Untie("forces/fbx-total-lbs");
+  PropertyManager->Untie("forces/fby-total-lbs");
+  PropertyManager->Untie("forces/fbz-total-lbs");
+  PropertyManager->Untie("metrics/aero-rp-x-ft");
+  PropertyManager->Untie("metrics/aero-rp-y-ft");
+  PropertyManager->Untie("metrics/aero-rp-z-ft");
+  PropertyManager->Untie("metrics/eyepoint-x-ft");
+  PropertyManager->Untie("metrics/eyepoint-y-ft");
+  PropertyManager->Untie("metrics/eyepoint-z-ft");
+}
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 //    The bitmasked value choices are as follows:
 //    unset: In this case (the default) JSBSim would only print