Skip to content

Commit fad9fbc

Browse files
authored
Merge pull request #874 from cesarBLG/blending-enhancement
Dynamic brake controller refactoring
2 parents ef6c1a8 + f8dbeab commit fad9fbc

File tree

12 files changed

+225
-188
lines changed

12 files changed

+225
-188
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2705,6 +2705,12 @@ Brake Token: ``TrainBrakesControllerSupressionStart``
27052705
- Brake Systems: Air single pipe, Air twin pipe, EP
27062706
- Description: Cancels effect of penalty brake application by TCS and restores control of brakes to driver.
27072707

2708+
Brake Position Labels
2709+
----------------------
2710+
The name of a given brake controller notch can be customized by adding an ORTSLabel
2711+
block to the notch definition::
2712+
2713+
Notch ( 0.5 0 TrainBrakesControllerEPFullServiceStart ORTSLabel ( "Regeneration III and EP" ) )
27082714

27092715
.. _physics-hud-brake:
27102716

@@ -2967,7 +2973,7 @@ DynamicBrakeForceCurves defined in the ENG file, than one is created
29672973
based on the MSTS parameter values.
29682974

29692975
It is possible to use dynamic brakes as a replacement for air brakes
2970-
when they are available (dynamic brake blending). During blending operation,
2976+
when they are available ("local" dynamic brake blending). During blending operation,
29712977
the following parameters will adjust the behaviour of air brakes:
29722978

29732979
.. index::
@@ -2980,7 +2986,38 @@ the following parameters will adjust the behaviour of air brakes:
29802986
air brakes are released while dynamic brakes satisfy the train brake demand.
29812987
If dynamic braking is not sufficient, air brakes will be partially applied
29822988
so the combination air+dynamic provides the required brake demand.
2983-
2989+
2990+
Sometimes the train brake controller is capable to apply the dynamic
2991+
brakes for the whole consist, usually as a first step before air brakes
2992+
are applied. This is usually known as "train blending", as opposed to
2993+
"local" blending which only affects dynamic braking on the locomotive itself.
2994+
A blending table which looks similar to the DynamicBrakeForceCurves table is
2995+
available. It specifies the amount of dynamic brake that is applied at each
2996+
notch of the train brake controller, where 0 means no dynamic brake and 1 means full dynamic brake::
2997+
Engine(
2998+
ORTSTrainDynamicBlendingTable(
2999+
comment ( Notch 0 of train brake - no dynamic brake applied )
3000+
0 (
3001+
0 0
3002+
300km/h 0
3003+
)
3004+
comment ( 30% of Train brake - apply full dynamic brake )
3005+
0.3 (
3006+
0 1
3007+
300km/h 1
3008+
)
3009+
comment ( 90% of Train brake - still apply full dynamic brake )
3010+
0.9 (
3011+
0 1
3012+
300km/h 1
3013+
)
3014+
comment ( Emergency brake notch - do not command dynamic brake )
3015+
1 (
3016+
0 0
3017+
300km/h 0
3018+
)
3019+
)
3020+
)
29843021

29853022
Native Open Rails Braking Parameters
29863023
------------------------------------

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ public void SetUpdateValue(float value)
226226
/// </summary>
227227
public void SetDynamicBrakeIntervention(float value)
228228
{
229-
if (value > 0 && Host.TrainDynamicBrakeIntervention <= 0)
230-
Host.TrainDynamicBrakeCommandStartTime = Host.Simulator.ClockTime;
231229
if (value <= 0)
232230
Host.TrainDynamicBrakeIntervention = -1;
233231
else Host.TrainDynamicBrakeIntervention = Math.Min(value, 1);
@@ -279,6 +277,10 @@ public void SetDynamicBrakeIntervention(float value)
279277
/// </summary>
280278
/// <returns>The nullable state fraction</returns>
281279
public abstract float? GetStateFraction();
280+
public virtual string GetStateName()
281+
{
282+
return ControllerStateDictionary.Dict[GetState()];
283+
}
282284
}
283285

284286
public enum BrakeControllerEvent

Source/Orts.Simulation/Simulation/Confirmer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public Confirmer(Simulator simulator, double defaultDurationS)
185185
ConfirmText = new string[][] {
186186
new string [] { GetString("<none>") }
187187
// Power
188-
, new string [] { GetParticularString("NonSteam", "Reverser"), GetString("reverse"), GetString("neutral"), GetString("forward"), null, null, GetString("locked. Close throttle, stop train then re-try.") }
188+
, new string [] { GetParticularString("NonSteam", "Reverser"), GetString("reverse"), GetString("neutral"), GetString("forward"), null, null, GetString("locked. Close throttle, release dynamic brake, stop train then re-try.") }
189189
, new string [] { GetString("Throttle"), null, null, null, GetString("close"), GetString("open"), GetString("locked. Release dynamic brake then re-try.") }
190190
, new string [] { GetString("Wheel-slip"), GetString("over"), null, GetString("occurring. Tractive power greatly reduced."), null, null, GetString("warning") }
191191
// Electric power
@@ -230,7 +230,7 @@ public Confirmer(Simulator simulator, double defaultDurationS)
230230
, new string [] { GetString("Train Brake"), null, null, null, GetString("release"), GetString("apply") }
231231
, new string [] { GetString("Engine Brake"), null, null, null, GetString("release"), GetString("apply") }
232232
, new string [] { GetString("Brakeman Brake"), null, null, null, GetString("release"), GetString("apply") }
233-
, new string [] { GetString("Dynamic Brake"), GetString("off"), null, GetString("setup"), GetString("decrease"), GetString("increase") }
233+
, new string [] { GetString("Dynamic Brake"), GetString("off"), null, GetString("setup"), GetString("decrease"), GetString("increase"), GetString("locked. Move reverser then retry.") }
234234
, new string [] { GetString("Emergency Brake"), GetString("release"), null, GetString("apply") }
235235
, new string [] { GetString("Bail Off"), GetString("disengage"), null, GetString("engage") }
236236
, new string [] { GetString("Brakes"), GetString("initialize"), null, null, null, null, GetString("cannot initialize. Stop train then re-try.") }

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
766766
// Note typically only one of the above will only ever be non-zero at the one time.
767767
// For flipped locomotives the force is "flipped" elsewhere, whereas dynamic brake force is "flipped" below by the direction of the speed.
768768

769-
if (DynamicBrakePercent > 0 && DynamicBrakeForceCurves != null && AbsSpeedMpS > 0)
769+
if (DynamicBrakePercent > 0 && DynamicBrake && DynamicBrakeForceCurves != null && AbsSpeedMpS > 0)
770770
{
771771
float f = DynamicBrakeForceCurves.Get(.01f * DynamicBrakePercent, AbsTractionSpeedMpS);
772772
if (f > 0 && LocomotivePowerSupply.DynamicBrakeAvailable)

0 commit comments

Comments
 (0)