Skip to content

Commit 3940e13

Browse files
committed
Automatic merge of T1.6-rc2-41-gacd714487 and 9 pull requests
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2391bc0: Automatic speed control - Pull request #1107 at f5eb3dc: Fix DPMode when last remote is moved to front. - Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception - Pull request #1114 at 9a4a873: Fix color of DB in DrivingInfo when in setup with DPU fenced. - Pull request #1115 at 01c0838: Do not activate ETS switch if no suitable cars are attached - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1104 at f9691cf: Handle simple adhesion within the axle module - Pull request #1081 at 689494b: Brake cuts power unification
11 parents 1ca7e1d + acd7144 + e10390b + 2391bc0 + f5eb3dc + 387388e + 9a4a873 + 01c0838 + 5845a1a + f9691cf + 689494b commit 3940e13

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

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

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ public enum SlipControlType
250250
public float SteamStaticWheelForce;
251251
public float SteamTangentialWheelForce;
252252
public float SteamDrvWheelWeightLbs; // Weight on each drive axle
253-
public float PreviousThrottleSetting = 0.0f; // Holds the value of the previous throttle setting for calculating the correct antislip speed
254253
float DebugTimer; // Used for debugging adhesion coefficient
255254
bool DebugSpeedReached = false; // Used for debugging adhesion coefficient
256255
float DebugSpeedIncrement = 1; // Used for debugging adhesion coefficient
@@ -2267,24 +2266,6 @@ public override void Update(float elapsedClockSeconds)
22672266
UpdateAxles(elapsedClockSeconds);
22682267

22692268
UpdateTrackSander(elapsedClockSeconds);
2270-
2271-
if (this is MSTSDieselLocomotive || this is MSTSElectricLocomotive) // Antislip and throttle down should only work on diesel or electric locomotives.
2272-
{
2273-
2274-
// If wheel slip waring activated, and antislip is set in ENG file then reduce throttle setting to a value below warning power
2275-
if (WheelSlipWarning && AntiSlip)
2276-
{
2277-
ThrottleController.SetValue(PreviousThrottleSetting);
2278-
}
2279-
2280-
2281-
PreviousThrottleSetting = (ThrottlePercent / 100.0f) - 0.005f;
2282-
PreviousThrottleSetting = MathHelper.Clamp(PreviousThrottleSetting, 0.0f, 1.0f); // Prevents parameter going outside of bounds
2283-
2284-
// If wheels slip and WheelslipCausesThrottleDown is set in engine file reduce throttle to 0 setting
2285-
if (WheelslipCausesThrottleDown && WheelSlip)
2286-
ThrottleController.SetValue(0.0f);
2287-
}
22882269
break;
22892270
default:
22902271
break;
@@ -2745,18 +2726,34 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27452726
{
27462727
if (axle.DriveType == AxleDriveType.ForceDriven)
27472728
{
2729+
float prevForceN = axle.DriveForceN;
27482730
axle.DriveForceN = TractiveForceN * axle.TractiveForceFraction;
27492731
if (SlipControlSystem == SlipControlType.Full)
27502732
{
27512733
// Simple slip control
27522734
// Motive force is reduced to the maximum adhesive force
27532735
// In wheelslip situations, motive force is set to zero
27542736
float adhesionLimit;
2755-
if (axle.SlipSpeedPercent > 115) adhesionLimit = 0;
2756-
else if (axle.SlipSpeedPercent > 95) adhesionLimit = axle.MaximumWheelAdhesion * (115 - axle.SlipSpeedPercent) / 20;
2737+
if (axle.SlipPercent > 115) adhesionLimit = 0;
2738+
else if (axle.SlipPercent > 95) adhesionLimit = axle.MaximumWheelAdhesion * (115 - axle.SlipSpeedPercent) / 20;
27572739
else adhesionLimit = axle.MaximumWheelAdhesion;
27582740
axle.DriveForceN = Math.Sign(axle.DriveForceN) * Math.Min(adhesionLimit * axle.AxleWeightN, Math.Abs(axle.DriveForceN));
27592741
}
2742+
else if (TractionForceN > 0) // only for traction (not for dynamic brake)
2743+
{
2744+
if (WheelslipCausesThrottleDown && WheelSlip)
2745+
{
2746+
// Disable traction in the axle if slipping
2747+
axle.DriveForceN = 0;
2748+
}
2749+
else if (AntiSlip && AdvancedAdhesionModel && WheelSlipWarning)
2750+
{
2751+
// Reduce tractive force to 0 in 3 seconds until wheel slip warning ends
2752+
float newForceN = Math.Max(Math.Abs(prevForceN) - TractiveForceN * axle.TractiveForceFraction * elapsedClockSeconds / 3, 0);
2753+
if (axle.DriveForceN > 0 && prevForceN >= 0) axle.DriveForceN = newForceN;
2754+
else if (axle.DriveForceN < 0 && prevForceN <= 0) axle.DriveForceN = -newForceN;
2755+
}
2756+
}
27602757
}
27612758
}
27622759
}

0 commit comments

Comments
 (0)