]> git.mxchange.org Git - flightgear.git/commitdiff
Latest JSBSim changes.
authordavid <david>
Fri, 14 Dec 2001 23:57:05 +0000 (23:57 +0000)
committerdavid <david>
Fri, 14 Dec 2001 23:57:05 +0000 (23:57 +0000)
src/FDM/JSBSim/FGPiston.cpp
src/FDM/JSBSim/FGPropeller.cpp
src/FDM/JSBSim/FGPropulsion.cpp

index 725499f1a68ecc21032fb64eabe5a9171e5e33a7..0065ff9d907d1ae0a5db19912d66251a1546e3d6 100644 (file)
@@ -1,7 +1,8 @@
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
  Module:       FGPiston.cpp
- Author:       Jon S. Berndt
+ Author:       Jon S. Berndt, JSBSim framework
+               Dave Luff, Piston engine model
  Date started: 09/12/2000
  Purpose:      This module models a Piston engine
 
@@ -85,6 +86,7 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec),
   crank_counter = 0;
   EngineNumber = 0;
   OilTemp_degK = 298;
+  ManifoldPressure_inHg = Atmosphere->GetPressure() * 0.014138; // psf to in Hg
 
   dt = State->Getdt();
 
@@ -285,8 +287,12 @@ void FGPiston::doEngineStartup(void)
 
 void FGPiston::doManifoldPressure(void)
 {
-  ManifoldPressure_inHg = MinManifoldPressure_inHg +
-    (Throttle * (MaxManifoldPressure_inHg - MinManifoldPressure_inHg));
+  if (Running || Cranking) {
+    ManifoldPressure_inHg = MinManifoldPressure_inHg +
+            (Throttle * (MaxManifoldPressure_inHg - MinManifoldPressure_inHg));
+  } else {
+    ManifoldPressure_inHg = Atmosphere->GetPressure() * 0.014138; // psf to in Hg
+  }  
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -390,11 +396,19 @@ void FGPiston::doEnginePower(void)
 
 void FGPiston::doEGT(void)
 {
+  double delta_T_exhaust = 0.0;
+  double heat_capacity_exhaust;
+  double enthalpy_exhaust;
+
   combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio);
-  double enthalpy_exhaust = m_dot_fuel * calorific_value_fuel * 
-    combustion_efficiency * 0.33;
-  double heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
-  double delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
+  enthalpy_exhaust = m_dot_fuel * calorific_value_fuel * combustion_efficiency * 0.33;
+  heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
+
+  if (heat_capacity_exhaust >= 0.0000001)
+    delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
+  else
+    delta_T_exhaust = 0.0;
+
   ExhaustGasTemp_degK = T_amb + delta_T_exhaust;
   ExhaustGasTemp_degK *= 0.444 + ((0.544 - 0.444) * Percentage_Power / 100.0);
 }
index 92e4c5340ca088dceb0cffcb6d94d84946630a1d..b47ba0c7f3b26fd66cdbead5db9ce830ca0600d4 100644 (file)
@@ -147,8 +147,8 @@ double FGPropeller::Calculate(double PowerAvailable)
   if (P_Factor > 0.0001) {
     alpha = fdmex->GetTranslation()->Getalpha();
     beta  = fdmex->GetTranslation()->Getbeta();
-    SetActingLocationY( GetLocationY() + P_Factor*alpha*fabs(Sense)/Sense);
-    SetActingLocationZ( GetLocationZ() + P_Factor*beta*fabs(Sense)/Sense);
+    SetActingLocationY( GetLocationY() + P_Factor*alpha*Sense);
+    SetActingLocationZ( GetLocationZ() + P_Factor*beta*Sense);
   } else if (P_Factor < 0.000) {
     cerr << "P-Factor value in config file must be greater than zero" << endl;
   }
@@ -161,7 +161,7 @@ double FGPropeller::Calculate(double PowerAvailable)
   // natural axis of the engine. The transform takes place in the base class
   // FGForce::GetBodyForces() function.
 
-  vH(eX) = Ixx*omega*fabs(Sense)/Sense;
+  vH(eX) = Ixx*omega*Sense;
   vH(eY) = 0.0;
   vH(eZ) = 0.0;
 
@@ -208,7 +208,7 @@ double FGPropeller::GetPowerRequired(void)
 
   PowerRequired = cPReq*RPS*RPS*RPS*Diameter*Diameter*Diameter*Diameter
                                                        *Diameter*rho;
-  vTorque(eX) = PowerRequired / ((RPM/60)*2.0*M_PI);
+  vTorque(eX) = -Sense*PowerRequired / (RPS*2.0*M_PI);
 
   return PowerRequired;
 }
index 177e954fe965c92ebecae918b22a75e81c805a60..2b8767dd0a19f23e3717820d8d547411e37948eb 100644 (file)
@@ -317,7 +317,7 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
         if (thrType == "FG_PROPELLER" && P_Factor > 0.001) {
           ((FGPropeller*)Thrusters[numThrusters])->SetPFactor(P_Factor);
           if (debug_lvl > 0) cout << "      P-Factor: " << P_Factor << endl;
-          ((FGPropeller*)Thrusters[numThrusters])->SetSense(Sense);
+          ((FGPropeller*)Thrusters[numThrusters])->SetSense(fabs(Sense)/Sense);
           if (debug_lvl > 0) cout << "      Sense: " << Sense <<  endl;
         }
         Thrusters[numThrusters]->SetdeltaT(dt*rate);