/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
crank_counter = 0;
EngineNumber = 0;
OilTemp_degK = 298;
+ ManifoldPressure_inHg = Atmosphere->GetPressure() * 0.014138; // psf to in Hg
dt = State->Getdt();
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
+ }
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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);
}
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;
}
// 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;
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;
}
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);