Skip to content

Commit 52410f9

Browse files
committed
More changes suggested in PR review.
Show total (max) and continuous tractive effort. Use trailing tons for all calculated ratings.
1 parent a57d23d commit 52410f9

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

Source/RunActivity/Viewer3D/Popups/HelpWindow.cs

+18-11
Original file line numberDiff line numberDiff line change
@@ -1194,10 +1194,12 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
11941194
int numCars = 0;
11951195
int numAxles = 0;
11961196
var totMassKg = playerTrain.MassKg;
1197+
float trailingMassKg = 0f;
11971198
string sectionMass = ""; // using " + " between wagon sets
11981199
var lengthM = playerTrain.Length;
11991200
var maxSpeedMps = playerTrain.TrainMaxSpeedMpS;
12001201
float totPowerW = 0f;
1202+
float totMaxTractiveEffortN = 0f;
12011203
float totMaxContTractiveEffortN = 0f;
12021204
string sectionMaxContTractiveForce = ""; // using " + " between DPU sets
12031205
float totMaxDynamicBrakeForceN = 0f;
@@ -1209,8 +1211,8 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
12091211
int engCount = 0; string countSeparator = ""; // when set, indicates that subsequent engines are in a separate block
12101212
float engMaxContTractiveForceN = 0f; float engMaxDynBrakeForceN = 0f; string forceSeparator = ""; // when set, indicates that subsequent engines are in a separate block
12111213

1212-
float wagMassKg = 0f; string massSeparator = ""; // when set, indicates that subsequent engines are in a separate block
1213-
float trailingMassKg = 0f; int numOperativeBrakes = 0;
1214+
float wagSectionMassKg = 0f; string massSeparator = ""; // when set, indicates that subsequent engines are in a separate block
1215+
int numOperativeBrakes = 0;
12141216
bool isMetric = false; bool isUK = false; // isImperial* does not seem to be used in simulation
12151217

12161218
if (TrainInfoSpriteSheet == null) { TrainInfoSpriteSheet = SharedTextureManager.Get(Owner.Viewer.RenderProcess.GraphicsDevice, Path.Combine(Owner.Viewer.ContentPath, "TrainInfoSprites.png")); }
@@ -1234,23 +1236,24 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
12341236
engCount++;
12351237
numAxles += eng.LocoNumDrvAxles + eng.GetWagonNumAxles();
12361238
totPowerW += eng.MaxPowerW;
1239+
totMaxTractiveEffortN += eng.MaxForceN;
12371240
totMaxContTractiveEffortN += eng.MaxContinuousForceN > 0 ? eng.MaxContinuousForceN : eng.MaxForceN;
12381241
engMaxContTractiveForceN += eng.MaxContinuousForceN > 0 ? eng.MaxContinuousForceN : eng.MaxForceN;
12391242
totMaxDynamicBrakeForceN += eng.MaxDynamicBrakeForceN;
12401243
engMaxDynBrakeForceN += eng.MaxDynamicBrakeForceN;
12411244

