]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGPropeller.cpp
Make yasim accept the launchbar and hook properties. They are not tied to anything...
[flightgear.git] / src / FDM / JSBSim / FGPropeller.cpp
index 9b352bc55cbc907dbe069de84ecd828c67d1c23f..d205a3a621900d3f561de6c76624cf7c1bb6c813 100644 (file)
@@ -56,7 +56,7 @@ CLASS IMPLEMENTATION
 // not just the X-axis of the engine/propeller. This may or may not work for a
 // helicopter.
 
-FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(exec)
+FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg, int num) : FGThruster(exec)
 {
   string token;
   int rows, cols;
@@ -107,6 +107,10 @@ FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(e
   RPM = 0;
   vTorque.InitMatrix();
 
+  char property_name[80];
+  snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
+  PropertyManager->Tie( property_name, &ThrustCoeff );
+
   Debug(0);
 }
 
@@ -116,6 +120,11 @@ FGPropeller::~FGPropeller()
 {
   if (cThrust)    delete cThrust;
   if (cPower)     delete cPower;
+
+  char property_name[80];
+  snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
+  PropertyManager->Untie( property_name );
+
   Debug(1);
 }
 
@@ -135,7 +144,7 @@ FGPropeller::~FGPropeller()
 
 double FGPropeller::Calculate(double PowerAvailable)
 {
-  double J, C_Thrust, omega;
+  double J, omega;
   double Vel = fdmex->GetAuxiliary()->GetAeroUVW(eU);
   double rho = fdmex->GetAtmosphere()->GetDensity();
   double RPS = RPM/60.0;
@@ -148,9 +157,9 @@ double FGPropeller::Calculate(double PowerAvailable)
   }
 
   if (MaxPitch == MinPitch) { // Fixed pitch prop
-    C_Thrust = cThrust->GetValue(J);
+    ThrustCoeff = cThrust->GetValue(J);
   } else {                    // Variable pitch prop
-    C_Thrust = cThrust->GetValue(J, Pitch);
+    ThrustCoeff = cThrust->GetValue(J, Pitch);
   }
 
   if (P_Factor > 0.0001) {
@@ -162,7 +171,7 @@ double FGPropeller::Calculate(double PowerAvailable)
     cerr << "P-Factor value in config file must be greater than zero" << endl;
   }
 
-  Thrust = C_Thrust*RPS*RPS*Diameter*Diameter*Diameter*Diameter*rho;
+  Thrust = ThrustCoeff*RPS*RPS*Diameter*Diameter*Diameter*Diameter*rho;
   omega = RPS*2.0*M_PI;
 
   vFn(1) = Thrust;
@@ -243,16 +252,16 @@ FGColumnVector3 FGPropeller::GetPFactor()
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropeller::GetThrusterLabels(int id)
+string FGPropeller::GetThrusterLabels(int id, string delimeter)
 {
   std::ostringstream buf;
 
-  buf << Name << "_Torque[" << id << "], "
-      << Name << "_PFactor_Pitch[" << id << "], "
-      << Name << "_PFactor_Yaw[" << id << "], "
-      << Name << "_Thrust[" << id << "], ";
+  buf << Name << "_Torque[" << id << "]" << delimeter
+      << Name << "_PFactor_Pitch[" << id << "]" << delimeter
+      << Name << "_PFactor_Yaw[" << id << "]" << delimeter
+      << Name << "_Thrust[" << id << "]" << delimeter;
   if (IsVPitch())
-    buf << Name << "_Pitch[" << id << "], ";
+    buf << Name << "_Pitch[" << id << "]" << delimeter;
   buf << Name << "_RPM[" << id << "]";
 
   return buf.str();
@@ -260,17 +269,17 @@ string FGPropeller::GetThrusterLabels(int id)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-string FGPropeller::GetThrusterValues(int id)
+string FGPropeller::GetThrusterValues(int id, string delimeter)
 {
   std::ostringstream buf;
 
   FGColumnVector3 vPFactor = GetPFactor();
-  buf << vTorque(eX) << ", "
-      << vPFactor(ePitch) << ", "
-      << vPFactor(eYaw) << ", "
-      << Thrust << ", ";
+  buf << vTorque(eX) << delimeter
+      << vPFactor(ePitch) << delimeter
+      << vPFactor(eYaw) << delimeter
+      << Thrust << delimeter;
   if (IsVPitch())
-    buf << Pitch << ", ";
+    buf << Pitch << delimeter;
   buf << RPM;
 
   return buf.str();