Skip to content

Commit a4628ab

Browse files
authored
Merge pull request #520 from peternewell/brake-fix#4
Add checks for AirBrakeMaxMainResPipePressure.
2 parents 1dae11d + d6e23e1 commit a4628ab

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,8 +1420,38 @@ public override void Initialize()
14201420
}
14211421
}
14221422

1423-
if (MaximumMainReservoirPipePressurePSI == 0)
1423+
// MaximumMainReservoirPipePressurePSI is only used in twin pipe system, and should have a value
1424+
if ((BrakeSystem is AirTwinPipe))
14241425
{
1426+
1427+
// for airtwinpipe system, make sure that a value is set for it
1428+
if (MaximumMainReservoirPipePressurePSI == 0)
1429+
{
1430+
MaximumMainReservoirPipePressurePSI = MaxMainResPressurePSI;
1431+
if (Simulator.Settings.VerboseConfigurationMessages)
1432+
{
1433+
Trace.TraceInformation("AirBrakeMaxMainResPipePressure not set in ENG file, set to default pressure of {0}.", FormatStrings.FormatPressure(MaximumMainReservoirPipePressurePSI, PressureUnit.PSI, MainPressureUnit, true));
1434+
}
1435+
1436+
}
1437+
}
1438+
else if ((BrakeSystem is AirSinglePipe) && MaximumMainReservoirPipePressurePSI != 0)
1439+
{
1440+
1441+
// if value not equal to MaxMainResPressurePSI then reset (could already be at this value due to "copying" of locomotive)
1442+
if (MaximumMainReservoirPipePressurePSI != MaxMainResPressurePSI)
1443+
{
1444+
// for a airsinglepipe system, AirBrakeMaxMainResPipePressure should be left out of ENG file, and it should be set the same as MaxMainResPressurePSI
1445+
MaximumMainReservoirPipePressurePSI = MaxMainResPressurePSI;
1446+
if (Simulator.Settings.VerboseConfigurationMessages)
1447+
{
1448+
Trace.TraceInformation("AirBrakeMaxMainResPipePressure is set in ENG file, but should not be normally used for AirSinglePipe system, reset to default pressure of {0}. Consider removing AirBrakeMaxMainResPipePressure parameter from ENG file", FormatStrings.FormatPressure(MaximumMainReservoirPipePressurePSI, PressureUnit.PSI, MainPressureUnit, true));
1449+
}
1450+
}
1451+
}
1452+
else
1453+
{
1454+
// normal default setting. This should be the normal case for airsinglepipe systems
14251455
MaximumMainReservoirPipePressurePSI = MaxMainResPressurePSI;
14261456
}
14271457

@@ -1440,7 +1470,7 @@ public override void Initialize()
14401470
{
14411471
Trace.TraceInformation("TrainBrakeController.MaxPressurePSI is assumed to be {0} Inhg, - confirmed as a value of {1} InHg", TempMaxPressure, Bar.ToInHg(Bar.FromPSI(TrainBrakeController.MaxPressurePSI)));
14421472
}
1443-
1473+
14441474
}
14451475
else if (TrainBrakeController.MaxPressurePSI < 7 || TrainBrakeController.MaxPressurePSI > 13) // Outside an acceptable range (Eqiv = 15InHg to 25InHg), then convert to a fixed default
14461476
{

0 commit comments

Comments
 (0)