@@ -2663,7 +2663,7 @@ public float GetAvailableDynamicBrakeForceN(float d)
26632663 }
26642664 protected virtual void UpdateDynamicBrakeForce ( float elapsedClockSeconds )
26652665 {
2666- if ( ThrottlePercent <= 0 && TractionForceN < = 0 && LocomotivePowerSupply . DynamicBrakeAvailable && Direction != Direction . N && DynamicBrakePercent >= 0 )
2666+ if ( ThrottlePercent <= 0 && TractionForceN = = 0 && LocomotivePowerSupply . DynamicBrakeAvailable && Direction != Direction . N && DynamicBrakePercent >= 0 )
26672667 {
26682668 if ( DynamicBrakeCommandStartTime == null )
26692669 {
@@ -2753,7 +2753,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27532753 }
27542754 else if ( SlipControlSystem == SlipControlType . CutPower )
27552755 {
2756- if ( TractionForceN > 0 )
2756+ if ( ! DynamicBrake )
27572757 {
27582758 if ( axle . HuDIsWheelSlip ) SlipControlActive [ i ] = true ;
27592759 }
@@ -2767,7 +2767,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27672767 }
27682768 else if ( SlipControlSystem == SlipControlType . ReduceForce )
27692769 {
2770- if ( TractionForceN > 0 && axle . DriveForceN != 0 && AdvancedAdhesionModel )
2770+ if ( ! DynamicBrake && axle . DriveForceN != 0 && AdvancedAdhesionModel )
27712771 {
27722772 if ( axle . SlipPercent > axle . SlipWarningTresholdPercent ) SlipControlActive [ i ] = true ;
27732773 }
@@ -3166,6 +3166,8 @@ protected virtual void UpdateAxles(float elapsedClockSeconds)
31663166 // TODO: Rolling friction should be handled by the axle module
31673167
31683168 TractiveForceN = LocomotiveAxles . DriveForceN ;
3169+ if ( DynamicBrake ) DynamicBrakeForceN = Math . Abs ( TractiveForceN ) ;
3170+ else TractionForceN = Math . Abs ( TractiveForceN ) ;
31693171 MotiveForceN = LocomotiveAxles . AxleMotiveForceN ;
31703172 BrakeForceN = LocomotiveAxles . AxleBrakeForceN ;
31713173
@@ -5139,14 +5141,7 @@ public virtual float GetDataOf(CabViewControl cvc)
51395141 if ( LocomotiveAxles . Count > 0 )
51405142 {
51415143 data = 0.0f ;
5142- if ( TractionForceN > 0 )
5143- {
5144- //float rangeFactor = direction == 0 ? (float)cvc.MaxValue : (float)cvc.MinValue;
5145- float rangeFactor = direction == 0 ? MaxCurrentA : ( float ) cvc . MinValue ;
5146- data = TractionForceN / MaxForceN * rangeFactor ;
5147- data = Math . Abs ( data ) ;
5148- }
5149- if ( DynamicBrakeForceN > 0 )
5144+ if ( DynamicBrake )
51505145 {
51515146 float rangeFactor ;
51525147 if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS )
@@ -5165,6 +5160,13 @@ public virtual float GetDataOf(CabViewControl cvc)
51655160 }
51665161 data = DynamicBrakeForceN / MaxDynamicBrakeForceN * rangeFactor ;
51675162 }
5163+ else
5164+ {
5165+ //float rangeFactor = direction == 0 ? (float)cvc.MaxValue : (float)cvc.MinValue;
5166+ float rangeFactor = direction == 0 ? MaxCurrentA : ( float ) cvc . MinValue ;
5167+ data = TractionForceN / MaxForceN * rangeFactor ;
5168+ data = Math . Abs ( data ) ;
5169+ }
51685170 if ( direction == 1 )
51695171 data = - data ;
51705172 if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS ) data = Math . Abs ( data ) ;
@@ -5184,16 +5186,16 @@ public virtual float GetDataOf(CabViewControl cvc)
51845186 if ( DynamicBrakeMaxCurrentA == 0 )
51855187 DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
51865188 data = 0.0f ;
5187- if ( TractionForceN > 0 )
5188- {
5189- data = TractiveForceN / MaxForceN * MaxCurrentA ;
5190- data = Math . Abs ( data ) ;
5191- }
5192- if ( DynamicBrakeForceN > 0 )
5189+ if ( DynamicBrake )
51935190 {
51945191 data = DynamicBrakeForceN / MaxDynamicBrakeForceN * DynamicBrakeMaxCurrentA ;
51955192 data = - Math . Abs ( data ) ; // Ensure that dynamic force is seen as a "-ve force", changes colour on the load meter
51965193 }
5194+ else
5195+ {
5196+ data = TractiveForceN / MaxForceN * MaxCurrentA ;
5197+ data = Math . Abs ( data ) ;
5198+ }
51975199 if ( direction == 1 )
51985200 data = - data ;
51995201 break ;
@@ -5205,7 +5207,7 @@ public virtual float GetDataOf(CabViewControl cvc)
52055207 direction = ( ( CVCGauge ) cvc ) . Direction ;
52065208 data = 0.0f ;
52075209 data = TractiveForceN ;
5208- if ( DynamicBrakeForceN > 0 )
5210+ if ( DynamicBrake )
52095211 {
52105212 data = DynamicBrakeForceN ;
52115213 }
@@ -5217,13 +5219,13 @@ public virtual float GetDataOf(CabViewControl cvc)
52175219 MaxCurrentA = ( float ) cvc . MaxValue ;
52185220 if ( DynamicBrakeMaxCurrentA == 0 )
52195221 DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5220- if ( TractionForceN > 0 )
5222+ if ( DynamicBrake )
52215223 {
5222- data = ( data / MaxForceN ) * MaxCurrentA ;
5224+ data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
52235225 }
5224- if ( DynamicBrakeForceN > 0 )
5226+ else
52255227 {
5226- data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5228+ data = ( data / MaxForceN ) * MaxCurrentA ;
52275229 }
52285230 data = Math . Abs ( data ) ;
52295231 break ;
@@ -5261,13 +5263,13 @@ public virtual float GetDataOf(CabViewControl cvc)
52615263 MaxCurrentA = ( float ) cvc . MaxValue ;
52625264 if ( DynamicBrakeMaxCurrentA == 0 )
52635265 DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5264- if ( TractionForceN > 0 )
5266+ if ( DynamicBrake )
52655267 {
5266- data = ( data / MaxForceN ) * MaxCurrentA ;
5268+ data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
52675269 }
5268- if ( DynamicBrakeForceN > 0 )
5270+ else
52695271 {
5270- data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5272+ data = ( data / MaxForceN ) * MaxCurrentA ;
52715273 }
52725274 break ;
52735275
0 commit comments