# [Car Physics] Turbochargers and friends

## Recommended Posts

Hi guys,

Does any of you have experience, idea or a good resource about turbo? Programming wise!

My first thought is to use the engine rpm/throttle position to approximate the amount of gas going out in the exhaust, and thus increasing the pressure in the intake part, maybe calculating some spin velocity of the turbines.
I don't have much clue if it's a linear function, or can I derive the power increase from the pressure.
The only useful figure I found was that the turbo increases the output torque by 30-40%

Some other question about lsd differentials. As far as I understand with clutch packed (eg. salisbury) the clutches provide the locking. All the docs I read assumed that when the torque bias ratio and preload were exceeded the diff opens and works as an ordinary open-diff, but I'm sure in this case the preload and clutches still work to lock the wherls. So there is no formulas to calculate this locking torque.

Also if I used some clutch friction just like in the gearbox, that would make the bias-ratio unneccesary, because it would be enough to check if the road reaction torques overcame the clutch torque.

Well, many confusion and white spots, but hoping for Kunos and the other experienced ones to pop up and enlighten my day ;)

thanks for any help and suggestion.

##### Share on other sites

I think most games fake a turbocharger by just having a pressure readout and blow off valve flutter on gear change; the torque values are from a torque curve.

If you want a simple approximation, you could have two torque curves, one for the torque values with 0 turbo pressure, and another on top for what the turbo adds at maximum pressure, and have a simple spooling function.

If you are talking about the simulation of a turbo, simulating exhaust gases flow, and manifold pressures etc., I have no idea on how to do that but that is overkill for a game.

I'm busy but I will try to answer the other questions later if noone else does

Edited by KamilKZ

##### Share on other sites

Agree with KamilKZ, in the end the turbo only affect the torque and engine power output, so it should be as simple as having a different mapping of torque values for the different turbo conditions.

##### Share on other sites
great, thanks.

I figured I'd make a simple model using the enginerpm to increase the pressure, and the throttle position could determine the max value.
using the pressure with a lookup curve could be enough for the torque increment.
As I guess, the valve blowoff is not related to shifting, but to releasing the throttle, is it correct?

when the valve opens, does the pressure drop to "zero", or to the amount that the engine can handle?

##### Share on other sites

In netKar PRO I did it the "hard core" way.. had a turbo with its own RPM, inertia and so on.. exhaust spins the turbo, that produces pressure that goes into the engine. The relationship between torque and pressure is basically linear.. 2 bar = twice the torque, nothing complex there.

For Assetto Corsa things are much easier because the data to feed into the "complex" system I had in netKar is basically impossible to find.. so, at the of the day what you have is the max boost for a car and the amount of lag in the system.. which is how AC is modelling it.. much easier to get to the target result quickly and more effectively.

The blow off valve protects the engine intake.. when you close the gas you close the intake, but the turbo is still spinning and pushing air through the intake that now is closed or half closed.. this generates huge pressure that needs to be eliminated to avoid damage.. that is where the valve opens to relieve the pressure.

An easy way to model it is to have an amount of pressure that can be handled by the intake as function of gas pedal position.. if the pressure is higher than that.. the valve opens.

You are right about the clutch pack differential, it doesn't turn into an "open" diff.. the clutches are still engaged creating friction... it's just that the difference of torque in the system is bigger than the clutches friction and the diff starts to slip.. but it doesn't turn into an open diff.

##### Share on other sites
thanks Kunos,

I went for the simple solution thats looks nice at first.
Here are some feedback for others who are also interested in it;

params:
lagtime (time to reach max pressure)
boost (the torque amount to add)
valvetime (time to relief the pressure)

so using the throttle position and engine rpm, something like

pressure+=throttle*maxpressure*(rpm/maxrpm)*(timestep/lagtime)

An alternative solution seems reasonable because all technical charts show engine power curve with turbo, so defining the power decrease without turbo seems more practical.

Also opening the valve when pressure exceeded:

pressure>throttle*maxpressure

pressure-=maxpressure*(timestep/valvetime)

Now I'm not sure if the valve closes when the pressure is acceptable, but I do so. And some "dampening" to decrease the pressure that was "consumed" by the engine, so gently stepping off the gas will not open the valve.

