Skip to content

Conversation

@peternewell
Copy link
Contributor

Implements Polach adhesion physics to replace current adhesion physics.

This will allow future track based enhancements to be implemented

https://blueprints.launchpad.net/or/+spec/enhance-adhesion

@peternewell peternewell added enhancement New feature or request not-for-unstable Special label to exclude a pull request from the Unstable Version labels Sep 26, 2023
@peternewell peternewell self-assigned this Sep 26, 2023
@peternewell peternewell added for-unstable Special label to include a pull request in the Unstable Version and removed not-for-unstable Special label to exclude a pull request from the Unstable Version labels Oct 1, 2023
twpol pushed a commit that referenced this pull request Oct 1, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: Dispatcher window improvements
- Pull request #874 at e90cf2b: 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 0b44e34: Implement Polach Adhesion
twpol pushed a commit that referenced this pull request Oct 1, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: Dispatcher window improvements
- Pull request #874 at e90cf2b: 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 0b44e34: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
twpol pushed a commit that referenced this pull request Oct 2, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: Dispatcher window improvements
- Pull request #874 at e90cf2b: 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 2a7fb17: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
twpol pushed a commit that referenced this pull request Oct 5, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: 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 2a7fb17: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
twpol pushed a commit that referenced this pull request Oct 7, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: 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 4981d5b: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
twpol pushed a commit that referenced this pull request Oct 8, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: 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 90b5712: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
twpol pushed a commit that referenced this pull request Oct 9, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: 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 90b5712: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
- Pull request #880 at 084b404: fix: Refined comment summarising property SData1
twpol pushed a commit that referenced this pull request Oct 10, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: 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 bb3dfb9: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
- Pull request #880 at 084b404: fix: Refined comment summarising property SData1
twpol pushed a commit that referenced this pull request Oct 10, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: 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 9407233: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
- Pull request #880 at 084b404: fix: Refined comment summarising property SData1
twpol pushed a commit that referenced this pull request Oct 14, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #865 at 776d6df: 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 ef944ab: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
- Pull request #880 at 084b404: fix: Refined comment summarising property SData1
twpol pushed a commit that referenced this pull request Oct 14, 2023
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- 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 ef944ab: Implement Polach Adhesion
- Pull request #879 at 5a0ff7b: chore: remove Website folder
- Pull request #880 at 084b404: fix: Refined comment summarising property SData1
twpol pushed a commit that referenced this pull request Oct 15, 2023
- 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 #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 ef944ab: Implement Polach Adhesion
- Pull request #880 at 084b404: fix: Refined comment summarising property SData1
twpol pushed a commit that referenced this pull request Oct 19, 2023
- 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 #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 076cd04: Implement Polach Adhesion
twpol pushed a commit that referenced this pull request Oct 21, 2023
- 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 #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 076cd04: Implement Polach Adhesion
- Pull request #883 at aac4d3f: SwitchPanel disconnect/connect handling
twpol pushed a commit that referenced this pull request Oct 21, 2023
- 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 #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 076cd04: Implement Polach Adhesion
- Pull request #883 at aac4d3f: SwitchPanel disconnect/connect handling
- Pull request #884 at 8b3d60a: build: Additional settings for dotnet build
twpol pushed a commit that referenced this pull request Oct 22, 2023
- 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 076cd04: Implement Polach Adhesion
- Pull request #883 at aac4d3f: SwitchPanel disconnect/connect handling
- Pull request #884 at 8b3d60a: build: Additional settings for dotnet build
Copy link
Contributor

@cesarBLG cesarBLG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Peter,
I have a style suggestion on how to switch between models without having lots of if (usePolachAdhesion) clauses. I can fix it myself when this gets merged, so you can switch to a different topic.

Comment on lines +823 to +830
if (UsePolachAdhesion)
{
axleOutForceN = Math.Sign(slipSpeedMpS) * AxleWeightN * SlipCharacteristicsPolach(slipSpeedMpS);
}
else
{
axleOutForceN = AxleWeightN * SlipCharacteristicsPacha((float)axleSpeedMpS - TrainSpeedMpS, TrainSpeedMpS, AdhesionK, AdhesionLimit);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if the differences between models are kept in SlipCharacteristics(), so the rest of the functions is platform-agnostic. I offer to do that in a further PR if you prefer. Only a couple of lines have to be changed.

Comment on lines +974 to +987
WheelSlipThresholdMpS = MpS.FromKpH(AdhesionK / AdhesionLimit);
WheelAdhesion = 0.99f;
MaximumPolachWheelAdhesion = 0.99f;

}

forceToAccelerationFactor = WheelRadiusM * WheelRadiusM / totalInertiaKgm2;

