Skip to content

Commit aa310b6

Browse files
committed
Automatic merge of T1.6-186-g21d9ada29 and 13 pull requests
- Pull request #1082 at b49a693: 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
15 parents c4c411d + 21d9ada + b49a693 + 85bde8e + a8127a1 + 378be55 + 73c47b4 + e241a0d + b6c197f + 2599bfe + 906f204 + d28315e + 4cd961b + 015769e + 41911f1 commit aa310b6

File tree

4 files changed

+47
-61
lines changed

4 files changed

+47
-61
lines changed

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public enum CABViewControlTypes
140140
WATER_INJECTOR1,
141141
WATER_INJECTOR2,
142142
SMALL_EJECTOR,
143+
BACK_PR,
143144
STEAM_PR,
144145
STEAMCHEST_PR,
145146
TENDER_WATER,

Source/Orts.Simulation/Common/SteamTable.cs

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,31 +1088,6 @@ public static Interpolator LiveSteamInjectorWaterFedForSteamUsedAtPressureInterp
10881088
1.0f, 1.0f, 1.0f, 0.988f, 0.965f, 0.912f, 0.859f, 0.800f, 0.753f, 0.706f, 0.659f, 0.612f, 0.571f, 0.535f, 0.500f, 0.471f, 0.447f, 0.433f, 0.424f, 0.420f, 0.410f, 0.410f
10891089
};
10901090

1091-
// Indicated HorsePower -
1092-
static float[] IndicatedHorsepowerIHP = new float[]
1093-
{
1094-
0.0f, 200.0f, 500.0f, 1000.0f, 1250.0f, 1500.0f, 1750.0f, 2000.0f, 2500.0f, 3000.0f,
1095-
3500.0f, 4000.0f, 4500.0f, 5000.0f, 5500.0f, 6000.0f, 6500.0f, 7000.0f, 7500.0f
1096-
};
1097-
1098-
// BackPressure - Saturated locomotive - Ref Principles of Locomotive Operation and Train Operation - Fig 73 - pg 178 - Assume atmospheric -
1099-
// extrapolated beyond 1800IHP with test results from PRR Test reports
1100-
//
1101-
static float[] BackPressureSatPSI = new float[]
1102-
{
1103-
1.0f, 1.5f, 2.0f, 3.0f, 3.75f, 4.5f, 5.6f, 7.0f, 10.0f, 12.8f,
1104-
15.5f, 18.5f, 22.0f, 26.0f, 30.0f, 35.0f, 40.0f, 45.0f, 50.0f
1105-
};
1106-
1107-
// BackPressure - Superheated locomotive - Ref Principles of Locomotive Operation and Train Operation - Fig 73 - pg 178 - Assume atmospheric
1108-
// extrapolated beyond 1800IHP with test results from PRR Test reports
1109-
//
1110-
static float[] BackPressureSuperPSI = new float[]
1111-
{
1112-
0.0f, 0.25f, 0.5f, 1.0f, 1.5f, 2.0f,2.5f, 2.8f, 3.5f,4.5f,
1113-
6.0f, 7.5f, 10.0f, 14.0f, 18.0f, 25.0f, 30.0f , 35.0f, 40.0f
1114-
};
1115-
11161091
// Indicator Diagram - Cylinder Events
11171092

11181093
// Indicator Diagram Event - Exhaust Open - Perwall program - http://5at.co.uk/index.php/references-and-links/software.html
@@ -1145,19 +1120,6 @@ public static Interpolator SuperheatTempLimitInterpolatorXtoDegF()
11451120
return new Interpolator(CutOffFractionTableX, SuperheatCondenstationLimitTableDegF);
11461121
}
11471122

