Skip to content

Commit 858fa7e

Browse files
committed
Cleanup, fixes, and documentation
1 parent cf9f306 commit 858fa7e

File tree

2 files changed

+66
-13
lines changed

2 files changed

+66
-13
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,11 +2976,23 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
29762976
single: ORTSEmergencyValveActuationRate
29772977
single: ORTSEmergencyDumpValveRate
29782978
single: ORTSEmergencyDumpValveTimer
2979+
single: ORTSEmergencyResQuickRelease
29792980
single: ORTSMainResPipeAuxResCharging
29802981
single: ORTSBrakeRelayValveRatio
29812982
single: ORTSEngineBrakeRelayValveRatio
29822983
single: ORTSBrakeRelayValveApplicationRate
29832984
single: ORTSBrakeRelayValveReleaseRate
2985+
single: ORTSMaxTripleValveCylinderPressure
2986+
single: ORTSMaxServiceCylinderPressure
2987+
single: ORTSUniformChargingThreshold
2988+
single: ORTSUniformChargingRatio
2989+
single: ORTSQuickServiceLimit
2990+
single: ORTSQuickServiceApplicationRate
2991+
single: ORTSQuickServiceVentRate
2992+
single: ORTSAcceleratedApplicationFactor
2993+
single: ORTSAcceleratedApplicationMaxVentRate
2994+
single: ORTSInitialApplicationThreshold
2995+
single: ORTSCylinderSpringPressure
29842996
single: ORTSMainResChargingRate
29852997
single: ORTSEngineBrakeReleaseRate
29862998
single: ORTSEngineBrakeApplicationRate
@@ -3012,11 +3024,14 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
30123024
brake actuation of the triple valve. If the pressure in the brake pipe
30133025
decreases at a higher rate than specified, the triple valve will switch to
30143026
emergency mode.
3015-
- ``Wagon(ORTSEmergencyDumpValveRate)``-- Rate at which BP is locally discharged
3027+
- ``Wagon(ORTSEmergencyDumpValveRate`` -- Rate at which BP is locally discharged
30163028
at every wagon during an emergency brake application.
3017-
- ``Wagon(ORTSEmergencyDumpValveTimer)``-- Timer for emergency dump valve to close
3029+
- ``Wagon(ORTSEmergencyDumpValveTimer`` -- Timer for emergency dump valve to close
30183030
after it is activated. If set to 0, it will close as soon as BP is discharged.
30193031
Default value will prevent BP from being charged for 2 minutes.
3032+
- ``Wagon(ORTSEmergencyResQuickRelease`` -- Set to 1 (default 0) to enable quick release,
3033+
in which emergency reservoir air is used to increase the brake pipe pressure
3034+
during release. Remains active until brake cylinder pressure drops below 5 psi.
30203035
- ``Wagon(ORTSMainResPipeAuxResCharging`` -- Boolean value that indicates,
30213036
for twin pipe systems, if the main reservoir pipe is used for charging the auxiliary
30223037
reservoirs. If set to false, the main reservoir pipe will not be used
@@ -3037,6 +3052,40 @@ MaxAuxilaryChargingRate and EmergencyResChargingRate.
30373052
by the triple valve. For example, UIC distributors set maximum cylinder pressure
30383053
to 3.8 bar when brake pipe is below 3.5 bar, and further brake pipe discharging
30393054
does not increase cylinder pressure.
3055+
- ``Wagon(ORTSMaxServiceCylinderPressure`` -- Sets the maximum cylinder pressure
3056+
demanded during service applications. During emergency applications,
3057+
brake cylinder pressure is instead limited by ``ORTSMaxTripleValveCylinderPressure``.
3058+
- ``Wagon(ORTSUniformChargingThreshold`` -- The pressure difference between the brake
3059+
pipe and auxiliary reservoir at which uniform charging activates during release
3060+
(default 3 psi), usually used to reduce the rate of auxiliary reservoir charging.
3061+
- ``Wagon(ORTSUniformChargingRatio`` -- Factor used to divide auxiliary reservoir
3062+
charging rate by when uniform charging is active. Eg: setting of 2 will halve
3063+
charging rate while uniform charging is active (defaults to 0, disabling the feature).
3064+
- ``Wagon(ORTSQuickServiceLimit`` -- Quick service activates when triple valve
3065+
initially changes from release to apply, and will remain active until brake
3066+
cylinder pressure reaches the pressure specified here (default 0,
3067+
which disables quick service).
3068+
- ``Wagon(ORTSQuickServiceApplicationRate`` -- Optional setting for brake cylinder
3069+
application rate during quick service, can be used to increase speed of initial
3070+
applications. Has no effect if set lower than ``MaxApplicationRate`` (default 0).
3071+
- ``Wagon(ORTSQuickServiceVentRate`` -- Optional ability for the brake pipe
3072+
pressure to be locally reduced at the specified rate while quick service is active
3073+
(default 0).
3074+
- ``Wagon(ORTSAcceleratedApplicationFactor`` -- Triple valves can speed up applications
3075+
by measuring the rate of brake pipe reduction, multiplying the reduction
3076+
by the factor specified here, then locally venting that amount of brake pipe air.
3077+
Eg: a factor of 0.5 will speed up brake pipe propogation by +50%. Warning: Large
3078+
factors can cause out of control brake pipe reductions, avoid settings larger
3079+
than 1 (default 0, which disables the feature entirely).
3080+
- ``Wagon(ORTSAcceleratedApplicationMaxVentRate`` -- Sets the maximum rate
3081+
at which accelerated application will reduce the brake pipe pressure
3082+
(default 5 psi/s).
3083+
- ``Wagon(ORTSInitialApplicationThreshold`` -- The pressure difference between
3084+
the brake pipe and auxiliary reservoir at which the triple valve will
3085+
change from release to apply (default 1 psi).
3086+
- ``Wagon(ORTSCylinderSpringPressure`` -- Below the specified pressure, no
3087+
brake force will be developed, simulating the pressure required to
3088+
overcome the brake cylinder return spring (default 0).
30403089
- ``Engine(ORTSMainResChargingRate`` -- Rate of main reservoir pressure change
30413090
in psi per second when the compressor is on (default .4).
30423091
- ``Engine(ORTSEngineBrakeReleaseRate`` -- Rate of engine brake pressure

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public class AirSinglePipe : MSTSBrakeSystem
7575
protected float QuickServiceLimitPSI;
7676
protected float QuickServiceApplicationRatePSIpS;
7777
protected float QuickServiceVentRatePSIpS;
78-
protected float AcceleratedApplicationRatio;
79-
protected float AcceleratedApplicationLimitPSIpS = 10.0f;
78+
protected float AcceleratedApplicationFactor;
79+
protected float AcceleratedApplicationLimitPSIpS = 5.0f;
8080
protected float InitialApplicationThresholdPSI = 1.0f;
8181
protected float BrakeCylinderSpringPressurePSI;
8282
protected float ServiceMaxCylPressurePSI;
@@ -161,7 +161,7 @@ public override void InitializeFromCopy(BrakeSystem copy)
161161
QuickServiceLimitPSI = thiscopy.QuickServiceLimitPSI;
162162
QuickServiceApplicationRatePSIpS = thiscopy.QuickServiceApplicationRatePSIpS;
163163
QuickServiceVentRatePSIpS = thiscopy.QuickServiceVentRatePSIpS;
164-
AcceleratedApplicationRatio = thiscopy.AcceleratedApplicationRatio;
164+
AcceleratedApplicationFactor = thiscopy.AcceleratedApplicationFactor;
165165
AcceleratedApplicationLimitPSIpS = thiscopy.AcceleratedApplicationLimitPSIpS;
166166
InitialApplicationThresholdPSI = thiscopy.InitialApplicationThresholdPSI;
167167
BrakeCylinderSpringPressurePSI = thiscopy.BrakeCylinderSpringPressurePSI;
@@ -303,8 +303,8 @@ public override void Parse(string lowercasetoken, STFReader stf)
303303
case "wagon(ortsquickservicelimit": QuickServiceLimitPSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
304304
case "wagon(ortsquickserviceapplicationrate": QuickServiceApplicationRatePSIpS = stf.ReadFloatBlock(STFReader.UNITS.PressureRateDefaultPSIpS, null); break;
305305
case "wagon(ortsquickserviceventrate": QuickServiceVentRatePSIpS = stf.ReadFloatBlock(STFReader.UNITS.PressureRateDefaultPSIpS, null); break;
306-
case "wagon(ortsacceleratedapplicationratio": AcceleratedApplicationRatio = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
307-
case "wagon(ortsacceleratedapplicationmaxventrate": AcceleratedApplicationLimitPSIpS = stf.ReadFloatBlock(STFReader.UNITS.PressureRateDefaultPSIpS, 10.0f); break;
306+
case "wagon(ortsacceleratedapplicationfactor": AcceleratedApplicationFactor = stf.ReadFloatBlock(STFReader.UNITS.None, null); break;
307+
case "wagon(ortsacceleratedapplicationmaxventrate": AcceleratedApplicationLimitPSIpS = stf.ReadFloatBlock(STFReader.UNITS.PressureRateDefaultPSIpS, 5.0f); break;
308308
case "wagon(ortsinitialapplicationthreshold": InitialApplicationThresholdPSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, 1.0f); break;
309309
case "wagon(ortscylinderspringpressure": BrakeCylinderSpringPressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
310310
case "wagon(ortsmaxservicecylinderpressure": ServiceMaxCylPressurePSI = stf.ReadFloatBlock(STFReader.UNITS.PressureDefaultPSI, null); break;
@@ -512,7 +512,6 @@ public void UpdateTripleValveState(float elapsedClockSeconds)
512512
}
513513
}
514514
else EmergencyDumpStartTime = null;
515-
prevBrakePipePressurePSI = BrakeLine1PressurePSI;
516515
}
517516

518517
public override void Update(float elapsedClockSeconds)
@@ -574,9 +573,9 @@ public override void Update(float elapsedClockSeconds)
574573
}
575574
else
576575
{
577-
if (TripleValveState == ValveState.Apply && AcceleratedApplicationRatio > 0) // Accelerated application: Air is vented from the brake pipe to speed up service applications
576+
if (AcceleratedApplicationFactor > 0) // Accelerated application: Air is vented from the brake pipe to speed up service applications
578577
{
579-
dpPipe = Math.Min(BrakePipeChange * AcceleratedApplicationRatio, elapsedClockSeconds * AcceleratedApplicationLimitPSIpS); // Amount of air vented is proportional to pressure reduction from external sources
578+
dpPipe = Math.Min(BrakePipeChange * AcceleratedApplicationFactor, elapsedClockSeconds * AcceleratedApplicationLimitPSIpS); // Amount of air vented is proportional to pressure reduction from external sources
580579
}
581580
dp = elapsedClockSeconds * MaxApplicationRatePSIpS;
582581
}
@@ -686,14 +685,17 @@ public override void Update(float elapsedClockSeconds)
686685
}
687686

688687
// Handle brake release: reduce cylinder pressure if all triple valve, EP holding valve and retainers allow so
688+
if (threshold < 2.2f) // Prevent brakes getting stuck with a small amount of air on distributor systems
689+
threshold = 0;
689690
float minCylPressurePSI = Math.Max(threshold, RetainerPressureThresholdPSI);
691+
690692
if (TripleValveState == ValveState.Release && HoldingValve == ValveState.Release && AutoCylPressurePSI > minCylPressurePSI)
691693
{
692694
float dp = elapsedClockSeconds * ReleaseRatePSIpS;
693-
if (AutoCylPressurePSI < minCylPressurePSI + 1)
695+
if (AutoCylPressurePSI < threshold + 1 && threshold > 2.2f)
694696
dp *= MathHelper.Clamp(AutoCylPressurePSI - threshold, 0.1f, 1.0f); // Reduce release rate if nearing target pressure to prevent toggling between release and lap
695697
if (AutoCylPressurePSI - dp < minCylPressurePSI)
696-
dp = AutoCylPressurePSI-minCylPressurePSI;
698+
dp = AutoCylPressurePSI - minCylPressurePSI;
697699
if (dp < 0)
698700
dp = 0;
699701
AutoCylPressurePSI -= dp;
@@ -751,6 +753,8 @@ public override void Update(float elapsedClockSeconds)
751753
{
752754
if (AuxResPressurePSI < BrakeLine1PressurePSI && (valveType == MSTSWagon.BrakeValveType.Distributor ? true : TripleValveState == ValveState.Release) && !BleedOffValveOpen)
753755
{
756+
if (AuxResPressurePSI > BrakeLine1PressurePSI - 1)
757+
dpAux *= MathHelper.Clamp(BrakeLine1PressurePSI - AuxResPressurePSI, 0.1f, 1.0f); // Reduce recharge rate if nearing target pressure to smooth out changes in brake pipe
754758
if (UniformChargingRatio > 0) // Uniform charging: Aux res charging is slowed down when the brake pipe is substantially higher than the aux res
755759
{
756760
if (!UniformChargingActive && AuxResPressurePSI < BrakeLine1PressurePSI - UniformChargingThresholdPSI)
@@ -965,7 +969,7 @@ public override void Update(float elapsedClockSeconds)
965969

966970
if (!Car.BrakesStuck)
967971
{
968-
Car.BrakeShoeForceN = Car.MaxBrakeForceN * Math.Min(CylPressurePSI / MaxCylPressurePSI, 1);
972+
Car.BrakeShoeForceN = Car.MaxBrakeForceN * MathHelper.Clamp((CylPressurePSI - BrakeCylinderSpringPressurePSI) / (MaxCylPressurePSI - BrakeCylinderSpringPressurePSI), 0, 1);
969973
if (Car.BrakeShoeForceN < Car.MaxHandbrakeForceN * HandbrakePercent / 100)
970974
Car.BrakeShoeForceN = Car.MaxHandbrakeForceN * HandbrakePercent / 100;
971975
}

0 commit comments

Comments
 (0)