Skip to content

Commit 39cd994

Browse files
committed
Dynamic brake cut for default TCS
1 parent 805221e commit 39cd994

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5323,11 +5323,13 @@ the tables below.
53235323
.. index::
53245324
single: DoesBrakeCutPower
53255325
single: BrakeCutsPowerAtBrakeCylinderPressure
5326+
single: OrtsEmergencyBrakeCutsDynamicBrake
53265327

5327-
Two other parameters in the Engine section of the ENG file are used by the TCS:
5328+
Other parameters in the Engine section of the ENG file are used by the TCS:
53285329

53295330
- ``DoesBrakeCutPower( x )`` sets whether applying brake on the locomotive cuts the traction (1 for enabled, 0 for disabled)
53305331
- ``BrakeCutsPowerAtBrakeCylinderPressure( x )`` sets the minimum pressure in the brake cylinder that cuts the traction (by default 4 PSI)
5332+
- ``OrtsEmergencyBrakeCutsDynamicBrake`` sets whether an emergency braking disables dynamic brakes
53315333

53325334

53335335
Train Derailment

Source/Orts.Simulation/Common/Scripting/TrainControlSystem.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ internal void AttachToHost(ScriptedTrainControlSystem host)
269269
/// </summary>
270270
public Func<float> BrakeCutsPowerAtBrakeCylinderPressureBar;
271271
/// <summary>
272+
/// True if dynamic brake must be cut if the emergency brake is applied.
273+
/// </summary>
274+
public bool EmergencyBrakeCutsDynamicBrake => Locomotive.EmergencyBrakeCutsDynamicBrake;
275+
/// <summary>
272276
/// State of the train brake controller.
273277
/// </summary>
274278
public Func<ControllerState> TrainBrakeControllerState;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ public float OdometerM
463463
public float BrakeCutsPowerAtBrakePipePressurePSI;
464464
public bool DoesVacuumBrakeCutPower { get; private set; }
465465
public bool DoesBrakeCutPower { get; private set; }
466+
public bool EmergencyBrakeCutsDynamicBrake { get; private set; }
466467
public float BrakeCutsPowerAtBrakeCylinderPressurePSI { get; private set; }
467468
public bool DoesHornTriggerBell { get; private set; }
468469
public bool DPSyncTrainApplication { get; private set; }
@@ -1117,6 +1118,7 @@ public override void Parse(string lowercasetoken, STFReader stf)
11171118
case "engine(brakecutspoweratbrakecylinderpressure": BrakeCutsPowerAtBrakeCylinderPressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
11181119
case "engine(ortsbrakecutspoweratbrakepipepressure": BrakeCutsPowerAtBrakePipePressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
11191120
case "engine(ortsbrakerestorespoweratbrakepipepressure": BrakeRestoresPowerAtBrakePipePressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
1121+
case "engine(ortsemergencybrakecutsdynamicbrake": EmergencyBrakeCutsDynamicBrake = stf.ReadBoolBlock(false); break;
11201122
case "engine(doeshorntriggerbell": DoesHornTriggerBell = stf.ReadBoolBlock(false); break;
11211123
case "engine(ortshornlightstimer": HornTimerS = stf.ReadFloatBlock(STFReader.UNITS.Time, null); break;
11221124
case "engine(ortsbelllightstimer": BellTimerS = stf.ReadFloatBlock(STFReader.UNITS.Time, null); break;
@@ -1336,6 +1338,7 @@ public override void Copy(MSTSWagon copy)
13361338
BrakeCutsPowerAtBrakeCylinderPressurePSI = locoCopy.BrakeCutsPowerAtBrakeCylinderPressurePSI;
13371339
BrakeCutsPowerAtBrakePipePressurePSI = locoCopy.BrakeCutsPowerAtBrakePipePressurePSI;
13381340
BrakeRestoresPowerAtBrakePipePressurePSI = locoCopy.BrakeRestoresPowerAtBrakePipePressurePSI;
1341+
EmergencyBrakeCutsDynamicBrake = locoCopy.EmergencyBrakeCutsDynamicBrake;
13391342
DynamicBrakeCommandStartTime = locoCopy.DynamicBrakeCommandStartTime;
13401343
DynamicBrakeBlendingOverride = locoCopy.DynamicBrakeBlendingOverride;
13411344
DynamicBrakeBlendingForceMatch = locoCopy.DynamicBrakeBlendingForceMatch;

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/TrainControlSystem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@ public override void Update()
11991199
}
12001200

12011201
SetTractionAuthorization(!DoesBrakeCutPower() || LocomotiveBrakeCylinderPressureBar() < BrakeCutsPowerAtBrakeCylinderPressureBar());
1202+
SetDynamicBrakingAuthorization(!EmergencyBrakeCutsDynamicBrake || !IsBrakeEmergency());
12021203

12031204
SetEmergencyBrake(EmergencyBrake);
12041205
SetFullBrake(FullBrake);

0 commit comments

Comments
 (0)