@@ -1139,7 +1139,7 @@ public void Save(BinaryWriter outf)
11391139 if ( Math . Abs ( slipSpeedMpS ) < 0.1f )
11401140 {
11411141 axleBrakeForceN = Math . Min ( BrakeRetardForceN , Math . Max ( MaximumWheelAdhesion * AxleWeightN - frictionForceN + Math . Abs ( axleInForceN ) , 0 ) ) ;
1142- return ( accelerationMpSS , axleSpeedMpS / WheelRadiusM , axleInForceN , axleMotiveForceN , axleBrakeForceN , frictionForceN ) ;
1142+ return ( accelerationMpSS , axleSpeedMpS / WheelRadiusM , axleInForceN / transmissionEfficiency , axleMotiveForceN , axleBrakeForceN , frictionForceN ) ;
11431143 }
11441144 }
11451145 // In the static adhesion regime (low speeds for Polach formula), unless the static adhesion coefficient is exceeded,
@@ -1160,7 +1160,7 @@ public void Save(BinaryWriter outf)
11601160 {
11611161 axleMotiveForceN = axleOutForceN + Math . Sign ( TrainSpeedMpS ) * totalFrictionForceN ;
11621162 }
1163- return ( accelerationMpSS , axleSpeedMpS / WheelRadiusM , axleInForceN , axleMotiveForceN , axleBrakeForceN , frictionForceN ) ;
1163+ return ( accelerationMpSS , axleSpeedMpS / WheelRadiusM , axleInForceN / transmissionEfficiency , axleMotiveForceN , axleBrakeForceN , frictionForceN ) ;
11641164 }
11651165
11661166 /// <summary>
@@ -1258,7 +1258,7 @@ void Integrate(float elapsedClockSeconds)
12581258
12591259 double dt = elapsedClockSeconds / NumOfSubstepsPS ;
12601260 double hdt = dt / 2 ;
1261- double axleInForceSumN = 0 ;
1261+ double driveForceSumN = 0 ;
12621262 double axleMotiveForceSumN = 0 ;
12631263 double axleBrakeForceSumN = 0 ;
12641264 double axleFrictionForceSumN = 0 ;
@@ -1282,12 +1282,12 @@ void Integrate(float elapsedClockSeconds)
12821282
12831283 AxleSpeedMpS += ( integratorError = ( k1 . accelMpSS + 2 * ( k2 . accelMpSS + k3 . accelMpSS ) + k4 . accelMpSS ) * dt / 6 ) ;
12841284 AxlePositionRad += ( k1 . angSpeedRadpS + 2 * ( k2 . angSpeedRadpS + k3 . angSpeedRadpS ) + k4 . angSpeedRadpS ) * dt / 6 ;
1285- axleInForceSumN += ( k1 . driveForceN + 2 * ( k2 . driveForceN + k3 . driveForceN ) + k4 . driveForceN ) ;
1285+ driveForceSumN += ( k1 . driveForceN + 2 * ( k2 . driveForceN + k3 . driveForceN ) + k4 . driveForceN ) ;
12861286 axleMotiveForceSumN += ( k1 . axleMotiveForceN + 2 * ( k2 . axleMotiveForceN + k3 . axleMotiveForceN ) + k4 . axleMotiveForceN ) ;
12871287 axleBrakeForceSumN += ( k1 . axleBrakeForceN + 2 * ( k2 . axleBrakeForceN + k3 . axleBrakeForceN ) + k4 . axleBrakeForceN ) ;
12881288 axleFrictionForceSumN += ( k1 . axleFrictionForceN + 2 * ( k2 . axleFrictionForceN + k3 . axleFrictionForceN ) + k4 . axleFrictionForceN ) ;
12891289 }
1290- DriveForceN = ( float ) ( axleInForceSumN / ( NumOfSubstepsPS * 6 ) ) ;
1290+ DriveForceN = ( float ) ( driveForceSumN / ( NumOfSubstepsPS * 6 ) ) ;
12911291 AxleMotiveForceN = ( float ) ( axleMotiveForceSumN / ( NumOfSubstepsPS * 6 ) ) ;
12921292 AxleBrakeForceN = ( float ) ( axleBrakeForceSumN / ( NumOfSubstepsPS * 6 ) ) ;
12931293 AxleFrictionForceN = ( float ) ( axleFrictionForceSumN / ( NumOfSubstepsPS * 6 ) ) ;
@@ -1422,13 +1422,13 @@ public void UpdateSimpleAdhesion(float elapsedClockSeconds)
14221422 axleInForceN = DriveForceN * transmissionEfficiency ;
14231423 else if ( DriveType == AxleDriveType . MotorDriven )
14241424 axleInForceN = ( float ) motor . GetDevelopedTorqueNm ( TrainSpeedMpS * transmissionRatio / WheelRadiusM ) * transmissionEfficiency / WheelRadiusM ;
1425- DriveForceN = axleInForceN ;
1425+ DriveForceN = axleInForceN / transmissionEfficiency ;
14261426
14271427 float frictionForceN = FrictionN ;
14281428 float totalFrictionForceN = BrakeRetardForceN + frictionForceN ; // Dissipative forces: they will never increase wheel speed
1429- float totalAxleForceN = DriveForceN - Math . Sign ( TrainSpeedMpS ) * totalFrictionForceN ;
1429+ float totalAxleForceN = axleInForceN - Math . Sign ( TrainSpeedMpS ) * totalFrictionForceN ;
14301430 float axleOutForceN = totalAxleForceN ;
1431- AxleMotiveForceN = DriveForceN ;
1431+ AxleMotiveForceN = axleInForceN ;
14321432 AxleBrakeForceN = BrakeRetardForceN ;
14331433 AxleFrictionForceN = frictionForceN ;
14341434 AxleSpeedMpS = TrainSpeedMpS ;
@@ -1464,7 +1464,7 @@ public void UpdateSimpleAdhesion(float elapsedClockSeconds)
14641464 axleOutForceN = MathHelper . Clamp ( axleOutForceN , - adhesionForceN , adhesionForceN ) ;
14651465 }
14661466 // In case of wheel skid, reduce indicated brake force
1467- if ( ( ( TrainSpeedMpS > 0 && axleOutForceN < 0 ) || ( TrainSpeedMpS < 0 && axleOutForceN > 0 ) ) && Math . Abs ( DriveForceN ) < BrakeRetardForceN && Math . Sign ( TrainSpeedMpS ) * ( - axleOutForceN + axleInForceN ) - frictionForceN > 0 )
1467+ if ( ( ( TrainSpeedMpS > 0 && axleOutForceN < 0 ) || ( TrainSpeedMpS < 0 && axleOutForceN > 0 ) ) && Math . Abs ( axleInForceN ) < BrakeRetardForceN && Math . Sign ( TrainSpeedMpS ) * ( - axleOutForceN + axleInForceN ) - frictionForceN > 0 )
14681468 {
14691469 AxleBrakeForceN = Math . Sign ( TrainSpeedMpS ) * ( - axleOutForceN + axleInForceN ) - frictionForceN ;
14701470 }
@@ -1476,7 +1476,7 @@ public void UpdateSimpleAdhesion(float elapsedClockSeconds)
14761476 }
14771477 AxlePositionRad += AxleSpeedMpS / WheelRadiusM * elapsedClockSeconds ;
14781478
1479- if ( Math . Abs ( TrainSpeedMpS ) < 0.001f && Math . Abs ( DriveForceN ) < totalFrictionForceN )
1479+ if ( Math . Abs ( TrainSpeedMpS ) < 0.001f && Math . Abs ( axleInForceN ) < totalFrictionForceN )
14801480 {
14811481 axleOutForceN = 0 ;
14821482 }
0 commit comments