Skip to content

Commit d56da76

Browse files
committed
Change display power in HuD
1 parent 4858fbf commit d56da76

File tree

1 file changed

+17
-2
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies

1 file changed

+17
-2
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,23 @@ public string GetStatus()
419419
result.AppendFormat("\t{0}", Simulator.Catalog.GetParticularString("Engine", GetStringAttribute.GetPrettyName(eng.State)));
420420

421421
result.AppendFormat("\t{0}\t{1}", Simulator.Catalog.GetParticularString("HUD", "Power"), FormatStrings.FormatPower(MaxOutputPowerW, Locomotive.IsMetric, false, false));
422-
foreach (var eng in DEList)
423-
result.AppendFormat("\t{0}", FormatStrings.FormatPower(eng.CurrentDieselOutputPowerW, Locomotive.IsMetric, false, false));
422+
423+
if (Locomotive.DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
424+
{
425+
426+
foreach (var eng in DEList)
427+
{
428+
// Power(Watts) = Torque(Nm) * rpm / 9.54.
429+
var tempPowerDisplay = eng.GearBox.torqueCurveMultiplier * eng.DieselTorqueTab[eng.RealRPM] * eng.RealRPM / 9.54f;
430+
tempPowerDisplay = MathHelper.Clamp(tempPowerDisplay, 0, MaxOutputPowerW); // Clamp throttle setting within bounds
431+
result.AppendFormat("\t{0}", FormatStrings.FormatPower(tempPowerDisplay, Locomotive.IsMetric, false, false));
432+
}
433+
}
434+
else
435+
{
436+
foreach (var eng in DEList)
437+
result.AppendFormat("\t{0}", FormatStrings.FormatPower(eng.CurrentDieselOutputPowerW, Locomotive.IsMetric, false, false));
438+
}
424439

425440
result.AppendFormat("\t{0}", Simulator.Catalog.GetString("Load"));
426441
foreach (var eng in DEList)

0 commit comments

Comments
 (0)