Skip to content

Commit c038b29

Browse files
committed
Automatic merge of T1.6-186-g21d9ada29 and 14 pull requests
- Pull request #1082 at daa2c74: Allow variable water level in glass gauge - Pull request #1057 at 85bde8e: Switchable brake system - Pull request #1081 at a8127a1: Brake cuts power unification - Pull request #1091 at 378be55: Automatic speed control - Pull request #1122 at 73c47b4: Wagon Size and Centering Controls - Pull request #1124 at e241a0d: Built-in PBL2 brake controller - Pull request #1128 at b6c197f: Particle Emitter Overhaul - Pull request #1158 at 2599bfe: Temporary fix for bug 2121985: F9 TCO out-of-range after resume - Pull request #1169 at 906f204: Revise TrainCar.SetUpWheels to Better Handle Unusual Rolling Stock - Pull request #1175 at d28315e: Make Data Logger interval configurable - Pull request #1176 at 4cd961b: Remove Implicit Requirement for Engine Name to Come After "Engine (" - Pull request #1178 at 015769e: Fix Diesel RPM Rate of Change - Pull request #1183 at 41911f1: docs: Add code guidelines for translations - Pull request #1184 at f5c7a50: Fix/avoid type initialization exception - 2nd try
16 parents f53679a + 21d9ada + daa2c74 + 85bde8e + a8127a1 + 378be55 + 73c47b4 + e241a0d + b6c197f + 2599bfe + 906f204 + d28315e + 4cd961b + 015769e + 41911f1 + f5c7a50 commit c038b29

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
@@ -580,6 +580,9 @@ public float TenderFuelMassKG // Decreased by firing and increased
580580
public float LogReleasePressurePSI;
581581
public float LogSteamChestPressurePSI;
582582

583+
float BackPressureCorrectionFactor = 0.15f; // Factor to adjust back pressure for steam usage by exhaust injectors
584+
float LocomotiveBackPressurePSIG; // Back pressure in locomotive including effect of cylinders and blast pipe
585+
583586
// Values for Steam Cylinder events
584587
// Commented out as never used
585588
//float ValveTravel = 10.8268f;
@@ -2112,6 +2115,7 @@ public override void Initialize()
21122115
}
21132116

21142117
// if no user input provided then assign default values
2118+
// the default is the "full locomotive" back pressure, it will be decreased further down if an exhaust injector is fitted
21152119
if (BackPressuretoSteamOutput == null)
21162120
{
21172121
float tempMaxBackPressurePSI = 0.0002762f * pS.TopH(TheoreticalMaxSteamOutputLBpS);
@@ -2946,6 +2950,7 @@ public override void Update(float elapsedClockSeconds)
29462950
CabSteamChestPressurePSI = 0;
29472951
CabSteamBoosterPressurePSI = 0;
29482952
SteamDrvWheelWeightLbs = 0;
2953+
LocomotiveBackPressurePSIG = 0;
29492954

29502955
for (int i = 0; i < SteamEngines.Count; i++)
29512956
{
@@ -3096,16 +3101,20 @@ public override void Update(float elapsedClockSeconds)
30963101
HuDBoosterSteamConsumptionLbpS = SteamEngines[i].CylinderSteamUsageLBpS;
30973102
SteamBoosterPressurePSI = (throttle * InitialPressureDropRatioRpMtoX[pS.TopM(SteamEngines[i].DriveWheelRevRpS)] * BoilerPressurePSI); // equivalent to steam chest pressure
30983103
}
3099-
3100-
31013104
}
3105+
3106+
// update the boiler steam values as appropriate for each locomotive engine
31023107
BoilerMassLB -= elapsedClockSeconds * SteamEngines[i].CylinderSteamUsageLBpS; // Boiler mass will be reduced by cylinder steam usage
31033108
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.
31043109
TotalSteamUsageLBpS += SteamEngines[i].CylinderSteamUsageLBpS;
31053110
BoilerHeatOutBTUpS += SteamEngines[i].CylinderSteamUsageLBpS * (BoilerSteamHeatBTUpLB - BoilerWaterHeatBTUpLB);
31063111
CumulativeCylinderSteamConsumptionLbs += SteamEngines[i].CylinderSteamUsageLBpS * elapsedClockSeconds;
31073112
CylinderSteamUsageLBpS += SteamEngines[i].CylinderSteamUsageLBpS;
31083113
CylCockSteamUsageLBpS += SteamEngines[i].CylCockSteamUsageLBpS;
3114+
// Back pressure in cylinder - this is an approximation using the back pressure from the blast pipe
3115+
SteamEngines[i].CylinderBackPressurePSIG = BackPressuretoSteamOutput[pS.TopH(SteamEngines[i].CylinderSteamUsageLBpS)];
3116+
// Sum back pressure for all engines to give total locomotive back pressure
3117+
LocomotiveBackPressurePSIG = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
31093118