Differentials:
Do diffs ALWAYS split torque in 1:1 ratio?
Is it possible for a middle diff to send more torque to the rear? If so, the axle speeds will always be different thus generating locking torque. Is it normal??

##### Share on other sites

Differentials:
Do diffs ALWAYS split torque in 1:1 ratio?
Is it possible for a middle diff to send more torque to the rear? If so, the axle speeds will always be different thus generating locking torque. Is it normal??

Exactly, you can have different ratio, I actually call it bias and it's only used for awd differentials where you have a central diff that splits more of the torque to the back or front, as required.

Lets say an Audi R8 AWD has  30% on the front and 70% on the back, making it a bit oversteery and well balanced for the required situation. Basically you never want a 50/50 split AWD sports car, it will end up in a tree eventually. You always want some oversteer on sportscars to have the abilty to "play around". Wich imo reminds me if Audi R8 had an upen diff in the front and limited slip in the back, can somebody correct me?

As for turbos, I'm using a supercharger method at the moment, the same method that is used in rFactor1. It's about the same as you described, but I have some factors to define how much it spools for its power per rpm and how much torque it produces or decreases. If you didnt allready know then with turbos you can sometimes actually take power  when you want to add power, usually heavily boosted cars have les torque on the lower rpm but as the turbo kicks in you gain more hp's ebcause the action happens at high rpm's. But this also adds torque after the turbo is spooled up.

Turbos are really fun and if you do them right then you get a huge improvement. I for example made a drift car and once I added my boost script it instantly made it a better drift car because you get a lot more action on engine output.

I hope this info was usefull, also how have things gone with your sim? I'm glad to see that you're still working on it!

##### Share on other sites

You are right about the clutch pack differential, it doesn't turn into an "open" diff.. the clutches are still engaged creating friction... it's just that the difference of torque in the system is bigger than the clutches friction and the diff starts to slip.. but it doesn't turn into an open diff.

Ok, but it makes me confused, if I take the salisbury diff (everybody wants a Lotus49 :) )

I more or less understand the concept of the ramp angles and how to derive torque bias ratios, but there are still clutches that provide the locking, and when it comes to exact figures I feel lost.

Example:

The wheels have 100Nm and 300Nm road torques, that is 3:1 ratio, if we have a diff with 2:1 bias ratio, in this case it would "open".

And then with the same diff if the wheels have 20Nm and 60Nm, that is still 3:1 ratio, and would "open" again.

But, in the first case the clutches could resist 100Nm torque difference and in the second the same clutches slip at 40Nm difference.

Somehow I have problem with this :)

I for example made a drift car and once I added my boost script it instantly made it a better drift car because you get a lot more action on engine output.

What kind of tire model do you use?

Regarding drifting I have concerns about my tires, the combined-characteristic sometimes seems odd. Or am I crazy trying to drift a car with weight 58-60% at the rear?

When the tail breaks out, it's almost impossible to recover.

I tried with more slippery tires and it got much better, but it was useless for normal driving.

I hope this info was usefull, also how have things gone with your sim? I'm glad to see that you're still working on it!

Yes it was :)

Unfortunately I didn't have too much time recently but the development is still moving forward :)

To show-off a bit, here is a video. The car is a bit "nervous", maybe the 240deg wheel I have and set to a very-non-linear steering, I dont know...

At least the turbo is working, but the encoder ruined the red gauge pointers :/ And the valve blow sounds are in the engine-coast samples, no relation to the sim, don't get mislead :)

##### Share on other sites

Or am I crazy trying to drift a car with weight 58-60% at the rear?

Oh man, yes you are drift cars are mostly 52-48 balanced.

As for diffs, I'm not sure If you got everything right here. I'd recomend over check things, I dont remember exactly how they were working, but the reference material I used thought me somethign different.

Tire model, belive it or not, I'm using the old pacejka89 tire model. And it gets driftign done pretty well.
You can try out my demo if youd like, https://www.dropbox.com/s/h69ochlmqdxbgwr/MoDyEn%20Bryce%20Canyon.rar?dl=0
If you want I can provide a quick drift setup to it aswell, or watch forza4 drift setup videos on the tube and apply the same to my physics.

Your video is awesome!!! I really love your work, it feels natural and youve got the tire sounds pretty nicely done.
Heres my video on the same track

