Skip to content

Commit 2357ef4

Browse files
committed
Further adjustments to WSP
1 parent db06ac2 commit 2357ef4

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,16 +1030,16 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
10301030
WheelBrakeSlideProtectionFitted = false;
10311031
}
10321032
break;
1033-
case "wagon(ortsemergencybrakingdisableswsp":
1033+
case "wagon(ortswheelbrakesslideprotectionlimitdisable":
10341034
// stf.MustMatch("(");
10351035
var brakeslideprotectiondisable = stf.ReadFloatBlock(STFReader.UNITS.None, null);
10361036
if (brakeslideprotectiondisable == 1)
10371037
{
1038-
WheelBrakeSlideProtectionEmergencyDisabled = true;
1038+
WheelBrakeSlideProtectionLimitDisabled = true;
10391039
}
10401040
else
10411041
{
1042-
WheelBrakeSlideProtectionEmergencyDisabled = false;
1042+
WheelBrakeSlideProtectionLimitDisabled = false;
10431043
}
10441044
break;
10451045
case "wagon(ortsdavis_a": DavisAN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
@@ -1366,7 +1366,7 @@ public virtual void Copy(MSTSWagon copy)
13661366
MainSoundFileName = copy.MainSoundFileName;
13671367
BrakeShoeFrictionFactor = copy.BrakeShoeFrictionFactor;
13681368
WheelBrakeSlideProtectionFitted = copy.WheelBrakeSlideProtectionFitted;
1369-
WheelBrakeSlideProtectionEmergencyDisabled = copy.WheelBrakeSlideProtectionEmergencyDisabled;
1369+
WheelBrakeSlideProtectionLimitDisabled = copy.WheelBrakeSlideProtectionLimitDisabled;
13701370
InitialMaxBrakeForceN = copy.InitialMaxBrakeForceN;
13711371
InitialMaxHandbrakeForceN = copy.InitialMaxHandbrakeForceN;
13721372
MaxBrakeForceN = copy.MaxBrakeForceN;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,10 @@ public override void Update(float elapsedClockSeconds)
500500

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

503-
if (Car.WheelBrakeSlideProtectionFitted)
503+
if (Car.WheelBrakeSlideProtectionFitted && Car.Train.IsPlayerDriven)
504504
{
505505
// WSP dump valve active
506-
if ((Car.BrakeSkidWarning || Car.BrakeSkid) && !Car.WheelBrakeSlideProtectionDumpValveLockout && ( (!Car.WheelBrakeSlideProtectionEmergencyDisabled && BrakeLine1PressurePSI > 36.25) || Car.WheelBrakeSlideProtectionEmergencyDisabled) )
506+
if ((Car.BrakeSkidWarning || Car.BrakeSkid) && CylPressurePSI > 0 && !Car.WheelBrakeSlideProtectionDumpValveLockout && ( (!Car.WheelBrakeSlideProtectionLimitDisabled && BrakeLine1PressurePSI > 36.25) || Car.WheelBrakeSlideProtectionLimitDisabled) )
507507
{
508508
Car.WheelBrakeSlideProtectionActive = true;
509509
AutoCylPressurePSI -= elapsedClockSeconds * MaxReleaseRatePSIpS;

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public float ConvectionFactor
258258
// Used to calculate wheel sliding for locked brake
259259
public bool WheelBrakeSlideProtectionFitted = false;
260260
public bool WheelBrakeSlideProtectionActive = false;
261-
public bool WheelBrakeSlideProtectionEmergencyDisabled = false;
261+
public bool WheelBrakeSlideProtectionLimitDisabled = false;
262262
public float WheelBrakeSlideProtectionTimerS = 7;
263263
public bool WheelBrakeSlideProtectionDumpValveLockout = false;
264264

@@ -929,8 +929,8 @@ public virtual void UpdateBrakeSlideCalculation()
929929

930930
if (this is MSTSDieselLocomotive || this is MSTSElectricLocomotive)
931931
{
932-
933-
if (WheelSlipWarning && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0) // If advanced adhesion model indicates wheel slip, then check other conditiond (throttle and brake force) to determine whether it is a wheel slip or brake skid
932+
// If advanced adhesion model indicates wheel slip warning, then check other conditions (throttle and brake force) to determine whether it is a wheel slip or brake skid
933+
if (WheelSlipWarning && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0)
934934
{
935935
BrakeSkidWarning = true; // set brake skid flag true
936936
}
@@ -939,14 +939,15 @@ public virtual void UpdateBrakeSlideCalculation()
939939
BrakeSkidWarning = false;
940940
}
941941

942-
if (WheelSlip && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0) // If advanced adhesion model indicates wheel slip, then check other conditiond (throttle and brake force) to determine whether it is a wheel slip or brake skid
942+
// If advanced adhesion model indicates wheel slip, then check other conditions (throttle and brake force) to determine whether it is a wheel slip or brake skid
943+
if (WheelSlip && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0)
943944
{
944-
BrakeSkid = true; // set brake skid flag true
945-
}
946-
else
947-
{
948-
BrakeSkid = false;
949-
}
945+
BrakeSkid = true; // set brake skid flag true
946+
}
947+
else
948+
{
949+
BrakeSkid = false;
950+
}
950951
}
951952

952953
else if (!(this is MSTSDieselLocomotive) || !(this is MSTSElectricLocomotive))
@@ -955,11 +956,12 @@ public virtual void UpdateBrakeSlideCalculation()
955956
// Calculate tread force on wheel - use the retard force as this is related to brakeshoe coefficient, and doesn't vary with skid.
956957
BrakeWheelTreadForceN = BrakeRetardForceN;
957958

959+
// Determine whether car is experiencing a wheel slip during braking
958960
if (!BrakeSkidWarning && AbsSpeedMpS > 0.01)
959961
{
960962
var wagonbrakeadhesiveforcen = MassKG * GravitationalAccelerationMpS2 * Train.WagonCoefficientFriction; // Adhesive force wheel normal
961963

962-
if (BrakeWheelTreadForceN > 0.80f * WagonBrakeAdhesiveForceN)
964+
if (BrakeWheelTreadForceN > 0.80f * WagonBrakeAdhesiveForceN && ThrottlePercent > 0.01)
963965
{
964966
BrakeSkidWarning = true; // wagon wheel is about to slip
965967
}
@@ -970,7 +972,7 @@ public virtual void UpdateBrakeSlideCalculation()
970972
}
971973

972974
// Reset WSP dump valve lockout
973-
if (WheelBrakeSlideProtectionFitted && WheelBrakeSlideProtectionDumpValveLockout && (ThrottlePercent == 0 || AbsSpeedMpS == 0))
975+
if (WheelBrakeSlideProtectionFitted && WheelBrakeSlideProtectionDumpValveLockout && (ThrottlePercent > 0.01 || AbsSpeedMpS <= 0.002))
974976
{
975977
WheelBrakeSlideProtectionTimerS = 7;
976978
WheelBrakeSlideProtectionDumpValveLockout = false;

0 commit comments

Comments
 (0)