@@ -2660,7 +2660,7 @@ public float GetAvailableDynamicBrakeForceN(float d)
26602660 }
26612661 protected virtual void UpdateDynamicBrakeForce ( float elapsedClockSeconds )
26622662 {
2663- if ( ThrottlePercent <= 0 && TractionForceN < = 0 && LocomotivePowerSupply . DynamicBrakeAvailable && Direction != Direction . N && DynamicBrakePercent >= 0 )
2663+ if ( ThrottlePercent <= 0 && TractionForceN = = 0 && LocomotivePowerSupply . DynamicBrakeAvailable && Direction != Direction . N && DynamicBrakePercent >= 0 )
26642664 {
26652665 if ( DynamicBrakeCommandStartTime == null )
26662666 {
@@ -2750,7 +2750,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27502750 }
27512751 else if ( SlipControlSystem == SlipControlType . CutPower )
27522752 {
2753- if ( TractionForceN > 0 )
2753+ if ( ! DynamicBrake )
27542754 {
27552755 if ( axle . HuDIsWheelSlip ) SlipControlActive [ i ] = true ;
27562756 }
@@ -2764,7 +2764,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
27642764 }
27652765 else if ( SlipControlSystem == SlipControlType . ReduceForce )
27662766 {
2767- if ( TractionForceN > 0 && axle . DriveForceN != 0 && AdvancedAdhesionModel )
2767+ if ( ! DynamicBrake && axle . DriveForceN != 0 && AdvancedAdhesionModel )
27682768 {
27692769 if ( axle . SlipPercent > axle . SlipWarningTresholdPercent ) SlipControlActive [ i ] = true ;
27702770 }
@@ -3163,6 +3163,8 @@ protected virtual void UpdateAxles(float elapsedClockSeconds)
31633163 // TODO: Rolling friction should be handled by the axle module
31643164
31653165 TractiveForceN = LocomotiveAxles . DriveForceN ;
3166+ if ( DynamicBrake ) DynamicBrakeForceN = Math . Abs ( TractiveForceN ) ;
3167+ else TractionForceN = Math . Abs ( TractiveForceN ) ;
31663168 MotiveForceN = LocomotiveAxles . AxleMotiveForceN ;
31673169 BrakeForceN = LocomotiveAxles . AxleBrakeForceN ;
31683170
@@ -5375,14 +5377,7 @@ public virtual float GetDataOf(CabViewControl cvc)
53755377 if ( LocomotiveAxles . Count > 0 )
53765378 {
53775379 data = 0.0f ;
5378- if ( TractionForceN > 0 )
5379- {
5380- //float rangeFactor = direction == 0 ? (float)cvc.MaxValue : (float)cvc.MinValue;
5381- float rangeFactor = direction == 0 ? MaxCurrentA : ( float ) cvc . MinValue ;
5382- data = TractionForceN / MaxForceN * rangeFactor ;
5383- data = Math . Abs ( data ) ;
5384- }
5385- if ( DynamicBrakeForceN > 0 )
5380+ if ( DynamicBrake )
53865381 {
53875382 float rangeFactor ;
53885383 if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS )
@@ -5401,6 +5396,13 @@ public virtual float GetDataOf(CabViewControl cvc)
54015396 }
54025397 data = DynamicBrakeForceN / MaxDynamicBrakeForceN * rangeFactor ;
54035398 }
5399+ else
5400+ {
5401+ //float rangeFactor = direction == 0 ? (float)cvc.MaxValue : (float)cvc.MinValue;
5402+ float rangeFactor = direction == 0 ? MaxCurrentA : ( float ) cvc . MinValue ;
5403+ data = TractionForceN / MaxForceN * rangeFactor ;
5404+ data = Math . Abs ( data ) ;
5405+ }
54045406 if ( direction == 1 )
54055407 data = - data ;
54065408 if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS ) data = Math . Abs ( data ) ;
@@ -5420,16 +5422,16 @@ public virtual float GetDataOf(CabViewControl cvc)
54205422 if ( DynamicBrakeMaxCurrentA == 0 )
54215423 DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
54225424 data = 0.0f ;
5423- if ( TractionForceN > 0 )
5424- {
5425- data = TractiveForceN / MaxForceN * MaxCurrentA ;
5426- data = Math . Abs ( data ) ;
5427- }
5428- if ( DynamicBrakeForceN > 0 )
5425+ if ( DynamicBrake )
54295426 {
54305427 data = DynamicBrakeForceN / MaxDynamicBrakeForceN * DynamicBrakeMaxCurrentA ;
54315428 data = - Math . Abs ( data ) ; // Ensure that dynamic force is seen as a "-ve force", changes colour on the load meter
54325429 }
5430+ else
5431+ {
5432+ data = TractiveForceN / MaxForceN * MaxCurrentA ;
5433+ data = Math . Abs ( data ) ;
5434+ }
54335435 if ( direction == 1 )
54345436 data = - data ;
54355437 break ;
@@ -5441,7 +5443,7 @@ public virtual float GetDataOf(CabViewControl cvc)
54415443 direction = ( ( CVCGauge ) cvc ) . Direction ;
54425444 data = 0.0f ;
54435445 data = TractiveForceN ;
5444- if ( DynamicBrakeForceN > 0 )
5446+ if ( DynamicBrake )
54455447 {
54465448 data = DynamicBrakeForceN ;
54475449 }
@@ -5453,13 +5455,13 @@ public virtual float GetDataOf(CabViewControl cvc)
54535455 MaxCurrentA = ( float ) cvc . MaxValue ;
54545456 if ( DynamicBrakeMaxCurrentA == 0 )
54555457 DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5456- if ( TractionForceN > 0 )
5458+ if ( DynamicBrake )
54575459 {
5458- data = ( data / MaxForceN ) * MaxCurrentA ;
5460+ data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
54595461 }
5460- if ( DynamicBrakeForceN > 0 )
5462+ else
54615463 {
5462- data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5464+ data = ( data / MaxForceN ) * MaxCurrentA ;
54635465 }
54645466 data = Math . Abs ( data ) ;
54655467 break ;
@@ -5497,13 +5499,13 @@ public virtual float GetDataOf(CabViewControl cvc)
54975499 MaxCurrentA = ( float ) cvc . MaxValue ;
54985500 if ( DynamicBrakeMaxCurrentA == 0 )
54995501 DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5500- if ( TractionForceN > 0 )
5502+ if ( DynamicBrake )
55015503 {
5502- data = ( data / MaxForceN ) * MaxCurrentA ;
5504+ data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
55035505 }
5504- if ( DynamicBrakeForceN > 0 )
5506+ else
55055507 {
5506- data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5508+ data = ( data / MaxForceN ) * MaxCurrentA ;
55075509 }
55085510 break ;
55095511
0 commit comments