Skip to content

Commit b7841ed

Browse files
committed
Set brakes so that mixed SME and EP brakes do not operate together.
1 parent f1c627e commit b7841ed

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using ORTS.Common;
1919
using System;
2020
using System.Collections.Generic;
21+
using ORTS.Scripting.Api;
2122

2223
namespace Orts.Simulation.RollingStocks.SubSystems.Brakes.MSTS
2324
{
@@ -33,7 +34,9 @@ public EPBrakeSystem(TrainCar car)
3334
public override void Update(float elapsedClockSeconds)
3435
{
3536
MSTSLocomotive lead = (MSTSLocomotive)Car.Train.LeadLocomotive;
36-
if (lead != null && lead.BrakeSystem is EPBrakeSystem)
37+
38+
// Only allow brakes to operate if car is connected to an SME system
39+
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))
3740
{
3841

3942
float demandedAutoCylPressurePSI = 0;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using ORTS.Common;
1919
using System;
2020
using System.Collections.Generic;
21+
using ORTS.Scripting.Api;
2122

2223
namespace Orts.Simulation.RollingStocks.SubSystems.Brakes.MSTS
2324
{
@@ -33,7 +34,9 @@ public SMEBrakeSystem(TrainCar car)
3334
public override void Update(float elapsedClockSeconds)
3435
{
3536
MSTSLocomotive lead = (MSTSLocomotive)Car.Train.LeadLocomotive;
36-
if (lead != null && lead.BrakeSystem is SMEBrakeSystem)
37+
38+
// Only allow brakes to operate if car is connected to an SME system
39+
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))
3740
{
3841

3942
float demandedAutoCylPressurePSI = 0;

0 commit comments

Comments
 (0)