Sign in to follow this  

[Car Physics] Proper driveline simulation

Recommended Posts

bmarci    786

I've been thinking about a more accurate driveline simulation.
Instead of applying engine torque on the wheels I'd make separate parts.

I have two models in my mind;
1. Distinct the engine and the rest (transmission/diff/wheels) separated with the clutch.
In this situation I'd apply engine torque on the flywheel and depending on the clutch position on the rest of the driveline.
Having the wheel reaction forces calculated applying the torque backwards to the engine.

2. Handle each part separated using input/output values like an effect loop (who plays guitar knows what I'm talking about [img][/img] )
The torque coming from the engine going into the clutch and then to the transmission and so to the wheels.
Thus every component would have its input/output angular velocity/torque ... etc.

My biggest concern is about the inertias. Suppose I have proper inertia values for each component as a separate part;

And I have the current angular velocities accordingly.

In the first method the equation would look like;
Torque at the engine (T_Engine)

T_Wheel = T_Engine * CLUTCH_FACTOR * gear_ratio * diff_ratio
IW = I_Engine * CLUTCH_FACTOR + I_Gearbox_in + I_Diff_in + I_Wheel
AngAcc_Wheel = T_wheel / IW

Then I have road response torque (T_Road)

T_Reaction = T_Road / diff_ratio / gear_ratio / CLUTCH_FACTOR
IE = (I_Wheel + I_Diff_out + I_Gearbox_out) * CLUTCH_FACTOR + I_Engine
AngAcc_Engine = T_Reaction / IE

Maybe the CLUTCH_FACTOR shouldn't be used in both Torque and Inertia calculations.

Or using the second method, and here comes the (I-am-not-sure-about-it) part;

AngAcc_Engine = T_Engine / I_Engine
T_Gearbox_in = T_Engine * CLUTCH_FACTOR
AngAcc_Gearbox_in = T_Gearbox_in / I_Gearbox_in
AngVel_Gearbox_out = AngVel_Gearbox_in * gear_ratio
T_Gearbox_out = T_Gearbox_in * gear_ratio

T_Diff_in = T_Gearbox_out
AngAcc_Diff_in = T_Diff_in / I_Diff_in
AngVel_Diff_out = AngVel_Diff_in * diff_ratio
T_Diff_out = T_Diff_in * diff_ratio

T_Wheel = T_Diff_out
AngAcc_Wheel = T_Wheel / I_Wheel

And the reaction torque backward, using the "_out" part of inertias.

The second method would make more sense but I'm not sure the right inertia values are used.
Eg: In case of accelerating the flywheel, should I use only I_Engine or the inertia of the underlying parts.
I sense I should use all of them, but then again I think the response torque should balance the acceleration.
Or maybe calculate the torques in the first step going back and forth, and then caluclate the angular acceleration on each part separately.

So this way with constant throttle, pressing the clutch would let the engine to rev up, while the rest of the driveline would slow down.
Engaging the clutch again would work as a spring to equalize the angular velocities at the flywheel and clutch-plate.

Or maybe add the clutch as a separate part, that applies extra torque based on the angualr velocity differences.

It's just a theory, no implementation yet, so every remark, confirmation or contradiction are welcome [img][/img]

Share this post

Link to post
Share on other sites
kunos    2254
I used method 2 in netKar (maybe because I play guitar? :P ), my old sim, and method 1 in my new sim.

Method 2 is cool and fashionable but it isn't worth the hassle IMO, at the end of the day you only get 2 scenario: single axle drive (rwd or fwd) or 4x4 all wheel drive... the "cascade" nature of method 2 makes it VERY hard to adapt to simulate 4x4 with 3 differentials because it's very hard to close the loop properly. You'll also end up with lots of classes that do pretty much the same thing while with method 1 you can have the entire drivetrain in one singe class and solve everything in one single function.. I find it much simpler to work with.

Share this post

Link to post
Share on other sites
Rapha    158
Hello again [img][/img]

(i know i have a lot of things to answer in the other topic, but i'm not finished analyzing and trying all suggestions yet !)

This subject is very interesting, as i am willing to modelize a proper engine transmission too, eventually.

My main concerns are : inertia of components (varying with gear), inner friction and the differential.

I am very busy right now working on the purely handling part, so i cant try anything / do suggestions for the moment, but i can give you this link, which is very informative on the subject : [url=""][/url]

Other cool links on this website : [url=""][/url]

But it is quite possible you already have this link in your bookmarks !

Good luck working on that driveline ! I stay tuned. Edited by PochyPoch

Share this post

Link to post
Share on other sites
bmarci    786
[quote name='PochyPoch' timestamp='1349304440' post='4986573']
I am very busy right now working on the purely handling part, so i cant try anything / do suggestions for the moment, but i can give you this link, which is very informative on the subject :

Other cool links on this website :

But it is quite possible you already have this link in your bookmarks !

No, I didn't have them, thanks! Interesting read :)
Unfortunately I don't have too much time on this, I'm occupied with real work now :(

Share this post

Link to post
Share on other sites
bmarci    786
Hi again,
I've just bumped into some confusion as usual.
In my old sim, I used a very simplified model, that worked, and looked reasonable with major limitations;
I calculated the wheel torque directly from the engine through the transmission gearings...etc.
Adding the last iteration's road reaction I got the current wheel angular velocity, and that was calculated back to the engine to get the current RPM.

wheel_acc = (TDrive + TReaction) / IWheel
engine_avel = wheel_avel/diff_ratio/gear_ratio

Now, I've advanced to level 2, so it doesn't seem enough for me.
Having learnt about the effective inertia, I'm not sure where to apply them.

Idea #1
1. The drive torque is coming from the engine and applied at the contact patch, thus I'd use the effective inertia from the engine to the wheel.
2. The reaction is coming from the contact patch and acting backwards to the engine so the inertia is calculatd from the wheel to the engine.

wheel_acc = TDrive / I_Engine2Wheel
wheel_acc += TReaction / I_Wheel2Engine

I suppose the engine angular velocity could be calculated back as above.


To be able to rev the engine in neutral or using the clutch the engine's and the gearbox/wheels' angular velocities must be separated.

Idea #2
1. Accelerate the flywheel using the inertia from the engine to wheel (including clutch position)
2. Depending on the clutch, some torque is going to the gearbox, and to the wheels, using the gearbox to wheel inertia, so the gearbox/wheels have different angular acceleration if the clutch is not engaged
3. The reaction torque is acting as usual, decelerating the wheels/gearbox's angular velocity
4. Again, depending on the clutch, some reaction torque is going back to the engine, using the flywheel inertia

Or, my second idea of Idea #2 :)

Applying torque only on the flywheel, and have the clutch as a torsion spring using the angular velocity differences of the flywheel and the gearbox.
Thus the engine only accelerates itself and the wheels decelerate the rest, and the clucth is applying torques on both parts to equalize the angular velocities, and I guess this is the way it works in the real life. So the term max_clutch_torque would make sense.

Both idea would produce believable results, but since I don't have too much reference it's hard to decide:)
We don't talk about differentials, yet.

I start experimenting with both solutions, but meanwhile, does anybody have any experience or thought? Edited by bmarci

Share this post

Link to post
Share on other sites
kunos    2254
your idea sounds very reasonable and very similar to what I am doing.. the only difference is that the torque from clutch to engine isn't really a torsion spring, it's pure friction.. what i do is to treat it as a friction and have a "small enough" slip delta where I lock engine and clutch together.
Another simple fix would be to have a torsion spring but to clamp its maximum generated torque to a parameter.. this to avoid generating huge torques coming from speed delta that are too high.

Share this post

Link to post
Share on other sites
bmarci    786
Thanks Kunos,
So the modified theory follows:

1. Separating the case when the engine and geatbox are locked and rolling together as one big assembly.
2. After gearchange or pressing the clutch, the engine and gearbox are separated and their angular velocities and accelerations get different.
3. As the pedal is released the clutch torque is applied, on both componets, using what inertias? (IFlywheel on engine, and IEffectiveGearbox on gearbox??? )

t_clutch = minmax((engine_ang_vel - gearbox_ang_vel) * clutch_factor, -1.0, 1.0) * t_clucth_max

ang_acc_engine += t_clutch / IFlywheel
ang_acc_gearbox -= t_clutch / IEffectiveGearbox

One more thing about differentials, and wheel inertias,
The classic example of one wheel on ice and one on tarmac (open diff!!). The engine produces 200Nm that goes directly to the wheels, 100Nm/100Nm
The ice one has 0Nm resistance and the tarmac one has 100Nm, so the last one should not move, and the "resistance goes" to the other side, so it gets 200Nm, and spins like hell.

Until now I tought I should have used drive torque with inertia from engine to wheel to accelerate the wheel, and use wheel to engine inertia to slow it down by the resistance torque.
But in the above example with not moving tarmac wheel it's impossible to achieve, since the two used inertias are hardly to be equal.

By the way, my hobby car is getting fun to drive, I improved the rigid body physics and collision detection since the video was captured :)

Share this post

Link to post
Share on other sites
kunos    2254
that is amazing.. very very good behavior at low and near to zero speeds.
What's the rendering engine? Edited by kunos

Share this post

Link to post
Share on other sites
bmarci    786
Ohh, thank you!!!
The rendering engine is a self creation, I made it a few years ago.
Regarding low speed stability, I was also surprised :)

