From 2985bc159480263a3469d4deb0beb2c7434056c3 Mon Sep 17 00:00:00 2001 From: peternewell Date: Mon, 1 Jan 2024 17:10:00 +1100 Subject: [PATCH] Add steam booster pressure cab control --- Source/Orts.Formats.Msts/CabViewFile.cs | 1 + .../RollingStocks/MSTSSteamLocomotive.cs | 16 ++++++++++++++-- .../Simulation/RollingStocks/MSTSWagon.cs | 7 ++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Source/Orts.Formats.Msts/CabViewFile.cs b/Source/Orts.Formats.Msts/CabViewFile.cs index 6e11e3cd0a..a416c66354 100644 --- a/Source/Orts.Formats.Msts/CabViewFile.cs +++ b/Source/Orts.Formats.Msts/CabViewFile.cs @@ -133,6 +133,7 @@ public enum CABViewControlTypes STEAM_BOOSTER_AIR, STEAM_BOOSTER_IDLE, STEAM_BOOSTER_LATCH, + STEAM_BOOSTER_PRESSURE, WATER_INJECTOR1, WATER_INJECTOR2, SMALL_EJECTOR, diff --git a/Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs b/Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs index d6ac4469be..b5b02ef559 100644 --- a/Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs +++ b/Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs @@ -134,6 +134,7 @@ public class MSTSSteamLocomotive : MSTSLocomotive public bool SteamBoosterIdleMode = false; public bool BoosterGearsEngaged = false; public bool SteamBoosterLatchedLocked = false; + public float SteamBoosterPressurePSI; float BoosterGearEngageTimeS; float BoosterIdleHeatingTimerS; float BoosterIdleHeatingTimePeriodS = 120; // This is the time period that the Booster needs to be idled to heat it up @@ -143,6 +144,8 @@ public class MSTSSteamLocomotive : MSTSLocomotive public float HuDBoosterSteamConsumptionLbpS; public float BoosterSteamConsumptionLbpS; float BoosterIdleChokeSizeIn; + float BoosterPressureFactor = 0; + float BoosterMaxIdleChokeSizeIn = 0.625f; /// /// Grate limit of locomotive exceedeed? @@ -1317,22 +1320,27 @@ public override void Initialize() if (MaxBoilerPressurePSI > 300) { BoosterIdleChokeSizeIn = 0.375f; + BoosterPressureFactor = BoosterIdleChokeSizeIn / BoosterMaxIdleChokeSizeIn; } else if (MaxBoilerPressurePSI > 275 && MaxBoilerPressurePSI <= 300) { BoosterIdleChokeSizeIn = 0.4375f; + BoosterPressureFactor = BoosterIdleChokeSizeIn / BoosterMaxIdleChokeSizeIn; } else if (MaxBoilerPressurePSI > 250 && MaxBoilerPressurePSI <= 275) { BoosterIdleChokeSizeIn = 0.5f; + BoosterPressureFactor = BoosterIdleChokeSizeIn / BoosterMaxIdleChokeSizeIn; } else if (MaxBoilerPressurePSI > 200 && MaxBoilerPressurePSI <= 250) { BoosterIdleChokeSizeIn = 0.5625f; + BoosterPressureFactor = BoosterIdleChokeSizeIn / BoosterMaxIdleChokeSizeIn; } else { BoosterIdleChokeSizeIn = 0.625f; + BoosterPressureFactor = BoosterIdleChokeSizeIn / BoosterMaxIdleChokeSizeIn; } // Set crank angle between different sides of the locomotive @@ -2343,8 +2351,8 @@ public override void Update(float elapsedClockSeconds) { // In Idle mode steam consumption will be calculated by steam through an orifice. // Steam Flow (lb/hr) = 24.24 x Press(BoilerPressure + Atmosphere(psi)) x ChokeDia^2 (in) - this needs to be multiplied by Num Cyls - var BoosterPressurePSI = BoilerPressurePSI + OneAtmospherePSI; - SteamEngines[i].CylinderSteamUsageLBpS = pS.FrompH(SteamEngines[i].NumberCylinders * (24.24f * (BoosterPressurePSI) * BoosterIdleChokeSizeIn * BoosterIdleChokeSizeIn)); + SteamBoosterPressurePSI = (BoilerPressurePSI + OneAtmospherePSI) * BoosterPressureFactor; + SteamEngines[i].CylinderSteamUsageLBpS = pS.FrompH(SteamEngines[i].NumberCylinders * (24.24f * (SteamBoosterPressurePSI) * BoosterIdleChokeSizeIn * BoosterIdleChokeSizeIn)); HuDBoosterSteamConsumptionLbpS = SteamEngines[i].CylinderSteamUsageLBpS; } @@ -2352,6 +2360,7 @@ public override void Update(float elapsedClockSeconds) { // In run mode steam consumption calculated by cylinder model HuDBoosterSteamConsumptionLbpS = SteamEngines[i].CylinderSteamUsageLBpS; + SteamBoosterPressurePSI = (throttle * InitialPressureDropRatioRpMtoX[pS.TopM(DrvWheelRevRpS)] * BoilerPressurePSI); // equivalent to steam chest pressure } @@ -6671,6 +6680,9 @@ public override float GetDataOf(CabViewControl cvc) case CABViewControlTypes.STEAMHEAT_PRESSURE: data = ConvertFromPSI(cvc, CurrentSteamHeatPressurePSI); break; + case CABViewControlTypes.STEAM_BOOSTER_PRESSURE: + data = ConvertFromPSI(cvc, SteamChestPressurePSI); + break; case CABViewControlTypes.CUTOFF: case CABViewControlTypes.REVERSER_PLATE: data = Train.MUReverserPercent / 100f; diff --git a/Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs b/Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs index e8dd7ff6d4..f5e89f2aa5 100644 --- a/Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs +++ b/Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs @@ -523,6 +523,11 @@ public virtual void LoadFromWagFile(string wagFilePath) if (MSTSWagonNumWheels == 0 && InitWagonNumAxles == 0 ) { DerailmentCoefficientEnabled = false; + + if (Simulator.Settings.VerboseConfigurationMessages) + { + Trace.TraceInformation("Derailment Coefficient set to false for Wagon {0}", WagFilePath); + } } // Ensure Drive Axles is set to a default if no OR value added to WAG file @@ -539,7 +544,7 @@ public virtual void LoadFromWagFile(string wagFilePath) if (Simulator.Settings.VerboseConfigurationMessages) { - Trace.TraceInformation("Number of Wagon Axles set to default value of {0}", WagonNumAxles); + Trace.TraceInformation("Number of Wagon Axles set to default value of {0} on Wagon {1}", WagonNumAxles, WagFilePath); } } else