# Pacejka stuff (car physics)

This topic is 3520 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to implement the longitudal version of pacejka's formula. Short: I don't know how to properly accelerate the drive wheels based on engine torque to generate a good slip ratio. Long: However, it doesn't seem to be working well (quarter mile times for real values are like 18 seconds, and it takes 10 just to go from 0-60). Anyways, this is how I'm currently calculating it, could someone point me in the right direction? First, I calculate the engine RPM by:
        engine.RPM = (groundSpeed / 2*M_PI*wheelRadius) * finalRatio * gearRatio[currentGear] * 60;

Then, the drive torque is calculated using an estimated torque curve:
	float torque () { return -0.00001*(RPM-4400)*(RPM-4400) + 800; }

like so:
	driveTorque = engine.torque() * gearRatio[currentGear] * finalRatio * .7; // .7 efficiency

So this torque is torque at the wheel. The slip ratio is calculated using:
	wheelSlipRatio = ((wheelAngVel * wheelRadius)-groundSpeed)/groundSpeed;

and the traction force is calculated using:
	float tractionForce = pacejkaLongitudal (wheelSlipRatio*100);
float tractionTorque = tractionForce * wheelRadius;

(where pacejkaLongitudal is the pacejka formulae. This is correct, I've graphed it and it compares to the graph in the Physics of racing series, same with the values) This is where I start becoming unsure of myself, but this is the next bit of code that calculates and integrates into wheel angular velocity (all values that say "wheel" refer to drive wheels).
	float totalTorque = driveTorque - tractionTorque; // + brakeTorque
float wheelAngAccel = totalTorque / wheelInertia;
wheelAngVel += wheelAngAccel * seconds;
float driveForce = tractionForce;

float acceleration = driveForce / mass;

Then acceleration is integrated into groundSpeed (will use vectors later once I get longitudal) and then finally integrated into position. I understand the concept, but the one thing I dont' understand is that how to integrate torque into the drive wheels in order to generate an acceleration. Right now it's going to slow, and I haven't even put in drag or other resistance forces, so it is my opinion that something is defintely wrong. I know, I should be calculating engine rpm like this:
        engine.RPM = wheelAngVel * finalRatio * gearRatio[currentGear] * 60 / 2*M_PI;

However, it hardly moves then. Please ask if more details are required, and help is appreciated! I'm really confused :). [Edited by - solinent on October 22, 2008 7:23:27 PM]

##### Share on other sites

What is the max slipRatio value you are getting during the simulation?

You are calling pacejkaLongitudal with a % of slip, are you sure the units are consistent? Usually it is:

0 = free rolling
-1 = locked

Also get a printout of "driveForce / mass".

Consider that pacejika was not designed to simulate starts from speed=0.
It is likely that, during the first seconds of your simulation the tyres are spinning like crazy. You need some graphs to understand what it is going on.

##### Share on other sites
Hi,

Thanks alot, that makes sense. My slip ratios can go up to 5 times (500%), which means they are slipping a whole lot.

So, when should the longitudal version of it be used? Maybe only after a certain speed? Is there any literature on this specific topic?

I'll try to output some values to a file to get a good estimate of what's happening.

I'll figure out how to use gnuplot to get an acceleration vs time, and slip ratio vs time.

Final question: is there any data for one specific car that I can use that has alot of this info? Like acceleration vs time and slip ratio vs time? This would be very useful.

I don't have any calculus knowledge, other than basic stuff you learn in precalculus (I have intro calculus/vectors next semester, gr 12).

I'm aiming for it to be a 2d simulation, but if I can get a good feeling demo (in line with real physics) I want to do 3d, so that is the basis of using very accurate models (also because it's challenging/fun).

##### Share on other sites
Ok, the first graph here is the acceleration/time for using pure dynamics (ie a engine torque -> wheel torque -> wheel force -> acceleration)

Here it is:

The other graph is coming up, for some reason it's exporting corrupted data, give me a second.

edit:
Pacejka stuff, first gear is still done using non-pacejka stuff.

acceleration/time

slip ratio/time

[Edited by - solinent on October 23, 2008 2:31:11 PM]

##### Share on other sites

Ok so 2 things to consider:

- It is clear from the graphs that as soon the 2nd gear is engaged and the magic formula kicks in (you said it is off for 1st) the longitudinal force drops down. So something is wrong in the MF output. Can you plot the result of slipRatio/Fx of the formula?

