Skip to content

Commit d366ab7

Browse files
committed
Correct use of wheel speed vs ground speed for traction calculations (always use wheel speed in order to obey conservation of energy)
1 parent 12b1a74 commit d366ab7

File tree

8 files changed

+102
-105
lines changed

8 files changed

+102
-105
lines changed

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

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,7 +2568,7 @@ public virtual float GetAvailableTractionForceN(float t)
25682568
if (forceN < 0 && !TractiveForceCurves.AcceptsNegativeValues())
25692569
forceN = 0;
25702570
}
2571-
if (forceN * AbsSpeedMpS > powerW) forceN = powerW / AbsSpeedMpS;
2571+
if (forceN * AbsTractionSpeedMpS > powerW) forceN = powerW / AbsTractionSpeedMpS;
25722572
return forceN;
25732573
}
25742574
protected virtual void UpdateTractionForce(float elapsedClockSeconds)
@@ -2611,13 +2611,13 @@ protected virtual void UpdateTractionForce(float elapsedClockSeconds)
26112611
public float GetAvailableDynamicBrakeForceN(float d)
26122612
{
26132613
float forceN = 0;
2614-
if (d > 0 && DynamicBrakeForceCurves != null && AbsSpeedMpS > 0)
2614+
if (d > 0 && DynamicBrakeForceCurves != null && AbsTractionSpeedMpS > 0)
26152615
{
2616-
forceN = DynamicBrakeForceCurves.Get(d, AbsSpeedMpS) * (1 - PowerReduction);
2616+
forceN = DynamicBrakeForceCurves.Get(d, AbsTractionSpeedMpS) * (1 - PowerReduction);
26172617
if (LocomotivePowerSupply.MaximumDynamicBrakePowerW > 0)
26182618
{
26192619
float powerW = LocomotivePowerSupply.MaximumDynamicBrakePowerW * (1 - PowerReduction);
2620-
if (forceN * AbsSpeedMpS > powerW) forceN = powerW / AbsSpeedMpS;
2620+
if (forceN * AbsTractionSpeedMpS > powerW) forceN = powerW / AbsTractionSpeedMpS;
26212621
}
26222622
}
26232623
return forceN;
@@ -2653,7 +2653,7 @@ protected virtual void UpdateDynamicBrakeForce(float elapsedClockSeconds)
26532653
if (dynamicLimited) d = maxdynamic;
26542654
d = MathHelper.Clamp(d, 0, 1);
26552655

2656-
if (maxdynamic > 0 && AbsSpeedMpS > 0)
2656+
if (maxdynamic > 0 && AbsTractionSpeedMpS > 0)
26572657
{
26582658
float limitForceN = GetAvailableDynamicBrakeForceN(maxdynamic);
26592659
float targetForceN = GetAvailableDynamicBrakeForceN(d);
@@ -2664,7 +2664,7 @@ protected virtual void UpdateDynamicBrakeForce(float elapsedClockSeconds)
26642664
{
26652665
DynamicBrakeForceN = 0; // Set dynamic brake force to zero if in Notch 0 position
26662666
}
2667-
TractiveForceN -= (SpeedMpS > 0 ? 1 : SpeedMpS < 0 ? -1 : Direction == Direction.Reverse ? -1 : 1) * DynamicBrakeForceN;
2667+
TractiveForceN -= Math.Sign(WheelSpeedMpS) * DynamicBrakeForceN;
26682668
}
26692669

26702670
/// <summary>
@@ -2679,29 +2679,15 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
26792679
// With Simple adhesion apart from correction for rail adhesion, there is no further variation to the motive force.
26802680
// With Advanced adhesion the raw motive force is fed into the advanced (axle) adhesion model, and is corrected for wheel slip and rail adhesion
26812681

2682-
// For the advanced adhesion model, a rudimentary form of slip control is incorporated by using the wheel speed to calculate tractive effort.
2683-
// As wheel speed is increased tractive effort is decreased. Hence wheel slip is "controlled" to a certain extent.
2684-
// This doesn't cover all types of locomotives, for example if DC traction motors and no slip control, then the tractive effort shouldn't be reduced.
2685-
// This won't eliminate slip, but limits its impact.
2686-
// More modern locomotive have a more sophisticated system that eliminates slip in the majority (if not all circumstances).
2687-
// Simple adhesion control does not have any slip control feature built into it.
2688-
// TODO - a full review of slip/no slip control.
2682+
// "AbsTractionSpeedMpS" is the reference speed used for all tractive effort/dynamic braking calculations
2683+
// This speed is an absolute value (Abs) and is measured in meters per second (MpS), and is set to the wheel speed of the locomotive.
2684+
// Why use wheel speed? The locomotive transmission (electric, hydraulic, mechanical, steam) is connected to the wheels of the locomotive,
2685+
// so the speed of the wheels is what will drive the transmission response (this is true whether the wheels are slipping or not;
2686+
// the traction motor/gearbox/steam piston does not "know" or "care" if the wheels are slipping or not, and behaves the same either way).
2687+
// For a locomotive to respond to ground speed or slippage, additional systems (such as wheel slip protection) are required, these are
2688+
// implemented elsewhere.
26892689
PrevAbsTractionSpeedMpS = AbsTractionSpeedMpS;
2690-
if (TractionMotorType == TractionMotorTypes.AC)
2691-
{
2692-
AbsTractionSpeedMpS = AbsSpeedMpS;
2693-
}
2694-
else
2695-
{
2696-
if (WheelSlip && AdvancedAdhesionModel)
2697-
{
2698-
AbsTractionSpeedMpS = AbsWheelSpeedMpS;
2699-
}
2700-
else
2701-
{
2702-
AbsTractionSpeedMpS = AbsSpeedMpS;
2703-
}
2704-
}
2690+
AbsTractionSpeedMpS = AbsWheelSpeedMpS;
27052691
UpdateTractionForce(elapsedClockSeconds);
27062692

27072693
if (MaxForceN > 0 && MaxContinuousForceN > 0 && PowerReduction < 1)

0 commit comments

Comments
 (0)