31103119
if (SteamEngines[i].CylinderCocksPressureAtmPSI > CylinderCocksPressureAtmPSI)
31113120
{
@@ -5453,14 +5462,14 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
54535462
// (d) - Exhaust (Back) Pressure (For LP equates to point m)
54545463
// LP Cylinder
54555464
// Cylinder back pressure will be decreased depending upon locomotive speed
5456-
SteamEngines[numberofengine].LPPressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
5465+
SteamEngines[numberofengine].LPPressure_d_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
54575466

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

54615470
// HP Cylinder
54625471

5463-
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
5472+
SteamEngines[numberofengine].Pressure_d_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
54645473

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

57445753
// (m) - LP exhaust pressure
57455754
// LP Cylinder back pressure will be increased depending upon locomotive speed
5746-
SteamEngines[numberofengine].LPCompPressure_m_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
5755+
SteamEngines[numberofengine].LPCompPressure_m_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
57475756

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

60716080

60726081
// (d) - Back Pressure
6073-
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
6082+
SteamEngines[numberofengine].Pressure_d_AtmPSI = SteamEngines[numberofengine].CylinderBackPressurePSIG + OneAtmospherePSI;
60746083

60756084
if (throttle < 0.02f)
60766085
{
@@ -7552,9 +7561,12 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
75527561
}
75537562
else // Exhaust steam injector
75547563
{
7555-
if (throttle > 0.01 && BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)] > 1)
7564+
// Calculate back pressure if exhaust injector is on
7565+
var EstimatedCylinderBackPressurePSIG = (1 - BackPressureCorrectionFactor) * BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7566+
7567+
if (throttle > 0.01 && EstimatedCylinderBackPressurePSIG > 1)
75567568
{
7557-
Injector1CorrectedPressurePSI = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7569+
Injector1CorrectedPressurePSI = EstimatedCylinderBackPressurePSIG;
75587570
ActualInjector1FlowRateLBpS = Injector1Fraction * Injector1NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMaximaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector1CorrectedPressurePSI));
75597571
Inj1MinimaFlowRateLBpS = Injector1Fraction * Injector1NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMinimaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector1CorrectedPressurePSI));
75607572

@@ -7650,9 +7662,12 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
76507662
}
76517663
else // Exhaust steam injector
76527664
{
7653-
if (throttle > 0.01 && BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)] > 1)
7665+
// Calculate back pressure if exhaust injector is on
7666+
var EstimatedCylinderBackPressurePSIG = (1 - BackPressureCorrectionFactor) * BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7667+
7668+
if (throttle > 0.01 && EstimatedCylinderBackPressurePSIG > 1)
76547669
{
7655-
Injector2CorrectedPressurePSI = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
7670+
Injector2CorrectedPressurePSI = EstimatedCylinderBackPressurePSIG;
76567671
ActualInjector2FlowRateLBpS = Injector2Fraction * Injector2NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMaximaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector2CorrectedPressurePSI));
76577672
Inj2MinimaFlowRateLBpS = Injector2Fraction * Injector2NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMinimaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector2CorrectedPressurePSI));
76587673

@@ -8117,7 +8132,7 @@ public override float GetDataOf(CabViewControl cvc)
81178132
data = ConvertFromPSI(cvc, BoilerPressurePSI);
81188133
break;
81198134
case CABViewControlTypes.BACK_PR:
8120-
data = ConvertFromPSI(cvc, -1 * BackPressuretoSteamOutput[CylinderSteamUsageLBpH]);
8135+
data = ConvertFromPSI(cvc, -1 * LocomotiveBackPressurePSIG);
81218136
break;
81228137
case CABViewControlTypes.STEAMCHEST_PR:
81238138
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)