Skip to content

Commit 93e8388

Browse files
authored
Merge pull request #1054 from peternewell/fix_cyl_cocks
Steam Cylinder Sound Bug
2 parents da4b28b + 68d578c commit 93e8388

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5813,9 +5813,6 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
58135813
// mean pressure during stroke = ((absolute mean pressure + (clearance + cylstroke)) - (initial pressure + clearance)) / cylstroke
58145814
// Mean effective pressure = cylinderpressure - backpressure
58155815

5816-
// Cylinder pressure also reduced by steam vented through cylinder cocks.
5817-
CylCockPressReduceFactor = 1.0f;
5818-
58195816
if (SteamEngines[numberofengine].AuxiliarySteamEngineType != SteamEngine.AuxiliarySteamEngineTypes.Booster)
58205817
{
58215818

@@ -5838,13 +5835,24 @@ private void UpdateCylinders(float elapsedClockSeconds, float throttle, float cu
58385835
SteamEngines[numberofengine].CylCockSteamUsageLBpS = 0;
58395836
}
58405837

5841-
if (HasSuperheater) // Superheated locomotive
5838+
// Cylinder pressure also reduced by steam vented through cylinder cocks.
5839+
5840+
if (throttle > 0.01 && absSpeedMpS > 0.1) // if regulator open and train stationary
58425841
{
5843-
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.
5842+
5843+
if (HasSuperheater) // Superheated locomotive
5844+
{
5845+
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.
5846+
}
5847+
else // Simple locomotive
5848+
{
5849+
CylCockPressReduceFactor = (SteamEngines[numberofengine].CylinderSteamUsageLBpS / (SteamEngines[numberofengine].CylinderSteamUsageLBpS + SteamEngines[numberofengine].CylCockSteamUsageLBpS)); // Saturated steam locomotive
5850+
}
58445851
}
5845-
else // Simple locomotive
5852+
else
5853+
// if regulator open and train stationary. No steam is used and exahusted by the cylinders (apart from through cock), hence ReduceFactor = 1
58465854
{
5847-
CylCockPressReduceFactor = (SteamEngines[numberofengine].CylinderSteamUsageLBpS / (SteamEngines[numberofengine].CylinderSteamUsageLBpS + SteamEngines[numberofengine].CylCockSteamUsageLBpS)); // Saturated steam locomotive
5855+
CylCockPressReduceFactor = 1.0f;
58485856
}
58495857

58505858
if (SteamEngineType == SteamEngineTypes.Compound)

0 commit comments

Comments
 (0)