Skip to content

Commit f220735

Browse files
committed
Further refinement to WSP
1 parent 4a0e48a commit f220735

File tree

4 files changed

+47
-17
lines changed

4 files changed

+47
-17
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,16 +1018,28 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
10181018
case "wagon(ortsbrakeshoefriction": BrakeShoeFrictionFactor = new Interpolator(stf); break;
10191019
case "wagon(maxhandbrakeforce": InitialMaxHandbrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
10201020
case "wagon(maxbrakeforce": InitialMaxBrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
1021-
case "wagon(ortswheelbrakeslipprotection":
1021+
case "wagon(ortswheelbrakeslideprotection":
10221022
// stf.MustMatch("(");
1023-
var brakeslipprotection = stf.ReadFloatBlock(STFReader.UNITS.None, null);
1024-
if (brakeslipprotection == 1)
1023+
var brakeslideprotection = stf.ReadFloatBlock(STFReader.UNITS.None, null);
1024+
if (brakeslideprotection == 1)
10251025
{
1026-
WheelBrakeSlipProtectionFitted = true;
1026+
WheelBrakeSlideProtectionFitted = true;
10271027
}
10281028
else
10291029
{
1030-
WheelBrakeSlipProtectionFitted = false;
1030+
WheelBrakeSlideProtectionFitted = false;
1031+
}
1032+
break;
1033+
case "wagon(ortsemergencybrakingdisableswsp":
1034+
// stf.MustMatch("(");
1035+
var brakeslideprotectiondisable = stf.ReadFloatBlock(STFReader.UNITS.None, null);
1036+
if (brakeslideprotectiondisable == 1)
1037+
{
1038+
WheelBrakeSlideProtectionEmergencyDisabled = true;
1039+
}
1040+
else
1041+
{
1042+
WheelBrakeSlideProtectionEmergencyDisabled = false;
10311043
}
10321044
break;
10331045
case "wagon(ortsdavis_a": DavisAN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
@@ -1353,7 +1365,8 @@ public virtual void Copy(MSTSWagon copy)
13531365
DriverWheelRadiusM = copy.DriverWheelRadiusM;
13541366
MainSoundFileName = copy.MainSoundFileName;
13551367
BrakeShoeFrictionFactor = copy.BrakeShoeFrictionFactor;
1356-
WheelBrakeSlipProtectionFitted = copy.WheelBrakeSlipProtectionFitted;
1368+
WheelBrakeSlideProtectionFitted = copy.WheelBrakeSlideProtectionFitted;
1369+
WheelBrakeSlideProtectionEmergencyDisabled = copy.WheelBrakeSlideProtectionEmergencyDisabled;
13571370
InitialMaxBrakeForceN = copy.InitialMaxBrakeForceN;
13581371
InitialMaxHandbrakeForceN = copy.InitialMaxHandbrakeForceN;
13591372
MaxBrakeForceN = copy.MaxBrakeForceN;
@@ -1576,6 +1589,9 @@ public override void Save(BinaryWriter outf)
15761589
outf.Write(CarInsideTempC);
15771590
outf.Write(CurrentCarSteamHeatBoilerWaterCapacityL);
15781591

1592+
outf.Write(WheelBrakeSlideProtectionActive);
1593+
outf.Write(WheelBrakeSlideProtectionTimerS);
1594+
15791595
base.Save(outf);
15801596
}
15811597

@@ -1620,6 +1636,9 @@ public override void Restore(BinaryReader inf)
16201636
CarInsideTempC = inf.ReadSingle();
16211637
CurrentCarSteamHeatBoilerWaterCapacityL = inf.ReadSingle();
16221638

1639+
WheelBrakeSlideProtectionActive = inf.ReadBoolean();
1640+
WheelBrakeSlideProtectionTimerS = inf.ReadInt32();
1641+
16231642
base.Restore(inf);
16241643
}
16251644

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public override void Update(float elapsedClockSeconds)
377377
UpdateTripleValveState(threshold);
378378

