@@ -2660,7 +2660,7 @@ public float GetAvailableDynamicBrakeForceN(float d)
2660
2660
}
2661
2661
protected virtual void UpdateDynamicBrakeForce ( float elapsedClockSeconds )
2662
2662
{
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 )
2664
2664
{
2665
2665
if ( DynamicBrakeCommandStartTime == null )
2666
2666
{
@@ -2750,7 +2750,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
2750
2750
}
2751
2751
else if ( SlipControlSystem == SlipControlType . CutPower )
2752
2752
{
2753
- if ( TractionForceN > 0 )
2753
+ if ( ! DynamicBrake )
2754
2754
{
2755
2755
if ( axle . HuDIsWheelSlip ) SlipControlActive [ i ] = true ;
2756
2756
}
@@ -2764,7 +2764,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
2764
2764
}
2765
2765
else if ( SlipControlSystem == SlipControlType . ReduceForce )
2766
2766
{
2767
- if ( TractionForceN > 0 && axle . DriveForceN != 0 && AdvancedAdhesionModel )
2767
+ if ( ! DynamicBrake && axle . DriveForceN != 0 && AdvancedAdhesionModel )
2768
2768
{
2769
2769
if ( axle . SlipPercent > axle . SlipWarningTresholdPercent ) SlipControlActive [ i ] = true ;
2770
2770
}
@@ -3163,6 +3163,8 @@ protected virtual void UpdateAxles(float elapsedClockSeconds)
3163
3163
// TODO: Rolling friction should be handled by the axle module
3164
3164
3165
3165
TractiveForceN = LocomotiveAxles . DriveForceN ;
3166
+ if ( DynamicBrake ) DynamicBrakeForceN = Math . Abs ( TractiveForceN ) ;
3167
+ else TractionForceN = Math . Abs ( TractiveForceN ) ;
3166
3168
MotiveForceN = LocomotiveAxles . AxleMotiveForceN ;
3167
3169
BrakeForceN = LocomotiveAxles . AxleBrakeForceN ;
3168
3170
@@ -5375,14 +5377,7 @@ public virtual float GetDataOf(CabViewControl cvc)
5375
5377
if ( LocomotiveAxles . Count > 0 )
5376
5378
{
5377
5379
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 )
5386
5381
{
5387
5382
float rangeFactor ;
5388
5383
if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS )
@@ -5401,6 +5396,13 @@ public virtual float GetDataOf(CabViewControl cvc)
5401
5396
}
5402
5397
data = DynamicBrakeForceN / MaxDynamicBrakeForceN * rangeFactor ;
5403
5398
}
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
+ }
5404
5406
if ( direction == 1 )
5405
5407
data = - data ;
5406
5408
if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS ) data = Math . Abs ( data ) ;
@@ -5420,16 +5422,16 @@ public virtual float GetDataOf(CabViewControl cvc)
5420
5422
if ( DynamicBrakeMaxCurrentA == 0 )
5421
5423
DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5422
5424
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 )
5429
5426
{
5430
5427
data = DynamicBrakeForceN / MaxDynamicBrakeForceN * DynamicBrakeMaxCurrentA ;
5431
5428
data = - Math . Abs ( data ) ; // Ensure that dynamic force is seen as a "-ve force", changes colour on the load meter
5432
5429
}
5430
+ else
5431
+ {
5432
+ data = TractiveForceN / MaxForceN * MaxCurrentA ;
5433
+ data = Math . Abs ( data ) ;
5434
+ }
5433
5435
if ( direction == 1 )
5434
5436
data = - data ;
5435
5437
break ;
@@ -5441,7 +5443,7 @@ public virtual float GetDataOf(CabViewControl cvc)
5441
5443
direction = ( ( CVCGauge ) cvc ) . Direction ;
5442
5444
data = 0.0f ;
5443
5445
data = TractiveForceN ;
5444
- if ( DynamicBrakeForceN > 0 )
5446
+ if ( DynamicBrake )
5445
5447
{
5446
5448
data = DynamicBrakeForceN ;
5447
5449
}
@@ -5453,13 +5455,13 @@ public virtual float GetDataOf(CabViewControl cvc)
5453
5455
MaxCurrentA = ( float ) cvc . MaxValue ;
5454
5456
if ( DynamicBrakeMaxCurrentA == 0 )
5455
5457
DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5456
- if ( TractionForceN > 0 )
5458
+ if ( DynamicBrake )
5457
5459
{
5458
- data = ( data / MaxForceN ) * MaxCurrentA ;
5460
+ data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5459
5461
}
5460
- if ( DynamicBrakeForceN > 0 )
5462
+ else
5461
5463
{
5462
- data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5464
+ data = ( data / MaxForceN ) * MaxCurrentA ;
5463
5465
}
5464
5466
data = Math . Abs ( data ) ;
5465
5467
break ;
@@ -5497,13 +5499,13 @@ public virtual float GetDataOf(CabViewControl cvc)
5497
5499
MaxCurrentA = ( float ) cvc . MaxValue ;
5498
5500
if ( DynamicBrakeMaxCurrentA == 0 )
5499
5501
DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5500
- if ( TractionForceN > 0 )
5502
+ if ( DynamicBrake )
5501
5503
{
5502
- data = ( data / MaxForceN ) * MaxCurrentA ;
5504
+ data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5503
5505
}
5504
- if ( DynamicBrakeForceN > 0 )
5506
+ else
5505
5507
{
5506
- data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5508
+ data = ( data / MaxForceN ) * MaxCurrentA ;
5507
5509
}
5508
5510
break ;
5509
5511
0 commit comments