@@ -3793,9 +3793,17 @@ public void StartThrottleIncrease()
37933793 }
37943794
37953795 if ( CombinedControlType == CombinedControl . ThrottleDynamic && DynamicBrakeController . CurrentValue > 0 )
3796+ {
37963797 StartDynamicBrakeDecrease ( null ) ;
3798+ if ( DynamicBrakeController != null )
3799+ DynamicBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
3800+ }
37973801 else if ( CombinedControlType == CombinedControl . ThrottleAir && TrainBrakeController . CurrentValue > 0 )
3802+ {
37983803 StartTrainBrakeDecrease ( null ) ;
3804+ if ( TrainBrakeController != null )
3805+ TrainBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
3806+ }
37993807 else
38003808 StartThrottleIncrease ( ThrottleController . SmoothMax ( ) ) ;
38013809 }
@@ -3863,6 +3871,7 @@ public void StartThrottleDecrease(float? target)
38633871 }
38643872
38653873 protected bool speedSelectorModeDecreasing = false ;
3874+
38663875 public void StartThrottleDecrease ( )
38673876 {
38683877 if ( CruiseControl ? . SpeedRegMode == CruiseControl . SpeedRegulatorMode . Auto && CruiseControl . SelectedMaxAccelerationPercent != 0
@@ -3911,9 +3920,17 @@ public void StartThrottleDecrease()
39113920 ThrottleController . CurrentValue = 1 ;
39123921 }
39133922 if ( CombinedControlType == CombinedControl . ThrottleDynamic && ThrottleController . CurrentValue <= 0 )
3923+ {
39143924 StartDynamicBrakeIncrease ( null ) ;
3925+ if ( DynamicBrakeController != null )
3926+ DynamicBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
3927+ }
39153928 else if ( CombinedControlType == CombinedControl . ThrottleAir && ThrottleController . CurrentValue <= 0 )
3929+ {
39163930 StartTrainBrakeIncrease ( null ) ;
3931+ if ( TrainBrakeController != null )
3932+ TrainBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
3933+ }
39173934 else
39183935 StartThrottleDecrease ( ThrottleController . SmoothMin ( ) ) ;
39193936 }
@@ -3958,9 +3975,19 @@ public void StopThrottleDecrease()
39583975 ThrottleController . StopDecrease ( ) ;
39593976
39603977 if ( CombinedControlType == CombinedControl . ThrottleDynamic )
3978+ {
3979+ // sometimes called without a corresponding start
3980+ if ( DynamicBrakeController != null && DynamicBrakeController . CommandStartTime < CommandStartTime )
3981+ DynamicBrakeController . CommandStartTime = CommandStartTime ;
39613982 StopDynamicBrakeIncrease ( ) ;
3983+ }
39623984 else if ( CombinedControlType == CombinedControl . ThrottleAir )
3985+ {
3986+ // sometimes called without a corresponding start
3987+ if ( TrainBrakeController != null && TrainBrakeController . CommandStartTime < CommandStartTime )
3988+ TrainBrakeController . CommandStartTime = CommandStartTime ;
39633989 StopTrainBrakeIncrease ( ) ;
3990+ }
39643991 if ( ThrottleController . SmoothMin ( ) != null )
39653992 new ContinuousThrottleCommand ( Simulator . Log , false , ThrottleController . CurrentValue , CommandStartTime ) ;
39663993 }
@@ -4657,6 +4684,7 @@ public void StartEngineBrakeIncrease(float? target)
46574684
46584685 //if (CruiseControl != null) CruiseControl.EngineBrakePriority = true;
46594686 EngineBrakeController . StartIncrease ( target ) ;
4687+ EngineBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
46604688 Simulator . Confirmer . Confirm ( CabControl . EngineBrake , CabSetting . Increase , GetEngineBrakeStatus ( ) ) ;
46614689 SignalEvent ( Event . EngineBrakeChange ) ;
46624690 }
@@ -4788,6 +4816,7 @@ public void StartBrakemanBrakeIncrease(float? target)
47884816 return ;
47894817
47904818 BrakemanBrakeController . StartIncrease ( target ) ;
4819+ BrakemanBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
47914820 Simulator . Confirmer . Confirm ( CabControl . BrakemanBrake , CabSetting . Increase , GetBrakemanBrakeStatus ( ) ) ;
47924821// SignalEvent(Event.EngineBrakeChange);
47934822 }
@@ -4902,6 +4931,7 @@ public void StartDynamicBrakeIncrease(float? target)
49024931 float prevValue = DynamicBrakeController . CurrentValue ;
49034932
49044933 DynamicBrakeController . StartIncrease ( target ) ;
4934+ DynamicBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
49054935
49064936 AlerterReset ( TCSEvent . DynamicBrakeChanged ) ;
49074937 SignalEvent ( Event . DynamicBrakeChange ) ;
@@ -4936,6 +4966,7 @@ public void StartDynamicBrakeDecrease(float? target)
49364966 if ( DynamicBrakeController ? . CurrentValue > 0 )
49374967 {
49384968 DynamicBrakeController . StartDecrease ( target ) ;
4969+ DynamicBrakeController . CommandStartTime = Simulator . ClockTime ; // Remember when the command was issued
49394970
49404971 AlerterReset ( TCSEvent . DynamicBrakeChanged ) ;
49414972 SignalEvent ( Event . DynamicBrakeChange ) ;
0 commit comments