I'll add a drift video to to show what the tire model is capable of.

Edited by WhateverMan

##### Share on other sites

You are right about the clutch pack differential, it doesn't turn into an "open" diff.. the clutches are still engaged creating friction... it's just that the difference of torque in the system is bigger than the clutches friction and the diff starts to slip.. but it doesn't turn into an open diff.

Ok, but it makes me confused, if I take the salisbury diff (everybody wants a Lotus49 )

I more or less understand the concept of the ramp angles and how to derive torque bias ratios, but there are still clutches that provide the locking, and when it comes to exact figures I feel lost.

Example:

The wheels have 100Nm and 300Nm road torques, that is 3:1 ratio, if we have a diff with 2:1 bias ratio, in this case it would "open".

And then with the same diff if the wheels have 20Nm and 60Nm, that is still 3:1 ratio, and would "open" again.

But, in the first case the clutches could resist 100Nm torque difference and in the second the same clutches slip at 40Nm difference.

Somehow I have problem with this

mah I don't really think about bias. I have an open diff, to make a salisbury I just calculate the slip between the diff cage and the arms and apply friction from the clutches based on that, it all works out by itself.

In your example, the reason why you'll have "only" 40Nm from the clutches is explained by the fact that, in order to have 20Nm+60Nm coming as reaction torque, it is likely your engine torque is also around that value.. thus the force trying to push the clutches against the housing is less than the force in your previous example with 100,300Nm... so it all balances out at the end.

BTW, great stuff both of you. Are you using some game engine for your things or custom code? Are you looking for a job perhaps? :P

Edited by kunos

##### Share on other sites

Your video is awesome!!! I really love your work, it feels natural and youve got the tire sounds pretty nicely done.

Thanks! Your drifting stuff is cool, that's what I was after :)

The tire sounds are very simple, using only one skid sample!

I'm precalculating long/lat optimal slips and based on those values just adjusting the frequency of the sample (playing 4 looping instances) according to the current slip values.

eg:

skid_start = opt_sa * 0.8   << the slip value when the sound starts playing (low freq)

skid_max = opt_sa* 1.2   << the slip value when the sound reaches it's highest freq

skid_mark = opt_sa * 1.0  << when skidmark appears

using the current_sa and the above thresholds, I just set the frequency between 18000 and 24000Hz (the sample is in 22Khz)

Fade-in/out the volume is just a nice touch to it ;) And the same goes to longitudinal slips.

Tire model, belive it or not, I'm using the old pacejka89 tire model.

I do! And I'm using that too :D

For pure slips the Pacejka89 is perfect, problems come when combining Fx/Fy. I have 6-7 different methods here for the "friction circle". All of them are good in some way but all of them have weirdnesses, I haven't found the "one-fits-all" model yet :(

mah I don't really think about bias. I have an open diff, to make a salisbury I just calculate the slip between the diff cage and the arms and apply friction from the clutches based on that, it all works out by itself.

I'll give it a try. Also I was thinking about using the torque-bias to determine the clutch factor, so it could work for both power and coast locking.

BTW, great stuff both of you. Are you using some game engine for your things or custom code?

Thanks! It's 100% custom code, but only DirectX 8, so it looks like %\$#!! compared to WhateverMan's :)

##### Share on other sites

BTW, great stuff both of you. Are you using some game engine for your things or custom code? Are you looking for a job perhaps?

Thanks! Well in my case I'm using Unity3d as the game engine but I did a complete overhaul on the shaders and physics. Once Unity dies, I'll be ready for a custom game engine.

I'll give it a try. Also I was thinking about using the torque-bias to determine the clutch factor, so it could work for both power and coast locking.

I think I did my diffs the same way as Kunos. Also I'm not completely locking the diff, I'm doing what rFactor did, pumpTorque as the locking torque and poer/coast ratios to define the locking ammount in the specifyed direction. If it helps then the way I deffined wich way the diff is locking was quite simple. If driveTorque>0 then it was power locking and otherwise it was coast locking.

I'm pretty bad in english when it comes to really detailed sentences, so I hope you understood what I was trying to say.

