Skip to content

Commit

Permalink
Correct code factor issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewell committed Jun 1, 2023
1 parent d1ddb98 commit ea7a67f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
Expand Up @@ -981,7 +981,6 @@ public virtual void LoadFromWagFile(string wagFilePath)
Trace.TraceInformation("Empty Values = Brake {0} Handbrake {1} DavisA {2} DavisB {3} DavisC {4} CoGY {5}", LoadEmptyMaxBrakeForceN, LoadEmptyMaxHandbrakeForceN, LoadEmptyORTSDavis_A, LoadEmptyORTSDavis_B, LoadEmptyORTSDavis_C, LoadEmptyCentreOfGravityM_Y);
Trace.TraceInformation("Full Values = Brake {0} Handbrake {1} DavisA {2} DavisB {3} DavisC {4} CoGY {5}", LoadFullMaxBrakeForceN, LoadFullMaxHandbrakeForceN, LoadFullORTSDavis_A, LoadFullORTSDavis_B, LoadFullORTSDavis_C, LoadFullCentreOfGravityM_Y);
#endif

}

// Determine whether or not to use the Davis friction model. Must come after freight animations are initialized.
Expand Down
Expand Up @@ -210,9 +210,14 @@ public override void Update(float elapsedClockSeconds)
{
Car.BrakeShoeForceN = Car.MaxBrakeForceN * Math.Min(BrakeForceFraction, 1);
if (Car.BrakeShoeForceN < Car.MaxHandbrakeForceN * HandbrakePercent / 100)
{
Car.BrakeShoeForceN = Car.MaxHandbrakeForceN * HandbrakePercent / 100;
}
}
else
{
Car.BrakeShoeForceN = Math.Max(Car.MaxBrakeForceN, Car.MaxHandbrakeForceN / 2);
}
else Car.BrakeShoeForceN = Math.Max(Car.MaxBrakeForceN, Car.MaxHandbrakeForceN / 2);

float brakeShoeFriction = Car.GetBrakeShoeFrictionFactor();
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();
Expand Down
9 changes: 1 addition & 8 deletions Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs
Expand Up @@ -3220,15 +3220,12 @@ public virtual float GetFilledFraction(uint pickupType)
return 0f;
}


/// <summary>
/// Returns the coefficient of friction (CoF) for the brake shoe. For legacy operation, it will be a "representation" of the CoF that will adjust
/// the brake retard force with speed.
/// </summary>

public virtual float GetBrakeShoeFrictionFactor()
{

{
var frictionfraction = 0.0f;
float AdhesionMultiplier = Simulator.Settings.AdhesionFactor / 100.0f; // User set adjustment factor - convert to a factor where 100% = no change to adhesion

Expand Down Expand Up @@ -3257,7 +3254,6 @@ public virtual float GetBrakeShoeFrictionFactor()
{
if (BrakeShoeFrictionFactor != null) // User defined friction has been applied in WAG file, but brake shoe has not be described, hence a legacy condition - Assume MaxBrakeForce is correctly set in the WAG, so no adjustment required
{

float userFriction = BrakeShoeFrictionFactor[MpS.ToKpH(AbsSpeedMpS)];
float zeroUserFriction = BrakeShoeFrictionFactor[MpS.ToKpH(0)];

Expand All @@ -3275,14 +3271,12 @@ public virtual float GetBrakeShoeFrictionFactor()
}

return frictionfraction;

}
else
{
frictionfraction = (7.6f / (MpS.ToKpH(AbsSpeedMpS) + 17.5f) + 0.07f); // Base Curtius - Kniffler equation - u = 0.50, all other values are scaled off this formula; // For simple friction use "default" curve
return frictionfraction;
}

}

/// <summary>
Expand Down Expand Up @@ -3328,7 +3322,6 @@ public virtual float GetBrakeShoeFrictionCoefficientHuD()
}

return frictionfraction;

}
else
{
Expand Down

0 comments on commit ea7a67f

Please sign in to comment.