Skip to content

Commit daa2c74

Browse files
committed
Adjust back pressure operation due to exhaust injector
1 parent 6550dab commit daa2c74

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ public float TenderFuelMassKG // Decreased by firing and increased
578578
public float LogReleasePressurePSI;
579579
public float LogSteamChestPressurePSI;
580580

581+
float BackPressureCorrectionFactor = 0.15f; // Factor to adjust back pressure for steam usage by exhaust injectors
582+
float LocomotiveBackPressurePSIG; // Back pressure in locomotive including effect of cylinders and blast pipe
583+
581584
// Values for Steam Cylinder events
582585
// Commented out as never used
583586
//float ValveTravel = 10.8268f;
@@ -2103,6 +2106,7 @@ public override void Initialize()
21032106
}
21042107

21052108
// if no user input provided then assign default values
2109+
// the default is the "full locomotive" back pressure, it will be decreased further down if an exhaust injector is fitted
21062110
if (BackPressuretoSteamOutput == null)
21072111
{
21082112
float tempMaxBackPressurePSI = 0.0002762f * pS.TopH(TheoreticalMaxSteamOutputLBpS);
@@ -2937,6 +2941,7 @@ public override void Update(float elapsedClockSeconds)
29372941
CabSteamChestPressurePSI = 0;
29382942
CabSteamBoosterPressurePSI = 0;
29392943
SteamDrvWheelWeightLbs = 0;
2944+
LocomotiveBackPressurePSIG = 0;
29402945

29412946
for (int i = 0; i < SteamEngines.Count; i++)
29422947
{
@@ -3085,16 +3090,20 @@ public override void Update(float elapsedClockSeconds)
30853090
HuDBoosterSteamConsumptionLbpS = SteamEngines[i].CylinderSteamUsageLBpS;
30863091
SteamBoosterPressurePSI = (throttle * InitialPressureDropRatioRpMtoX[pS.TopM(SteamEngines[i].DriveWheelRevRpS)] * BoilerPressurePSI); // equivalent to steam chest pressure
30873092
}
3088-
3089-
30903093
}
3094+
3095+
// update the boiler steam values as appropriate for each locomotive engine
30913096
BoilerMassLB -= elapsedClockSeconds * SteamEngines[i].CylinderSteamUsageLBpS; // Boiler mass will be reduced by cylinder steam usage
30923097
BoilerHeatBTU -= elapsedClockSeconds * SteamEngines[i].CylinderSteamUsageLBpS * (BoilerSteamHeatBTUpLB - BoilerWaterHeatBTUpLB); // Boiler Heat will be reduced by heat required to replace the cylinder steam usage, ie create steam from hot water.
30933098
TotalSteamUsageLBpS += SteamEngines[i].CylinderSteamUsageLBpS;
30943099
BoilerHeatOutBTUpS += SteamEngines[i].CylinderSteamUsageLBpS * (BoilerSteamHeatBTUpLB - BoilerWaterHeatBTUpLB);
30953100
CumulativeCylinderSteamConsumptionLbs += SteamEngines[i].CylinderSteamUsageLBpS * elapsedClockSeconds;
30963101
CylinderSteamUsageLBpS += SteamEngines[i].CylinderSteamUsageLBpS;
30973102
CylCockSteamUsageLBpS += SteamEngines[i].CylCockSteamUsageLBpS;
3103+
// Back pressure in cylinder - this is an approximation using the back pressure from the blast pipe
3104+
SteamEngines[i].CylinderBackPressurePSIG = BackPressuretoSteamOutput[pS.TopH(SteamEngines[i].CylinderSteamUsageLBpS)];
3105+
// Sum back pressure for all engines to give total locomotive back pressure
3106+
LocomotiveBackPressurePSIG = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
30983107

