Bypass valve shock absorbers

Everything about modding.
Post Reply
User avatar
Tunari
Site Admin
Posts: 45
Joined: Fri May 19, 2023 11:47 am
Location: Finngolia
IQ rating: 89
iRating: 2545

Bypass valve shock absorbers

Post by Tunari »

Image Pasted at 2023-4-25 01-33.jpg
Image Pasted at 2023-4-25 01-33.jpg (773.22 KiB) Viewed 5911 times
Bypass valve shock absorbers are used in offroading applications. Also known as threshold dampers.
The special bit about these dampers, is that instead of depending on travel speed, like a fast damper, the bypass valves operate on damper rod travel. These dampers are mostly useful in applications with a lot of suspension travel, not so in sleek racecars that drive on pavement.

Before I continue, I must mention I am not a car engineer and this is how I personally understood all this. Car suspensions are a really complex thing and I'm just working with what I got. :ideacool: I also have no idea how they set these up in real life, so whatever I'm doing is probably not all that accurate. However the principle function is there.

The following picture demonstrates how the damper works (according to me). As the damper rod travels further inside the damper upper housing, it reaches another bypass sleeve that will let damper oil seep through.
dampers.png
dampers.png (124.83 KiB) Viewed 5911 times
Now, to the Assetto Corsa implementation

Prerequisites:
  • Car with a lot of travel range (at least 400mm, for a 2-step setup)
  • Basic knowledge of AC dynamic controller inis
  • Extension physics
  • A little bit of LUA knowledge
  • Advanced knowledge about suspension setups
Step 0. Enable extension physics in car.ini

Step 1. lua controller inputs.
Create a text file called script.lua into the data folder of the car.
Paste the following snippet into the file, and save. (assuming you have no existing script lua, else you will have to do some coding of your own)
This snippet of code gives us the current ROD TRAVEL in millimeters as a dynamic controller input.

Code: Select all

local data = ac.accessCarPhysics()

--current rod travel in mm
local frontLeftTravel = 0
local frontRightTravel = 0
local rearLeftTravel = 0
local rearRightTravel = 0

--rod "preloads" are used ot offset the ride height calculation as your rod cannot extend past the lower bumpstop when there is not enough travel range
--adjusting packer will probably mess with this value..surely it can be calculated automicaly but imm lazy
--ROD_LENGTH - BUMPSTOP_DN = preload (allow for at least +-10mm tolerance)
local frontRodPreload = 0
local rearRodPreload = 0
--tolerance correction in mm should you need it
local frontRodTolerance = 0
local rearRodTolerance = 0

function suspension(dt)

frontLeftTravel = car.wheels[0].suspensionTravel * 1000 - frontRodPreload + frontRodTolerance
frontRightTravel = car.wheels[1].suspensionTravel * 1000 - frontRodPreload + frontRodTolerance
rearLeftTravel = car.wheels[2].suspensionTravel * 1000 - rearRodPreload + rearRodTolerance
rearRightTravel = car.wheels[3].suspensionTravel * 1000 - rearRodPreload + rearRodTolerance

--comment or remove these once you have set up your suspension/ready for release.
ac.debug("FL travel", frontLeftTravel)
ac.debug("FR travel", frontRightTravel)
ac.debug("RL travel", rearLeftTravel)
ac.debug("RR travel", rearRightTravel)

--make travel a dyn ctrl input, these will be used
--by setup external controllers.
data.controllerInputs[0] = frontLeftTravel
data.controllerInputs[1] = frontRightTravel
data.controllerInputs[2] = rearLeftTravel
data.controllerInputs[3] = rearRightTravel

end

function script.update(dt)
	suspension()
end
Step 2. Create damper look up tables (LUTs).
Simple. The filename can be whatever you'd like, as long as you personally can keep track of them.
I personally use "damp_<f/r>_bump.lut" and "damp_<f/r>_reb.lut" (ie. damp_f_bump)
the LUT format is the following
mm of travel | damping rate (N/s)
You should have 4 .lut files now.
Set these up with data later, but for now write 100|1000 or something like that.

Step 3. Creating some controller files.
This step requires some patience and attention. You must create 2 controller files for each corner. One for bump, one for rebound. The naming scheme I use for my controller files, is "cont_<corner>_bump.ini" and "cont_<corner>_reb.ini" (ie. cont_lf_bump.ini).
The dynamic controller input order is
0 = LF
1 = RF
2 = LR
3 = RR
The dynamic controller file:

