From af831c3d248c021c824cfefdc8b8b0dbb166cb76 Mon Sep 17 00:00:00 2001 From: Csantucci Date: Sun, 17 Dec 2023 16:39:52 +0100 Subject: [PATCH] First fix for https://www.elvastower.com/forums/index.php?/topic/37671-advanced-adhesion-model-switched-to-low-performance-option-due-to-low-frame-rate/ --- .../SubSystems/PowerTransmissions/Axle.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs b/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs index a59013a0e..cac3edaf1 100644 --- a/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs +++ b/Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/Axle.cs @@ -1004,18 +1004,21 @@ public virtual void Update(float timeSpan) // Switches between Polach (high performance) adhesion model and Pacha (low performance) adhesion model depending upon the PC performance if(timeSpan < 0.025) // timespan 0.025 = 40 fps screen rate, low timeSpan and high FPS { + if (UsePolachAdhesion == false) + { + var ScreenFrameRate = 1 / timeSpan; + Trace.TraceInformation("Advanced adhesion model set to high performance option; frame rate {0} at ElapsedClockSeconds of {1}", ScreenFrameRate, timeSpan); + } UsePolachAdhesion = true; } else if(timeSpan > 0.033) // timespan 0.033 = 30 fps screen rate, high timeSpan and low FPS { - UsePolachAdhesion = false; - if (TrainSpeedMpS > 0 ) + if (UsePolachAdhesion == true) { var ScreenFrameRate = 1 / timeSpan; - Trace.TraceInformation("Advanced adhesion model switched to low performance option due to low frame rate {0} at ElapsedClockSeconds of {1}", ScreenFrameRate, timeSpan); - + Trace.TraceInformation("Advanced adhesion model set to low performance option due to low frame rate {0} at ElapsedClockSeconds of {1}", ScreenFrameRate, timeSpan); } - + UsePolachAdhesion = false; // Set values for Pacha adhesion WheelSlipThresholdMpS = MpS.FromKpH(AdhesionK / AdhesionLimit); WheelAdhesion = 0.99f; -- 2.30.2.windows.1