Skip to content

Commit 9afc8c3

Browse files
committed
Update flowmeters on trailing locomotives to prevent stuck indications when changing cabs
1 parent cb3f1c0 commit 9afc8c3

File tree

1 file changed

+18
-8
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS

1 file changed

+18
-8
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/AirSinglePipe.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,17 +1276,27 @@ protected static void PropagateBrakeLinePressures(float elapsedClockSeconds, Tra
12761276
}
12771277
}
12781278
}
1279-
// Equalize main reservoir with train pipe for every locomotive
12801279
foreach (TrainCar car in train.Cars)
12811280
{
1282-
if (car is MSTSLocomotive loco && car.BrakeSystem.TwoPipes)
1281+
if (car is MSTSLocomotive loco)
12831282
{
1284-
float volumeRatio = loco.BrakeSystem.BrakePipeVolumeM3 / loco.MainResVolumeM3;
1285-
float dp = Math.Min((loco.MainResPressurePSI - loco.BrakeSystem.BrakeLine2PressurePSI) / (1 + volumeRatio), loco.MaximumMainReservoirPipePressurePSI - loco.BrakeSystem.BrakeLine2PressurePSI);
1286-
loco.MainResPressurePSI -= dp * volumeRatio;
1287-
loco.BrakeSystem.BrakeLine2PressurePSI += dp;
1288-
if (loco.MainResPressurePSI < 0) loco.MainResPressurePSI = 0;
1289-
if (loco.BrakeSystem.BrakeLine2PressurePSI < 0) loco.BrakeSystem.BrakeLine2PressurePSI = 0;
1283+
// Continue updating flowmeter on non-lead locomotives so it zeroes out eventually
1284+
if (car != lead)
1285+
{
1286+
(car as MSTSLocomotive).BrakePipeFlowM3pS = 0;
1287+
(car as MSTSLocomotive).FilteredBrakePipeFlowM3pS = (car as MSTSLocomotive).AFMFilter.Filter(0, elapsedClockSeconds);
1288+
}
1289+
1290+
// Equalize main reservoir with MR pipe for every locomotive
1291+
if (car.BrakeSystem.TwoPipes)
1292+
{
1293+
float volumeRatio = loco.BrakeSystem.BrakePipeVolumeM3 / loco.MainResVolumeM3;
1294+
float dp = Math.Min((loco.MainResPressurePSI - loco.BrakeSystem.BrakeLine2PressurePSI) / (1 + volumeRatio), loco.MaximumMainReservoirPipePressurePSI - loco.BrakeSystem.BrakeLine2PressurePSI);
1295+
loco.MainResPressurePSI -= dp * volumeRatio;
1296+
loco.BrakeSystem.BrakeLine2PressurePSI += dp;
1297+
if (loco.MainResPressurePSI < 0) loco.MainResPressurePSI = 0;
1298+
if (loco.BrakeSystem.BrakeLine2PressurePSI < 0) loco.BrakeSystem.BrakeLine2PressurePSI = 0;
1299+
}
12901300
}
12911301
}
12921302

0 commit comments

Comments
 (0)