Also about pacejka combining, Beckman's method is the best. And SAE low peed friction model at 400hz or 1000hz works perfectly well, this is how I got my simulation stable now. But what I did notice is that something gets lost when doing the simulation through a .dll lib. Its funny because the code in my C# version and C++ version are identical in every aspect, but the C++ version works with a small bug. Some small, really small values wobble making the car unstable at some point.

And the funny thing is that I dont know which values they are, is it the differential or the tires... but what I do know is that at high speed when going straight the car wants to do a long repetive S on the road, going from left to right and back like a sine wave. I tryed to trace down the values in debug mode, but the numbers are really really small.

ALSO about drift cars, what I said earlyer, 52/48 was 52% on the front and 48% on the back. Drift cars are Front Rear Layout cars. You need more weight on the front because you controll with your wheels and lighter rear to get more wheel spin. Later you use rear wings aerodynamics to balance the angles with speed requirement.

Edited by WhateverMan

##### Share on other sites

If driveTorque>0 then it was power locking and otherwise it was coast locking.

Also about pacejka combining, Beckman's method is the best. And SAE low peed friction model at 400hz or 1000hz works perfectly well,

The Beckman's method is vey good indeed, but only second best.
For me, it becomes very slippery when the car starts skidding.
I let the slip ratio go over 1 thus the scaling factor cuts back the lateral forces (no donuts), and with locked wheels the sideway resistive forces "disappear". Maybe this is the reality, I never tried handbraking at 160km/h :))
I found some interesting in the RCVD: "tire data nondimensionalization". I might play around with that too.

Regarding low speed, is it SAE950311? I bought that paper too, but the lateral relaxation didn't work. Also the longitudinal was "sliding" when stopped on a hill, so I ended up with my own approach.

I'll try the drifting setup and get back to you.

##### Share on other sites

I'm doing what rFactor did

I don't mean to be awkward but you must know something I don't :)
Did you find/get info on rFactor's stuffs or just checking RF car settings to get inspired?

##### Share on other sites
As we came together so nicely, I'd come up with one more question which is more visual than physical. That is backfire.
Does it happen with some random chance when rpm drops or more scientific than that?
And the same question applies to exhaust splutter. Edited by bmarci

##### Share on other sites

As we came together so nicely, I'd come up with one more question which is more visual than physical. That is backfire.
Does it happen with some random chance when rpm drops or more scientific than that?
And the same question applies to exhaust splutter.

As far as I know backfire occurs when there is a significant change in engine compression(friction torque for programmers), lets say from -60 to -120. Such a change is critical and causes the engine to pop flames through exhaust. I use this method, but theres also some logic and timing into it otherwise you get mad explosions every now and then. In my GTR35 video, where the backfire sound is to loud, you can hear when it occurs. I'm not saying this is the way its done, but this is how I think it works. I've been watching alot of race material for reference and serious backfire only occurs on down shifts and sometimes while coasting all of wich lead to a conclusion that it's caused by the change of compression.

As for rFactor, I only played with the values and did tests and thats how I figured it out, also there is some info around the net that confirms that this is how they did it. If I'm wrong (I think I'm not...) then id like to hear the truth. Atleast what I figured out, works for me perfectly.

##### Share on other sites

The 'science' behind backfires is that they usually occur due to a bad air-fuel-ratio. Such as the engine running rich when it's air starved (eg when boost pressure drops via blow off valve and the ecu adds more fuel than it needs). They can also occur due to ignition timing. Both the AFR and timings change while the engine is running, and sometimes the changes might not keep up with the engine speed causing backfire.

Note he talks about anti lag systems using ignition timing to actually cause backfire and keep the turbo spooling.

##### Share on other sites

That is correct, but how do you but all of this in code where you have basically "baked" data. There are no ignition timing or air-fuel-ratio. You have a Dyno curve for power and a the opposite for engine braking.

It would be really interesting to see if someone can combine the real theory with programming ways!

##### Share on other sites

Hey there!

I wanted to join this interesting conversation as I'm too developing a vehicle physics simulation. It's at an early stage, but I've reached a point where I can begin testing the physics in a more serious way. I wanted to ask you guys where do you get the track models for your tests. I've been searching for a good 3D model of an actual track but no luck. Can you recommend a good source for 3D models of racing tracks?

Here's a video of my vehicle simulation if you're interested. I had spent most of the time designing a correct tire simulation solution, which is exposed at the video (ensure annotations are enabled):

