Skip to content

Commit a57d23d

Browse files
committed
Update calculation of Operative Brakes and Tons per Operative Brake.
Brake Force alone is not sufficient to determine if the car has operative brakes. BrakeValve (BrakeEquipmentType) does not work well for the Content Manager, and even some newer rollingstock has it incorrect. Thus BrakeSystem (BrakeSystemType) not being "just a pipe" or manual braking seems to work best. Also corrected TpOP to only use trailing tonnage (as defined by BNSF).
1 parent 9b3415e commit a57d23d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Source/RunActivity/Viewer3D/Popups/HelpWindow.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
using SharpFont;
3838
using static Orts.Viewer3D.WebServices.TrainCarOperationsWebpage.OperationsSend;
3939
using SharpDX.Direct3D9;
40+
using Orts.Simulation.RollingStocks.SubSystems.Brakes.MSTS;
4041

4142
namespace Orts.Viewer3D.Popups
4243
{
@@ -1209,7 +1210,7 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
12091210
float engMaxContTractiveForceN = 0f; float engMaxDynBrakeForceN = 0f; string forceSeparator = ""; // when set, indicates that subsequent engines are in a separate block
12101211

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

12151216
if (TrainInfoSpriteSheet == null) { TrainInfoSpriteSheet = SharedTextureManager.Get(Owner.Viewer.RenderProcess.GraphicsDevice, Path.Combine(Owner.Viewer.ContentPath, "TrainInfoSprites.png")); }
@@ -1250,6 +1251,8 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
12501251
numCars++;
12511252
numAxles += wag.GetWagonNumAxles();
12521253
wagMassKg += wag.MassKG;
1254+
trailingMassKg += wag.MassKG;
1255+
if (wag.MaxBrakeForceN > 0 && car.BrakeSystem != null && !(car.BrakeSystem is SingleTransferPipe) && !(car.BrakeSystem is ManualBraking)) { numOperativeBrakes++; }
12531256

12541257
// handle transition from engines to wagons
12551258
if (engCount > 0 || (engCount == 0 && numCars == 0))
@@ -1270,7 +1273,6 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
12701273
if (couplerStrength < lowestCouplerStrengthN) { lowestCouplerStrengthN = couplerStrength; }
12711274
var derailForce = GetDerailForce(wag);
12721275
if (derailForce < lowestDerailForceN) { lowestDerailForceN = derailForce; }
1273-
if (wag.MaxBrakeForceN > 0) { numOperativeBrakes++; } // simplistic: real world has cutout brakes, and no brakes on some articulated car-segments
12741276

12751277
carInfoList.Add(new CarInfo(wag.MassKG, isEng));
12761278
}
@@ -1328,7 +1330,7 @@ private void AddAggregatedTrainInfo(Train playerTrain, ControlLayout scrollbox,
13281330
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Horespower per Ton:"), LabelAlignment.Left));
13291331
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, string.Format("{0:0.0}", hpt), LabelAlignment.Left));
13301332

1331-
float tpob = numOperativeBrakes > 0 ? Kg.ToTUS(totMassKg) / numOperativeBrakes : 0;
1333+
float tpob = numOperativeBrakes > 0 ? Kg.ToTUS(trailingMassKg) / numOperativeBrakes : 0;
13321334
line = scrollbox.AddLayoutHorizontalLineOfText();
13331335
line.Add(new Label(labelWidth, line.RemainingHeight, Viewer.Catalog.GetString("Tons per Operative Brake:"), LabelAlignment.Left));
13341336
line.Add(new Label(line.RemainingWidth, line.RemainingHeight, string.Format("{0:0}", tpob), LabelAlignment.Left));

0 commit comments

Comments
 (0)