Skip to content

Commit

Permalink
Correct calculation issue with brake shoe CoF
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewell committed Jun 1, 2023
1 parent 4e475c2 commit d1ddb98
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
Expand Up @@ -721,6 +721,7 @@ public override void Update(float elapsedClockSeconds)
else Car.BrakeShoeForceN = Math.Max(Car.MaxBrakeForceN, Car.MaxHandbrakeForceN / 2);

float brakeShoeFriction = Car.GetBrakeShoeFrictionFactor();
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();

Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
if (Car.BrakeSkid) // Test to see if wheels are skiding to excessive brake force
Expand Down
Expand Up @@ -215,6 +215,7 @@ public override void Update(float elapsedClockSeconds)
else Car.BrakeShoeForceN = Math.Max(Car.MaxBrakeForceN, Car.MaxHandbrakeForceN / 2);

float brakeShoeFriction = Car.GetBrakeShoeFrictionFactor();
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();

Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
if (Car.BrakeSkid) // Test to see if wheels are skiding to excessive brake force
Expand Down
Expand Up @@ -160,6 +160,7 @@ public override void Update(float elapsedClockSeconds)
BleedOffValveOpen = false;

float brakeShoeFriction = Car.GetBrakeShoeFrictionFactor();
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();

Car.BrakeRetardForceN = ( Car.MaxHandbrakeForceN * HandbrakePercent / 100) * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
if (Car.BrakeSkid) // Test to see if wheels are skiding to excessive brake force
Expand Down
Expand Up @@ -146,6 +146,7 @@ public override void Update(float elapsedClockSeconds)
}

float brakeShoeFriction = Car.GetBrakeShoeFrictionFactor();
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();

Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
if (Car.BrakeSkid) // Test to see if wheels are skiding due to excessive brake force
Expand Down
Expand Up @@ -581,6 +581,7 @@ public override void Update(float elapsedClockSeconds)
else Car.BrakeShoeForceN = Math.Max(Car.MaxBrakeForceN, Car.MaxHandbrakeForceN / 2);

float brakeShoeFriction = Car.GetBrakeShoeFrictionFactor();
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();

Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
if (Car.BrakeSkid) // Test to see if wheels are skiding due to excessive brake force
Expand Down
9 changes: 5 additions & 4 deletions Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs
Expand Up @@ -275,6 +275,7 @@ public float ConvectionFactor
float BrakeWheelTreadForceN; // The retarding force apparent on the tread of the wheel
float WagonBrakeAdhesiveForceN; // The adhesive force existing on the wheels of the wagon
public float SkidFriction = 0.08f; // Friction if wheel starts skidding - based upon wheel dynamic friction of approx 0.08
public float HuDBrakeShoeFriction;

public float AuxTenderWaterMassKG; // Water mass in auxiliary tender
public string AuxWagonType; // Store wagon type for use with auxilary tender calculations
Expand Down Expand Up @@ -3242,11 +3243,11 @@ public virtual float GetBrakeShoeFrictionFactor()

if (BrakeShoeType == BrakeShoeTypes.CastIron)
{
frictionfraction = 0.6f * ((1.6f * brakeShoeForcekN + 100.0f) / (8.0f * brakeShoeForcekN + 100.0f)) * ((AbsSpeedMpS + 100.0f) / (5.0f * AbsSpeedMpS + 100.0f));
frictionfraction = 0.6f * ((1.6f * brakeShoeForcekN + 100.0f) / (8.0f * brakeShoeForcekN + 100.0f)) * ((MpS.ToKpH(AbsSpeedMpS) + 100.0f) / (5.0f * MpS.ToKpH(AbsSpeedMpS) + 100.0f));
}
else if (BrakeShoeType == BrakeShoeTypes.HiFrictionCompost)
{
frictionfraction = 0.44f * ((0.1f * brakeShoeForcekN + 20.0f) / (0.4f * brakeShoeForcekN + 20.0f)) * ((AbsSpeedMpS + 150.0f) / (2.0f * AbsSpeedMpS + 150.0f));
frictionfraction = 0.44f * ((0.1f * brakeShoeForcekN + 20.0f) / (0.4f * brakeShoeForcekN + 20.0f)) * ((MpS.ToKpH(AbsSpeedMpS) + 150.0f) / (2.0f * MpS.ToKpH(AbsSpeedMpS) + 150.0f));
}
else if (BrakeShoeType == BrakeShoeTypes.UserDefined)
{
Expand Down Expand Up @@ -3304,11 +3305,11 @@ public virtual float GetBrakeShoeFrictionCoefficientHuD()

if (BrakeShoeType == BrakeShoeTypes.CastIron)
{
frictionfraction = 0.6f * ((1.6f * brakeShoeForcekN + 100.0f) / (8.0f * brakeShoeForcekN + 100.0f)) * ((AbsSpeedMpS + 100.0f) / (5.0f * AbsSpeedMpS + 100.0f));
frictionfraction = 0.6f * ((1.6f * brakeShoeForcekN + 100.0f) / (8.0f * brakeShoeForcekN + 100.0f)) * ((MpS.ToKpH(AbsSpeedMpS) + 100.0f) / (5.0f * MpS.ToKpH(AbsSpeedMpS) + 100.0f));
}
else if (BrakeShoeType == BrakeShoeTypes.HiFrictionCompost)
{
frictionfraction = 0.44f * ((0.1f * brakeShoeForcekN + 20.0f) / (0.4f * brakeShoeForcekN + 20.0f)) * ((AbsSpeedMpS + 150.0f) / (2.0f * AbsSpeedMpS + 150.0f));
frictionfraction = 0.44f * ((0.1f * brakeShoeForcekN + 20.0f) / (0.4f * brakeShoeForcekN + 20.0f)) * ((MpS.ToKpH(AbsSpeedMpS) + 150.0f) / (2.0f * MpS.ToKpH(AbsSpeedMpS) + 150.0f));
}
else if (BrakeShoeType == BrakeShoeTypes.UserDefined)
{
Expand Down
2 changes: 1 addition & 1 deletion Source/RunActivity/Viewer3D/Popups/HUDWindow.cs
Expand Up @@ -1160,7 +1160,7 @@ void TextPageForceInfo(TableData table)
TableSetCell(table, 12, "{0}", FormatStrings.FormatLargeMass(car.MassKG, car.IsMetric, car.IsUK));
TableSetCell(table, 13, "{0:F2}%", -car.CurrentElevationPercent);
TableSetCell(table, 14, "{0}", FormatStrings.FormatDistance(car.CurrentCurveRadius, car.IsMetric));
TableSetCell(table, 15, "{0:F0}%", car.GetBrakeShoeFrictionCoefficientHuD() * 100.0f);
TableSetCell(table, 15, "{0:F0}%", car.HuDBrakeShoeFriction * 100.0f);
TableSetCell(table, 16, car.HUDBrakeSkid ? Viewer.Catalog.GetString("Yes") : Viewer.Catalog.GetString("No"));
TableSetCell(table, 17, "{0} {1}", FormatStrings.FormatTemperature(car.WheelBearingTemperatureDegC, car.IsMetric, false), car.DisplayWheelBearingTemperatureStatus);
TableSetCell(table, 18, car.Flipped ? Viewer.Catalog.GetString("Flipped") : "");
Expand Down

0 comments on commit d1ddb98

Please sign in to comment.