Since I'm not using any physics engine, I made a kind of "hybrid" solution. The vehicle is calculated at 1000Hz and also the rigid body with suspension and tire springs.
The collision and response is a different story, though.
I had a concern about having a middle-ware physics that runs at ~60hz (higher rate would kill the performance because of the collision detection) and having a race car suspension and a very stiff tire (200-300kN/m), that 60Hz seems barely enogh for these springs.
An option would be to let the physics engine calculate with some dummy objects and fake spring values, just to handle collisions, and have a "side track" that calculates the actual body at higher rates and occasionaly mix the results. Just an idea.
The low speed handling of slip ratio is not done yet, I don't have the famous SAE950311 paper, but before I bought it I have a very evil solution for the problem that I don't know if it will work, I'll keep you updated.

But before all that, let's get back to the driveline simulation!
The questions in post #7 are still valid :)

Share this post

Link to post
Share on other sites
bmarci    786
Just to share results, some values and results,

1st gear ratio = 3.067
gearbox inertia = 0.14
flywheel inertia = 0.29
diff ratio = 4.35
diff inertia = 0.05
wheel inertia = 1

wlywheel effective inertia = 0.308

I found an other formula that resulted 0.919 with the same input values.
The first one I found on, the last one was around the net, using addition in squared components instead of multiplication.
#1: (ratio1*ratio2)^2 * inertia
#2: (ratio1+ratio2)^2 * inertia

