Skip to content

Commit e6e95f1

Browse files
committed
Add parameter for minimum speed of blended braking
1 parent 18c3e9c commit e6e95f1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3344,6 +3344,7 @@ the following parameters will adjust the behaviour of air brakes:
33443344
single: DynamicBrakeHasAutoBailOff
33453345
single: ORTSDynamicBrakesHasPartialBailOff
33463346
single: ORTSDynamicBlendingRetainedPressure
3347+
single: ORTSDynamicBlendingMinimumSpeed
33473348
single: ORTSTrainDynamicBlendingTable
33483349
single: ORTSDynamicBrakeReplacementWithEngineBrake
33493350
single: ORTSDynamicBrakeReplacementWithEngineBrakeAtSpeed
@@ -3358,6 +3359,9 @@ the following parameters will adjust the behaviour of air brakes:
33583359
pressure which, when used in combination with ORTSDynamicBrakesHasPartialBailOff,
33593360
will remain applied regardless of the blended dynamic brake force. This
33603361
pressure is also the minimum pressure at which the blended braking system will activate.
3362+
- ``Engine(ORTSDynamicBlendingMinimumSpeed`` -- Below the specified speed
3363+
(default units mph, default value 5 mph / 8 kph), local dynamic brake blending
3364+
will be disabled, allowing locomotive brakes to hold the train while stopped.
33613365

33623366
Sometimes the train brake controller is capable to apply the dynamic
33633367
brakes for the whole consist, usually as a first step before air brakes

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ public float OdometerM
421421
protected bool DynamicBrakeBlendingOverride; // true when DB lever >0% should always override the blending. When false, the bigger command is applied.
422422
protected bool DynamicBrakeBlendingForceMatch = true; // if true, dynamic brake blending tries to achieve the same braking force as the airbrake would have.
423423
public float DynamicBrakeBlendingRetainedPressurePSI { get; private set; } = -1.0f; // the amount of pressure that will always be retained in the brake cylinders during blended braking
424+
public float DynamicBrakeBlendingMinSpeedMpS { get; private set; } = 2.25f; // below this speed, blended braking is disabled
424425
protected bool DynamicBrakeControllerSetupLock; // if true if dynamic brake lever will lock until dynamic brake is available
425426

426427
public float DynamicBrakeBlendingPercent { get; protected set; } = -1;
@@ -1098,6 +1099,7 @@ public override void Parse(string lowercasetoken, STFReader stf)
10981099
case "engine(ortsdynamicbrakeshaspartialbailoff": DynamicBrakePartialBailOff = stf.ReadBoolBlock(false); break;
10991100
case "engine(ortsdynamicbrakereplacementwithenginebrake": DynamicBrakeEngineBrakeReplacement = stf.ReadBoolBlock(false); break;
11001101
case "engine(ortsdynamicbrakereplacementwithenginebrakeatspeed": DynamicBrakeEngineBrakeReplacementSpeed = stf.ReadFloatBlock(STFReader.UNITS.SpeedDefaultMPH, null); break;
1102+
case "engine(ortsdynamicblendingminimumspeed": DynamicBrakeBlendingMinSpeedMpS = stf.ReadFloatBlock(STFReader.UNITS.SpeedDefaultMPH, null); break;
11011103
case "engine(dynamicbrakesdelaytimebeforeengaging": DynamicBrakeDelayS = stf.ReadFloatBlock(STFReader.UNITS.Time, null); break;
11021104
case "engine(dynamicbrakesresistorcurrentlimit": DynamicBrakeMaxCurrentA = stf.ReadFloatBlock(STFReader.UNITS.Current, null); break;
11031105
case "engine(numwheels": MSTSLocoNumDrvWheels = stf.ReadFloatBlock(STFReader.UNITS.None, 4.0f); if (MSTSLocoNumDrvWheels < 1) STFException.TraceWarning(stf, "Engine:NumWheels is less than 1, parts of the simulation may not function correctly"); break;
@@ -1265,6 +1267,7 @@ public override void Copy(MSTSWagon copy)
12651267
DynamicBrakePartialBailOff = locoCopy.DynamicBrakePartialBailOff;
12661268
DynamicBrakeEngineBrakeReplacement = locoCopy.DynamicBrakeEngineBrakeReplacement;
12671269
DynamicBrakeEngineBrakeReplacementSpeed = locoCopy.DynamicBrakeEngineBrakeReplacementSpeed;
1270+
DynamicBrakeBlendingMinSpeedMpS = locoCopy.DynamicBrakeBlendingMinSpeedMpS;
12681271
DynamicBrakeMaxCurrentA = locoCopy.DynamicBrakeMaxCurrentA;
12691272
DynamicBrakeSpeed1MpS = locoCopy.DynamicBrakeSpeed1MpS;
12701273
DynamicBrakeSpeed2MpS = locoCopy.DynamicBrakeSpeed2MpS;
@@ -2034,9 +2037,14 @@ protected void CorrectBrakingParams()
20342037
public void DynamicBrakeBlending(float elapsedClockSeconds)
20352038
{
20362039
// Local blending
2040+
if (airPipeSystem == null)
2041+
{
2042+
DynamicBrakeBlendingPercent = -1;
2043+
return;
2044+
}
20372045
float autoDemandedPressurePSI = airPipeSystem.AutoCylPressurePSI * airPipeSystem.RelayValveRatio;
20382046

2039-
if (Math.Abs(SpeedMpS) > DynamicBrakeSpeed1MpS && airPipeSystem != null && autoDemandedPressurePSI > DynamicBrakeBlendingRetainedPressurePSI
2047+
if (Math.Abs(SpeedMpS) > DynamicBrakeBlendingMinSpeedMpS && autoDemandedPressurePSI > DynamicBrakeBlendingRetainedPressurePSI
20402048
&& ThrottlePercent == 0 && !(DynamicBrakeController != null && DynamicBrakeBlendingOverride && DynamicBrakeController.SavedValue > 0))
20412049
{
20422050
float target = (autoDemandedPressurePSI - DynamicBrakeBlendingRetainedPressurePSI) /

0 commit comments

Comments
 (0)