Skip to content

Commit c301fa6

Browse files
committed
Revert "Fix steam locomotive adhesion bug"
This reverts commit 1fb1ba8.
1 parent 1fb1ba8 commit c301fa6

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5196,9 +5196,20 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
51965196
float reciprocatingInertiaAngleFactor = 0;
51975197
float connectRodInertiaAngleFactor = 0;
51985198

5199-
// Calculate the "angle variation factors" for the Inertia
5200-
reciprocatingInertiaAngleFactor = (cos + ((CrankRadiusFt / ConnectRodLengthFt) * (float)Math.Cos(2 * crankAngleRad)));
5201-
connectRodInertiaAngleFactor = (cos + ((CrankRadiusFt * RodCoGFt) / (ConnectRodLengthFt * ConnectRodLengthFt)) * (float)Math.Cos(2 * crankAngleRad));
5199+
// Calculate the "angle variation factors" for the Inertia
5200+
// Account for the position of the crosshead position. In other words it depends upon whether the Rods and Reciporating gear is above or below the axle.
5201+
if (crankAngleRad > 0 && crankAngleRad < Math.PI)
5202+
{
5203+
// forward stroke
5204+
reciprocatingInertiaAngleFactor = (cos + ((CrankRadiusFt / ConnectRodLengthFt) * (float)Math.Cos(2 * crankAngleRad)));
5205+
connectRodInertiaAngleFactor = (cos + ((CrankRadiusFt * RodCoGFt) / (ConnectRodLengthFt * ConnectRodLengthFt)) * (float)Math.Cos(2 * crankAngleRad));
5206+
}
5207+
else
5208+
{
5209+
// reverse stroke
5210+
reciprocatingInertiaAngleFactor = (cos - ((CrankRadiusFt / ConnectRodLengthFt) * (float)Math.Cos(2 * crankAngleRad)));
5211+
connectRodInertiaAngleFactor = (cos - ((CrankRadiusFt * RodCoGFt) / (ConnectRodLengthFt * ConnectRodLengthFt)) * (float)Math.Cos(2 * crankAngleRad));
5212+
}
52025213

52035214
// Calculate the speed factor to allow for variation in speed
52045215
// Adjust the above factor to allow for the speed of rotation on the parts - based upon Eq 8 (pg 21)

0 commit comments

Comments
 (0)