@@ -2605,6 +2605,7 @@ protected virtual void UpdateTractionForce(float elapsedClockSeconds)
26052605
26062606 // Ensure that throttle never exceeds the limits imposed by other subsystems
26072607 float maxthrottle = MaxThrottlePercent / 100 ;
2608+ if ( DynamicBrake ) maxthrottle = 0 ;
26082609 // For diesel locomotives, also take into account the throttle setting associated to the current engine RPM
26092610 if ( IsPlayerTrain && this is MSTSDieselLocomotive diesel && ! diesel . TractiveForcePowerLimited ) maxthrottle = Math . Min ( maxthrottle , diesel . DieselEngines . ApparentThrottleSetting / 100.0f ) ;
26102611 if ( t > maxthrottle ) t = maxthrottle ;
@@ -2651,26 +2652,18 @@ public float GetAvailableDynamicBrakeForceN(float d)
26512652 }
26522653 protected virtual void UpdateDynamicBrakeForce ( float elapsedClockSeconds )
26532654 {
2654- if ( ThrottlePercent <= 0 && TractionForceN <= 0 && LocomotivePowerSupply . DynamicBrakeAvailable && Direction != Direction . N )
2655+ if ( ThrottlePercent <= 0 && TractionForceN <= 0 && LocomotivePowerSupply . DynamicBrakeAvailable && Direction != Direction . N && DynamicBrakePercent >= 0 )
26552656 {
2656- if ( DynamicBrakePercent >= 0 )
2657+ if ( DynamicBrakeCommandStartTime == null )
26572658 {
2658- if ( DynamicBrakeCommandStartTime == null )
2659- {
2660- DynamicBrakeCommandStartTime = Simulator . ClockTime ;
2661- }
2662- if ( ! DynamicBrake && DynamicBrakeCommandStartTime + DynamicBrakeDelayS < Simulator . ClockTime )
2663- {
2664- DynamicBrake = true ;
2665- }
2659+ DynamicBrakeCommandStartTime = Simulator . ClockTime ;
26662660 }
2667- else if ( DynamicBrakeForceN == 0 )
2661+ if ( ! DynamicBrake && DynamicBrakeCommandStartTime + DynamicBrakeDelayS < Simulator . ClockTime )
26682662 {
2669- DynamicBrake = false ;
2670- DynamicBrakeCommandStartTime = null ;
2663+ DynamicBrake = true ;
26712664 }
26722665 }
2673- else
2666+ else if ( DynamicBrakeForceN == 0 || ! LocomotivePowerSupply . DynamicBrakeAvailable || Direction == Direction . N )
26742667 {
26752668 DynamicBrake = false ;
26762669 DynamicBrakeCommandStartTime = null ;
0 commit comments