Skip to content

Commit cfc749d

Browse files
committed
Automatic merge of T1.5.1-757-gef6c1a8c8 and 17 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at a055bca: Blueprint/train car operations UI window - Pull request #885 at c81447b: feat: Add notifications to Menu - Pull request #886 at 1b88d7a: Scene viewer extension to TrackViewer - Pull request #888 at b20b888: docs: Document player application model - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 5ff1e73: Correct Decrease Colour - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 0a9d939: feat: Improved system information collection - Pull request #898 at e271395: Extra line with all the arguments for debugging purposes in logfile - Pull request #899 at 28638b2: Duplex steam engines - Booster Engine addition - Pull request #900 at 42ea7ad: DMI updates
19 parents 9bc4b45 + ef6c1a8 + 3539862 + d00beb9 + f8dbeab + 43bf33e + f92de76 + a055bca + c81447b + 1b88d7a + b20b888 + 1f5ba4c + bf8876b + 5ff1e73 + 5866028 + 0a9d939 + e271395 + 28638b2 + 42ea7ad commit cfc749d

File tree

2 files changed

+68
-64
lines changed

2 files changed

+68
-64
lines changed

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

Lines changed: 63 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,12 +1319,6 @@ public override void Initialize()
13191319
{
13201320
if (SteamEngines[i].AuxiliarySteamEngineType != SteamEngine.AuxiliarySteamEngineTypes.Booster)
13211321
{
1322-
1323-
1324-
1325-
1326-
1327-
13281322
if (SteamEngineType == SteamEngineTypes.Compound)
13291323
{
13301324
// Initialise Compound locomotive
@@ -2171,10 +2165,11 @@ public override void Update(float elapsedClockSeconds)
21712165
UpdateFirebox(elapsedClockSeconds, absSpeedMpS);
21722166
UpdateBoiler(elapsedClockSeconds);
21732167
UpdateAuxiliaries(elapsedClockSeconds, absSpeedMpS);
2174-
2168+
UpdateSuperHeat();
21752169

21762170
TractiveForceN = 0; // reset tractiveforceN in preparation to calculating a new value
21772171
MotiveForceN = 0;
2172+
CylinderSteamUsageLBpS = 0;
21782173

21792174
for (int i = 0; i < SteamEngines.Count; i++)
21802175
{
@@ -2214,7 +2209,7 @@ public override void Update(float elapsedClockSeconds)
22142209
{
22152210
SteamBoosterIdleMode = false;
22162211
SteamBoosterRunMode = true;
2217-
enginethrottle = 1.0f;
2212+
enginethrottle = throttle;
22182213
}
22192214
else if (!SteamBoosterAirOpen || !SteamBoosterLatchedLocked)
22202215
{
@@ -2231,6 +2226,7 @@ public override void Update(float elapsedClockSeconds)
22312226
TotalSteamUsageLBpS += SteamEngines[i].CylinderSteamUsageLBpS;
22322227
BoilerHeatOutBTUpS += SteamEngines[i].CylinderSteamUsageLBpS * (BoilerSteamHeatBTUpLB - BoilerWaterHeatBTUpLB);
22332228
CumulativeCylinderSteamConsumptionLbs += SteamEngines[i].CylinderSteamUsageLBpS * elapsedClockSeconds;
2229+
CylinderSteamUsageLBpS += SteamEngines[i].CylinderSteamUsageLBpS;
22342230

22352231
SteamEngines[i].MeanEffectivePressurePSI = MeanEffectivePressurePSI;
22362232

@@ -3895,7 +3891,63 @@ private void ApplyBoilerPressure()
38953891
TotalSteamUsageLBpS = 0.0f;
38963892
}
38973893

3898-
private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cutoff, float absSpeedMpS, int numberofengine)
3894+
private void UpdateSuperHeat()
3895+
{
3896+
// Determine if Superheater in use
3897+
if (HasSuperheater)
3898+
{
3899+
CurrentSuperheatTempF = SuperheatTempLbpHtoDegF[pS.TopH(CylinderSteamUsageLBpS)] * SuperheatTempRatio; // Calculate current superheat temp
3900+
CurrentSuperheatTempF = MathHelper.Clamp(CurrentSuperheatTempF, 0.0f, MaxSuperheatRefTempF); // make sure that superheat temp does not exceed max superheat temp or drop below zero
3901+
float CylinderCondensationSpeedFactor = 1.0f - 0.00214f * pS.TopM(DrvWheelRevRpS); // This provides a speed related factor which reduces the amount of superheating required to overcome
3902+
// initial condensation, ie allows for condensation reduction as more steam goes through the cylinder as speed increases and the cylinder gets hotter
3903+
CylinderCondensationSpeedFactor = MathHelper.Clamp(CylinderCondensationSpeedFactor, 0.25f, 1.0f); // make sure that speed factor does not go out of bounds
3904+
float DifferenceSuperheatTeampF = CurrentSuperheatTempF - (SuperheatTempLimitXtoDegF[cutoff] * CylinderCondensationSpeedFactor); // reduce superheat temp due to cylinder condensation
3905+
SuperheatVolumeRatio = 1.0f + (0.0015f * DifferenceSuperheatTeampF); // Based on formula Vsup = Vsat ( 1 + 0.0015 Tsup) - Tsup temperature at superheated level
3906+
// look ahead to see what impact superheat will have on cylinder usage
3907+
float FutureCylinderSteamUsageLBpS = CylinderSteamUsageLBpS * 1.0f / SuperheatVolumeRatio; // Calculate potential future new cylinder steam usage
3908+
float FutureSuperheatTempF = SuperheatTempLbpHtoDegF[pS.TopH(FutureCylinderSteamUsageLBpS)] * SuperheatTempRatio; // Calculate potential future new superheat temp
3909+
3910+
float SuperheatTempThresholdXtoDegF = SuperheatTempLimitXtoDegF[cutoff] - 25.0f; // 10 deg bandwith reduction to reset superheat flag
3911+
3912+
if (CurrentSuperheatTempF > SuperheatTempLimitXtoDegF[cutoff] * CylinderCondensationSpeedFactor)
3913+
{
3914+
IsSuperSet = true; // Set to use superheat factor if above superheat temp threshold
3915+
}
3916+
else if (FutureSuperheatTempF < SuperheatTempThresholdXtoDegF * CylinderCondensationSpeedFactor)
3917+
{
3918+
IsSuperSet = false; // Reset if superheat temp drops
3919+
}
3920+
3921+
if (IsSuperSet)
3922+
{
3923+
SuperheaterSteamUsageFactor = 1.0f / SuperheatVolumeRatio; // set steam usage based upon the volume of superheated steam
3924+
}
3925+
else // Superheated locomotive, but superheat temp limit has not been reached.
3926+
{
3927+
CylinderCondensationFactor = CylinderCondensationFractionX[cutoff];
3928+
3929+
float CondensationFactorTemp = 1.0f + (CylinderCondensationFactor); // Calculate correcting factor for steam use due to compensation
3930+
float TempCondensationFactor = CondensationFactorTemp - 1.0f;
3931+
float SuperHeatMultiplier = (1.0f - (CurrentSuperheatTempF / SuperheatTempLimitXtoDegF[cutoff])) * TempCondensationFactor;
3932+
SuperHeatMultiplier = MathHelper.Clamp(SuperHeatMultiplier, 0.0f, SuperHeatMultiplier);
3933+
float SuperHeatFactorFinal = 1.0f + SuperHeatMultiplier;
3934+
SuperheaterSteamUsageFactor = SuperHeatFactorFinal;
3935+
SuperheaterSteamUsageFactor = MathHelper.Clamp(SuperheaterSteamUsageFactor, 0.0f, 1.0f); // In saturated mode steam usage should not be reduced
3936+
}
3937+
}
3938+
else // Saturated steam locomotive
3939+
{
3940+
CylinderCondensationFactor = CylinderCondensationFractionX[cutoff];
3941+
float CondensationFactorTemp = 1.0f + (CylinderCondensationFactor); // Calculate correcting factor for steam use due to compensation
3942+
SuperheaterSteamUsageFactor = CondensationFactorTemp;
3943+
// SuperheaterSteamUsageFactor = 1.0f; // Steam input to cylinder, but loses effectiveness. In saturated mode steam usage should not be reduced
3944+
}
3945+
3946+
SuperheaterSteamUsageFactor = MathHelper.Clamp(SuperheaterSteamUsageFactor, 0.60f, SuperheaterSteamUsageFactor); // ensure factor does not go below 0.6, as this represents base steam consumption by the cylinders.
3947+
3948+
}
3949+
3950+
private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cutoff, float absSpeedMpS, int numberofengine)
38993951
{
39003952
// Calculate speed of locomotive in wheel rpm - used to determine changes in performance based upon speed.
39013953
DrvWheelRevRpS = absSpeedMpS / (2.0f * MathHelper.Pi * SteamEngines[numberofengine].AttachedAxle.WheelRadiusM);
@@ -4678,7 +4730,6 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
46784730
CutoffPressureDropRatio = (1.0f - ((1 / SuperheatCutoffPressureFactor) * (float)Math.Sqrt(pS.TopM(DrvWheelRevRpS * MotiveForceGearRatio))));
46794731
}
46804732

4681-
46824733
// (b) - Cutoff Pressure
46834734
SteamEngines[numberofengine].Pressure_b_AtmPSI = SteamEngines[numberofengine].Pressure_a_AtmPSI * CutoffPressureDropRatio;
46844735

@@ -4818,58 +4869,6 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
48184869
}
48194870

48204871
#endregion
4821-
// Determine if Superheater in use
4822-
if (HasSuperheater)
4823-
{
4824-
CurrentSuperheatTempF = SuperheatTempLbpHtoDegF[pS.TopH(CylinderSteamUsageLBpS)] * SuperheatTempRatio; // Calculate current superheat temp
4825-
CurrentSuperheatTempF = MathHelper.Clamp(CurrentSuperheatTempF, 0.0f, MaxSuperheatRefTempF); // make sure that superheat temp does not exceed max superheat temp or drop below zero
4826-
float CylinderCondensationSpeedFactor = 1.0f - 0.00214f * pS.TopM(DrvWheelRevRpS); // This provides a speed related factor which reduces the amount of superheating required to overcome
4827-
// initial condensation, ie allows for condensation reduction as more steam goes through the cylinder as speed increases and the cylinder gets hotter
4828-
CylinderCondensationSpeedFactor = MathHelper.Clamp(CylinderCondensationSpeedFactor, 0.25f, 1.0f); // make sure that speed factor does not go out of bounds
4829-
float DifferenceSuperheatTeampF = CurrentSuperheatTempF - (SuperheatTempLimitXtoDegF[cutoff] * CylinderCondensationSpeedFactor); // reduce superheat temp due to cylinder condensation
4830-
SuperheatVolumeRatio = 1.0f + (0.0015f * DifferenceSuperheatTeampF); // Based on formula Vsup = Vsat ( 1 + 0.0015 Tsup) - Tsup temperature at superheated level
4831-
// look ahead to see what impact superheat will have on cylinder usage
4832-
float FutureCylinderSteamUsageLBpS = CylinderSteamUsageLBpS * 1.0f / SuperheatVolumeRatio; // Calculate potential future new cylinder steam usage
4833-
float FutureSuperheatTempF = SuperheatTempLbpHtoDegF[pS.TopH(FutureCylinderSteamUsageLBpS)] * SuperheatTempRatio; // Calculate potential future new superheat temp
4834-
4835-
float SuperheatTempThresholdXtoDegF = SuperheatTempLimitXtoDegF[cutoff] - 25.0f; // 10 deg bandwith reduction to reset superheat flag
4836-
4837-
if (CurrentSuperheatTempF > SuperheatTempLimitXtoDegF[cutoff] * CylinderCondensationSpeedFactor)
4838-
{
4839-
IsSuperSet = true; // Set to use superheat factor if above superheat temp threshold
4840-
}
4841-
else if (FutureSuperheatTempF < SuperheatTempThresholdXtoDegF * CylinderCondensationSpeedFactor)
4842-
{
4843-
IsSuperSet = false; // Reset if superheat temp drops
4844-
}
4845-
4846-
4847-
if (IsSuperSet)
4848-
{
4849-
SuperheaterSteamUsageFactor = 1.0f / SuperheatVolumeRatio; // set steam usage based upon the volume of superheated steam
4850-
}
4851-
else // Superheated locomotive, but superheat temp limit has not been reached.
4852-
{
4853-
CylinderCondensationFactor = CylinderCondensationFractionX[cutoff];
4854-
4855-
float CondensationFactorTemp = 1.0f + (CylinderCondensationFactor); // Calculate correcting factor for steam use due to compensation
4856-
float TempCondensationFactor = CondensationFactorTemp - 1.0f;
4857-
float SuperHeatMultiplier = (1.0f - (CurrentSuperheatTempF / SuperheatTempLimitXtoDegF[cutoff])) * TempCondensationFactor;
4858-
SuperHeatMultiplier = MathHelper.Clamp(SuperHeatMultiplier, 0.0f, SuperHeatMultiplier);
4859-
float SuperHeatFactorFinal = 1.0f + SuperHeatMultiplier;
4860-
SuperheaterSteamUsageFactor = SuperHeatFactorFinal;
4861-
SuperheaterSteamUsageFactor = MathHelper.Clamp(SuperheaterSteamUsageFactor, 0.0f, 1.0f); // In saturated mode steam usage should not be reduced
4862-
}
4863-
}
4864-
else // Saturated steam locomotive
4865-
{
4866-
CylinderCondensationFactor = CylinderCondensationFractionX[cutoff];
4867-
float CondensationFactorTemp = 1.0f + (CylinderCondensationFactor); // Calculate correcting factor for steam use due to compensation
4868-
SuperheaterSteamUsageFactor = CondensationFactorTemp;
4869-
// SuperheaterSteamUsageFactor = 1.0f; // Steam input to cylinder, but loses effectiveness. In saturated mode steam usage should not be reduced
4870-
}
4871-
4872-
SuperheaterSteamUsageFactor = MathHelper.Clamp(SuperheaterSteamUsageFactor, 0.60f, SuperheaterSteamUsageFactor); // ensure factor does not go below 0.6, as this represents base steam consumption by the cylinders.
48734872

48744873
// mean pressure during stroke = ((absolute mean pressure + (clearance + cylstroke)) - (initial pressure + clearance)) / cylstroke
48754874
// Mean effective pressure = cylinderpressure - backpressure
@@ -4881,11 +4880,11 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
48814880
{
48824881
if (HasSuperheater) // Superheated locomotive
48834882
{
4884-
CylCockPressReduceFactor = ((CylinderSteamUsageLBpS / SuperheaterSteamUsageFactor) / ((CylinderSteamUsageLBpS / SuperheaterSteamUsageFactor) + CylCockSteamUsageLBpS)); // For superheated locomotives temp convert back to a saturated comparison for calculation of steam cock reduction factor.
4883+
CylCockPressReduceFactor = ((SteamEngines[numberofengine].CylinderSteamUsageLBpS / SuperheaterSteamUsageFactor) / ((SteamEngines[numberofengine].CylinderSteamUsageLBpS / SuperheaterSteamUsageFactor) + SteamEngines[numberofengine].CylCockSteamUsageLBpS)); // For superheated locomotives temp convert back to a saturated comparison for calculation of steam cock reduction factor.
48854884
}
48864885
else // Simple locomotive
48874886
{
4888-
CylCockPressReduceFactor = (CylinderSteamUsageLBpS / (CylinderSteamUsageLBpS + CylCockSteamUsageLBpS)); // Saturated steam locomotive
4887+
CylCockPressReduceFactor = (SteamEngines[numberofengine].CylinderSteamUsageLBpS / (SteamEngines[numberofengine].CylinderSteamUsageLBpS + SteamEngines[numberofengine].CylCockSteamUsageLBpS)); // Saturated steam locomotive
48894888
}
48904889

48914890
if (SteamEngineType == SteamEngineTypes.Compound)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,11 @@ public enum AuxiliarySteamEngineTypes
535535
/// </summary>
536536
public float CylinderSteamUsageLBpS;
537537

538+
/// <summary>
539+
/// Steam usage per steam engine steam cocks
540+
/// </summary>
541+
public float CylCockSteamUsageLBpS;
542+
538543
/// <summary>
539544
/// Indicated Horse Power
540545
/// </summary>

0 commit comments

Comments
 (0)