Skip to content

Commit 7157e08

Browse files
committed
Correct some display values in HuD
1 parent b05b85c commit 7157e08

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

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

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,6 @@ public float TenderCoalMassKG // Decreased by firing and increased
584584
public float MaxTractiveEffortLbf; // Maximum theoritical tractive effort for locomotive
585585
public float DisplayMaxTractiveEffortLbf; // HuD display value of maximum theoritical tractive effort for locomotive
586586

587-
float DisplayTractiveEffortLbsF; // Value of Tractive effort to display in HUD
588587
float MaxCriticalSpeedTractiveEffortLbf; // Maximum power value @ critical speed of piston
589588
float DisplayCriticalSpeedTractiveEffortLbf; // Display power value @ speed of piston
590589
float absStartTractiveEffortN = 0.0f; // Record starting tractive effort
@@ -4885,8 +4884,7 @@ private void UpdateMotion(float elapsedClockSeconds, float cutoff, float absSpee
48854884
TractiveEffortLbsF = 0.0f;
48864885
}
48874886
TractiveEffortLbsF = MathHelper.Clamp(TractiveEffortLbsF, 0, TractiveEffortLbsF);
4888-
DisplayTractiveEffortLbsF = TractiveEffortLbsF;
4889-
4887+
48904888
// Calculate IHP
48914889
// IHP = (MEP x CylStroke(ft) x cylArea(sq in) x No Strokes (/min)) / 33000) - this is per cylinder
48924890

@@ -4995,25 +4993,6 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
49954993
if (absSpeedMpS == 0 && cutoff < 0.05f) // If the reverser is set too low then not sufficient steam is admitted to the steam cylinders, and hence insufficient Motive Force will produced to move the train.
49964994
TractiveForceN = 0;
49974995

4998-
// Based upon max IHP, limit motive force.
4999-
5000-
if (IndicatedHorsePowerHP >= MaxIndicatedHorsePowerHP)
5001-
{
5002-
TractiveForceN = N.FromLbf((MaxIndicatedHorsePowerHP * 375.0f) / pS.TopH(Me.ToMi(SpeedMpS)));
5003-
IndicatedHorsePowerHP = MaxIndicatedHorsePowerHP; // Set IHP to maximum value
5004-
IsCritTELimit = true; // Flag if limiting TE
5005-
}
5006-
else
5007-
{
5008-
IsCritTELimit = false; // Reset flag if limiting TE
5009-
}
5010-
5011-
DrawBarPullLbsF = N.ToLbf(Math.Abs(TractiveForceN) - LocoTenderFrictionForceN); // Locomotive drawbar pull is equal to motive force of locomotive (+ tender) - friction forces of locomotive (+ tender)
5012-
DrawBarPullLbsF = MathHelper.Clamp(DrawBarPullLbsF, 0, DrawBarPullLbsF); // clamp value so it doesn't go negative
5013-
5014-
DrawbarHorsePowerHP = (DrawBarPullLbsF * MpS.ToMpH(absSpeedMpS)) / 375.0f; // TE in this instance is a maximum, and not at the wheel???
5015-
DrawbarHorsePowerHP = MathHelper.Clamp(DrawbarHorsePowerHP, 0, DrawbarHorsePowerHP); // clamp value so it doesn't go negative
5016-
50174996
#region - Steam Adhesion Model Input for Steam Locomotives
50184997

50194998
// Based upon information presented on pg 276 of "Locomotive Operation - A Technical and Practical Analysis" by G. R. Henderson -
@@ -5393,7 +5372,21 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
53935372
TractiveForceN = 0.5f;
53945373
}
53955374

5396-
#endregion
5375+
#endregion
5376+
5377+
5378+
// Based upon max IHP, limit motive force.
5379+
5380+
if (IndicatedHorsePowerHP >= MaxIndicatedHorsePowerHP)
5381+
{
5382+
TractiveForceN = N.FromLbf((MaxIndicatedHorsePowerHP * 375.0f) / pS.TopH(Me.ToMi(SpeedMpS)));
5383+
IndicatedHorsePowerHP = MaxIndicatedHorsePowerHP; // Set IHP to maximum value
5384+
IsCritTELimit = true; // Flag if limiting TE
5385+
}
5386+
else
5387+
{
5388+
IsCritTELimit = false; // Reset flag if limiting TE
5389+
}
53975390

53985391
// Find the maximum TE for debug i.e. @ start and full throttle
53995392
if (absSpeedMpS < 1.0)
@@ -6322,6 +6315,14 @@ public override string GetStatus()
63226315

63236316
public override string GetDebugStatus()
63246317
{
6318+
6319+
6320+
DrawBarPullLbsF = N.ToLbf(Math.Abs(MotiveForceN) - LocoTenderFrictionForceN); // Locomotive drawbar pull is equal to motive force of locomotive (+ tender) - friction forces of locomotive (+ tender)
6321+
DrawBarPullLbsF = MathHelper.Clamp(DrawBarPullLbsF, 0, DrawBarPullLbsF); // clamp value so it doesn't go negative
6322+
6323+
DrawbarHorsePowerHP = (DrawBarPullLbsF * MpS.ToMpH(absSpeedMpS)) / 375.0f; // TE in this instance is a maximum, and not at the wheel???
6324+
DrawbarHorsePowerHP = MathHelper.Clamp(DrawbarHorsePowerHP, 0, DrawbarHorsePowerHP); // clamp value so it doesn't go negative
6325+
63256326
var status = new StringBuilder(base.GetDebugStatus());
63266327

63276328
status.AppendFormat("\n\n\t\t === {0} === \t\t\n", Simulator.Catalog.GetString("Key Inputs"));
@@ -6764,7 +6765,7 @@ public override string GetDebugStatus()
67646765
Simulator.Catalog.GetString("StartTE"),
67656766
FormatStrings.FormatForce(absStartTractiveEffortN, IsMetric),
67666767
Simulator.Catalog.GetString("TE"),
6767-
FormatStrings.FormatForce(N.FromLbf(DisplayTractiveEffortLbsF), IsMetric),
6768+
FormatStrings.FormatForce(MotiveForceN, IsMetric),
67686769
Simulator.Catalog.GetString("Draw"),
67696770
FormatStrings.FormatForce(N.FromLbf(DrawBarPullLbsF), IsMetric),
67706771
Simulator.Catalog.GetString("CritSpeed"),
@@ -6809,7 +6810,7 @@ public override string GetDebugStatus()
68096810
Simulator.Catalog.GetString("StartTE"),
68106811
FormatStrings.FormatForce(absStartTractiveEffortN, IsMetric),
68116812
Simulator.Catalog.GetString("TE"),
6812-
FormatStrings.FormatForce(N.FromLbf(DisplayTractiveEffortLbsF), IsMetric),
6813+
FormatStrings.FormatForce(MotiveForceN, IsMetric),
68136814
Simulator.Catalog.GetString("Draw"),
68146815
FormatStrings.FormatForce(N.FromLbf(DrawBarPullLbsF), IsMetric),
68156816
Simulator.Catalog.GetString("CritSpeed"),

0 commit comments

Comments
 (0)