Skip to content

Commit fab5457

Browse files
committed
Add documentation
1 parent 73efb72 commit fab5457

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

Source/Documentation/Manual/features-rollingstock.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,8 +2087,15 @@ or::
20872087
ORTSEngineBrakeController ( "YourBrakes.cs" )
20882088
)
20892089

2090-
The .cs extension is optional. "MSTS" loads the default MSTS-compatible
2091-
implementation, so do `not` use this name for your own script.
2090+
The .cs extension is optional. Alternatively, there are several built-in
2091+
brake controllers:
2092+
- "MSTS": default implementation for a notched brake controller. Each notch
2093+
behaves as defined in the :ref:`Train Brake Controller Positions <physics-brake-controller>` section.
2094+
- "PBL2": a brake controller widely used in Europe. It has a stable Hold position which keeps brake
2095+
pipe pressure, and two unstable positions that apply or release the brakes when pressed. The controller
2096+
also generates the electrical Release and Apply signals required for the UIC EP brake.
2097+
2098+
Do `not` use these names for your own script.
20922099

20932100
.. _features-scripting-cb:
20942101

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Controllers/PBL2BrakeController.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public enum ControllerPosition
5353
private Timer ResetTimer { get; set; }
5454

5555
// brake controller values
56-
private float FirstDepressureBar = 0.5f;
5756
private float BrakeReleasedDepressureBar = 0.2f;
5857
private float EpActivationThresholdBar = 0.15f;
5958

@@ -151,9 +150,9 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
151150
return;
152151
}
153152

154-
if (!FirstDepression && CurrentPosition == ControllerPosition.Apply && pressureBar > Math.Max(MaxPressureBar() - FirstDepressureBar, 0))
153+
if (!FirstDepression && CurrentPosition == ControllerPosition.Apply && pressureBar > Math.Max(MaxPressureBar() - MinReductionBar(), 0))
155154
FirstDepression = true;
156-
else if (FirstDepression && pressureBar <= Math.Max(MaxPressureBar() - FirstDepressureBar, 0))
155+
else if (FirstDepression && pressureBar <= Math.Max(MaxPressureBar() - MinReductionBar(), 0))
157156
FirstDepression = false;
158157

159158
if (QuickReleaseButtonPressed())
@@ -179,7 +178,7 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
179178
CurrentState = State.Apply;
180179
else if (
181180
CurrentPosition == ControllerPosition.Apply && pressureBar > MaxPressureBar() - FullServReductionBar()
182-
|| FirstDepression && CurrentPosition != ControllerPosition.Release && !QuickRelease && pressureBar > MaxPressureBar() - FirstDepressureBar
181+
|| FirstDepression && CurrentPosition != ControllerPosition.Release && !QuickRelease && pressureBar > MaxPressureBar() - MinReductionBar()
183182
)
184183
CurrentState = State.Apply;
185184
else if (OverchargeElimination && pressureBar > MaxPressureBar())
@@ -199,7 +198,6 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
199198
else
200199
CurrentState = State.Hold;
201200

202-
float targetPressureBar = pressureBar;
203201
switch (CurrentState)
204202
{
205203
case State.Overcharge:
@@ -286,6 +284,9 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
286284

287285
if (QuickRelease && pressureBar >= Math.Min(MaxPressureBar(), MainReservoirPressureBar()))
288286
QuickRelease = false;
287+
288+
if (OverchargeElimination && pressureBar <= MaxPressureBar())
289+
OverchargeElimination = false;
289290
}
290291

291292
public override void UpdateEngineBrakePressure(ref float pressureBar, float elapsedClockSeconds)

0 commit comments

Comments
 (0)