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()
2178
2178
// Thus the loco weight only changes as boiler level goes up and down, and coal mass varies in the fire
2179
2179
{
2180
2180
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
2182
2183
// Adjust drive wheel weight
2183
2184
SteamLocomotiveIdentification . DrvWheelWeightKg = ( MassKG / InitialMassKG ) * SteamLocomotiveIdentification . InitialDrvWheelWeightKg ;
2184
2185
}
@@ -2224,7 +2225,8 @@ private void UpdateLocomotiveLoadPhysics()
2224
2225
{
2225
2226
2226
2227
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
2228
2230
// Adjust drive wheel weight
2229
2231
DieselLocomotiveIdentification . DrvWheelWeightKg = ( MassKG / InitialMassKG ) * DieselLocomotiveIdentification . InitialDrvWheelWeightKg ;
2230
2232
You can’t perform that action at this time.
0 commit comments