- Drivetrain inertia is not taken into account. The only inertia I see here is the wheel inertia. The problem is that, because of the gear and final ratio the inertia seen by the engine should be different from the inertia seen by the wheels. Ruud, author of Racer, has a nice page about this:

http://www.racer.nl/tech/effinertia.htm

##### Share on other sites
Thank you, I'll definitely look into those and generate that graph for you.

I'ved stopped doing longitudal for the moment, and was working on lateral, so I might take a little time to get back with that slip ratio graph.

Small question about the lateral pacejka, I can't find the units of the D, C, B, and E values of the lateral version (ruud doesn't seem to list them), I am trying to generate the appropriate curve using the PHOR's series explaination, but they dont' list the units either. I'll probably figure it out by the time you read this, but incase you see it earlier, it might help me out.

One problem is that I'm not accounting for extra vertical load on the rear due to acceleration yet. Is this affecting my values by alot? Also, does the suspension have anything to due with dampening the Fx values?

Thanks.

edit:
I think I got the units, and I got a graph that looks something like a pacejka curve, though it's obviously wrong since I get negative force at 0. This is how the function is set up (as per PHORS):
        D: 5957.2 | C: 1.779 | B: 0.340706 | E: -0.266611 | Sv: 0 | Sh: -0.0538066 | S = slipAngle + Sh        Fy = D * sin (C * atan(B*S + E*(atan(B*S) - B*S))) + Sv

[Edited by - solinent on October 24, 2008 9:04:33 AM]

##### Share on other sites
Magic formula doesn't have a "physical" interpretation.
If you want to use it, the only way forward for you is to build a simple editor that, given some MF paramteters is plotting the curve.
Then, try to get hold of some real tyre test curves and try to match either by hand (so you will also learn the effect on the paramters on the curve) or by formulas.
Pacejika's book has a nice explanation about calculating paramters from given data (ex. max slip angle, friction after the peak etc.).

Anyway, in few words, here is what each parameter does:

B - In my experience is never expressed directly, but rather calculated from another important value called Cornering Stiffness, that is, the slope of the curve at 0 slip. Basically you have a stiffness and calculate B as:

B=CS / C*D

Being:

CS=BCD

C - Curvature factor. Its main effect is in the "drop off" of the curve after the limit of adehsion. It is typically in the range of 1.3-1.4 for lateral and 1.6 for longitudinal.

D - is the peak value the curve will reach. You can use N (0..5000 for example) or friction coefficient (ex. 0...1.8) to later multiply by normal load on the tyre. Usually D comes, like CS, from more calculations to take into account load sensitivity, camber in Pacejika most advanced version.. temperature, pressure, speed, in custom variations.

E - This controls the beginning of the sliding area making it very abrupt or more soft.

Weight shifting is very important under acceleration because it allows the rear tyres to support more longitudinal force. Of course the springs/damper are controlling the rate of weight shifting around the car under dynamic manouvers.

Anyway, as I have said, if you are into car simulations, do yourself a favour: invest a couple of weeks into a tyre curve editor, you will never regret it and will be using it forever.

##### Share on other sites
Yeah, I'm writing this program without any written stuff, it's all in my head. Invest a few weeks? Normally it just takes me a weekend before I realize I'm in over my head and quit. But I did finish a almost-realtime raytracer.

Anyways, before I do such a rash thing, please read my edit to my earlier post, I figured out the units and got something like a pacejka curve, but something is wrong. (get negative force at 0).

I'll start coding a pacejka curve editor, though that will take some time, it does seem like it will help me. Maybe I'll just use the racer.nl one.

edit: Is pacejka's book something a mere 12th grade student with no calculus knowledge will be able to understand?

##### Share on other sites
Nothing is wrong.
Look here:

Sh: -0.0538066 | S = slipAngle + Sh

Sh is added to the slipAngle to simulate a tyre effect called ply-steer and/or conicity. If you set this param to 0, you will have 0 N at 0 slip angle.

EDIT: I don't understand what 12th grade is :D... we use different names for schools here in Italy. The book goes from simple math (I would say high school stuff, for the empirical models) to more complex derivative notation in other parts of the book. Consider that I have never been in college/university, just banging my head into books I have managed to figure it out.

##### Share on other sites
So I should get rid of Sh? Or maybe the lateral version of pacejka is only really good for high-speed simulation?

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
17
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631774
• Total Posts
3002295
×