Share this post

Link to post
Share on other sites
kunos    2254
[quote name='bmarci' timestamp='1353573681' post='5003167']

#2: (ratio1+ratio2)^2 * inertia

that looks very wrong to me

Share this post

Link to post
Share on other sites
bmarci    786
I put in a simple driveline sim, reving the engine in neutral works fine, at higher rpm gently applying the clutch drops the rpm and the wheels start turning.
The open diff also works, one rear wheel in the air spins the "free" tire.

[quote name='kunos' timestamp='1353580126' post='5003193']
that looks very wrong to me

Ok, here is an other one :)

IEngine + (RGear^2)*IGearBox + ((RGear*RDiff)^2)*(IDiff+IWheel)
In the above example the ratios are inverted if calculated from engine to wheel (eg: RGear=1/GearRatio).

One thing that I don't get, the ratio of inertias can get very big in case of higher gear ratios, eg: 0,2 : 120 ( engine : wheel )
which would make sense, because in 1st gear the engine can turn the wheels very easily but not the other way around.

I made simple calcualtion using engine->wheel inertia on (TDrive+TRoad)/IE2W
But, I wouldn't use that on brakes, I wouldn't use it on TRoad either, but it doesn't work right that way.

Suppose the car is in first gear, and standing on a slope, no brake applied.
The gravity and slope would make the car slide down thus generating slip ratio and RoadTorque, rolling the wheel and the driveshaft.
In life, the same resistance torque generates less acceleration in 1st gear than in 4th, the wheel is harder to turn.
But, as I use it the opposite happens, since the road_torque is applied with engine->wheel inertia.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this