@@ -676,11 +676,6 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
676676 if ( TractionMotorType == TractionMotorTypes . AC )
677677 {
678678 AbsTractionSpeedMpS = AbsSpeedMpS ;
679- if ( AbsWheelSpeedMpS > 1.1 * MaxSpeedMpS )
680- {
681- AverageForceN = TractiveForceN = 0 ;
682- return ;
683- }
684679 }
685680 else
686681 {
@@ -771,6 +766,53 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
771766 SignalEvent ( Event . EnginePowerOff ) ;
772767 DieselEngines . HandleEvent ( PowerSupplyEvent . StopEngine ) ;
773768 }
769+
770+ ApplyDirectionToTractiveForce ( ) ;
771+
772+ // Calculate the total tractive force for the locomotive - ie Traction + Dynamic Braking force.
773+ // Note typically only one of the above will only ever be non-zero at the one time.
774+ // For flipped locomotives the force is "flipped" elsewhere, whereas dynamic brake force is "flipped" below by the direction of the speed.
775+
776+ if ( DynamicBrakePercent > 0 && DynamicBrakeForceCurves != null && AbsSpeedMpS > 0 )
777+ {
778+ float f = DynamicBrakeForceCurves . Get ( .01f * DynamicBrakePercent , AbsTractionSpeedMpS ) ;
779+ if ( f > 0 && LocomotivePowerSupply . DynamicBrakeAvailable )
780+ {
781+ DynamicBrakeForceN = f * ( 1 - PowerReduction ) ;
782+ TractiveForceN -= ( SpeedMpS > 0 ? 1 : SpeedMpS < 0 ? - 1 : Direction == Direction . Reverse ? - 1 : 1 ) * DynamicBrakeForceN ;
783+ }
784+ else
785+ {
786+ DynamicBrakeForceN = 0f ;
787+ }
788+ }
789+ else
790+ DynamicBrakeForceN = 0 ; // Set dynamic brake force to zero if in Notch 0 position
791+
792+ foreach ( var motor in TractionMotors )
793+ {
794+ motor . UpdateTractiveForce ( elapsedClockSeconds , t ) ;
795+ }
796+
797+ if ( Simulator . UseAdvancedAdhesion && ! Simulator . Settings . SimpleControlPhysics )
798+ {
799+ UpdateAxleDriveForce ( ) ;
800+ }
801+ }
802+
803+ protected override void UpdateAxleDriveForce ( )
804+ {
805+ /* TODO: connect different engines to different axles
806+ if (DieselEngines.HasGearBox && DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
807+ {
808+ foreach (var de in DieselEngines)
809+ {
810+ }
811+ }
812+ else */
813+ {
814+ base . UpdateAxleDriveForce ( ) ;
815+ }
774816 }
775817
776818 /// <summary>
@@ -1088,7 +1130,7 @@ public string GetDpuStatus(bool dataDpu, CABViewControlUnits loadUnits = CABView
10881130 if ( FilteredMotiveForceN != 0 )
10891131 data = Math . Abs ( this . FilteredMotiveForceN ) ;
10901132 else
1091- data = Math . Abs ( this . LocomotiveAxle . DriveForceN ) ;
1133+ data = Math . Abs ( TractiveForceN ) ;
10921134 if ( DynamicBrakePercent > 0 )
10931135 {
10941136 data = - Math . Abs ( DynamicBrakeForceN ) ;
0 commit comments