Code: Select all

[CONTROLLER_0]
COMBINATOR=ADD
INPUT=SCRIPT_0 ;MAKE SURE YOU CHANGE THIS TO CORRESPOND TO THE CORNER OF THE WHEEL
LUT=damp_f_bump.lut ;NAME OF YOUR BUMP/REBOUND LUT YOU CREATED IN PREVIOUS STEP
FILTER=0.01
UP_LIMIT=100000
DOWN_LIMIT=0
You should now have 8 controller inis. Double check each to make sure the INPUTs and LUTs are correct. (so that you dont repeat my mistakes :roll: :roll: )

Step 4. Pointing setup.ini values to controller inis.
Extension physics introduced a new feature, called setup controllers. Originally implemented for hydraulic suspension I presume... Regardless, what we want to do now is create 8 setup items, the dampers for each corner and point them to their corresponding controller inis. Please also pay attention in this step, so that you dont plug the wrong inis to the wrong field. (who would make a stupid mistake like that :? )
Copy paste a complete damper setup from another car, or just use the snippet below and change the BUMP/REBOUND and corner name (LF/RF/LR/RR)
The setup item parameters do not matter, only the EXT_CONTROLLER=.ini reference.

Code: Select all

[DAMP_BUMP_LF]
SHOW_CLICKS=0
TAB=DAMPERS
NAME=Bump
MIN=10
MAX=20000
STEP=100
POS_X=0
POS_Y=0
HELP=HELP_LF_DAMPER_BUMP
EXT_CONTROLLER=cont_lf_bump.ini ;THIS IS THE CONTROLLER FILE REFERENCE
Step 5. suspensions.ini bits
To make things easier, disable PACKERS and FAST DAMPERS.
To disable these items, make their values 0.
ie. PACKER RANGE = 0.0
DAMP_FAST_BUMP=0
DAMP_FAST_BUMPTHRESHOLD=0.0
DAMP_FAST_REBOUND=0
DAMP_FAST_REBOUNDTHRESHOLD=0.0
You may re-enable them as you wish (or know what you are doing) but I recommend setting up fast dampers only after you have set up your bypass valve shocks. Please also note that by default, fast dampers override slow damper values, so depending on what you want to achieve, you may have to create 4 additional LUTs and 8 more controllers for the fast dampers.

Now, if you did everything correctly, you should be able to load in game and hopefully it didnt crash on you. :mrgreen:

Setting up the suspension:
Make sure your ROD_LENGTH is more, or equal to BUMP_STOP_DN or your suspension wont be able to travel completely from upper bump stop to lower bump stop. If your ROD_LENGTH is longer than BUMP_STOP_DN make sure to specify so, in the lua script (the preload values).
The damper LUT format as mentioned before, is mm|N/s. These LUTs are clamped, and also linearly interpolate, but do not extrapolate (they are clamped).
A simple 3-step LUT from my F-150 trick-truck.

Code: Select all

319|2400 ;the first step
320|4600 ;the second step start
399|4600 ;the second step end
400|8000 ;the third step
This should be all to get you started with some real :twisted: TRUCKIN' :twisted:. :ideacool:

Should you have any questions or problems, feel free to post ITT or create a new one in the support section.
Image
Image
Image
Image
Image
ImageImage
ImageImageImage
User avatar
Tunari
Site Admin
Posts: 45
Joined: Fri May 19, 2023 11:47 am
Location: Finngolia
IQ rating: 89
iRating: 2545

Re: Bypass valve shock absorbers

Post by Tunari »

custom shaders patch 0.1.80 preview adds LUA controlled dampers. the scripting is complete but i am waiting for the next CSP production release, to release a demo car along with the script.
the script is very similar to the functionality of the earlier implementation, except without hoarding 4 controller inputs, and having adjustable setup items. (pic related). you can adjust the baseline damper strength, and the amount of oil each bypass lets through (similar to how BeamNG does it). it also implements the kunos fast damper as additive. implementing a fast blowoff or pressure blowoff is also very easy to do.
2023-10-02_04-10-32.png
2023-10-02_04-10-32.png (516.48 KiB) Viewed 5108 times
Image
Image
Image
Image
Image
ImageImage
ImageImageImage
Post Reply