Skip to content

Commit 13af019

Browse files
committed
Automatic merge of T1.5.1-684-gc6e0de1c4 and 8 pull requests
- Pull request #570 at c59c788: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at a1318b5: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #878 at b13e6ab: Implement Polach Adhesion - Pull request #883 at aac4d3f: SwitchPanel disconnect/connect handling
10 parents 81fe83a + c6e0de1 + c59c788 + d00beb9 + a1318b5 + f8dbeab + 43bf33e + f92de76 + b13e6ab + aac4d3f commit 13af019

File tree

1 file changed

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

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,15 +904,16 @@ void Integrate(float elapsedClockSeconds)
904904
// Points are 1 = (0, upperLimit) and 2 = (threshold, lowerLimit)
905905

906906
var upperLimit = 130;
907-
var lowerLimit = 10;
907+
var lowerLimit = 1;
908908
var AdhesGrad = ((upperLimit - lowerLimit) / (WheelSlipThresholdMpS - 0));
909909
var targetNumOfSubstepsPS = Math.Abs((AdhesGrad * SlipSpeedMpS) + lowerLimit);
910910
if (float.IsNaN((float)targetNumOfSubstepsPS)) targetNumOfSubstepsPS = 1;
911911
// Trace.TraceInformation("Grad - {0} AdhesGrad {1} SlipSpeedMps {2} Threshold {3}", temp, AdhesGrad, SlipSpeedMpS, WheelSlipThresholdMpS);
912912

913-
if (targetNumOfSubstepsPS > NumOfSubstepsPS) // increase substeps
913+
// if (targetNumOfSubstepsPS > NumOfSubstepsPS && Math.Abs(integratorError) > Math.Max((Math.Abs(SlipSpeedMpS) - 1) * 0.01, 0.001)) // increase substeps
914+
if (targetNumOfSubstepsPS > NumOfSubstepsPS && Math.Abs(integratorError) > Math.Max((Math.Abs(SlipSpeedMpS) - 1) * 0.01, 0.001)) // increase substeps
914915
{
915-
if (--waitBeforeSpeedingUp <= 0) //wait for a while before speeding up the integration
916+
if (--waitBeforeSpeedingUp <= 0 ) //wait for a while before speeding up the integration
916917
{
917918
NumOfSubstepsPS += 5;
918919
waitBeforeSpeedingUp = 5; //not so fast ;)
@@ -923,14 +924,19 @@ void Integrate(float elapsedClockSeconds)
923924
NumOfSubstepsPS -= 5;
924925
waitBeforeSpeedingUp = 5;
925926
}
927+
else if (Math.Abs(integratorError) < 0.005)
928+
{
929+
NumOfSubstepsPS -= 2;
930+
waitBeforeSpeedingUp = 5;
931+
}
926932

927933
if (NumOfSubstepsPS < lowerLimit)
928934
NumOfSubstepsPS = lowerLimit;
929935

930936
if (NumOfSubstepsPS > upperLimit)
931937
NumOfSubstepsPS = upperLimit;
932938

933-
// Trace.TraceInformation("Grad - {0} AdhesGrad {1} SlipSpeedMps {2} Threshold {3} NumStepsPS {4}", targetNumOfSubstepsPS, AdhesGrad, SlipSpeedMpS, WheelSlipThresholdMpS, NumOfSubstepsPS);
939+
// Trace.TraceInformation("Grad - {0} AdhesGrad {1} SlipSpeedMps {2} Threshold {3} NumStepsPS {4} Error {5}", targetNumOfSubstepsPS, AdhesGrad, SlipSpeedMpS, WheelSlipThresholdMpS, NumOfSubstepsPS, integratorError);
934940

935941
double dt = elapsedClockSeconds / NumOfSubstepsPS;
936942
double hdt = dt / 2;

0 commit comments

Comments
 (0)