Skip to content

Commit 0b44e34

Browse files
committed
Correct -ve occuring issues
1 parent f4c0b91 commit 0b44e34

File tree

1 file changed

+16
-2
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ public float SlipSpeedPercent
623623
{
624624
var temp = SlipSpeedMpS / WheelSlipThresholdMpS * 100.0f;
625625
if (float.IsNaN(temp)) temp = 0;//avoid NaN on HuD display when first starting OR
626-
return temp;
626+
return Math.Abs(temp);
627627
}
628628
}
629629

@@ -1009,11 +1009,17 @@ public void Update()
10091009
var Syc = Sy + spinM1 * a_HertzianMM;
10101010
Syc2 = Syc * Syc;
10111011

1012-
// calculate "standard" Polach adhesion parameters as straight line approximations as u varies
1012+
// calculate "standard" Polach adhesion parameters as straight line approximations as u varies - these values are capped at the moment at the u=0.3 level
1013+
// Taking them lower may reduce the stability of the calculations
10131014
polach_A = 0.4;
10141015
polach_B = (1.6 * umax) - 0.28;
1016+
if (polach_B < 0.2) polach_B = 0.2f;
1017+
10151018
polach_Ka = (2.8 * umax) - 0.54;
1019+
if (polach_Ka < 0.3) polach_Ka = 0.3f;
1020+
10161021
polach_Ks = (1.2 * umax) - 0.26;
1022+
if (polach_Ks < 0.1) polach_Ks = 0.1f;
10171023
}
10181024
public double SlipCharacteristics(double slipSpeedMpS)
10191025
{
@@ -1041,6 +1047,14 @@ public double SlipCharacteristics(double slipSpeedMpS)
10411047
var slipComponent = Math.Atan(polach_Ks * Stiffness);
10421048
var f = polach_uadhesion / (Math.PI / 2) * (adhesionComponent + slipComponent);
10431049
var fx = f * Sx / Sc;
1050+
/*
1051+
if (fx < 0)
1052+
{
1053+
Trace.TraceInformation("Negative Fx - Fx {0} Speed {1} SlipSpeed {2} Sx {3} PolachAdhesion {4} adhesionComponent {5} slipComponent {6} Polach_Ks {7}", fx, MpS.ToMpH((float)speedMpS), MpS.ToMpH((float)slipSpeedMpS), MpS.ToMpH((float)Sx), polach_uadhesion, adhesionComponent, slipComponent, polach_Ks);
1054+
1055+
}
1056+
*/
1057+
10441058
return fx;
10451059
}
10461060
}

0 commit comments

Comments
 (0)