Skip to content

Commit 2d20539

Browse files
committed
Temporary application to use the gradient water level
1 parent 56bb992 commit 2d20539

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ public float TenderFuelMassKG // Decreased by firing and increased
464464
float MSTSSteamGaugeGlassHeightM;
465465
float WaterGlassLengthM;
466466
float waterGlassFractionLevel; // Water glass level as a fraction
467+
float CurrentWaterGaugeFraction;
467468

468469
float MEPFactor = 0.7f; // Factor to determine the MEP
469470
float GrateAreaDesignFactor = 500.0f; // Design factor for determining Grate Area
@@ -7202,6 +7203,13 @@ private void UpdateWaterGauge()
72027203

72037204
GradientBoilerLevelFraction = MathHelper.Clamp(GradientBoilerLevelFraction, 0.0f, 1.0f);
72047205

7206+
CurrentWaterGaugeFraction = ((BoilerWaterFractionAbs - waterVariationLevelM / BoilerDiameterM) - WaterGlassMinLevel) / (WaterGlassMaxLevel - WaterGlassMinLevel); // Calculate water glass grade fraction
7207+
7208+
CurrentWaterGaugeFraction = MathHelper.Clamp(CurrentWaterGaugeFraction, 0.0f, 1.0f);
7209+
7210+
// Trace.TraceInformation("CurrentWaterGaugeFraction {0} BoilerWaterFract {1} waterVariation {2} GradientBoilerFraction {3}", CurrentWaterGaugeFraction, BoilerWaterFractionAbs, waterVariationLevelM, GradientBoilerLevelFraction);
7211+
7212+
72057213
if (BoilerWaterFractionAbs < WaterMinLevel) // Blow fusible plugs if absolute boiler water drops below minimum level
72067214
{
72077215
if (!FusiblePlugIsBlown)
@@ -7478,9 +7486,11 @@ private void UpdateFiring(float absSpeedMpS)
74787486
#region AI Fireman
74797487
{
74807488

7481-
var CurrentWaterGaugeFraction = waterGlassFractionLevel;
7489+
// CurrentWaterGaugeFraction = waterGlassFractionLevel;
7490+
7491+
// var CurrentWaterGaugeFraction = 1.0f - GradientBoilerLevelFraction;
74827492

7483-
// var CurrentWaterGaugeFraction = GradientBoilerLevelFraction;
7493+
// Trace.TraceInformation("CurrentWaterGaugeFraction {0} WaterGaugeFraction {1}", CurrentWaterGaugeFraction, waterGlassFractionLevel);
74847494

74857495
if (SteamLocomotiveFeedWaterType == SteamLocomotiveFeedWaterSystemTypes.MotionPump && !WaterIsExhausted)
74867496
{
@@ -7905,6 +7915,7 @@ public override string GetStatus()
79057915
status.AppendFormat("{0}{2} = {1:F0}% {3}{2}\n", Simulator.Catalog.GetString("Boiler water glass"), 100 * waterGlassFractionLevel, boilerWaterSafety, FiringIsManual ? Simulator.Catalog.GetString("(safe range)") : "");
79067916

79077917
status.AppendFormat("{0} = {1:F0}%\n", Simulator.Catalog.GetString("Boiler water grad"), GradientBoilerLevelFraction * 100);
7918+
status.AppendFormat("{0} = {1:F0}%\n", Simulator.Catalog.GetString("Boiler water trig"), CurrentWaterGaugeFraction * 100);
79087919

79097920
if (FiringIsManual)
79107921
{

0 commit comments

Comments
 (0)