Skip to content

Commit 625c917

Browse files
committed
Adjust water level change on gradient
1 parent d3722cd commit 625c917

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,6 @@ public override void Initialize()
14881488
Trace.TraceWarning("Boiler Volume not found in ENG file, or doesn't appear to be a valid figure, and has been set to {0} Ft^3", BoilerVolumeFT3);
14891489
}
14901490

1491-
14921491
// Set up boiler water defaults
14931492

14941493
// Water Gauge Length - always use OR entered value as first preference
@@ -7171,13 +7170,12 @@ private void UpdateWaterGauge()
71717170
WaterGlassLevelIN = waterGlassFractionLevel * Me.ToIn(WaterGlassLengthM);
71727171
WaterGlassLevelIN = MathHelper.Clamp(WaterGlassLevelIN, 0, Me.ToIn(WaterGlassLengthM));
71737172

7174-
71757173
// Calculate water glass level when on gradient
71767174

71777175
var boilerangleRad = Math.Atan(CurrentElevationPercent / 100);
71787176

7179-
// water variation is calculated as the side of a triangle with half the boiler length as the hypotenuse
7180-
var waterVariationLevelM = (float)Math.Sin(boilerangleRad) * BoilerLengthM / 2.0f;
7177+
// water variation is calculated as the opposite side of a triangle with half the boiler length as the reference length (Adjacent side)
7178+
var waterVariationLevelM = (float)Math.Tan(boilerangleRad) * (BoilerLengthM / 2.0f);
71817179

71827180
float glassLevelGradientM = 0;
71837181

0 commit comments

Comments
 (0)