if (UsePolachAdhesion)
{

Polach.Update();
axleStaticForceN = AxleWeightN * SlipCharacteristicsPolach(0);
ComputeWheelSlipThresholdMpS();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be simplified to make it model-agnostic

Comment on lines +989 to +994
if (count < 6 && count++ == 5)
{
TrainSpeedMpS = 10 / 3.6f;
Polach.Update();
axleStaticForceN = AxleWeightN * SlipCharacteristicsPolach(0);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was debug info that isn't used anymore. We can remove it.

twpol pushed a commit that referenced this pull request Nov 26, 2023
- 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 67014b7: 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 8a6acee: Implement Polach Adhesion
- Pull request #882 at 753b622: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 228f0f0: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #889 at 43341cf: No speed update
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Nov 26, 2023
- 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 67014b7: 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 8a6acee: Implement Polach Adhesion
- Pull request #882 at 753b622: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at fabfc5a: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #889 at 43341cf: No speed update
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
@peternewell
Copy link
Contributor Author

Hi Cesar,

I have a style suggestion on how to switch between models without having lots of if (usePolachAdhesion) clauses. I can fix it myself when this gets merged, so you can switch to a different topic.

Thanks for that. I am happy to take up your offer as I am keen to move onto another feature that I have had in the pipeline for couple of months.




The heart of the adhesion algorithim is the slip characteristics (pictured below).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The heart of the adhesion algorithim is the slip characteristics (pictured below).
The heart of the adhesion algorithm is the slip characteristics (pictured below).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling error corrected.

@cjakeman
Copy link
Contributor

cjakeman commented Nov 27, 2023

Hi Peter,

Thanks for adding a piece for the manual.

I asked James about using the Frame Rate and it seems I was not understanding it fully. The Updater thread (where the Simulator updates) and the Render thread work in strict sequence so there is exactly 1 simulator cycle for each frame. So the relationship betwwen frame rate and elapsed seconds is fixed (as in this code snippet from RenderProcess.cs):

        public void ComputeFPS(float elapsedRealTime)
        {
            if (elapsedRealTime < 0.001)
                return;
            FrameRate.Update(elapsedRealTime, 1f / elapsedRealTime);
            FrameTime.Update(elapsedRealTime, elapsedRealTime);
        }

I hope that makes things clearer.

At the moment it still uses the FrameRate to switch. It switches down @ 55 and up at @ 59 (60 fps seems to be the maximum display value).

We think that you're setting the bar rather high for Polach Adhesion and switching at 30 and 40 fps might be better.

The real test is how well this suits Cesar and others with low-spec PCs. Would you use your Polach forum thread to ask for feedback on exactly this issue? If that proves to be OK and SetFrameRate() is removed, then your PR can be approved and merged.

Best wishes,

twpol pushed a commit that referenced this pull request Nov 27, 2023
- 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 67014b7: 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 8a6acee: Implement Polach Adhesion
- Pull request #882 at 753b622: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 52c3c82: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #889 at 43341cf: No speed update
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Nov 28, 2023
- 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 67014b7: 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 0d65fe4: Implement Polach Adhesion
- Pull request #882 at 753b622: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 52c3c82: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #889 at 43341cf: No speed update
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
@peternewell
Copy link
Contributor Author

Hi Chris,

The real test is how well this suits Cesar and others with low-spec PCs. Would you use your Polach forum thread to ask for feedback on exactly this issue? If that proves to be OK and SetFrameRate() is removed, then your PR can be approved and merged.

I have made the changes that you have requested.

Hopefully given the fact that there were not many people raising issues (probably won't impact many users until it goes to Testing) I am hoping that you can approve it within the next couple of days so that I can move onto some changes that I would like to add and merging this will help.

I am happy to address any issues addressed longer term if required.

Thanks

twpol pushed a commit that referenced this pull request Nov 28, 2023
- 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 67014b7: 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 a088cf7: Implement Polach Adhesion
- Pull request #882 at 753b622: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 52c3c82: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #889 at 43341cf: No speed update
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
// Test to determine whether to use Polach or Pacha adhesion

// 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to add an additional check so that we don't switch between models when simulation is paused (timeSpan=0). Also, when entering dense areas, frame rate will drop and will cause a non-smooth transition between models. That's not good I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to add an additional check so that we don't switch between models when simulation is paused (timeSpan=0). Also, when entering dense areas, frame rate will drop and will cause a non-smooth transition between models. That's not good I think.

The check would need to be based upon !Simulator.Paused and would prevent the switching code from working when the game is paused.


// Set values for Pacha adhesion
WheelSlipThresholdMpS = MpS.FromKpH(AdhesionK / AdhesionLimit);
WheelAdhesion = 0.99f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we setting this to 99% instead of using the same logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we setting this to 99% instead of using the same logic?

Both of these values were not displayed in the Pacha model. Wheel Adhesion could be displayed, but MaxWheelAdhesion was not calculated for the Pacha model.

Perhaps the more elegant way would be to change the HuD so that these lines are removed when switched to the Pacha mode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you can calculate MaxWheelAdhesion for the Pacha model too. It may be good having it for debugging. Never mind, I'll refactor this later to make almost everything in axle.cs model independent.

@cesarBLG
Copy link
Contributor

Hi Peter,
I see some potential issues that I would prefer to be addressed. Maybe I can approve it as is, and then we fix the problems in the future? I think none of us really knows what's happening with the substeps and its relationship with FPS, which is why we are trying some complex workarounds.

For example, in my case I typically get low FPS, but I don't know if the bottleneck is in the Update process or in the Render process. If the bottleneck is caused by rendering, this means that we can safely increase the number of substeps, and the FPS won't be impacted (the Update thread is suspended until restarted by the Render process, so there is room for extra CPU usage). On the other hand, if low FPS are caused by the Update process, then increasing the number of substeps will degrade performance. Since difference in CPU performance is quite similar for all computers, I would expect the bottleneck to be in the graphics side.

I write this because, with our current FPS-based approach, there will be jumps in wheel speed when FPS varies, and this will impact user experience. If we are sure that using 100 substeps does not impact frame rates (i.e. we have a rendering bottleneck), then we could use Polach for all systems.

All this discussion is beyond my knowledge, so I may be wrong.

@peternewell
Copy link
Contributor Author

Hi Peter, I see some potential issues that I would prefer to be addressed. Maybe I can approve it as is, and then we fix the problems in the future? I think none of us really knows what's happening with the substeps and its relationship with FPS, which is why we are trying some complex workarounds.

For example, in my case I typically get low FPS, but I don't know if the bottleneck is in the Update process or in the Render process. If the bottleneck is caused by rendering, this means that we can safely increase the number of substeps, and the FPS won't be impacted (the Update thread is suspended until restarted by the Render process, so there is room for extra CPU usage). On the other hand, if low FPS are caused by the Update process, then increasing the number of substeps will degrade performance. Since difference in CPU performance is quite similar for all computers, I would expect the bottleneck to be in the graphics side.

I write this because, with our current FPS-based approach, there will be jumps in wheel speed when FPS varies, and this will impact user experience. If we are sure that using 100 substeps does not impact frame rates (i.e. we have a rendering bottleneck), then we could use Polach for all systems.

All this discussion is beyond my knowledge, so I may be wrong.

It has always been my concern that the GPU card could be masking the problem.

James (via info from Chris) suggests that the Render and Update processes shouldn't be causing each other issues.

So the question becomes how do we confirm it one way or another.

I have a almost new PC and I run at 60fps all the time so I am not a good tester. Are you able to put any debug code into a test branch and see if you can confirm it one way or another?

As you suggest, I think that we are getting to the stage of approving it, and then addressing any potential issues identified, if they are raised.

twpol pushed a commit that referenced this pull request Nov 28, 2023
- 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 67014b7: 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 a088cf7: Implement Polach Adhesion
- Pull request #882 at 753b622: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 34e8cae: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #889 at 43341cf: No speed update
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Nov 29, 2023
- 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 67014b7: 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 a088cf7: Implement Polach Adhesion
- Pull request #882 at 753b622: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 34e8cae: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Nov 29, 2023
- 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 67014b7: 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 a088cf7: Implement Polach Adhesion
- Pull request #882 at 1734b59: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 34e8cae: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Nov 29, 2023
- 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 67014b7: 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 a088cf7: Implement Polach Adhesion
- Pull request #882 at 1734b59: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 93a5fa9: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Nov 30, 2023
- 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 67014b7: 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 a088cf7: Implement Polach Adhesion
- Pull request #882 at c5cdbd3: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at 93a5fa9: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Nov 30, 2023
- 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 67014b7: 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 a088cf7: Implement Polach Adhesion
- Pull request #882 at c5cdbd3: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at cd452ee: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
twpol pushed a commit that referenced this pull request Dec 1, 2023
- 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 67014b7: 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 9347dcf: Implement Polach Adhesion
- Pull request #882 at c5cdbd3: Blueprint/train car operations UI window
- Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling
- Pull request #885 at c81447b: feat: Add notifications to Menu
- Pull request #886 at cd452ee: Scene viewer extension to TrackViewer
- Pull request #888 at d7daf62: docs: Document player application model
- Pull request #890 at 39a9fa4: Allow depart early
- Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH
- Pull request #893 at bf8876b: Signal errors
- Pull request #894 at 794fddf: Correct Decrease Colour
- Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains
- Pull request #897 at 64a29c8: feat: Improved system information collection
Copy link
Contributor

@cjakeman cjakeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Peter,

Thanks for making these changes.

Approved and merged.

Chris

@cjakeman cjakeman merged commit 89833d4 into openrails:master Dec 1, 2023
@peternewell peternewell deleted the adhesion_polach_#1 branch December 1, 2023 21:20
@peternewell
Copy link
Contributor Author

Thanks Chris

Csantucci added a commit to Csantucci/openrails that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request for-unstable Special label to include a pull request in the Unstable Version

Development

Successfully merging this pull request may close these issues.

3 participants