File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Source/Orts.Simulation/Simulation/RollingStocks Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -2178,7 +2178,8 @@ private void UpdateLocomotiveLoadPhysics()
21782178 // Thus the loco weight only changes as boiler level goes up and down, and coal mass varies in the fire
21792179 {
21802180 MassKG = LoadEmptyMassKg + Kg . FromLb ( SteamLocomotiveIdentification . BoilerMassLB ) + SteamLocomotiveIdentification . FireMassKG + + ( SteamLocomotiveIdentification . CurrentTrackSandBoxCapacityM3 * SteamLocomotiveIdentification . SandWeightKgpM3 ) ;
2181- MassKG = MathHelper . Clamp ( MassKG , LoadEmptyMassKg , LoadFullMassKg ) ; // Clamp Mass to between the empty and full wagon values
2181+ var MassUpperLimit = LoadFullMassKg * 1.02f ; // Allow full load to go slightly higher so that rounding errors do not skew results
2182+ MassKG = MathHelper . Clamp ( MassKG , LoadEmptyMassKg , MassUpperLimit ) ; // Clamp Mass to between the empty and full wagon values
21822183 // Adjust drive wheel weight
21832184 SteamLocomotiveIdentification . DrvWheelWeightKg = ( MassKG / InitialMassKG ) * SteamLocomotiveIdentification . InitialDrvWheelWeightKg ;
21842185 }
@@ -2224,7 +2225,8 @@ private void UpdateLocomotiveLoadPhysics()
22242225 {
22252226
22262227 MassKG = LoadEmptyMassKg + ( DieselLocomotiveIdentification . DieselLevelL * DieselLocomotiveIdentification . DieselWeightKgpL ) + DieselLocomotiveIdentification . CurrentLocomotiveSteamHeatBoilerWaterCapacityL + ( DieselLocomotiveIdentification . CurrentTrackSandBoxCapacityM3 * DieselLocomotiveIdentification . SandWeightKgpM3 ) ;
2227- MassKG = MathHelper . Clamp ( MassKG , LoadEmptyMassKg , LoadFullMassKg ) ; // Clamp Mass to between the empty and full wagon values
2228+ var MassUpperLimit = LoadFullMassKg * 1.02f ; // Allow full load to go slightly higher so that rounding errors do not skew results
2229+ MassKG = MathHelper . Clamp ( MassKG , LoadEmptyMassKg , MassUpperLimit ) ; // Clamp Mass to between the empty and full wagon values
22282230 // Adjust drive wheel weight
22292231 DieselLocomotiveIdentification . DrvWheelWeightKg = ( MassKG / InitialMassKG ) * DieselLocomotiveIdentification . InitialDrvWheelWeightKg ;
22302232
You can’t perform that action at this time.
0 commit comments