Skip to content

Commit 79cd5f8

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 5bbc476 commit 79cd5f8

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Source/Contrib/ContentManager/ContentInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public static string GetText(Content content)
198198
if (!IsMetric && !IsUK)
199199
{
200200
details.AppendFormat("HPT:\t{1}{0}", Environment.NewLine, FormatHPT(data.MaxPowerW, data.MassKG));
201-
details.AppendFormat("TpOB:\t{1}{0}", Environment.NewLine, FormatTPOB(data.MassKG, data.NumOperativeBrakes));
201+
details.AppendFormat("TpOB:\t{1}{0}", Environment.NewLine, FormatTPOB(data.TrailingMassKG, data.NumOperativeBrakes));
202202
details.AppendFormat("TpEPA:\t{1}{0}", Environment.NewLine, FormatTonsPerEPA(data.MassKG, data.MaxTractiveForceN));
203203
details.AppendFormat("TpEDBA:\t{1}{0}", Environment.NewLine, FormatTonsPerEDBA(data.MassKG, data.MaxDynamicBrakeForceN));
204204
}

Source/Contrib/ContentManager/Models/Consist.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class Consist
3232
public readonly float LengthM = 0F;
3333
public readonly int NumAxles = 0;
3434
public readonly float MassKG = 0F;
35+
public readonly float TrailingMassKG = 0F;
3536
public readonly float MaxPowerW = 0F;
3637
public readonly float MaxTractiveForceN = 0F;
3738
public readonly float MaxDynamicBrakeForceN = 0F;
@@ -74,7 +75,6 @@ public Consist(Content content)
7475
MaxBrakeForce += wagonFile.MaxBrakeForceN;
7576
MinCouplerStrengthN = Math.Min(MinCouplerStrengthN, wagonFile.MinCouplerStrengthN);
7677
var subType = wagonFile.WagonType;
77-
if (wagonFile.MaxBrakeForceN > 0) { NumOperativeBrakes++; }
7878

7979
if (engFile != null)
8080
{
@@ -100,6 +100,12 @@ public Consist(Content content)
100100
else if (!wag.IsEOT && wagonFile.WagonSize.LengthM > 1.1) // exclude legacy EOT
101101
{
102102
WagCount++;
103+
TrailingMassKG += wagonFile.MassKG;
104+
if (wagonFile.MaxBrakeForceN > 0 && wagonFile.BrakeSystemType != null && !wagonFile.BrakeSystemType.Contains("manual_braking") &&
105+
!wagonFile.BrakeSystemType.Contains("air_piped") && !wagonFile.BrakeSystemType.Contains("vacuum_piped"))
106+
{
107+
NumOperativeBrakes++;
108+
}
103109
}
104110

105111
// see MSTSWagon.LoadFromWagFile()

Source/Orts.Formats.Msts/WagonFile.cs

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public class WagonFile
3434
public CarSize WagonSize;
3535
public int NumWagAxles; // ORTS
3636
public float NumWagWheels; // MSTS
37+
public string BrakeSystemType;
38+
public string BrakeEquipmentType;
3739
public float MaxBrakeForceN;
3840
public float MinCouplerStrengthN = ImpossiblyHighForceN;
3941

@@ -111,6 +113,8 @@ public WagonFile(string filePath)
111113
new STFReader.TokenProcessor("size", ()=>{ WagonSize = new CarSize( stf); }),
112114
new STFReader.TokenProcessor("ortsnumberaxles", ()=>{ NumWagAxles = stf.ReadIntBlock(null); }),
113115
new STFReader.TokenProcessor("numwheels", ()=>{ NumWagWheels = stf.ReadFloatBlock( STFReader.UNITS.None, null); }),
116+
new STFReader.TokenProcessor("brakesystemtype", ()=>{ BrakeSystemType = stf.ReadStringBlock(null).ToLower(); }),
117+
new STFReader.TokenProcessor("brakeequipmenttype", ()=>{ BrakeEquipmentType = stf.ReadStringBlock(null).ToLower(); }),
114118
new STFReader.TokenProcessor("maxbrakeforce", ()=>{ MaxBrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); }),
115119
new STFReader.TokenProcessor("coupling", ()=>{ new CouplingSpring( ref MinCouplerStrengthN, stf); })
116120
});

0 commit comments

Comments
 (0)