viper4gh / SimHub-Plugin-CalcLngWheelSlip

Plugin for SimHub. It calculates longitudinal wheel slip by the relationship between Tyre RPS and Car Speed and provides the result as new properties.
32 stars 8 forks source link

SimHub-Plugin: Calculate Longitudinal Wheel Slip

This is a plugin for SimHub

It calculates the longitudinal (in driving direction) wheel slip by the relationship between Tyre RPS and Car Speed, and provides the result as new properties.\ You can use these new properties to visualize lock and spin of wheels via a Dash for example, which can help to improve your brake and throttle input or optimize brake balance, ABS/TC, ARB and differential settings.\ In some cases the game API brings a Wheel Slip value directly with, but the difference is that this value is used for longitudinal and lateral (sideways) direction.\ The plugin is working for:

Installation

Put the DLL file Viper.PluginCalcLngWheelSlip.dll into the SimHub folder parallel to the SimHubWPF.exe and start SimHub.\ SimHub detects the new plugin, confirm the question for enabling.\ If SimHub does not start, please check the log files in the "Logs" folder.\ If you go to Settings -> Plugins tab now you should see the new plugin.

Further there is a settings screen under "Additional Plugins"-> "Calculate Longitudinal Wheel Slip" where you can configure the limits when a tyre diameter calculation is triggered.

Why do we need a tyre diameter calculation and what about these limits?

For the wheel slip calculation we have to calculate the tyre surface speed and compare it to the car speed.\ And for the tyre surface speed calculation we need the tyre diameter, which is not available in the game API.\ That means we have to calculate it first, but this works only if the wheel slip is nearly zero (no locking/spinning wheels, no cornering, no side slip).\ To automatically detect such a moment I defined 4 limits:

As soon as all 4 limits are met for the first time, the tyre diameter is calculated.\ And only if the diameter is calculated, the slip can be calculated.\ The tighter the limits are set, the more accurate the result, but the longer it takes that this moment happens.\ ~~The tyre diameters are saved as long as SimHub is running and you drive the same vehicle. If you change the vehicle or restart SimHub, the diameters are reset and the tyre diameter detection phase starts again.~~\ Since version 1.3.3 detected tyre diameters are saved to the file Viper.PluginCalcLngWheelSlip.data.json, which will be automatically created in the folder "SimHub\PluginsData\Common\" (an example file with a lot of cars for AMS2 is included in the release files, thanks @newtonpg for that, simply copy the file to "SimHub\PluginsData\Common" if you want to use it).\ The file is saved only on closing SimHub or switching to another game in SimHub, and is read on starting SimHub only, during runtime of SimHub the data is saved internally.

How to use the plugin

The plugin provides new properties and actions.\ The new properties provide the calculated diameter(m), the longitudinal slip value of every wheel and for the detection phase if you are within the limits.\ The slip value can be understood as follows:

There are further two new actions:

Demo Dash

For illustration purposes I added a Demo Dash to the Release.\ Simple double click on the file "Lock and Spin of Wheels.simhubdash" and SimHub will ask for the import process.\ The Dash has two screens, a main screen and a debug screen with a bit more information.\ You can see the 4 wheels and they will change the color depending on the calculated spin (blue) and lock (red) value.\ At the bottom you can see how the tyre diameter detection works.\ There are 4 small squares showing the 4 limits, green = within the limit, red = outside the limit (The limit values were taken over manually from the plugin. If you change them in the plugin, you have to change it in the Dash, too). At the first moment when all 4 squares are green at the same time the tyre diameter calculation is triggered and the larger rectangle in the middle turns green.\ As long as the larger rectangle is red, the calculation of the wheel slip does not work and the color of the 4 wheels remains black.\ Further the rectangle shows the calculated tyre diameter(cm) in the 4 edges.

Demo Video (Acura NSX GT3 @ Mugello Short with ABS)\

Screenshots\

Overlay

Further I added a small Overlay to the release which shows the four wheels with its slip values.\ Simple double click on the file "Viper - Lng Wheel Slip.simhubdash" and SimHub will ask for the import process.\ Here you can see how it works, first the tyre diameter detection phase where it shows if you are within the four limits and then how it operates if the detection phase is completed (red = locking wheels, blue = spinning wheels).

Demo Video (Mercedes-AMG GT3 @ Brands Hatch Indy)\