Skip to content

Commit

Permalink
Automatic merge of T1.5.1-684-gc6e0de1c4 and 8 pull requests
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
openrails-bot committed Oct 23, 2023
10 parents 81fe83a + c6e0de1 + c59c788 + d00beb9 + a1318b5 + f8dbeab + 43bf33e + f92de76 + b13e6ab + aac4d3f commit 13af019
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -904,15 +904,16 @@ void Integrate(float elapsedClockSeconds)
// Points are 1 = (0, upperLimit) and 2 = (threshold, lowerLimit)

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

if (targetNumOfSubstepsPS > NumOfSubstepsPS) // increase substeps
// if (targetNumOfSubstepsPS > NumOfSubstepsPS && Math.Abs(integratorError) > Math.Max((Math.Abs(SlipSpeedMpS) - 1) * 0.01, 0.001)) // increase substeps
if (targetNumOfSubstepsPS > NumOfSubstepsPS && Math.Abs(integratorError) > Math.Max((Math.Abs(SlipSpeedMpS) - 1) * 0.01, 0.001)) // increase substeps
{
if (--waitBeforeSpeedingUp <= 0) //wait for a while before speeding up the integration
if (--waitBeforeSpeedingUp <= 0 ) //wait for a while before speeding up the integration
{
NumOfSubstepsPS += 5;
waitBeforeSpeedingUp = 5; //not so fast ;)
Expand All @@ -923,14 +924,19 @@ void Integrate(float elapsedClockSeconds)
NumOfSubstepsPS -= 5;
waitBeforeSpeedingUp = 5;
}
else if (Math.Abs(integratorError) < 0.005)
{
NumOfSubstepsPS -= 2;
waitBeforeSpeedingUp = 5;
}

if (NumOfSubstepsPS < lowerLimit)
NumOfSubstepsPS = lowerLimit;

if (NumOfSubstepsPS > upperLimit)
NumOfSubstepsPS = upperLimit;

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

double dt = elapsedClockSeconds / NumOfSubstepsPS;
double hdt = dt / 2;
Expand Down

0 comments on commit 13af019

Please sign in to comment.