379379
// triple valve is set to charge the brake cylinder
380-
if ((TripleValveState == ValveState.Apply || TripleValveState == ValveState.Emergency) && !Car.WheelBrakeSlipProtectionActive)
380+
if ((TripleValveState == ValveState.Apply || TripleValveState == ValveState.Emergency) && !Car.WheelBrakeSlideProtectionActive)
381381
{
382382
float dp = elapsedClockSeconds * MaxApplicationRatePSIpS;
383383
if (AuxResPressurePSI - dp / AuxCylVolumeRatio < AutoCylPressurePSI + dp)
@@ -499,26 +499,25 @@ public override void Update(float elapsedClockSeconds)
499499

500500
// (ii) When Brake Pipe Pressure has been reduced below 250 kPa (36.25psi).
501501

502-
if (Car.WheelBrakeSlipProtectionFitted)
502+
if (Car.WheelBrakeSlideProtectionFitted)
503503
{
504-
if ((Car.BrakeSkidWarning || Car.BrakeSkid) && BrakeLine1PressurePSI > 36.25)
504+
if ((Car.BrakeSkidWarning || Car.BrakeSkid) && ( !Car.WheelBrakeSlideProtectionEmergencyDisabled && BrakeLine1PressurePSI > 36.25) && Car.WheelBrakeSlideProtectionTimerS != 0)
505505
{
506-
Car.WheelBrakeSlipProtectionActive = true;
506+
Car.WheelBrakeSlideProtectionActive = true;
507507
// Trace.TraceInformation("WSP#1 - CarID {0} BC {1} Auto {2} BP1 {3}", Car.CarID, CylPressurePSI, AutoCylPressurePSI, BrakeLine1PressurePSI);
508508
AutoCylPressurePSI -= elapsedClockSeconds * MaxReleaseRatePSIpS;
509509
CylPressurePSI = AutoCylPressurePSI;
510-
// Trace.TraceInformation("WSP#2 - CarID {0} BC {1} Auto {2}", Car.CarID, CylPressurePSI, AutoCylPressurePSI);
510+
// Trace.TraceInformation("WSP#2 - CarID {0} BC {1} Auto {2}", Car.CarID, CylPressurePSI, AutoCylPressurePSI);
511+
Car.WheelBrakeSlideProtectionTimerS -= elapsedClockSeconds;
511512
}
512513
else
513514
{
514-
Car.WheelBrakeSlipProtectionActive = false;
515+
Car.WheelBrakeSlideProtectionActive = false;
515516
// Trace.TraceInformation("WSP Non-active - CarID {0} BC {1} Auto {2} BP1 {3}", Car.CarID, CylPressurePSI, AutoCylPressurePSI, BrakeLine1PressurePSI);
516517
}
517518

518519

519520

520-
521-
522521
}
523522

524523

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public override void Update(float elapsedClockSeconds)
4949

5050
base.Update(elapsedClockSeconds);
5151

52-
if (AutoCylPressurePSI < demandedAutoCylPressurePSI && !Car.WheelBrakeSlipProtectionActive)
52+
if (AutoCylPressurePSI < demandedAutoCylPressurePSI && !Car.WheelBrakeSlideProtectionActive)
5353
{
5454
float dp = elapsedClockSeconds * MaxApplicationRatePSIpS;
5555
if (BrakeLine2PressurePSI - dp * AuxBrakeLineVolumeRatio / AuxCylVolumeRatio < AutoCylPressurePSI + dp)

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,11 @@ public float ConvectionFactor
256256
}
257257

258258
// Used to calculate wheel sliding for locked brake
259-
public bool WheelBrakeSlipProtectionFitted = false;
260-
public bool WheelBrakeSlipProtectionActive = false;
259+
public bool WheelBrakeSlideProtectionFitted = false;
260+
public bool WheelBrakeSlideProtectionActive = false;
261+
public bool WheelBrakeSlideProtectionEmergencyDisabled = false;
262+
public float WheelBrakeSlideProtectionTimerS = 7;
263+
261264
public bool BrakeSkid = false;
262265
public bool BrakeSkidWarning = false;
263266
public bool HUDBrakeSkid = false;
@@ -965,6 +968,15 @@ public virtual void UpdateBrakeSlideCalculation()
965968
BrakeSkidWarning = false; // wagon wheel is back to normal
966969
}
967970

971+
// Reset WSP timer
972+
973+
if (WheelBrakeSlideProtectionFitted && (ThrottlePercent == 0 || AbsSpeedMpS == 0))
974+
{
975+
WheelBrakeSlideProtectionTimerS = 7;
976+
977+
}
978+
979+
968980

969981
// Calculate adhesive force based upon whether in skid or not
970982
if (BrakeSkid)

0 commit comments

Comments
 (0)