30993108
if (SteamEngines[i].CylinderCocksPressureAtmPSI > CylinderCocksPressureAtmPSI)
31003109
{
@@ -5498,14 +5507,14 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
54985507
// (d) - Exhaust (Back) Pressure (For LP equates to point m)
54995508
// LP Cylinder
55005509
// Cylinder back pressure will be decreased depending upon locomotive speed
5501-
SteamEngines[numberofengine].LPPressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
5510+
SteamEngines[numberofengine].LPPressure_d_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
55025511

55035512
SteamEngines[numberofengine].LogLPBackPressurePSI = SteamEngines[numberofengine].LPPressure_d_AtmPSI - OneAtmospherePSI; // Value for recording in log file
55045513
SteamEngines[numberofengine].LogLPBackPressurePSI = MathHelper.Clamp(SteamEngines[numberofengine].LogLPBackPressurePSI, 0.00f, SteamEngines[numberofengine].LogLPBackPressurePSI); // Clamp so that LP Back pressure does not go negative
55055514

55065515
// HP Cylinder
55075516

5508-
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
5517+
SteamEngines[numberofengine].Pressure_d_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
55095518

55105519
SteamEngines[numberofengine].LogBackPressurePSI = SteamEngines[numberofengine].Pressure_d_AtmPSI - OneAtmospherePSI; // Value for log file
55115520
SteamEngines[numberofengine].LogBackPressurePSI = MathHelper.Clamp(SteamEngines[numberofengine].LogBackPressurePSI, 0.00f, SteamEngines[numberofengine].LogBackPressurePSI); // Clamp so that Back pressure does not go negative
@@ -5788,7 +5797,7 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
57885797

57895798
// (m) - LP exhaust pressure
57905799
// LP Cylinder back pressure will be increased depending upon locomotive speed
5791-
SteamEngines[numberofengine].LPCompPressure_m_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
5800+
SteamEngines[numberofengine].LPCompPressure_m_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
57925801

57935802
SteamEngines[numberofengine].LogLPBackPressurePSI = SteamEngines[numberofengine].LPCompPressure_m_AtmPSI - OneAtmospherePSI; // Value for recording in log file
57945803
SteamEngines[numberofengine].LogLPBackPressurePSI = MathHelper.Clamp(SteamEngines[numberofengine].LogLPBackPressurePSI, 0.00f, SteamEngines[numberofengine].LogLPBackPressurePSI); // Clamp so that LP Back pressure does not go negative
@@ -6115,7 +6124,7 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
61156124

61166125

61176126
// (d) - Back Pressure
6118-
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
6127+
SteamEngines[numberofengine].Pressure_d_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
61196128

61206129
if (throttle < 0.02f)
61216130
{
@@ -7656,9 +7665,12 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
76567665
}
76577666
else // Exhaust steam injector
76587667
{
7659-
if (throttle > 0.01 && BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)] > 1)
7668+
// Calculate back pressure if exhaust injector is on
7669+
var EstimatedCylinderBackPressurePSIG = (1 - BackPressureCorrectionFactor) * BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7670+
7671+
if (throttle > 0.01 && EstimatedCylinderBackPressurePSIG > 1)
76607672
{
7661-
Injector1CorrectedPressurePSI = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7673+
Injector1CorrectedPressurePSI = EstimatedCylinderBackPressurePSIG;
76627674
ActualInjector1FlowRateLBpS = Injector1Fraction * Injector1NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMaximaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector1CorrectedPressurePSI));
76637675
Inj1MinimaFlowRateLBpS = Injector1Fraction * Injector1NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMinimaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector1CorrectedPressurePSI));
76647676

@@ -7754,9 +7766,12 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
77547766
}
77557767
else // Exhaust steam injector
77567768
{
7757-
if (throttle > 0.01 && BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)] > 1)
7769+
// Calculate back pressure if exhaust injector is on
7770+
var EstimatedCylinderBackPressurePSIG = (1 - BackPressureCorrectionFactor) * BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7771+
7772+
if (throttle > 0.01 && EstimatedCylinderBackPressurePSIG > 1)
77587773
{
7759-
Injector2CorrectedPressurePSI = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7774+
Injector2CorrectedPressurePSI = EstimatedCylinderBackPressurePSIG;
77607775
ActualInjector2FlowRateLBpS = Injector2Fraction * Injector2NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMaximaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector2CorrectedPressurePSI));
77617776
Inj2MinimaFlowRateLBpS = Injector2Fraction * Injector2NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMinimaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector2CorrectedPressurePSI));
77627777

@@ -8221,7 +8236,7 @@ public override float GetDataOf(CabViewControl cvc)
82218236
data = ConvertFromPSI(cvc, BoilerPressurePSI);
82228237
break;
82238238
case CABViewControlTypes.BACK_PR:
8224-
data = ConvertFromPSI(cvc, -1 * BackPressuretoSteamOutput[CylinderSteamUsageLBpH]);
8239+
data = ConvertFromPSI(cvc, -1 * LocomotiveBackPressurePSIG);
82258240
break;
82268241
case CABViewControlTypes.STEAMCHEST_PR:
82278242
data = ConvertFromPSI(cvc, CabSteamChestPressurePSI);

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/SteamEngine.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,11 @@ public enum AuxiliarySteamEngineTypes
532532
/// </summary>
533533
public float CylCockSteamUsageLBpS;
534534

535+
/// <summary>
536+
/// Back pressure in cylinder
537+
/// </summary>
538+
public float CylinderBackPressurePSIG;
539+
535540
/// <summary>
536541
/// Cylinder steam cocks atmospheric pressure usage per steam engine steam cocks
537542
/// </summary>

0 commit comments

Comments
 (0)