12421245
// hanlde transition from wagons to engines
1243-
if (wagMassKg > 0)
1246+
if (wagSectionMassKg > 0)
12441247
{
1245-
sectionMass += massSeparator + FormatStrings.FormatLargeMass(wagMassKg, isMetric, isUK);
1246-
wagMassKg = 0f; massSeparator = " + ";
1248+
sectionMass += massSeparator + FormatStrings.FormatLargeMass(wagSectionMassKg, isMetric, isUK);
1249+
wagSectionMassKg = 0f; massSeparator = " + ";
12471250
}
12481251
}
12491252
else if (wag != null)
12501253
{
12511254
numCars++;
12521255
numAxles += wag.GetWagonNumAxles();
1253-
wagMassKg += wag.MassKG;
1256+
wagSectionMassKg += wag.MassKG;
12541257
trailingMassKg += wag.MassKG;
12551258
if (wag.MaxBrakeForceN > 0 && car.BrakeSystem != null && !(car.BrakeSystem is SingleTransferPipe) && !(car.BrakeSystem is ManualBraking)) { numOperativeBrakes++; }
12561259

@@ -1282,7 +1285,7 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
12821285
if (String.IsNullOrEmpty(numEngines)) { numEngines = "0"; }
12831286
if (engMaxContTractiveForceN > 0) { sectionMaxContTractiveForce += forceSeparator + FormatStrings.FormatForce(engMaxContTractiveForceN, isMetric); }
12841287
if (engMaxDynBrakeForceN > 0) { sectionMaxDynamicBrakeForce += forceSeparator + FormatStrings.FormatForce(engMaxDynBrakeForceN, isMetric); }
1285-
if (wagMassKg > 0) { sectionMass += massSeparator + FormatStrings.FormatLargeMass(wagMassKg, isMetric, isUK); }
1288+
if (wagSectionMassKg > 0) { sectionMass += massSeparator + FormatStrings.FormatLargeMass(wagSectionMassKg, isMetric, isUK); }
12861289

12871290
var line = scrollbox.AddLayoutHorizontalLineOfText();
12881291
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Number of Engines:"), LabelAlignment.Left));
@@ -1312,9 +1315,13 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
13121315
scrollbox.AddHorizontalSeparator();
13131316

13141317
line = scrollbox.AddLayoutHorizontalLineOfText();
1315-
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Total Power:"), LabelAlignment.Left));
1318+
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Max Power:"), LabelAlignment.Left));
13161319
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, FormatStrings.FormatPower(totPowerW, isMetric, false, false), LabelAlignment.Left));
13171320

1321+
line = scrollbox.AddLayoutHorizontalLineOfText();
1322+
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Max Tractive Effort:"), LabelAlignment.Left));
1323+
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, FormatStrings.FormatForce(totMaxTractiveEffortN, isMetric), LabelAlignment.Left));
1324+
13181325
line = scrollbox.AddLayoutHorizontalLineOfText();
13191326
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Max Continuous Tractive Effort:"), LabelAlignment.Left));
13201327
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, sectionMaxContTractiveForce, LabelAlignment.Left));
@@ -1325,7 +1332,7 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
13251332

13261333
if (!isMetric)
13271334
{
1328-
float hpt = totMassKg > 0f ? W.ToHp(totPowerW) / Kg.ToTUS(totMassKg) : 0f;
1335+
float hpt = trailingMassKg > 0f ? W.ToHp(totPowerW) / Kg.ToTUS(trailingMassKg) : 0f;
13291336
line = scrollbox.AddLayoutHorizontalLineOfText();
13301337
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Horespower per Ton:"), LabelAlignment.Left));
13311338
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, string.Format("{0:0.0}", hpt), LabelAlignment.Left));
@@ -1342,13 +1349,13 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
13421349
// and should really be defined in the path file.
13431350

13441351
// tons per equivalent powered axle (TPA or TpEPA)
1345-
float tpepa = totMaxContTractiveEffortN > 0 ? Kg.ToTUS(totMassKg) / (N.ToLbf(totMaxContTractiveEffortN) / 10000f) : 0;
1352+
float tpepa = totMaxContTractiveEffortN > 0 ? Kg.ToTUS(trailingMassKg) / (N.ToLbf(totMaxContTractiveEffortN) / 10000f) : 0;
13461353
line = scrollbox.AddLayoutHorizontalLineOfText();
13471354
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Tons per EPA:"), LabelAlignment.Left));
13481355
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, string.Format("{0:0}", tpepa), LabelAlignment.Left));
13491356

13501357
// tons per equivalent dynamic brake axle (TpEDBA)
1351-
float tpedba = totMaxDynamicBrakeForceN > 0 ? Kg.ToTUS(totMassKg) / (N.ToLbf(totMaxDynamicBrakeForceN) / 10000f) : 0;
1358+
float tpedba = totMaxDynamicBrakeForceN > 0 ? Kg.ToTUS(trailingMassKg) / (N.ToLbf(totMaxDynamicBrakeForceN) / 10000f) : 0;
13521359
line = scrollbox.AddLayoutHorizontalLineOfText();
13531360
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Tons per EDBA:"), LabelAlignment.Left));
13541361
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, string.Format("{0:0}", tpedba), LabelAlignment.Left));

0 commit comments

Comments
 (0)