Advertisement

[Car Physics] Proper driveline simulation

Started by October 02, 2012 04:39 PM
11 comments, last by bmarci 12 years, 3 months ago
Hi,

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 smile.png )
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;
I_Engine
I_Gearbox_in
I_Gearbox_out
I_Diff_in
I_Diff_out
I_Wheel

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 smile.png
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.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

Advertisement
Hello again smile.png

(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 : http://hpwizard.com/...al-inertia.html

Other cool links on this website : http://hpwizard.com/index.html

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

Good luck working on that driveline ! I stay tuned.


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 : http://hpwizard.com/...al-inertia.html

Other cool links on this website : http://hpwizard.com/index.html

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 :(
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.

So,
wheel_acc = TDrive / I_Engine2Wheel
wheel_acc += TReaction / I_Wheel2Engine

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

BUT!

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?
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.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

Advertisement
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??? )

eg:
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 :)


that is amazing.. very very good behavior at low and near to zero speeds.
What's the rendering engine?

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

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 :)

Just to share results, some values and results,

Situation:
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 racer.nl, the last one was around the net, using addition in squared components instead of multiplication.
so
#1: (ratio1*ratio2)^2 * inertia
#2: (ratio1+ratio2)^2 * inertia

This topic is closed to new replies.

Advertisement