Skip to content

Commit b48ac9f

Browse files
committed
Correct issue with wheel slip on steam locomotives.
1 parent ff2e73d commit b48ac9f

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,6 +2299,7 @@ public override void Update(float elapsedClockSeconds)
22992299
CylinderCocksPressureAtmPSI = 0;
23002300
CabSteamChestPressurePSI = 0;
23012301
CabSteamBoosterPressurePSI = 0;
2302+
SteamDrvWheelWeightLbs = 0;
23022303

23032304
for (int i = 0; i < SteamEngines.Count; i++)
23042305
{
@@ -2549,6 +2550,8 @@ public override void Update(float elapsedClockSeconds)
25492550

25502551
UpdateSteamTractiveForce(elapsedClockSeconds, tractiveforcethrottle, 0, 0, i);
25512552

2553+
SteamDrvWheelWeightLbs += Kg.ToLb(SteamEngines[i].AttachedAxle.WheelWeightKg / SteamEngines[i].AttachedAxle.NumAxles); // Calculate the weight per axle (used in MSTSLocomotive for friction calculatons)
2554+
25522555
}
25532556

25542557
UpdateTractiveForce(elapsedClockSeconds, ThrottlePercent / 100f, AbsSpeedMpS, AbsWheelSpeedMpS);
@@ -6358,10 +6361,8 @@ public override void AdvancedAdhesion(float elapsedClockSeconds)
63586361
float WheelMomentInertia = (linkedEngine.AttachedAxle.WheelWeightKg * linkedEngine.AttachedAxle.WheelRadiusM * linkedEngine.AttachedAxle.WheelRadiusM) / 2.0f;
63596362
float AxleMomentInertia = (linkedEngine.AttachedAxle.WheelWeightKg * AxleRadiusM * AxleRadiusM) / 2.0f;
63606363
float TotalWheelMomentofInertia = WheelMomentInertia + AxleMomentInertia; // Total MoI for generic wheelset
6361-
6362-
SteamDrvWheelWeightLbs = Kg.ToLb(linkedEngine.AttachedAxle.WheelWeightKg / linkedEngine.AttachedAxle.NumAxles); // Calculate the weight per axle (used in MSTSLocomotive for friction calculatons)
6363-
6364-
// The moment of inertia needs to be increased by the number of wheel sets
6364+
6365+
// The moment of inertia needs to be increased by the number of wheels in each set
63656366
TotalWheelMomentofInertia *= linkedEngine.AttachedAxle.NumAxles;
63666367

63676368
// the inertia of the coupling rods can also be added
@@ -6379,7 +6380,6 @@ public override void AdvancedAdhesion(float elapsedClockSeconds)
63796380
axle.DampingNs = axle.AxleWeightN / 200;
63806381
// Calculate internal resistance - IR = 3.8 * diameter of cylinder^2 * stroke * dia of drivers (all in inches) - This should reduce wheel force
63816382
axle.FrictionN = N.FromLbf(3.8f * Me.ToIn(linkedEngine.CylindersDiameterM) * Me.ToIn(linkedEngine.CylindersDiameterM) * Me.ToIn(linkedEngine.CylindersStrokeM) / (Me.ToIn(linkedEngine.AttachedAxle.WheelRadiusM * 2.0f)));
6382-
63836383
}
63846384

63856385
axle.BrakeRetardForceN = BrakeRetardForceN / LocomotiveAxles.Count;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2293,7 +2293,6 @@ private void UpdateDriveWheelWeight(int index, float masskg, int numberofengine
22932293
var LocoIdentification = Train.Cars[index] as MSTSSteamLocomotive;
22942294
if (LocoIdentification != null)
22952295
{
2296-
22972296
for (int i = 0; i < LocoIdentification.SteamEngines.Count; i++)
22982297
{
22992298
LocoIdentification.SteamEngines[i].AttachedAxle.WheelWeightKg = (MassKG / InitialMassKG) * LocoIdentification.SteamEngines[i].AttachedAxle.InitialDrvWheelWeightKg;

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,19 @@ public void Initialize()
241241
if (axle.DampingNs <= 0) axle.DampingNs = locomotive.MassKG / 1000.0f / AxleList.Count;
242242
if (axle.FrictionN <= 0) axle.FrictionN = locomotive.MassKG / 1000.0f / AxleList.Count;
243243
if (axle.NumberWheelAxles <= 0) axle.NumberWheelAxles = 1;
244+
245+
// set the wheel slip threshold times for different types of locomotives
246+
// Because of the irregular force around the wheel for a steam engine during a revolution, "response" time for warnings needs to be lower
247+
if (locomotive.EngineType == TrainCar.EngineTypes.Steam)
248+
{
249+
axle.WheelSlipThresholdTimeS = 0.01f;
250+
axle.WheelSlipWarningThresholdTimeS = 0.005f;
251+
}
252+
else
253+
{
254+
axle.WheelSlipThresholdTimeS = 1;
255+
axle.WheelSlipWarningThresholdTimeS = 1;
256+
}
244257
}
245258
axle.Initialize();
246259
}
@@ -598,6 +611,7 @@ public float TransmissionEfficiency
598611
/// </summary>
599612
public bool IsWheelSlip { get; private set; }
600613
float WheelSlipTimeS;
614+
public float WheelSlipThresholdTimeS = 1;
601615

602616
/// <summary>
603617
/// Wheelslip threshold value used to indicate maximal effective slip
@@ -659,6 +673,7 @@ public void ComputeWheelSlipThresholdMpS()
659673
/// </summary>
660674
public bool IsWheelSlipWarning { get; private set; }
661675
float WheelSlipWarningTimeS;
676+
public float WheelSlipWarningThresholdTimeS = 1;
662677

663678
/// <summary>
664679
/// Read only slip speed value in metric meters per second
@@ -1102,7 +1117,7 @@ public virtual void Update(float elapsedSeconds)
11021117
if (Math.Abs(SlipSpeedMpS) > WheelSlipThresholdMpS)
11031118
{
11041119
// Wait some time before indicating wheelslip to avoid false triggers
1105-
if (WheelSlipTimeS > 1)
1120+
if (WheelSlipTimeS > WheelSlipThresholdTimeS)
11061121
{
11071122
IsWheelSlip = IsWheelSlipWarning = true;
11081123
}
@@ -1111,7 +1126,7 @@ public virtual void Update(float elapsedSeconds)
11111126
else if (Math.Abs(SlipSpeedPercent) > SlipWarningTresholdPercent)
11121127
{
11131128
// Wait some time before indicating wheelslip to avoid false triggers
1114-
if (WheelSlipWarningTimeS > 1) IsWheelSlipWarning = true;
1129+
if (WheelSlipWarningTimeS > WheelSlipWarningThresholdTimeS) IsWheelSlipWarning = true;
11151130
IsWheelSlip = false;
11161131
WheelSlipWarningTimeS += elapsedSeconds;
11171132
}

0 commit comments

Comments
 (0)