@@ -929,7 +929,7 @@ public string GetDPDebugStatus()
929929 return status . ToString ( ) ;
930930 }
931931
932- public string GetDpuStatus ( bool dataDpu , CABViewControlUnits loadUnits = CABViewControlUnits . KILO_LBS ) // used by the TrainDpuInfo window
932+ public string GetDpuStatus ( bool dataDpu , CABViewControlUnits loadUnits = CABViewControlUnits . NONE ) // used by the TrainDpuInfo window
933933 {
934934 string throttle = "" ;
935935 if ( ThrottlePercent > 0 )
@@ -968,15 +968,46 @@ public string GetDpuStatus(bool dataDpu, CABViewControlUnits loadUnits = CABView
968968 status . AppendFormat ( "{0}\t " , throttle ) ;
969969
970970 // Load
971- var data = 0.0f ;
972- if ( ThrottlePercent > 0 )
971+ var data = 0f ;
972+ if ( FilteredMotiveForceN != 0 )
973+ data = Math . Abs ( this . FilteredMotiveForceN ) ;
974+ else
975+ data = Math . Abs ( this . LocomotiveAxle . DriveForceN ) ;
976+ if ( DynamicBrakePercent > 0 )
973977 {
974- if ( FilteredMotiveForceN != 0 )
975- data = FilteredMotiveForceN / MaxForceN * MaxCurrentA ;
976- else
977- data = LocomotiveAxle . DriveForceN / MaxForceN * MaxCurrentA ;
978+ data = - Math . Abs ( DynamicBrakeForceN ) ;
979+ }
980+ if ( loadUnits == CABViewControlUnits . NONE )
981+ loadUnits = IsMetric ? CABViewControlUnits . AMPS : CABViewControlUnits . KILO_LBS ;
982+ switch ( loadUnits )
983+ {
984+ case CABViewControlUnits . AMPS :
985+ if ( ThrottlePercent > 0 )
986+ {
987+ data = ( data / MaxForceN ) * MaxCurrentA ;
988+ }
989+ if ( DynamicBrakePercent > 0 )
990+ {
991+ data = ( data / MaxDynamicBrakeForceN ) * DynamicBrakeMaxCurrentA ;
992+ }
993+ status . AppendFormat ( "{0:F0} amps\t " , data ) ;
994+ break ;
995+
996+ case CABViewControlUnits . NEWTONS :
997+ status . AppendFormat ( "{0:F0} N\t " , data ) ;
998+ break ;
999+
1000+ case CABViewControlUnits . KILO_NEWTONS :
1001+ data = data / 1000.0f ;
1002+ status . AppendFormat ( "{0:F0} kN\t " , data ) ;
1003+ break ;
1004+
1005+ case CABViewControlUnits . KILO_LBS :
1006+ default :
1007+ data = N . ToLbf ( data ) * 0.001f ;
1008+ status . AppendFormat ( "{0:F0} klbf\t " , data ) ;
1009+ break ;
9781010 }
979- status . AppendFormat ( "{0:F0} amps\t " , Math . Abs ( data ) ) ;
9801011
9811012 // BP
9821013 var brakeInfoValue = brakeValue ( Simulator . Catalog . GetString ( "BP" ) , Simulator . Catalog . GetString ( "EOT" ) ) ;
0 commit comments