1148-
// Saturated Backpressure - Ref Principles of Locomotive Operation
1149-
public static Interpolator BackpressureSatIHPtoPSI()
1150-
{
1151-
return new Interpolator(IndicatedHorsepowerIHP, BackPressureSatPSI);
1152-
}
1153-
1154-
// Superheated Backpressure - Ref Principles of Locomotive Operation
1155-
public static Interpolator BackpressureSuperIHPtoPSI()
1156-
{
1157-
return new Interpolator(IndicatedHorsepowerIHP, BackPressureSuperPSI);
1158-
}
1159-
1160-
11611123
// Saturated Speed factor - ie drop in TE as speed increases due to piston impacts - Ref American locomotive Company
11621124
public static Interpolator SaturatedSpeedFactorSpeedDropFtpMintoX()
11631125
{

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

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ public class MSTSSteamLocomotive : MSTSLocomotive
294294
float FuelFeedRateKGpS;
295295
float DesiredChange; // Amount of change to increase fire mass, clamped to range 0.0 - 1.0
296296
public float CylinderSteamUsageLBpS;
297+
public float CylinderSteamUsageLBpH;
297298
public float NewCylinderSteamUsageLBpS;
298299
public float BlowerSteamUsageLBpS;
299300
public float FuelOilHeatingSteamUsageLbpS;
@@ -405,7 +406,8 @@ public class MSTSSteamLocomotive : MSTSLocomotive
405406
float LPCylinderSweptVolumeFT3pFT; // Volume of LP steam Cylinder
406407
float CylinderCondensationFactor; // Cylinder compensation factor for condensation in cylinder due to cutoff
407408
float BlowerSteamUsageFactor;
408-
Interpolator BackPressureIHPtoPSI; // back pressure in cylinders given usage
409+
Interpolator BackPressureIHPtoPSI; // back pressure in cylinders given usage - this value needs to be deprerecated
410+
Interpolator BackPressuretoSteamOutput; // back pressure in cylinders given steam usage
409411
Interpolator CylinderSteamDensityPSItoLBpFT3; // steam density in cylinders given pressure (could be super heated)
410412
Interpolator WaterDensityPSItoLBpFT3; // water density given pressure
411413
Interpolator WaterHeatPSItoBTUpLB; // total heat in water given pressure
@@ -1018,6 +1020,7 @@ public override void Parse(string lowercasetoken, STFReader stf)
10181020
case "engine(ortscylinderefficiencyrate": CylinderEfficiencyRate = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
10191021
case "engine(ortscylinderinitialpressuredrop": InitialPressureDropRatioRpMtoX = new Interpolator(stf); break;
10201022
case "engine(ortscylinderbackpressure": BackPressureIHPtoPSI = new Interpolator(stf); break;
1023+
case "engine(ortscylinderbackpressurevssteamoutput": BackPressuretoSteamOutput = new Interpolator(stf); break;
10211024
case "engine(ortsburnrate": NewBurnRateSteamToFuelLbspH = new Interpolator(stf); break;
10221025
case "engine(ortsboilerefficiency": BoilerEfficiencyGrateAreaLBpFT2toX = new Interpolator(stf); break;
10231026
case "engine(ortscylindereventexhaust": CylinderExhausttoCutoff = new Interpolator(stf); break;
@@ -1190,6 +1193,7 @@ public override void Copy(MSTSWagon copy)
11901193
CylinderEfficiencyRate = locoCopy.CylinderEfficiencyRate;
11911194
InitialPressureDropRatioRpMtoX = new Interpolator(locoCopy.InitialPressureDropRatioRpMtoX);
11921195
BackPressureIHPtoPSI = new Interpolator(locoCopy.BackPressureIHPtoPSI);
1196+
BackPressuretoSteamOutput = new Interpolator(locoCopy.BackPressuretoSteamOutput);
11931197
NewBurnRateSteamToFuelLbspH = new Interpolator(locoCopy.NewBurnRateSteamToFuelLbspH);
11941198
BoilerEfficiency = locoCopy.BoilerEfficiency;
11951199
SteamGearRatioLow = locoCopy.SteamGearRatioLow;
@@ -2101,22 +2105,31 @@ public override void Initialize()
21012105
// Assign default steam table values if table not in ENG file
21022106
// Back pressure increases with the speed of the locomotive, as cylinder finds it harder to exhaust all the steam.
21032107

2104-
if (BackPressureIHPtoPSI == null)
2108+
if (BackPressureIHPtoPSI != null)
21052109
{
2106-
if (HasSuperheater)
2107-
{
2108-
BackPressureIHPtoPSI = SteamTable.BackpressureSuperIHPtoPSI();
2109-
if (Simulator.Settings.VerboseConfigurationMessages)
2110-
Trace.TraceInformation("BackPressureIHPtoAtmPSI (Superheated) - default information read from SteamTables");
2111-
}
2112-
else
2113-
{
2114-
BackPressureIHPtoPSI = SteamTable.BackpressureSatIHPtoPSI();
2115-
if (Simulator.Settings.VerboseConfigurationMessages)
2116-
Trace.TraceInformation("BackPressureIHPtoAtmPSI (Saturated) - default information read from SteamTables");
2117-
}
2110+
if (Simulator.Settings.VerboseConfigurationMessages)
2111+
Trace.TraceInformation("ORTSCylinderBackPressure read. This is an inaccurate and depreceated value. It is thereofre suggested that either the OR default value is used (leave the ORTSCylinderBackPressure out) or use ORTSCylinderBackPressureVsSteamoutput instead.");
21182112
}
21192113

2114+
// if no user input provided then assign default values
2115+
if (BackPressuretoSteamOutput == null)
2116+
{
2117+
float tempMaxBackPressurePSI = 0.0002762f * pS.TopH(TheoreticalMaxSteamOutputLBpS);
2118+
2119+
// Create a new default back pressure table based upon default information
2120+
float[] TempSteamOutputRate = new float[]
2121+
{
2122+
0.0f, pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.1f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.2f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.3f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.4f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.5f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.6f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.7f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.8f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 0.9f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 1.0f), pS.TopH(TheoreticalMaxSteamOutputLBpS * 1.1f)
2123+
};
2124+
2125+
float[] TempBackPressure = new float[]
2126+
{
2127+
0.0f, tempMaxBackPressurePSI* (float)Math.Pow(0.1f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.2f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.3f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.4f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.5f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.6f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.7f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.8f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(0.9f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(1.0f, 2.0f), tempMaxBackPressurePSI* (float)Math.Pow(1.1f, 2.0f)
2128+
};
2129+
2130+
BackPressuretoSteamOutput = new Interpolator(TempSteamOutputRate, TempBackPressure);
2131+
}
2132+
21202133
// Confirm Injector type
21212134
if (Injector1Type == "Unknown" )
21222135
{
@@ -2199,7 +2212,7 @@ public override void Initialize()
21992212
}
22002213

22012214
var RefFeedwaterTempF = 65.0f;
2202-
var maxExhaustPressure = BackPressureIHPtoPSI[maxIndicatedHorsePowerTemp];
2215+
var maxExhaustPressure = BackPressuretoSteamOutput[pS.TopH(TheoreticalMaxSteamOutputLBpS)];
22032216

22042217
if (ActualInjector1NozzleSizeMM == 0)
22052218
{
@@ -3073,6 +3086,7 @@ public override void Update(float elapsedClockSeconds)
30733086
// Steam Flow (lb/hr) = 24.24 x Press(BoilerPressure + Atmosphere(psi)) x ChokeDia^2 (in) - this needs to be multiplied by Num Cyls
30743087
SteamBoosterPressurePSI = (BoilerPressurePSI + OneAtmospherePSI) * BoosterPressureFactor;
30753088
SteamEngines[i].CylinderSteamUsageLBpS = pS.FrompH(SteamEngines[i].NumberCylinders * (24.24f * (SteamBoosterPressurePSI) * BoosterIdleChokeSizeIn * BoosterIdleChokeSizeIn));
3089+
SteamEngines[i].CylinderSteamUsageLBpH = pS.TopH(SteamEngines[i].CylinderSteamUsageLBpS);
30763090
HuDBoosterSteamConsumptionLbpS = SteamEngines[i].CylinderSteamUsageLBpS;
30773091

30783092
}
@@ -5439,14 +5453,14 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
54395453
// (d) - Exhaust (Back) Pressure (For LP equates to point m)
54405454
// LP Cylinder
54415455
// Cylinder back pressure will be decreased depending upon locomotive speed
5442-
SteamEngines[numberofengine].LPPressure_d_AtmPSI = BackPressureIHPtoPSI[SteamEngines[numberofengine].IndicatedHorsePowerHP] + OneAtmospherePSI;
5456+
SteamEngines[numberofengine].LPPressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
54435457

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

54475461
// HP Cylinder
54485462

5449-
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressureIHPtoPSI[SteamEngines[numberofengine].IndicatedHorsePowerHP] + OneAtmospherePSI;
5463+
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
54505464

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

57305744
// (m) - LP exhaust pressure
57315745
// LP Cylinder back pressure will be increased depending upon locomotive speed
5732-
SteamEngines[numberofengine].LPCompPressure_m_AtmPSI = BackPressureIHPtoPSI[SteamEngines[numberofengine].IndicatedHorsePowerHP] + OneAtmospherePSI;
5746+
SteamEngines[numberofengine].LPCompPressure_m_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
57335747

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

60576071

60586072
// (d) - Back Pressure
6059-
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressureIHPtoPSI[SteamEngines[numberofengine].IndicatedHorsePowerHP] + OneAtmospherePSI;
6073+
SteamEngines[numberofengine].Pressure_d_AtmPSI = BackPressuretoSteamOutput[SteamEngines[numberofengine].CylinderSteamUsageLBpH] + OneAtmospherePSI;
60606074

60616075
if (throttle < 0.02f)
60626076
{
@@ -6376,6 +6390,7 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
63766390
// usage calculated as moving average to minimize chance of oscillation.
63776391
// Decrease steam usage by SuperheaterUsage factor to model superheater - very crude model - to be improved upon
63786392
SteamEngines[numberofengine].CylinderSteamUsageLBpS = (0.6f * SteamEngines[numberofengine].CylinderSteamUsageLBpS + 0.4f * CalculatedCylinderSteamUsageLBpS);
6393+
SteamEngines[numberofengine].CylinderSteamUsageLBpH = pS.TopH(SteamEngines[numberofengine].CylinderSteamUsageLBpS);
63796394
MeanEffectivePressurePSI = SteamEngines[numberofengine].MeanEffectivePressurePSI; // for display purposes
63806395

63816396
SteamReleasePressure_AtmPSI = SteamEngines[numberofengine].Pressure_c_AtmPSI; // for steam and smoke effects
@@ -7537,9 +7552,9 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
75377552
}
75387553
else // Exhaust steam injector
75397554
{
7540-
if (throttle > 0.01 && BackPressureIHPtoPSI[IndicatedHorsePowerHP] > 1)
7555+
if (throttle > 0.01 && BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)] > 1)
75417556
{
7542-
Injector1CorrectedPressurePSI = BackPressureIHPtoPSI[IndicatedHorsePowerHP];
7557+
Injector1CorrectedPressurePSI = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
75437558
ActualInjector1FlowRateLBpS = Injector1Fraction * Injector1NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMaximaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector1CorrectedPressurePSI));
75447559
Inj1MinimaFlowRateLBpS = Injector1Fraction * Injector1NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMinimaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector1CorrectedPressurePSI));
75457560