The tire simulation is now completed and now I'm developing the internal vehicle parts. The actual state is much more advanced, with an entire vehicle being properly simulated (engine, clutch, gearbox, differential...).

##### Share on other sites

WhateverMan:

I was playing yesterday with tire settings and managed to get quite good results with Beckman's method, but far not as good as yours. A small amount of TCS (20-30%) helped a lot and managed to drift with the F40, but without it it was a complete disaster...

Shifting the weight to front made it even worse, the grip increased on the front tires and during the drift when the rear end regained some traction the car instantly went off the track.

Maybe my tire curve is too "responsive" or the general settings are more racing than drifting. I have very stiff 200-250kN tire and 70kN suspension and 30kN antirollbar.

Also the front/rear doesn't differ too much, the rear is a bit softer (maybe 5-10%).

##### Share on other sites

There are a couple of things I managed to figure out;

Watching Edy's video I realized my car is making too much wheelspin, 570Nm and a gear ratio that spins the wheel at 120Km/h in first gear. (Thanks Edy :) )

I tried with "less powerful" setup and voila got much better.

My keyboard control was also too slow for drifting and took too much time to countersteer, that also didn't help get things better.

Yet, my pacejka combiner is still weird, I doublechecked the original Beckman's paper and everything seems ok, the situation is the following;

Starting the "drift maneuver" the rear end gets some angular momentum, and when it start skidding (still spinning tires) because the slip ratio is high the lateral force "disappears" and I'm unable to stop spinning out, and while the engine is revving at max it takes about a second to get back the traction.

Edy, would you like to discuss your pacejka combining method? ;)

Here is what I use:

Normalized slip parameters

s=slip_ratio/optimal_sr

a=slip_angle/optimal_sa

Normalized slip functions

Fx(optimal_sr) = Ox(1)

Fy(optimal_sa) = Oy(1)

p=sqrt(s^2 + a^2)

Combined forces:

Fx(s,a)=(s/p)*Ox(p)

Fy(s,a)=(a/p)*Oy(p)

With taking care of original and cimbined slip signs, it should be the famous Beckman's model :)

##### Share on other sites

I have no idea on how to do that but that is overkill for a game.

##### Share on other sites
@bmarci Nice to have helped in some way!

The vehicle in my video doesn't use pacejka curves, but a constant friction coefficient. You can imagine it as a flat friction line instead of a curve. It uses isotropic friction (same friction properties in all directions) so it doesn't even use a friction combining method.

The actual development version supports several ways of configuring the friction curves, from a flat line to Simplified Pacejka (I've documented the simplified version at the end of this article). Still, Simplified Pacejka with isotropic friction doesn't require any combination method. I plan to add Pacekja'94 once the anisotropic friction is implemented.

While Beckman's is considered the best combination method it contains strong deficiencies. Let me illustrate the problem graphically. Consider these two simplified "friction curves":
[attachment=25658:2015-01-26_210535.png]
Using the Beckman's method to combine them results in this force graphic:
[attachment=25659:2015-01-26_210857.png]
While the curves are correctly combined at the peak position (traction ellipse) the transitions outside the ellipse are badly combined, producing distorted forces. Beckman + Pacejka would generate a similar graphic but with smooth edges.

I've designed a better combination method inspired on Beckman's that produces a correctly uniform combination out of both curves. It looks perfect on paper but I can't confirm if it works as expected until I implement the anisotropic friction in my simulation.

##### Share on other sites
Hi Edy, your graphs look interesting, I didn'd know earlier why I had to use a "random" factor, usualy 1.2 to scale Fy after combining, to have better result, but that also affcted the not-over-the-peak values too.

If I wanted to make a 3d combined graph plot function like yours, are the heights (z) the sum of Fx & Fy ?

##### Share on other sites

No, z is the modulus of the resulting final force, same as described in Beckman's book, chapter 25:

$$\sqrt{(F{_{x}})^{2}+(F{_{y}})^{2}}$$

Beckman captured the region around the traction circle so it looks fine at first sight. But if he would have plotted a wider area, similar distorted forces would have been exposed.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628377
• Total Posts
2982325

• 10
• 9
• 14
• 24
• 11