File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ public EPBrakeSystem(TrainCar car)
34
34
public override void Update ( float elapsedClockSeconds )
35
35
{
36
36
MSTSLocomotive lead = ( MSTSLocomotive ) Car . Train . LeadLocomotive ;
37
+ float demandedAutoCylPressurePSI = 0 ;
37
38
38
- // Only allow brakes to operate if car is connected to an SME system
39
+ // Only allow EP brake tokens to operate if car is connected to an EP system
39
40
if ( lead != null && lead . BrakeSystem is EPBrakeSystem && Car . BrakeSystem is EPBrakeSystem && ( lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPFullServ || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPOnly || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPApply ) )
40
41
{
41
42
42
- float demandedAutoCylPressurePSI = 0 ;
43
43
if ( BrakeLine3PressurePSI >= 1000f || Car . Train . BrakeLine4 < 0 )
44
44
{
45
45
HoldingValve = ValveState . Release ;
@@ -53,9 +53,13 @@ public override void Update(float elapsedClockSeconds)
53
53
demandedAutoCylPressurePSI = Math . Min ( Math . Max ( Car . Train . BrakeLine4 , 0 ) , 1 ) * MaxCylPressurePSI ;
54
54
HoldingValve = AutoCylPressurePSI <= demandedAutoCylPressurePSI ? ValveState . Lap : ValveState . Release ;
55
55
}
56
+ }
56
57
57
- base . Update ( elapsedClockSeconds ) ;
58
+ base . Update ( elapsedClockSeconds ) ; // Allow processing of other valid tokens
58
59
60
+ // Only allow EP brake tokens to operate if car is connected to an EP system
61
+ if ( lead != null && lead . BrakeSystem is EPBrakeSystem && Car . BrakeSystem is EPBrakeSystem && ( lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPFullServ || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPOnly || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . EPApply ) )
62
+ {
59
63
if ( AutoCylPressurePSI < demandedAutoCylPressurePSI && ! Car . WheelBrakeSlideProtectionActive )
60
64
{
61
65
float dp = elapsedClockSeconds * MaxApplicationRatePSIpS ;
Original file line number Diff line number Diff line change @@ -38,12 +38,11 @@ public SMEBrakeSystem(TrainCar car)
38
38
public override void Update ( float elapsedClockSeconds )
39
39
{
40
40
MSTSLocomotive lead = ( MSTSLocomotive ) Car . Train . LeadLocomotive ;
41
+ float demandedAutoCylPressurePSI = 0 ;
41
42
42
- // Only allow brakes to operate if car is connected to an SME system
43
+ // Only allow SME brake tokens to operate if car is connected to an SME system
43
44
if ( lead != null && lead . BrakeSystem is SMEBrakeSystem && Car . BrakeSystem is SMEBrakeSystem && ( lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEFullServ || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEOnly || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEReleaseStart || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMESelfLap ) )
44
- {
45
-
46
- float demandedAutoCylPressurePSI = 0 ;
45
+ {
47
46
if ( BrakeLine3PressurePSI >= 1000f || Car . Train . BrakeLine4 < 0 )
48
47
{
49
48
HoldingValve = ValveState . Release ;
@@ -57,9 +56,12 @@ public override void Update(float elapsedClockSeconds)
57
56
demandedAutoCylPressurePSI = Math . Min ( Math . Max ( Car . Train . BrakeLine4 , 0 ) , 1 ) * MaxCylPressurePSI ;
58
57
HoldingValve = AutoCylPressurePSI <= demandedAutoCylPressurePSI ? ValveState . Lap : ValveState . Release ;
59
58
}
59
+ }
60
+ base . Update ( elapsedClockSeconds ) ; // Allow processing of other valid tokens
60
61
61
- base . Update ( elapsedClockSeconds ) ;
62
-
62
+ // Only allow SME brake tokens to operate if car is connected to an SME system
63
+ if ( lead != null && lead . BrakeSystem is SMEBrakeSystem && Car . BrakeSystem is SMEBrakeSystem && ( lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEFullServ || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEOnly || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMEReleaseStart || lead . TrainBrakeController . TrainBrakeControllerState == ControllerState . SMESelfLap ) )
64
+ {
63
65
if ( AutoCylPressurePSI < demandedAutoCylPressurePSI && ! Car . WheelBrakeSlideProtectionActive )
64
66
{
65
67
float dp = elapsedClockSeconds * MaxApplicationRatePSIpS ;
You can’t perform that action at this time.
0 commit comments