@@ -7635,9 +7650,9 @@ private void UpdateWaterInjection(float elapsedClockSeconds)
76357650
}
76367651
else // Exhaust steam injector
76377652
{
7638-
if (throttle > 0.01 && BackPressureIHPtoPSI[IndicatedHorsePowerHP] > 1)
7653+
if (throttle > 0.01 && BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)] > 1)
76397654
{
7640-
Injector2CorrectedPressurePSI = BackPressureIHPtoPSI[IndicatedHorsePowerHP];
7655+
Injector2CorrectedPressurePSI = BackPressuretoSteamOutput[pS.TopH(CylinderSteamUsageLBpS)];
76417656
ActualInjector2FlowRateLBpS = Injector2Fraction * Injector2NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMaximaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector2CorrectedPressurePSI));
76427657
Inj2MinimaFlowRateLBpS = Injector2Fraction * Injector2NozzleCorrectionFactor * pS.FrompH(ExhaustSteamInjectorMinimaWaterDeliveryLBatPSIandF.Get(tenderTemperatureF, Injector2CorrectedPressurePSI));
76437658

@@ -8101,6 +8116,9 @@ public override float GetDataOf(CabViewControl cvc)
81018116
case CABViewControlTypes.STEAM_PR:
81028117
data = ConvertFromPSI(cvc, BoilerPressurePSI);
81038118
break;
8119+
case CABViewControlTypes.BACK_PR:
8120+
data = ConvertFromPSI(cvc, -1 * BackPressuretoSteamOutput[CylinderSteamUsageLBpH]);
8121+
break;
81048122
case CABViewControlTypes.STEAMCHEST_PR:
81058123
data = ConvertFromPSI(cvc, CabSteamChestPressurePSI);
81068124
break;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,11 @@ public enum AuxiliarySteamEngineTypes
522522
/// </summary>
523523
public float CylinderSteamUsageLBpS;
524524

525+
/// <summary>
526+
/// Steam usage per steam engine per hour
527+
/// </summary>
528+
public float CylinderSteamUsageLBpH;
529+
525530
/// <summary>
526531
/// Steam usage per steam engine steam cocks
527532
/// </summary>

0 commit comments

Comments
 (0)