Skip to content

Commit bb3dfb9

Browse files
committed
Make adjustments to adhesion
1 parent 90b5712 commit bb3dfb9

File tree

1 file changed

+26
-4
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions

1 file changed

+26
-4
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ public void Initialize()
231231
if (axle.AxleWeightN <= 0) axle.AxleWeightN = 9.81f * locomotive.DrvWheelWeightKg / AxleList.Count; //remains fixed for diesel/electric locomotives, but varies for steam locomotives
232232
if (axle.NumAxles <= 0) axle.NumAxles = locomotive.LocoNumDrvAxles;
233233
if (axle.WheelRadiusM <= 0) axle.WheelRadiusM = locomotive.DriverWheelRadiusM;
234+
if (axle.WheelFlangeAngleRad <= 0) axle.WheelFlangeAngleRad = locomotive.MaximumWheelFlangeAngleRad;
234235
if (axle.DampingNs <= 0) axle.DampingNs = locomotive.MassKG / 1000.0f / AxleList.Count;
235236
if (axle.FrictionN <= 0) axle.FrictionN = locomotive.MassKG / 1000.0f / AxleList.Count;
236237
}
@@ -480,6 +481,11 @@ public float TransmissionEfficiency
480481
/// </summary>
481482
public float WheelRadiusM;
482483

484+
/// <summary>
485+
/// Flange angle wheels connected to axle
486+
/// </summary>
487+
public float WheelFlangeAngleRad;
488+
483489
/// <summary>
484490
/// Gauge of Track
485491
/// </summary>
@@ -594,7 +600,14 @@ public void ComputeWheelSlipThresholdMpS()
594600
double SlipSpeedMpS = AxleSpeedMpS - TrainSpeedMpS;
595601
double fslip = SlipCharacteristics(SlipSpeedMpS);
596602

597-
if (fa * fb > 0)
603+
if(SlipSpeedMpS == 0)
604+
{
605+
// For display purposes threshold = 0 when no slip speed
606+
WheelSlipThresholdMpS = 0;
607+
return;
608+
}
609+
610+
if (fa * fb > 0)
598611
{
599612
// If sign does not change, bisection fails
600613
WheelSlipThresholdMpS = MpS.FromKpH(0.05f);
@@ -615,7 +628,7 @@ public void ComputeWheelSlipThresholdMpS()
615628
fb = fc;
616629
}
617630
}
618-
WheelSlipThresholdMpS = (float)Math.Max((a + b) / 2, MpS.FromKpH(0.2f));
631+
WheelSlipThresholdMpS = (float)Math.Max((a + b) / 2, MpS.FromKpH(0.05f));
619632

620633
// if (SlipSpeedMpS > 0)
621634
// Trace.TraceInformation("Fx Values - a {0} fa1 {1} b {2} fb1 {3} s {4} fs {5} t {6} ft {7} u {8} fu {9} v {10} fv {11} x {12} fx {13} y {14} fy {15} Speed {16} Threshold {17} Fslip {18} SlipSpeed {19}", a, fa1, b, fb1, s, fs, t, ft, u, fu, v, fv, x, fx, y, fy, TrainSpeedMpS, WheelSlipThresholdMpS, fslip, SlipSpeedMpS);
@@ -651,7 +664,7 @@ public float SlipSpeedPercent
651664
{
652665
get
653666
{
654-
var temp = SlipSpeedMpS / WheelSlipThresholdMpS * 100.0f;
667+
var temp = (SlipSpeedMpS / WheelSlipThresholdMpS) * 100.0f;
655668
if (float.IsNaN(temp)) temp = 0;//avoid NaN on HuD display when first starting OR
656669
return Math.Abs(temp);
657670
}
@@ -742,6 +755,9 @@ public void Parse(STFReader stf)
742755
case "ortsradius":
743756
WheelRadiusM = stf.ReadFloatBlock(STFReader.UNITS.Distance, null);
744757
break;
758+
case "ortsflangeangle":
759+
WheelFlangeAngleRad = stf.ReadFloatBlock(STFReader.UNITS.Angle, null);
760+
break;
745761
case "ortsnumberwheelaxles":
746762
NumAxles = stf.ReadFloatBlock(STFReader.UNITS.Distance, null);
747763
break;
@@ -766,6 +782,7 @@ public void Parse(STFReader stf)
766782
public void Copy(Axle other)
767783
{
768784
WheelRadiusM = other.WheelRadiusM;
785+
WheelFlangeAngleRad = other.WheelFlangeAngleRad;
769786
NumAxles = other.NumAxles;
770787
InertiaKgm2 = other.InertiaKgm2;
771788
AxleWeightN = other.AxleWeightN;
@@ -1049,7 +1066,12 @@ public void Update()
10491066
if (float.IsNaN((float)Sy)) Sy = 0;//avoid NaN when first starting OR
10501067
Sy2 = Sy * Sy;
10511068

1052-
spinM1 = Math.Sin(wheelContactAngleRad) / wheelRadiusMM;
1069+
spinM1 = Math.Sin(Axle.WheelFlangeAngleRad) / wheelRadiusMM;
1070+
1071+
// Trace.TraceInformation("Spin - {0} FlangeAngle {1} wheelRadius {2} Speed {3}", spinM1, Axle.WheelFlangeAngleRad, wheelRadiusMM, trainSpeedMpS);
1072+
1073+
if (float.IsNaN((float)spinM1)) spinM1 = 0;//avoid NaN when first starting OR
1074+
10531075
Syc = Sy + (spinM1 * a_HertzianMM);
10541076
Syc2 = Syc * Syc;
10551077

0 commit comments

Comments
 (0)