@@ -2663,7 +2663,7 @@ public float GetAvailableDynamicBrakeForceN(float d)
2663
2663
}
2664
2664
protected virtual void UpdateDynamicBrakeForce ( float elapsedClockSeconds )
2665
2665
{
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 )
2667
2667
{
2668
2668
if ( DynamicBrakeCommandStartTime == null )
2669
2669
{
@@ -2753,7 +2753,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
2753
2753
}
2754
2754
else if ( SlipControlSystem == SlipControlType . CutPower )
2755
2755
{
2756
- if ( TractionForceN > 0 )
2756
+ if ( ! DynamicBrake )
2757
2757
{
2758
2758
if ( axle . HuDIsWheelSlip ) SlipControlActive [ i ] = true ;
2759
2759
}
@@ -2767,7 +2767,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds)
2767
2767
}
2768
2768
else if ( SlipControlSystem == SlipControlType . ReduceForce )
2769
2769
{
2770
- if ( TractionForceN > 0 && axle . DriveForceN != 0 && AdvancedAdhesionModel )
2770
+ if ( ! DynamicBrake && axle . DriveForceN != 0 && AdvancedAdhesionModel )
2771
2771
{
2772
2772
if ( axle . SlipPercent > axle . SlipWarningTresholdPercent ) SlipControlActive [ i ] = true ;
2773
2773
}
@@ -3166,6 +3166,8 @@ protected virtual void UpdateAxles(float elapsedClockSeconds)
3166
3166
// TODO: Rolling friction should be handled by the axle module
3167
3167
3168
3168
TractiveForceN = LocomotiveAxles . DriveForceN ;
3169
+ if ( DynamicBrake ) DynamicBrakeForceN = Math . Abs ( TractiveForceN ) ;
3170
+ else TractionForceN = Math . Abs ( TractiveForceN ) ;
3169
3171
MotiveForceN = LocomotiveAxles . AxleMotiveForceN ;
3170
3172
BrakeForceN = LocomotiveAxles . AxleBrakeForceN ;
3171
3173
@@ -5139,14 +5141,7 @@ public virtual float GetDataOf(CabViewControl cvc)
5139
5141
if ( LocomotiveAxles . Count > 0 )
5140
5142
{
5141
5143
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 )
5150
5145
{
5151
5146
float rangeFactor ;
5152
5147
if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS )
@@ -5165,6 +5160,13 @@ public virtual float GetDataOf(CabViewControl cvc)
5165
5160
}
5166
5161
data = DynamicBrakeForceN / MaxDynamicBrakeForceN * rangeFactor ;
5167
5162
}
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
+ }
5168
5170
if ( direction == 1 )
5169
5171
data = - data ;
5170
5172
if ( cvc . ControlType . Type == CABViewControlTypes . AMMETER_ABS ) data = Math . Abs ( data ) ;
@@ -5184,16 +5186,16 @@ public virtual float GetDataOf(CabViewControl cvc)
5184
5186
if ( DynamicBrakeMaxCurrentA == 0 )
5185
5187
DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5186
5188
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 )
5193
5190
{
5194
5191
data = DynamicBrakeForceN / MaxDynamicBrakeForceN * DynamicBrakeMaxCurrentA ;
5195
5192
data = - Math . Abs ( data ) ; // Ensure that dynamic force is seen as a "-ve force", changes colour on the load meter
5196
5193
}
5194
+ else
5195
+ {
5196
+ data = TractiveForceN / MaxForceN * MaxCurrentA ;
5197
+ data = Math . Abs ( data ) ;
5198
+ }
5197
5199
if ( direction == 1 )
5198
5200
data = - data ;
5199
5201
break ;
@@ -5205,7 +5207,7 @@ public virtual float GetDataOf(CabViewControl cvc)
5205
5207
direction = ( ( CVCGauge ) cvc ) . Direction ;
5206
5208
data = 0.0f ;
5207
5209
data = TractiveForceN ;
5208
- if ( DynamicBrakeForceN > 0 )
5210
+ if ( DynamicBrake )
5209
5211
{
5210
5212
data = DynamicBrakeForceN ;
5211
5213
}
@@ -5217,13 +5219,13 @@ public virtual float GetDataOf(CabViewControl cvc)
5217
5219
MaxCurrentA = ( float ) cvc . MaxValue ;
5218
5220
if ( DynamicBrakeMaxCurrentA == 0 )
5219
5221
DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5220
- if ( TractionForceN > 0 )
5222
+ if ( DynamicBrake )
5221
5223
{
5222
- data = ( data / MaxForceN ) * MaxCurrentA ;
5224
+ data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5223
5225
}
5224
- if ( DynamicBrakeForceN > 0 )
5226
+ else
5225
5227
{
5226
- data = ( DynamicBrakeForceN / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5228
+ data = ( data / MaxForceN ) * MaxCurrentA ;
5227
5229
}
5228
5230
data = Math . Abs ( data ) ;
5229
5231
break ;
@@ -5261,13 +5263,13 @@ public virtual float GetDataOf(CabViewControl cvc)
5261
5263
MaxCurrentA = ( float ) cvc . MaxValue ;
5262
5264
if ( DynamicBrakeMaxCurrentA == 0 )
5263
5265
DynamicBrakeMaxCurrentA = ( float ) cvc . MinValue ;
5264
- if ( TractionForceN > 0 )
5266
+ if ( DynamicBrake )
5265
5267
{
5266
- data = ( data / MaxForceN ) * MaxCurrentA ;
5268
+ data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5267
5269
}
5268
- if ( DynamicBrakeForceN > 0 )
5270
+ else
5269
5271
{
5270
- data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
5272
+ data = ( data / MaxForceN ) * MaxCurrentA ;
5271
5273
}
5272
5274
break ;
5273
5275
0 commit comments