@@ -2008,9 +2008,12 @@ public override void Update(float elapsedClockSeconds)
20082008
20092009 // Cruise Control
20102010 CruiseControl ? . Update ( elapsedClockSeconds ) ;
2011-
2012- // TODO this is a wild simplification for electric and diesel electric
2013- UpdateTractiveForce ( elapsedClockSeconds , ThrottlePercent / 100f , AbsSpeedMpS , AbsWheelSpeedMpS ) ;
2011+
2012+ if ( EngineType == EngineTypes . Diesel || EngineType == EngineTypes . Electric )
2013+ {
2014+ // TODO this is a wild simplification for electric and diesel electric
2015+ UpdateTractiveForce ( elapsedClockSeconds , ThrottlePercent / 100f , AbsSpeedMpS , AbsWheelSpeedMpS , 0 ) ;
2016+ }
20142017
20152018 foreach ( MultiPositionController mpc in MultiPositionControllers )
20162019 {
@@ -2372,7 +2375,7 @@ protected virtual void UpdateControllers(float elapsedClockSeconds)
23722375 /// <summary>
23732376 /// This function updates periodically the locomotive's motive force.
23742377 /// </summary>
2375- protected virtual void UpdateTractiveForce ( float elapsedClockSeconds , float t , float AbsSpeedMpS , float AbsWheelSpeedMpS )
2378+ protected virtual void UpdateTractiveForce ( float elapsedClockSeconds , float t , float AbsSpeedMpS , float AbsWheelSpeedMpS , int numberofengine )
23762379 {
23772380 // Method to set force and power info
23782381 // An alternative method in the steam locomotive will override this and input force and power info for it.
@@ -2438,7 +2441,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds, float t, f
24382441 AverageForceN = w * AverageForceN + ( 1 - w ) * TractiveForceN ;
24392442 }
24402443
2441- ApplyDirectionToTractiveForce ( ) ;
2444+ ApplyDirectionToTractiveForce ( ref TractiveForceN ) ;
24422445
24432446 // Calculate the total tractive force for the locomotive - ie Traction + Dynamic Braking force.
24442447 // Note typically only one of the above will only ever be non-zero at the one time.
@@ -2493,21 +2496,21 @@ protected virtual void UpdateAxleDriveForce()
24932496 /// <summary>
24942497 /// This function applies a sign to the motive force as a function of the direction of the train.
24952498 /// </summary>
2496- protected virtual void ApplyDirectionToTractiveForce ( )
2499+ protected virtual void ApplyDirectionToTractiveForce ( ref float tractiveForceN )
24972500 {
24982501 if ( Train . IsPlayerDriven )
24992502 {
25002503 switch ( Direction )
25012504 {
25022505 case Direction . Forward :
2503- //MotiveForceN *= 1; //Not necessary
2506+ //tractiveForceN *= 1; //Not necessary
25042507 break ;
25052508 case Direction . Reverse :
2506- TractiveForceN *= - 1 ;
2509+ tractiveForceN *= - 1 ;
25072510 break ;
25082511 case Direction . N :
25092512 default :
2510- TractiveForceN *= 0 ;
2513+ tractiveForceN *= 0 ;
25112514 break ;
25122515 }
25132516 }
@@ -2516,7 +2519,7 @@ protected virtual void ApplyDirectionToTractiveForce()
25162519 switch ( Direction )
25172520 {
25182521 case Direction . Reverse :
2519- TractiveForceN *= - 1 ;
2522+ tractiveForceN *= - 1 ;
25202523 break ;
25212524 default :
25222525 break ;
0 commit comments