Skip to content

Commit 1663ee4

Browse files
committed
Correct bug with Maximum TE
1 parent e5db0a2 commit 1663ee4

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

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

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,9 +1470,6 @@ public override void Initialize()
14701470
SteamGearRatio = 1.0f; // set gear ratio to default, as not a geared locomotive
14711471

14721472
SteamEngines[i].MaxTractiveEffortLbf = (SteamEngines[i].NumberCylinders / 2.0f) * (Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersStrokeM) / (2 * Me.ToIn(SteamEngines[i].AttachedAxle.WheelRadiusM))) * MaxBoilerPressurePSI * TractiveEffortFactor * MotiveForceGearRatio * CylinderEfficiencyRate;
1473-
1474-
Trace.TraceInformation("MaxTE - {0} Wheel Radius {1}", MaxTractiveEffortLbf, SteamEngines[i].AttachedAxle.WheelRadiusM);
1475-
14761473
}
14771474
else // Default to Simple Locomotive (Assumed Simple) shows up as "Unknown"
14781475
{
@@ -8189,32 +8186,32 @@ public void ToggleCylinderCocks()
81898186

81908187
public void ToggleCylinderCompound()
81918188
{
8192-
8193-
if (SteamEngineType == SteamEngineTypes.Compound) // only use this control if a compound locomotive
8189+
for (int i = 0; i < SteamEngines.Count; i++)
81948190
{
8195-
CylinderCompoundOn = !CylinderCompoundOn;
8196-
SignalEvent(Event.CylinderCompoundToggle);
8197-
if (IsPlayerTrain)
8191+
if (SteamEngineType == SteamEngineTypes.Compound) // only use this control if a compound locomotive
81988192
{
8199-
Simulator.Confirmer.Confirm(CabControl.CylinderCompound, CylinderCompoundOn ? CabSetting.On : CabSetting.Off);
8200-
}
8201-
if (!CylinderCompoundOn) // Compound bypass valve closed - operating in compound mode
8202-
{
8203-
// Calculate maximum tractive effort if set for compounding
8204-
for (int i = 0; i < SteamEngines.Count; i++)
8193+
CylinderCompoundOn = !CylinderCompoundOn;
8194+
SignalEvent(Event.CylinderCompoundToggle);
8195+
if (IsPlayerTrain)
82058196
{
8197+
Simulator.Confirmer.Confirm(CabControl.CylinderCompound, CylinderCompoundOn ? CabSetting.On : CabSetting.Off);
8198+
}
8199+
if (!CylinderCompoundOn) // Compound bypass valve closed - operating in compound mode
8200+
{
8201+
// Calculate maximum tractive effort if set for compounding
8202+
82068203
MaxTractiveEffortLbf = CylinderEfficiencyRate * (1.6f * MaxBoilerPressurePSI * Me.ToIn(SteamEngines[i].LPCylindersDiameterM) * Me.ToIn(SteamEngines[i].LPCylindersDiameterM) * Me.ToIn(SteamEngines[i].LPCylindersStrokeM)) / ((CompoundCylinderRatio + 1.0f) * (Me.ToIn(SteamEngines[i].AttachedAxle.WheelRadiusM * 2.0f)));
8204+
8205+
DisplayMaxTractiveEffortLbf = MaxTractiveEffortLbf;
82078206
}
8208-
DisplayMaxTractiveEffortLbf = MaxTractiveEffortLbf;
8209-
}
8210-
else // Compound bypass valve opened - operating in simple mode
8211-
{
8212-
// Calculate maximum tractive effort if set to simple operation
8213-
for (int i = 0; i < SteamEngines.Count; i++)
8207+
else // Compound bypass valve opened - operating in simple mode
82148208
{
8215-
MaxTractiveEffortLbf += CylinderEfficiencyRate * (1.6f * MaxBoilerPressurePSI * Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersStrokeM)) / (Me.ToIn(SteamEngines[i].AttachedAxle.WheelRadiusM * 2.0f));
8209+
// Calculate maximum tractive effort if set to simple operation
8210+
8211+
MaxTractiveEffortLbf = CylinderEfficiencyRate * (1.6f * MaxBoilerPressurePSI * Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersDiameterM) * Me.ToIn(SteamEngines[i].CylindersStrokeM)) / (Me.ToIn(SteamEngines[i].AttachedAxle.WheelRadiusM * 2.0f));
8212+
8213+
DisplayMaxTractiveEffortLbf = MaxTractiveEffortLbf;
82168214
}
8217-
DisplayMaxTractiveEffortLbf = MaxTractiveEffortLbf;
82188215
}
82198216
}
82208217
}

0 commit comments

Comments
 (0)