rocket engine and piston engine fixes
This commit is contained in:
parent
a70431c5a4
commit
b1eebb21a6
3 changed files with 35 additions and 16 deletions
|
@ -88,7 +88,7 @@ FGPiston::FGPiston(FGFDMExec* exec, Element* el, int engine_number)
|
||||||
MinManifoldPressure_inHg = 6.5;
|
MinManifoldPressure_inHg = 6.5;
|
||||||
MaxManifoldPressure_inHg = 28.5;
|
MaxManifoldPressure_inHg = 28.5;
|
||||||
ISFC = -1;
|
ISFC = -1;
|
||||||
volumetric_efficiency = -0.1;
|
volumetric_efficiency = 0.85;
|
||||||
Bore = 5.125;
|
Bore = 5.125;
|
||||||
Stroke = 4.375;
|
Stroke = 4.375;
|
||||||
Cylinders = 4;
|
Cylinders = 4;
|
||||||
|
@ -239,32 +239,41 @@ FGPiston::FGPiston(FGFDMExec* exec, Element* el, int engine_number)
|
||||||
|
|
||||||
StarterHP = sqrt(MaxHP) * 0.4;
|
StarterHP = sqrt(MaxHP) * 0.4;
|
||||||
displacement_SI = Displacement * in3tom3;
|
displacement_SI = Displacement * in3tom3;
|
||||||
|
RatedMeanPistonSpeed_fps = ( MaxRPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS
|
||||||
|
|
||||||
// Create IFSC and VE to match the engine if not provided
|
// Create IFSC to match the engine if not provided
|
||||||
int calculated_ve=0;
|
|
||||||
if (volumetric_efficiency < 0) {
|
|
||||||
volumetric_efficiency = MaxManifoldPressure_inHg / 29.92;
|
|
||||||
calculated_ve=1;
|
|
||||||
}
|
|
||||||
if (ISFC < 0) {
|
if (ISFC < 0) {
|
||||||
double pmep = MaxManifoldPressure_inHg > 29.92 ? 0 : 29.92 - MaxManifoldPressure_inHg;
|
double pmep = 29.92 - MaxManifoldPressure_inHg;
|
||||||
pmep *= inhgtopa;
|
pmep *= inhgtopa;
|
||||||
double fmep = (18400 * (2*(Stroke/12)*(MaxRPM/60)) * fttom + 46500)/2;
|
double fmep = (18400 * RatedMeanPistonSpeed_fps * fttom + 46500);
|
||||||
double hp_loss = ((pmep + fmep) * displacement_SI * MaxRPM)/(Cycles*22371);
|
double hp_loss = ((pmep + fmep) * displacement_SI * MaxRPM)/(Cycles*22371);
|
||||||
ISFC = ( Displacement * MaxRPM * volumetric_efficiency ) / (9411 * (MaxHP+hp_loss));
|
ISFC = ( 1.1*Displacement * MaxRPM * volumetric_efficiency *(MaxManifoldPressure_inHg / 29.92) ) / (9411 * (MaxHP+hp_loss));
|
||||||
// cout <<"FMEP: "<< fmep <<" PMEP: "<< pmep << " hp_loss: " <<hp_loss <<endl;
|
// cout <<"FMEP: "<< fmep <<" PMEP: "<< pmep << " hp_loss: " <<hp_loss <<endl;
|
||||||
}
|
}
|
||||||
if ( MaxManifoldPressure_inHg > 29.9 ) { // Don't allow boosting with a bogus number
|
if ( MaxManifoldPressure_inHg > 29.9 ) { // Don't allow boosting with a bogus number
|
||||||
MaxManifoldPressure_inHg = 29.9;
|
MaxManifoldPressure_inHg = 29.9;
|
||||||
if (calculated_ve) volumetric_efficiency = 1.0;
|
|
||||||
}
|
}
|
||||||
minMAP = MinManifoldPressure_inHg * inhgtopa; // inHg to Pa
|
minMAP = MinManifoldPressure_inHg * inhgtopa; // inHg to Pa
|
||||||
maxMAP = MaxManifoldPressure_inHg * inhgtopa;
|
maxMAP = MaxManifoldPressure_inHg * inhgtopa;
|
||||||
|
|
||||||
// For throttle
|
// For throttle
|
||||||
RatedMeanPistonSpeed_fps = ( MaxRPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS
|
/*
|
||||||
if(Z_airbox < 998){
|
* Pm = ( Ze / ( Ze + Zi + Zt ) ) * Pa
|
||||||
double Ze=RatedMeanPistonSpeed_fps/PeakMeanPistonSpeed_fps; // engine impedence
|
* Where:
|
||||||
|
* Pm = Manifold Pressure
|
||||||
|
* Pa = Ambient Pressre
|
||||||
|
* Ze = engine impedance, Ze is effectively 1 / Mean Piston Speed
|
||||||
|
* Zi = airbox impedance
|
||||||
|
* Zt = throttle impedance
|
||||||
|
*
|
||||||
|
* For the calculation below throttle is fully open or Zt = 0
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(Z_airbox < 0.0){
|
||||||
|
double Ze=PeakMeanPistonSpeed_fps/RatedMeanPistonSpeed_fps; // engine impedence
|
||||||
Z_airbox = (standard_pressure *Ze / maxMAP) - Ze; // impedence of airbox
|
Z_airbox = (standard_pressure *Ze / maxMAP) - Ze; // impedence of airbox
|
||||||
}
|
}
|
||||||
Z_throttle=(((MaxRPM * Stroke) / 360)/((IdleRPM * Stroke) / 360))*(standard_pressure/minMAP - 1) - Z_airbox; // Constant for Throttle impedence
|
Z_throttle=(((MaxRPM * Stroke) / 360)/((IdleRPM * Stroke) / 360))*(standard_pressure/minMAP - 1) - Z_airbox; // Constant for Throttle impedence
|
||||||
|
@ -913,7 +922,9 @@ void FGPiston::Debug(int from)
|
||||||
cout << " MaxThrottle: " << MaxThrottle << endl;
|
cout << " MaxThrottle: " << MaxThrottle << endl;
|
||||||
cout << " MinThrottle: " << MinThrottle << endl;
|
cout << " MinThrottle: " << MinThrottle << endl;
|
||||||
cout << " ISFC: " << ISFC << endl;
|
cout << " ISFC: " << ISFC << endl;
|
||||||
cout << " Volumentric Efficiency: " << volumetric_efficiency << endl;
|
cout << " Volumetric Efficiency: " << volumetric_efficiency << endl;
|
||||||
|
cout << " PeakMeanPistonSpeed_fps: " << PeakMeanPistonSpeed_fps << endl;
|
||||||
|
cout << " Intake Impedance Factor: " << Z_airbox << endl;
|
||||||
|
|
||||||
cout << endl;
|
cout << endl;
|
||||||
cout << " Combustion Efficiency table:" << endl;
|
cout << " Combustion Efficiency table:" << endl;
|
||||||
|
|
|
@ -69,6 +69,7 @@ FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number)
|
||||||
FuelFlowRate = 0.0;
|
FuelFlowRate = 0.0;
|
||||||
OxidizerFlowRate = 0.0;
|
OxidizerFlowRate = 0.0;
|
||||||
SLOxiFlowMax = 0.0;
|
SLOxiFlowMax = 0.0;
|
||||||
|
BuildupTime = 0.0;
|
||||||
It = 0.0;
|
It = 0.0;
|
||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
|
@ -77,6 +78,8 @@ FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number)
|
||||||
|
|
||||||
if (el->FindElement("isp"))
|
if (el->FindElement("isp"))
|
||||||
Isp = el->FindElementValueAsNumber("isp");
|
Isp = el->FindElementValueAsNumber("isp");
|
||||||
|
if (el->FindElement("builduptime"))
|
||||||
|
BuildupTime = el->FindElementValueAsNumber("builduptime");
|
||||||
if (el->FindElement("maxthrottle"))
|
if (el->FindElement("maxthrottle"))
|
||||||
MaxThrottle = el->FindElementValueAsNumber("maxthrottle");
|
MaxThrottle = el->FindElementValueAsNumber("maxthrottle");
|
||||||
if (el->FindElement("minthrottle"))
|
if (el->FindElement("minthrottle"))
|
||||||
|
@ -127,7 +130,6 @@ double FGRocket::Calculate(void)
|
||||||
if (ThrustTable != 0L) { // Thrust table given -> Solid fuel used
|
if (ThrustTable != 0L) { // Thrust table given -> Solid fuel used
|
||||||
|
|
||||||
if ((Throttle == 1 || BurnTime > 0.0 ) && !Starved) {
|
if ((Throttle == 1 || BurnTime > 0.0 ) && !Starved) {
|
||||||
BurnTime += State->Getdt();
|
|
||||||
double TotalEngineFuelBurned=0.0;
|
double TotalEngineFuelBurned=0.0;
|
||||||
for (int i=0; i<(int)SourceTanks.size(); i++) {
|
for (int i=0; i<(int)SourceTanks.size(); i++) {
|
||||||
FGTank* tank = Propulsion->GetTank(i);
|
FGTank* tank = Propulsion->GetTank(i);
|
||||||
|
@ -137,6 +139,11 @@ double FGRocket::Calculate(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
VacThrust = ThrustTable->GetValue(TotalEngineFuelBurned);
|
VacThrust = ThrustTable->GetValue(TotalEngineFuelBurned);
|
||||||
|
if (BurnTime <= BuildupTime && BuildupTime > 0.0) {
|
||||||
|
VacThrust *= sin((BurnTime/BuildupTime)*M_PI/2.0);
|
||||||
|
// VacThrust *= (1-cos((BurnTime/BuildupTime)*M_PI))/2.0; // 1 - cos approach
|
||||||
|
}
|
||||||
|
BurnTime += State->Getdt(); // Increment burn time
|
||||||
} else {
|
} else {
|
||||||
VacThrust = 0.0;
|
VacThrust = 0.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,6 +200,7 @@ private:
|
||||||
double OxidizerFlowRate;
|
double OxidizerFlowRate;
|
||||||
double PropellantFlowRate;
|
double PropellantFlowRate;
|
||||||
bool Flameout;
|
bool Flameout;
|
||||||
|
double BuildupTime;
|
||||||
FGTable* ThrustTable;
|
FGTable* ThrustTable;
|
||||||
|
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
|
|
Loading…
Add table
Reference in a new issue