Skip to content

Commit 1b14563

Browse files
authored
Merge pull request #394 from Csantucci/variable2-fix
Bug fix for https://bugs.launchpad.net/or/+bug/1923946 Variable2 goes negative with electric locos
2 parents b68a97d + 5f74513 commit 1b14563

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSElectricLocomotive.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
using Orts.Simulation.RollingStocks.SubSystems.PowerSupplies;
3535
using ORTS.Common;
3636
using ORTS.Scripting.Api;
37+
using System;
3738
using System.Diagnostics;
3839
using System.IO;
3940
using System.Text;
@@ -232,7 +233,7 @@ protected override void UpdateSoundVariables(float elapsedClockSeconds)
232233
else
233234
{
234235
float dV2;
235-
dV2 = TractiveForceN / MaxForceN * 100f - Variable2;
236+
dV2 = Math.Abs(TractiveForceN) / MaxForceN * 100f - Variable2;
236237
float max = 2f;
237238
if (dV2 > max) dV2 = max;
238239
else if (dV2 < -max) dV2 = -max;

0 commit comments

Comments
 (0)