]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGAircraft.cpp
JSBSim updates. This update changes the file format, so an update of the base
[flightgear.git] / src / FDM / JSBSim / FGAircraft.cpp
index f3e242b326b001f5ecd0c258805c83c1f2ab57c5..2e94ecfad3e285655e281ef6ffa2408325432cd0 100644 (file)
@@ -101,14 +101,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;
-  bi2vel=ci2vel=alphaw=0;
+  HTailArea = VTailArea = 0.0;
+  HTailArm  = VTailArm  = 0.0;
+  lbarh = lbarv = 0.0;
+  vbarh = vbarv = 0.0;
+  WingIncidence = 0.0;
 
   bind();
 
@@ -127,8 +125,6 @@ FGAircraft::~FGAircraft()
 
 bool FGAircraft::Run(void)
 {
-  double twovel;
-  
   if (!FGModel::Run()) {                 // if false then execute this Run()
     vForces.InitMatrix();
     vForces += Aerodynamics->GetForces();
@@ -148,22 +144,6 @@ bool FGAircraft::Run(void)
     vNwcg = State->GetTb2s() * vNcg;
     vNwcg(3) = -1*vNwcg(3) + 1;
     
-    twovel=2*Translation->GetVt();
-    if(twovel > 0) {
-      bi2vel = WingSpan / twovel;
-      ci2vel = cbar / twovel;
-    }  
-    
-    alphaw = Translation->Getalpha() + WingIncidence;
-    
-    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;
@@ -249,11 +229,6 @@ 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);
@@ -276,51 +251,10 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg)
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-//    The bitmasked value choices are as follows:
-//    unset: In this case (the default) JSBSim would only print
-//       out the normally expected messages, essentially echoing
-//       the config files as they are read. If the environment
-//       variable is not set, debug_lvl is set to 1 internally
-//    0: This requests JSBSim not to output any messages
-//       whatsoever.
-//    1: This value explicity requests the normal JSBSim
-//       startup messages
-//    2: This value asks for a message to be printed out when
-//       a class is instantiated
-//    4: When this value is set, a message is displayed when a
-//       FGModel object executes its Run() method
-//    8: When this value is set, various runtime state variables
-//       are printed out periodically
-//    16: When set various parameters are sanity checked and
-//       a message is printed out when they go out of bounds
 
-void FGAircraft::Debug(int from)
+void FGAircraft::bind(void)
 {
-  if (debug_lvl <= 0) return;
-
-  if (debug_lvl & 1) { // Standard console startup message output
-    if (from == 0) { // Constructor
-    }
-  }
-  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
-    if (from == 0) cout << "Instantiated: FGAircraft" << endl;
-    if (from == 1) cout << "Destroyed:    FGAircraft" << endl;
-  }
-  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
-  }
-  if (debug_lvl & 8 ) { // Runtime state variables
-  }
-  if (debug_lvl & 16) { // Sanity checking
-  }
-  if (debug_lvl & 64) {
-    if (from == 0) { // Constructor
-      cout << IdSrc << endl;
-      cout << IdHdr << endl;
-    }
-  }
-}
-
-void FGAircraft::bind(void){
+  typedef double (FGAircraft::*PMF)(int) const;
   PropertyManager->Tie("metrics/Sw-sqft", this,
                        &FGAircraft::GetWingArea);
   PropertyManager->Tie("metrics/bw-ft", this,
@@ -346,48 +280,35 @@ void FGAircraft::bind(void){
   PropertyManager->Tie("metrics/vbarv-norm", this,
                        &FGAircraft::Getvbarv);
   PropertyManager->Tie("moments/l-total-lbsft", this,1,
-                       &FGAircraft::GetMoments);
+                       (PMF)&FGAircraft::GetMoments);
   PropertyManager->Tie("moments/m-total-lbsft", this,2,
-                       &FGAircraft::GetMoments);
+                       (PMF)&FGAircraft::GetMoments);
   PropertyManager->Tie("moments/n-total-lbsft", this,3,
-                       &FGAircraft::GetMoments);
+                       (PMF)&FGAircraft::GetMoments);
   PropertyManager->Tie("forces/fbx-total-lbs", this,1,
-                       &FGAircraft::GetForces);
+                       (PMF)&FGAircraft::GetForces);
   PropertyManager->Tie("forces/fby-total-lbs", this,2,
-                       &FGAircraft::GetForces);
+                       (PMF)&FGAircraft::GetForces);
   PropertyManager->Tie("forces/fbz-total-lbs", this,3,
-                       &FGAircraft::GetForces);
+                       (PMF)&FGAircraft::GetForces);
   PropertyManager->Tie("metrics/aero-rp-x-ft", this,1,
-                       &FGAircraft::GetXYZrp);
+                       (PMF)&FGAircraft::GetXYZrp);
   PropertyManager->Tie("metrics/aero-rp-y-ft", this,2,
-                       &FGAircraft::GetXYZrp);
+                       (PMF)&FGAircraft::GetXYZrp);
   PropertyManager->Tie("metrics/aero-rp-z-ft", this,3,
-                       &FGAircraft::GetXYZrp);
+                       (PMF)&FGAircraft::GetXYZrp);
   PropertyManager->Tie("metrics/eyepoint-x-ft", this,1,
-                       &FGAircraft::GetXYZep);
+                       (PMF)&FGAircraft::GetXYZep);
   PropertyManager->Tie("metrics/eyepoint-y-ft", this,2,
-                       &FGAircraft::GetXYZep);
+                       (PMF)&FGAircraft::GetXYZep);
   PropertyManager->Tie("metrics/eyepoint-z-ft", this,3,
-                       &FGAircraft::GetXYZep);
-  PropertyManager->Tie("metrics/alpha-max-deg", this,
-                       &FGAircraft::GetAlphaCLMax,
-                       &FGAircraft::SetAlphaCLMax,
-                       true);
-  PropertyManager->Tie("metrics/alpha-min-deg", this,
-                       &FGAircraft::GetAlphaCLMin,
-                       &FGAircraft::SetAlphaCLMin,
-                       true);
-  PropertyManager->Tie("aero/bi2vel", this,
-                       &FGAircraft::GetBI2Vel);
-  PropertyManager->Tie("aero/ci2vel", this,
-                       &FGAircraft::GetCI2Vel);
-  PropertyManager->Tie("aero/alpha-wing-rad", this,
-                       &FGAircraft::GetAlphaW);
-  PropertyManager->Tie("systems/stall-warn-norm", this,
-                        &FGAircraft::GetStallWarn);
+                       (PMF)&FGAircraft::GetXYZep);
 }
 
