@@ -250,7 +250,6 @@ public enum SlipControlType
250
250
public float SteamStaticWheelForce ;
251
251
public float SteamTangentialWheelForce ;
252
252
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
254
253
float DebugTimer ; // Used for debugging adhesion coefficient
255
254
bool DebugSpeedReached = false ; // Used for debugging adhesion coefficient
256
255
float DebugSpeedIncrement = 1 ; // Used for debugging adhesion coefficient
@@ -2264,24 +2263,6 @@ public override void Update(float elapsedClockSeconds)
2264
2263
UpdateAxles ( elapsedClockSeconds ) ;
2265
2264
2266
2265
UpdateTrackSander ( elapsedClockSeconds ) ;
2267
-
2268
- if ( this is MSTSDieselLocomotive || this is MSTSElectricLocomotive ) // Antislip and throttle down should only work on diesel or electric locomotives.
2269
- {
2270
-
2271
- // If wheel slip waring activated, and antislip is set in ENG file then reduce throttle setting to a value below warning power
2272
- if ( WheelSlipWarning && AntiSlip )
2273
- {
2274
- ThrottleController . SetValue ( PreviousThrottleSetting ) ;
2275
- }
2276
-
2277
-
2278
- PreviousThrottleSetting = ( ThrottlePercent / 100.0f ) - 0.005f ;
2279
- PreviousThrottleSetting = MathHelper . Clamp ( PreviousThrottleSetting , 0.0f , 1.0f ) ; // Prevents parameter going outside of bounds
2280
-
2281
- // If wheels slip and WheelslipCausesThrottleDown is set in engine file reduce throttle to 0 setting
2282
- if ( WheelslipCausesThrottleDown && WheelSlip )
2283
- ThrottleController . SetValue ( 0.0f ) ;
2284
- }
2285
2266
break ;
2286
2267
default :
2287
2268
break ;
@@ -2742,18 +2723,34 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
2742
2723
{
2743
2724
if ( axle . DriveType == AxleDriveType . ForceDriven )
2744
2725
{
2726
+ float prevForceN = axle . DriveForceN ;
2745
2727
axle . DriveForceN = TractiveForceN * axle . TractiveForceFraction ;
2746
2728
if ( SlipControlSystem == SlipControlType . Full )
2747
2729
{
2748
2730
// Simple slip control
2749
2731
// Motive force is reduced to the maximum adhesive force
2750
2732
// In wheelslip situations, motive force is set to zero
2751
2733
float adhesionLimit ;
2752
- if ( axle . SlipSpeedPercent > 115 ) adhesionLimit = 0 ;
2753
- else if ( axle . SlipSpeedPercent > 95 ) adhesionLimit = axle . MaximumWheelAdhesion * ( 115 - axle . SlipSpeedPercent ) / 20 ;
2734
+ if ( axle . SlipPercent > 115 ) adhesionLimit = 0 ;
2735
+ else if ( axle . SlipPercent > 95 ) adhesionLimit = axle . MaximumWheelAdhesion * ( 115 - axle . SlipSpeedPercent ) / 20 ;
2754
2736
else adhesionLimit = axle . MaximumWheelAdhesion ;
2755
2737
axle . DriveForceN = Math . Sign ( axle . DriveForceN ) * Math . Min ( adhesionLimit * axle . AxleWeightN , Math . Abs ( axle . DriveForceN ) ) ;
2756
2738
}
2739
+ else if ( TractionForceN > 0 ) // only for traction (not for dynamic brake)
2740
+ {
2741
+ if ( WheelslipCausesThrottleDown && WheelSlip )
2742
+ {
2743
+ // Disable traction in the axle if slipping
2744
+ axle . DriveForceN = 0 ;
2745
+ }
2746
+ else if ( AntiSlip && AdvancedAdhesionModel && WheelSlipWarning )
2747
+ {
2748
+ // Reduce tractive force to 0 in 3 seconds until wheel slip warning ends
2749
+ float newForceN = Math . Max ( Math . Abs ( prevForceN ) - TractiveForceN * axle . TractiveForceFraction * elapsedClockSeconds / 3 , 0 ) ;
2750
+ if ( axle . DriveForceN > 0 && prevForceN >= 0 ) axle . DriveForceN = newForceN ;
2751
+ else if ( axle . DriveForceN < 0 && prevForceN <= 0 ) axle . DriveForceN = - newForceN ;
2752
+ }
2753
+ }
2757
2754
}
2758
2755
}
2759
2756
}
0 commit comments