Skip to content

Commit c124bde

Browse files
committed
Correct issue with load%
1 parent 9d5fb93 commit c124bde

File tree

1 file changed

+5
-3
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies

1 file changed

+5
-3
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/DieselEngine.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,9 @@ public void Update(float elapsedClockSeconds)
10841084
Locomotive.PrevMotiveForceN *= -1f;
10851085

10861086
if ((State == DieselEngineState.Running) && (Locomotive.ThrottlePercent > 0))
1087-
{
1088-
OutputPowerW = (Locomotive.PrevMotiveForceN > 0 ? Locomotive.PrevMotiveForceN * Locomotive.AbsSpeedMpS : 0) / Locomotive.DieselEngines.NumOfActiveEngines;
1087+
{
1088+
var abstempMotiveForce = Math.Abs(Locomotive.PrevMotiveForceN);
1089+
OutputPowerW = ( abstempMotiveForce > 0 ? abstempMotiveForce * Locomotive.AbsSpeedMpS : 0) / Locomotive.DieselEngines.NumOfActiveEngines;
10891090
}
10901091
else
10911092
{
@@ -1438,7 +1439,8 @@ public void Update(float elapsedClockSeconds)
14381439

14391440
if (Locomotive.DieselEngines.NumOfActiveEngines > 0)
14401441
{
1441-
CurrentDieselOutputPowerW -= Locomotive.DieselPowerSupply.ElectricTrainSupplyPowerW / Locomotive.DieselEngines.NumOfActiveEngines;
1442+
1443+
CurrentDieselOutputPowerW = (CurrentDieselOutputPowerW - Locomotive.DieselPowerSupply.ElectricTrainSupplyPowerW) / Locomotive.DieselEngines.NumOfActiveEngines;
14421444
CurrentDieselOutputPowerW = CurrentDieselOutputPowerW < 0f ? 0f : CurrentDieselOutputPowerW;
14431445
}
14441446

0 commit comments

Comments
 (0)