Skip to content

Commit fd2cabb

Browse files
committed
Include axle friction in total friction
This over-estimates a bit the friction force (this has happened for a while), as Davis A and B already include rolling friction
1 parent 9c7cdbf commit fd2cabb

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,6 +3186,8 @@ protected virtual void UpdateAxles(float elapsedClockSeconds)
31863186

31873187
foreach (var axle in LocomotiveAxles)
31883188
{
3189+
/*axle.FrictionN = DavisAN * axle.WheelWeightKg / MassKG;
3190+
axle.DampingNs = DavisBNSpM * axle.WheelWeightKg / MassKG;*/
31893191
axle.BrakeRetardForceN = BrakeRetardForceN * axle.BrakeForceFraction;
31903192
axle.TrainSpeedMpS = SpeedMpS; //Set the train speed of the axle mod
31913193
axle.WheelRadiusM = DriverWheelRadiusM;
@@ -3203,6 +3205,7 @@ protected virtual void UpdateAxles(float elapsedClockSeconds)
32033205
else TractionForceN = Math.Abs(TractiveForceN);
32043206
MotiveForceN = LocomotiveAxles.AxleMotiveForceN;
32053207
BrakeForceN = LocomotiveAxles.AxleBrakeForceN;
3208+
RollingFrictionForceN = LocomotiveAxles.AxleFrictionForceN;
32063209

32073210
if (elapsedClockSeconds > 0)
32083211
{

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6684,7 +6684,17 @@ private float NormalisedCrankAngle(int enginenumber, int cylinderNumber, float c
66846684

66856685

66866686
protected override void UpdateAxles(float elapsedClockSeconds)
6687-
{
6687+
{
6688+
foreach (var axle in LocomotiveAxles)
6689+
{
6690+
/*axle.FrictionN = DavisAN * axle.WheelWeightKg / MassKG;
6691+
axle.DampingNs = DavisBNSpM * axle.WheelWeightKg / MassKG;*/
6692+
axle.BrakeRetardForceN = BrakeRetardForceN * axle.BrakeForceFraction;
6693+
axle.TrainSpeedMpS = SpeedMpS; //Set the train speed of the axle mod
6694+
axle.WheelDistanceGaugeM = TrackGaugeM;
6695+
axle.CurrentCurveRadiusM = CurrentCurveRadiusM;
6696+
axle.BogieRigidWheelBaseM = RigidWheelBaseM;
6697+
}
66886698
foreach (var engine in SteamEngines)
66896699
{
66906700
var axle = engine.AttachedAxle;
@@ -6741,20 +6751,13 @@ protected override void UpdateAxles(float elapsedClockSeconds)
67416751
axle.FrictionN = N.FromLbf(3.8f * Me.ToIn(engine.CylindersDiameterM) * Me.ToIn(engine.CylindersDiameterM) * Me.ToIn(engine.CylindersStrokeM) / (Me.ToIn(axle.WheelRadiusM * 2.0f)));
67426752
}
67436753
}
6744-
foreach (var axle in LocomotiveAxles)
6745-
{
6746-
axle.BrakeRetardForceN = BrakeRetardForceN * axle.BrakeForceFraction;
6747-
axle.TrainSpeedMpS = SpeedMpS; //Set the train speed of the axle mod
6748-
axle.WheelDistanceGaugeM = TrackGaugeM;
6749-
axle.CurrentCurveRadiusM = CurrentCurveRadiusM;
6750-
axle.BogieRigidWheelBaseM = RigidWheelBaseM;
6751-
}
67526754

67536755
LocomotiveAxles.Update(elapsedClockSeconds);
67546756

67556757
TractiveForceN = LocomotiveAxles.DriveForceN;
67566758
MotiveForceN = LocomotiveAxles.AxleMotiveForceN;
67576759
BrakeForceN = LocomotiveAxles.AxleBrakeForceN;
6760+
RollingFrictionForceN = LocomotiveAxles.AxleFrictionForceN;
67586761

67596762
if (LocoNumDrvAxles <= 0)
67606763
{

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,14 @@ private void UpdateTrainBaseResistance()
23702370
{
23712371
UpdateTrainBaseResistance_ORTS();
23722372
}
2373+
2374+
// TODO: the Davis A and B parameters already include rolling friction. Thus, there is an over-estimation
2375+
// of the rolling friction forces, due to a small amount of friction being inserted to the axle module.
2376+
// This needs to be fixed by inserting the Davis A and B parameters to the axle, to the 'friction' and
2377+
// 'damping' axle parameters respectively, and their calculation must be removed from UpdateTrainBaseResistance_ methods
2378+
// This means that low/high speed friction has to be calculated and passed to the axle module elsewhere
2379+
// Davis C is related to air speed and must be calculated here and not inside the axle module
2380+
FrictionForceN += RollingFrictionForceN;
23732381
}
23742382

23752383
/// <summary>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,14 +571,15 @@ public Direction Direction
571571

572572
// TrainCar.Update() must set these variables
573573
/// <summary>
574-
/// Force transmitted to rail, excluding brake force
574+
/// Force transmitted to rail, excluding brake and friction force
575575
/// Adhesion-corrected tractive force
576576
/// </summary>
577577
public float MotiveForceN;
578578
/// <summary>
579579
/// Tractive force generated by the engine(s)
580580
/// </summary>
581581
public float TractiveForceN = 0f;
582+
public float RollingFrictionForceN;
582583
// Gravity forces have negative values on rising grade.
583584
// This means they have the same sense as the motive forces and will push the train downhill.
584585
public float GravityForceN; // Newtons - signed relative to direction of car.

0 commit comments

Comments
 (0)