Skip to content

Commit 5ab0e7e

Browse files
committed
Correct issue with engine efficiency in HuD
1 parent c124bde commit 5ab0e7e

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,20 @@ public float LoadPercent
921921
{
922922
get
923923
{
924-
return CurrentDieselOutputPowerW <= 0f ? 0f : ((OutputPowerW + (Locomotive.DieselEngines.NumOfActiveEngines > 0 ? Locomotive.LocomotivePowerSupply.ElectricTrainSupplyPowerW / Locomotive.DieselEngines.NumOfActiveEngines : 0f)) * 100f / CurrentDieselOutputPowerW);
924+
if (Locomotive.DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
925+
{
926+
float tempEff = 0;
927+
if (GearBox.CurrentGear != null)
928+
{
929+
tempEff = (((GearBox.CurrentGear.TractiveForceatMaxSpeedN * GearBox.CurrentGear.MaxSpeedMpS / Locomotive.DieselEngines.NumOfActiveEngines) / (DieselTorqueTab[MaxRPM] * MaxRPM / 9.54f)) * 100.0f);
930+
}
931+
932+
return tempEff;
933+
}
934+
else
935+
{
936+
return CurrentDieselOutputPowerW <= 0f ? 0f : ((OutputPowerW + (Locomotive.DieselEngines.NumOfActiveEngines > 0 ? Locomotive.LocomotivePowerSupply.ElectricTrainSupplyPowerW / Locomotive.DieselEngines.NumOfActiveEngines : 0f)) * 100f / CurrentDieselOutputPowerW);
937+
}
925938
}
926939
}
927940
/// <summary>

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/GearBox.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,18 @@ public void Initialize()
809809
// if they entered the TE at maximum gear speed, then increase the value accordingly
810810
Gears[i].MaxTractiveForceN = GearBoxParams.GearBoxTractiveForceAtSpeedN[i] * 1.234f;
811811
}
812+
// For purposes of calculating engine efficiency the tractive force at maximum gear speed needs to be used.
813+
if (GearBoxParams.GearBoxTractiveForceAtSpeedN[i] != 0)
814+
{
815+
// Assume that user has entered the TE at max speed already in the Eng
816+
Gears[i].TractiveForceatMaxSpeedN = GearBoxParams.GearBoxTractiveForceAtSpeedN[i];
817+
}
818+
else
819+
{
820+
// Assume that user entered max TE at maximum torque point
821+
Gears[i].TractiveForceatMaxSpeedN = GearBoxParams.GearBoxMaxTractiveForceForGearsN[i] / 1.234f;
822+
}
823+
812824
Gears[i].OverspeedPercentage = GearBoxParams.GearBoxOverspeedPercentageForFailure;
813825
Gears[i].UpGearProportion = GearBoxParams.GearBoxUpGearProportion;
814826
if (Locomotive != null && Locomotive.DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
@@ -1046,6 +1058,7 @@ public class Gear
10461058
public float ChangeUpSpeedRpM;
10471059
public float ChangeDownSpeedRpM;
10481060
public float MaxTractiveForceN;
1061+
public float TractiveForceatMaxSpeedN;
10491062
public float OverspeedPercentage;
10501063
public float BackLoadForceN;
10511064
public float CoastingForceN;

0 commit comments

Comments
 (0)