]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGFCS.cpp
Fix stall widths for the "auxilliary" (reverse flow) stalls so they
[flightgear.git] / src / FDM / JSBSim / FGFCS.cpp
index cf1b8628fe57dbdb5801df73d9a71e305c8480c2..4405ad559d04dfddcf782c8d7c58dbb6c26946c5 100644 (file)
@@ -100,6 +100,7 @@ FGFCS::~FGFCS()
   MixturePos.clear();
   PropAdvanceCmd.clear();
   PropAdvance.clear();
+  SteerPosDeg.clear();
 
   unsigned int i;
 
@@ -117,10 +118,17 @@ bool FGFCS::Run(void)
 
   if (FGModel::Run()) return true; // fast exit if nothing to do
 
+  // Set the default engine commands
   for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = ThrottleCmd[i];
   for (i=0; i<MixturePos.size(); i++) MixturePos[i] = MixtureCmd[i];
   for (i=0; i<PropAdvance.size(); i++) PropAdvance[i] = PropAdvanceCmd[i];
 
+  // Set the default steering angle
+  for (i=0; i<SteerPosDeg.size(); i++) {
+    FGLGear* gear = GroundReactions->GetGearUnit(i);
+    SteerPosDeg[i] = gear->GetDefaultSteerAngle( GetDsCmd() );
+  }
+
   for (i=0; i<APComponents.size(); i++) APComponents[i]->Run(); // cycle AP components
   for (i=0; i<FCSComponents.size(); i++) FCSComponents[i]->Run(); // cycle FCS components
 
@@ -412,7 +420,7 @@ double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGFCS::GetComponentStrings(void)
+string FGFCS::GetComponentStrings(string delimeter)
 {
   unsigned int comp;
   string CompStrings = "";
@@ -420,14 +428,14 @@ string FGFCS::GetComponentStrings(void)
 
   for (comp = 0; comp < FCSComponents.size(); comp++) {
     if (firstime) firstime = false;
-    else          CompStrings += ", ";
+    else          CompStrings += delimeter;
 
     CompStrings += FCSComponents[comp]->GetName();
   }
 
   for (comp = 0; comp < APComponents.size(); comp++)
   {
-    CompStrings += ", ";
+    CompStrings += delimeter;
     CompStrings += APComponents[comp]->GetName();
   }
 
@@ -436,7 +444,7 @@ string FGFCS::GetComponentStrings(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGFCS::GetComponentValues(void)
+string FGFCS::GetComponentValues(string delimeter)
 {
   unsigned int comp;
   string CompValues = "";
@@ -445,14 +453,14 @@ string FGFCS::GetComponentValues(void)
 
   for (comp = 0; comp < FCSComponents.size(); comp++) {
     if (firstime) firstime = false;
-    else          CompValues += ", ";
+    else          CompValues += delimeter;
 
     sprintf(buffer, "%9.6f", FCSComponents[comp]->GetOutput());
     CompValues += string(buffer);
   }
 
   for (comp = 0; comp < APComponents.size(); comp++) {
-    sprintf(buffer, ", %9.6f", APComponents[comp]->GetOutput());
+    sprintf(buffer, "%s%9.6f", delimeter.c_str(), APComponents[comp]->GetOutput());
     CompValues += string(buffer);
   }
 
@@ -473,6 +481,13 @@ void FGFCS::AddThrottle(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGFCS::AddGear(void)
+{
+  SteerPosDeg.push_back(0.0);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 void FGFCS::Normalize(void) {
 
   //not all of these are guaranteed to be defined for every model
@@ -533,6 +548,10 @@ void FGFCS::bind(void)
                        &FGFCS::GetDrCmd,
                        &FGFCS::SetDrCmd,
                        true);
+  PropertyManager->Tie("fcs/steer-cmd-norm", this,
+                       &FGFCS::GetDsCmd,
+                       &FGFCS::SetDsCmd,
+                       true);
   PropertyManager->Tie("fcs/flap-cmd-norm", this,
                        &FGFCS::GetDfCmd,
                        &FGFCS::SetDfCmd,
@@ -747,7 +766,6 @@ void FGFCS::bindModel(void)
   unsigned i;
   char tmp[80];
 
-
   for (i=0; i<ThrottleCmd.size(); i++) {
     snprintf(tmp,80,"fcs/throttle-cmd-norm[%u]",i);
     PropertyManager->Tie( tmp,this,i,
@@ -784,6 +802,16 @@ void FGFCS::bindModel(void)
                             true );
     }
   }
+
+  for (i=0; i<SteerPosDeg.size(); i++) {
+    if (GroundReactions->GetGearUnit(i)->GetSteerable()) {
+      snprintf(tmp,80,"fcs/steer-pos-deg[%u]",i);
+      PropertyManager->Tie( tmp, this, i,
+                            &FGFCS::GetSteerPosDeg,
+                            &FGFCS::SetSteerPosDeg,
+                            true );
+    }
+  }
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -800,6 +828,15 @@ void FGFCS::unbind(FGPropertyManager *node)
   }
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGFCS::convert(void)
+{
+  for (int i=0; i<FCSComponents.size(); i++) {
+    FCSComponents[i]->convert();
+  }
+}
+
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 //    The bitmasked value choices are as follows:
 //    unset: In this case (the default) JSBSim would only print