-void FGAircraft::unbind(void){
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGAircraft::unbind(void)
+{
   PropertyManager->Untie("metrics/Sw-sqft");
   PropertyManager->Untie("metrics/bw-ft");
   PropertyManager->Untie("metrics/cbarw-ft");
@@ -412,10 +333,50 @@ void FGAircraft::unbind(void){
   PropertyManager->Untie("metrics/eyepoint-x-ft");
   PropertyManager->Untie("metrics/eyepoint-y-ft");
   PropertyManager->Untie("metrics/eyepoint-z-ft");
-  PropertyManager->Untie("metrics/alpha-max-deg");
-  PropertyManager->Untie("metrics/alpha-min-deg");
-  PropertyManager->Untie("aero/bi2vel");
-  PropertyManager->Untie("aero/ci2vel");
-  PropertyManager->Untie("aero/alpha-wing-rad");
-  PropertyManager->Untie("systems/stall-warn-norm");
 }
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+//    The bitmasked value choices are as follows:
+//    unset: In this case (the default) JSBSim would only print
+//       out the normally expected messages, essentially echoing
+//       the config files as they are read. If the environment
+//       variable is not set, debug_lvl is set to 1 internally
+//    0: This requests JSBSim not to output any messages
+//       whatsoever.
+//    1: This value explicity requests the normal JSBSim
+//       startup messages
+//    2: This value asks for a message to be printed out when
+//       a class is instantiated
+//    4: When this value is set, a message is displayed when a
+//       FGModel object executes its Run() method
+//    8: When this value is set, various runtime state variables
+//       are printed out periodically
+//    16: When set various parameters are sanity checked and
+//       a message is printed out when they go out of bounds
+
+void FGAircraft::Debug(int from)
+{
+  if (debug_lvl <= 0) return;
+
+  if (debug_lvl & 1) { // Standard console startup message output
+    if (from == 0) { // Constructor
+    }
+  }
+  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+    if (from == 0) cout << "Instantiated: FGAircraft" << endl;
+    if (from == 1) cout << "Destroyed:    FGAircraft" << endl;
+  }
+  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+  }
+  if (debug_lvl & 8 ) { // Runtime state variables
+  }
+  if (debug_lvl & 16) { // Sanity checking
+  }
+  if (debug_lvl & 64) {
+    if (from == 0) { // Constructor
+      cout << IdSrc << endl;
+      cout << IdHdr << endl;
+    }
+  }
+}
+