Sync. with JSBSim CVS
This commit is contained in:
parent
226231434e
commit
90f498be4d
3 changed files with 22 additions and 21 deletions
src/FDM/JSBSim
|
@ -92,8 +92,8 @@ Element::Element(string nm)
|
||||||
convert["LBS/FT/SEC"]["N/M/SEC"] = 14.5939;
|
convert["LBS/FT/SEC"]["N/M/SEC"] = 14.5939;
|
||||||
convert["N/M/SEC"]["LBS/FT/SEC"] = 1.0/convert["LBS/FT/SEC"]["N/M/SEC"];
|
convert["N/M/SEC"]["LBS/FT/SEC"] = 1.0/convert["LBS/FT/SEC"]["N/M/SEC"];
|
||||||
// Damping force (Square Law)
|
// Damping force (Square Law)
|
||||||
convert["LBS/FT/SEC2"]["N/M/SEC2"] = 14.5939;
|
convert["LBS/FT2/SEC2"]["N/M2/SEC2"] = 47.880259;
|
||||||
convert["N/M/SEC2"]["LBS/FT/SEC2"] = 1.0/convert["LBS/FT/SEC2"]["N/M/SEC2"];
|
convert["N/M2/SEC2"]["LBS/FT2/SEC2"] = 1.0/convert["LBS/FT2/SEC2"]["N/M2/SEC2"];
|
||||||
// Power
|
// Power
|
||||||
convert["WATTS"]["HP"] = 0.001341022;
|
convert["WATTS"]["HP"] = 0.001341022;
|
||||||
convert["HP"]["WATTS"] = 1.0/convert["WATTS"]["HP"];
|
convert["HP"]["WATTS"] = 1.0/convert["WATTS"]["HP"];
|
||||||
|
@ -158,8 +158,8 @@ Element::Element(string nm)
|
||||||
convert["LBS/FT/SEC"]["LBS/FT/SEC"] = 1.00;
|
convert["LBS/FT/SEC"]["LBS/FT/SEC"] = 1.00;
|
||||||
convert["N/M/SEC"]["N/M/SEC"] = 1.00;
|
convert["N/M/SEC"]["N/M/SEC"] = 1.00;
|
||||||
// Damping force (Square law)
|
// Damping force (Square law)
|
||||||
convert["LBS/FT/SEC2"]["LBS/FT/SEC2"] = 1.00;
|
convert["LBS/FT2/SEC2"]["LBS/FT2/SEC2"] = 1.00;
|
||||||
convert["N/M/SEC2"]["N/M/SEC2"] = 1.00;
|
convert["N/M2/SEC2"]["N/M2/SEC2"] = 1.00;
|
||||||
// Power
|
// Power
|
||||||
convert["HP"]["HP"] = 1.00;
|
convert["HP"]["HP"] = 1.00;
|
||||||
convert["WATTS"]["WATTS"] = 1.00;
|
convert["WATTS"]["WATTS"] = 1.00;
|
||||||
|
|
|
@ -86,8 +86,8 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number) : Exec(fdmex),
|
||||||
if (el->FindElement("damping_coeff")) {
|
if (el->FindElement("damping_coeff")) {
|
||||||
dampCoeff = el->FindElement("damping_coeff");
|
dampCoeff = el->FindElement("damping_coeff");
|
||||||
if (dampCoeff->GetAttributeValue("type") == "SQUARE") {
|
if (dampCoeff->GetAttributeValue("type") == "SQUARE") {
|
||||||
eDampType = dtSquare; // default is dtLinear
|
eDampType = dtSquare;
|
||||||
bDamp = el->FindElementValueAsNumberConvertTo("damping_coeff", "LBS/FT/SEC2");
|
bDamp = el->FindElementValueAsNumberConvertTo("damping_coeff", "LBS/FT2/SEC2");
|
||||||
} else {
|
} else {
|
||||||
bDamp = el->FindElementValueAsNumberConvertTo("damping_coeff", "LBS/FT/SEC");
|
bDamp = el->FindElementValueAsNumberConvertTo("damping_coeff", "LBS/FT/SEC");
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,8 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number) : Exec(fdmex),
|
||||||
if (el->FindElement("damping_coeff_rebound")) {
|
if (el->FindElement("damping_coeff_rebound")) {
|
||||||
dampCoeffRebound = el->FindElement("damping_coeff_rebound");
|
dampCoeffRebound = el->FindElement("damping_coeff_rebound");
|
||||||
if (dampCoeffRebound->GetAttributeValue("type") == "SQUARE") {
|
if (dampCoeffRebound->GetAttributeValue("type") == "SQUARE") {
|
||||||
eDampTypeRebound = dtSquare; // default is dtLinear
|
eDampTypeRebound = dtSquare;
|
||||||
bDampRebound = el->FindElementValueAsNumberConvertTo("damping_coeff_rebound", "LBS/FT/SEC2");
|
bDampRebound = el->FindElementValueAsNumberConvertTo("damping_coeff_rebound", "LBS/FT2/SEC2");
|
||||||
} else {
|
} else {
|
||||||
bDampRebound = el->FindElementValueAsNumberConvertTo("damping_coeff_rebound", "LBS/FT/SEC");
|
bDampRebound = el->FindElementValueAsNumberConvertTo("damping_coeff_rebound", "LBS/FT/SEC");
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,9 +235,9 @@ Manifold_Pressure_Lookup = new
|
||||||
RatedAltitude[2] = el->FindElementValueAsNumberConvertTo("ratedaltitude3", "FT");
|
RatedAltitude[2] = el->FindElementValueAsNumberConvertTo("ratedaltitude3", "FT");
|
||||||
}
|
}
|
||||||
char property_name[80];
|
char property_name[80];
|
||||||
snprintf(property_name, 80, "/engines/engine[%d]/power_hp", engine_number);
|
snprintf(property_name, 80, "propulsion/engine[%d]/power_hp", EngineNumber);
|
||||||
PropertyManager->Tie(property_name, &HP);
|
PropertyManager->Tie(property_name, &HP);
|
||||||
snprintf(property_name, 80, "/engines/engine[%d]/bsfc", engine_number);
|
snprintf(property_name, 80, "propulsion/engine[%d]/bsfc", EngineNumber);
|
||||||
PropertyManager->Tie(property_name, &BSFC);
|
PropertyManager->Tie(property_name, &BSFC);
|
||||||
|
|
||||||
minMAP = MinManifoldPressure_inHg * inhgtopa; // inHg to Pa
|
minMAP = MinManifoldPressure_inHg * inhgtopa; // inHg to Pa
|
||||||
|
@ -299,10 +299,6 @@ Manifold_Pressure_Lookup = new
|
||||||
FGPiston::~FGPiston()
|
FGPiston::~FGPiston()
|
||||||
{
|
{
|
||||||
char property_name[80];
|
char property_name[80];
|
||||||
snprintf(property_name, 80, "/engines/engine[%d]/power_hp", EngineNumber);
|
|
||||||
PropertyManager->Untie(property_name);
|
|
||||||
snprintf(property_name, 80, "/engines/engine[%d]/bsfc", EngineNumber);
|
|
||||||
PropertyManager->Untie(property_name);
|
|
||||||
|
|
||||||
delete Lookup_Combustion_Efficiency;
|
delete Lookup_Combustion_Efficiency;
|
||||||
delete Power_Mixture_Correlation;
|
delete Power_Mixture_Correlation;
|
||||||
|
@ -513,7 +509,8 @@ void FGPiston::doBoostControl(void)
|
||||||
|
|
||||||
void FGPiston::doMAP(void)
|
void FGPiston::doMAP(void)
|
||||||
{
|
{
|
||||||
suction_loss = pow( ThrottlePos*0.98, RPM/MaxRPM );
|
suction_loss = RPM > 0.0 ? ThrottlePos * MaxRPM / RPM : 1.0;
|
||||||
|
if (suction_loss > 1.0) suction_loss = 1.0;
|
||||||
MAP = p_amb * suction_loss;
|
MAP = p_amb * suction_loss;
|
||||||
|
|
||||||
if(Boosted) {
|
if(Boosted) {
|
||||||
|
@ -540,7 +537,7 @@ void FGPiston::doMAP(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Boost the manifold pressure.
|
// Boost the manifold pressure.
|
||||||
MAP += MAP * BoostMul[BoostSpeed] * RPM/MaxRPM;
|
MAP += MAP * BoostMul[BoostSpeed] * suction_loss * RPM/RatedRPM[BoostSpeed];
|
||||||
// Now clip the manifold pressure to BCV or Wastegate setting.
|
// Now clip the manifold pressure to BCV or Wastegate setting.
|
||||||
if(bTakeoffPos) {
|
if(bTakeoffPos) {
|
||||||
if(MAP > TakeoffMAP[BoostSpeed]) {
|
if(MAP > TakeoffMAP[BoostSpeed]) {
|
||||||
|
@ -577,7 +574,7 @@ void FGPiston::doAirFlow(void)
|
||||||
rho_air = p_amb / (R_air * T_amb);
|
rho_air = p_amb / (R_air * T_amb);
|
||||||
double displacement_SI = Displacement * in3tom3;
|
double displacement_SI = Displacement * in3tom3;
|
||||||
double swept_volume = (displacement_SI * (RPM/60)) / 2;
|
double swept_volume = (displacement_SI * (RPM/60)) / 2;
|
||||||
double v_dot_air = swept_volume * volumetric_efficiency;
|
double v_dot_air = swept_volume * volumetric_efficiency * suction_loss;
|
||||||
|
|
||||||
double rho_air_manifold = MAP / (R_air * T_amb);
|
double rho_air_manifold = MAP / (R_air * T_amb);
|
||||||
m_dot_air = v_dot_air * rho_air_manifold;
|
m_dot_air = v_dot_air * rho_air_manifold;
|
||||||
|
@ -627,14 +624,18 @@ void FGPiston::doEnginePower(void)
|
||||||
double T_amb_sea_lev_degF = KelvinToFahrenheit(288);
|
double T_amb_sea_lev_degF = KelvinToFahrenheit(288);
|
||||||
|
|
||||||
// FIXME: this needs to be generalized
|
// FIXME: this needs to be generalized
|
||||||
double ME, Adjusted_BSFC; // Convienience term for use in the calculations
|
double ME, friction, percent_RPM; // Convienience term for use in the calculations
|
||||||
ME = Mixture_Efficiency_Correlation->GetValue(m_dot_fuel/m_dot_air);
|
ME = Mixture_Efficiency_Correlation->GetValue(m_dot_fuel/m_dot_air);
|
||||||
Adjusted_BSFC = (1/ThrottlePos) * BSFC;
|
|
||||||
Percentage_Power = 1.000;
|
percent_RPM = RPM/MaxRPM;
|
||||||
|
friction = 1 - (percent_RPM * percent_RPM * percent_RPM * percent_RPM/10);
|
||||||
|
if (friction < 0 ) friction = 0;
|
||||||
|
Percentage_Power = friction;
|
||||||
|
|
||||||
if ( Magnetos != 3 ) Percentage_Power *= SparkFailDrop;
|
if ( Magnetos != 3 ) Percentage_Power *= SparkFailDrop;
|
||||||
|
|
||||||
HP = (FuelFlow_gph * 6.0 / Adjusted_BSFC )* ME * suction_loss * Percentage_Power;
|
|
||||||
|
HP = (FuelFlow_gph * 6.0 / BSFC )* ME * suction_loss * Percentage_Power;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue