Skip to content

Commit 86b0c1e

Browse files
committed
Adjust Brake Force to use Brake Shoe Force
1 parent 51d4cd9 commit 86b0c1e

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,14 @@ public virtual void LoadFromWagFile(string wagFilePath)
597597
// Initialise key wagon parameters
598598
MassKG = InitialMassKG;
599599
MaxHandbrakeForceN = InitialMaxHandbrakeForceN;
600-
MaxBrakeForceN = InitialMaxBrakeForceN;
600+
if (MaxBrakeShoeForceN != 0)
601+
{
602+
MaxBrakeForceN = MaxBrakeShoeForceN;
603+
}
604+
else
605+
{
606+
MaxBrakeForceN = InitialMaxBrakeForceN;
607+
}
601608
CentreOfGravityM = InitialCentreOfGravityM;
602609

603610
if (FreightAnimations != null)
@@ -1129,6 +1136,7 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
11291136
case "wagon(ortsbrakeshoefriction": BrakeShoeFrictionFactor = new Interpolator(stf); break;
11301137
case "wagon(maxhandbrakeforce": InitialMaxHandbrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
11311138
case "wagon(maxbrakeforce": InitialMaxBrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
1139+
case "wagon(maxbrakeshoebrakeforce": MaxBrakeShoeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
11321140
case "wagon(ortswheelbrakeslideprotection":
11331141
// stf.MustMatch("(");
11341142
var brakeslideprotection = stf.ReadFloatBlock(STFReader.UNITS.None, null);
@@ -1504,6 +1512,7 @@ public virtual void Copy(MSTSWagon copy)
15041512
InitialMaxBrakeForceN = copy.InitialMaxBrakeForceN;
15051513
InitialMaxHandbrakeForceN = copy.InitialMaxHandbrakeForceN;
15061514
MaxBrakeForceN = copy.MaxBrakeForceN;
1515+
MaxBrakeShoeForceN = copy.MaxBrakeShoeForceN;
15071516
MaxHandbrakeForceN = copy.MaxHandbrakeForceN;
15081517
WindowDeratingFactor = copy.WindowDeratingFactor;
15091518
DesiredCompartmentTempSetpointC = copy.DesiredCompartmentTempSetpointC;

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
210210

211211
public float MaxHandbrakeForceN;
212212
public float MaxBrakeForceN = 89e3f;
213+
public float MaxBrakeShoeForceN;
213214
public float InitialMaxHandbrakeForceN; // Initial force when agon initialised
214-
public float InitialMaxBrakeForceN = 89e3f; // Initial force when agon initialised
215+
public float InitialMaxBrakeForceN = 89e3f; // Initial force when wagon initialised
215216

216217
// Coupler Animation
217218
public AnimatedCoupler FrontCoupler = new AnimatedCoupler();
@@ -959,12 +960,21 @@ public virtual void UpdateBrakeSlideCalculation()
959960
float UserFriction = GetUserBrakeShoeFrictionFactor();
960961
float ZeroUserFriction = GetZeroUserBrakeShoeFrictionFactor();
961962
float AdhesionMultiplier = Simulator.Settings.AdhesionFactor / 100.0f; // User set adjustment factor - convert to a factor where 100% = no change to adhesion
963+
BrakeShoeCoefficientFrictionAdjFactor = 1.0f;
964+
BrakeShoeRetardCoefficientFrictionAdjFactor = 1.0f;
965+
BrakeShoeCoefficientFriction = 1.0f;
962966

963967
// This section calculates an adjustment factor for the brake force dependent upon the "base" (zero speed) friction value.
964968
//For a user defined case the base value is the zero speed value from the curve entered by the user.
965969
// For a "default" case where no user data has been added to the WAG file, the base friction value has been assumed to be 0.2, thus maximum value of 20% applied.
966970

967-
if (UserFriction != 0) // User defined friction has been applied in WAG file - Assume MaxBrakeForce is correctly set in the WAG, so no adjustment required
971+
if (UserFriction != 0 && MaxBrakeShoeForceN != 0) // Assume user has set up brakeshoe force and brakeshoe CoF
972+
{
973+
BrakeShoeCoefficientFrictionAdjFactor = UserFriction * AdhesionMultiplier;
974+
BrakeShoeRetardCoefficientFrictionAdjFactor = BrakeShoeCoefficientFrictionAdjFactor;
975+
BrakeShoeCoefficientFriction = UserFriction * AdhesionMultiplier; // For display purposes on HUD
976+
}
977+
else if (UserFriction != 0) // User defined friction has been applied in WAG file - Assume MaxBrakeForce is correctly set in the WAG, so no adjustment required
968978
{
969979
BrakeShoeCoefficientFrictionAdjFactor = UserFriction / ZeroUserFriction * AdhesionMultiplier; // Factor calculated by normalising zero speed value on friction curve applied in WAG file
970980
BrakeShoeRetardCoefficientFrictionAdjFactor = UserFriction / ZeroUserFriction * AdhesionMultiplier;

0 commit comments

Comments
 (0)