Skip to content

Commit 9c7cdbf

Browse files
committed
Yet another try to overcome micro-slips respecting ramp up rates
1 parent 6ef735b commit 9c7cdbf

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

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

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,27 +2740,43 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27402740
if (SlipControlSystem == SlipControlType.Full)
27412741
{
27422742
// Simple slip control
2743-
// Motive force is reduced to the maximum adhesive force
2744-
// In wheelslip situations, motive force is set to zero
2743+
// Motive force is limited to the maximum adhesive force
2744+
// In wheelslip situations, motive force is reduced to zero
27452745
float absForceN = Math.Min(Math.Abs(axle.DriveForceN), axle.MaximumWheelAdhesion * axle.AxleWeightN);
27462746
float newForceN;
2747-
if (axle.HuDIsWheelSlip)
2747+
if (axle.DriveForceN != 0)
27482748
{
2749-
newForceN = 0;
2749+
if (axle.HuDIsWheelSlip) SlipControlActive[i] = true;
27502750
}
2751-
else if (!axle.HuDIsWheelSlipWarning)
2751+
else
27522752
{
2753-
// If well below slip threshold, restore full power in 10 seconds
2754-
newForceN = Math.Min(Math.Abs(prevForceN) + absForceN * elapsedClockSeconds / 10, absForceN);
2753+
SlipControlActive[i] = false;
27552754
}
2756-
else if (axle.IsWheelSlip)
2755+
2756+
if (SlipControlActive[i])
27572757
{
2758-
newForceN = Math.Max(Math.Abs(prevForceN) - absForceN * elapsedClockSeconds / 3, 0);
2758+
if (!axle.HuDIsWheelSlip)
2759+
{
2760+
// If well below slip threshold, restore full power in 10 seconds
2761+
newForceN = Math.Min(Math.Abs(prevForceN) + absForceN * elapsedClockSeconds / 10, absForceN);
2762+
2763+
// If full force is restored, disengage slip control (but limiting force to max adhesion)
2764+
if (newForceN / absForceN > 0.95f) SlipControlActive[i] = false;
2765+
}
2766+
else if (axle.IsWheelSlip)
2767+
{
2768+
newForceN = Math.Max(Math.Abs(prevForceN) - absForceN * elapsedClockSeconds / 3, 0);
2769+
}
2770+
else
2771+
{
2772+
newForceN = Math.Min(Math.Abs(prevForceN), absForceN);
2773+
}
27592774
}
27602775
else
27612776
{
27622777
newForceN = absForceN;
27632778
}
2779+
27642780
if (axle.DriveForceN > 0 && prevForceN >= 0) axle.DriveForceN = newForceN;
27652781
else if (axle.DriveForceN < 0 && prevForceN <= 0) axle.DriveForceN = -newForceN;
27662782
}
@@ -2806,7 +2822,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
28062822
}
28072823
else
28082824
{
2809-
newForceN = absForceN;
2825+
newForceN = Math.Min(Math.Abs(prevForceN), absForceN);
28102826
}
28112827
if (axle.DriveForceN > 0 && prevForceN >= 0) axle.DriveForceN = newForceN;
28122828
else if (axle.DriveForceN < 0 && prevForceN <= 0) axle.DriveForceN = -newForceN;

0 commit comments

Comments
 (0)