ijaygee) - 2007-07-06 09:08By: Ian Greenwood (
Martin, its been a while since I brought up this topic. I've been
playing with Verlet integration and relaxation methods over the past
few months - cloth sims, constraints and the like...after modelling a
semi-rigid box and seeing it collide and spin off a wall and come to
rest on the ground with no inertia tensors or orientation matrices in
sight, I got a wild idea that I might be able to use this integration
method for cars... No such luck... But, in revisiting tyre grip/slip I
managed to come up with what I think is the solution for realistic car
Just to recap, another poster pointed me at Brian Beckman's "Physics of Racing Series", which is a great set of articles. I tried following Brian's formulas/methods but the results weren't very convincing. I think Brian's notion of "slip ratio" (Vcp - Vcar/Vcar) is wrong - it tends to reduce the effects with speed, which I think you'd agree doesn't sound right and as far as my sim is concerned it simply doesn't work...
(see the full set of Brian's articles here - http://phors.locost7.info/contents.htm)
First, some answers
I did get something going using the RARS method of obtaining the slip vector but, their tyre model was a bit too simplistic.
Now I've married Brian's 'magic formula' for the tyre friction with the RARS method of obtaining the slip vector and the results are looking pretty good.
SlipVector = tyreContactPatchVelocity + carVelocity
SlipVector is the relative velocity of the contact patch w.r.t. the road
tyreContactPatchVelocity is the velocity of the tyre contact patch w.r.t. the car (it points backward to the direction of travel - in the direction the tyre is rotating - usually straight back for the drive wheels but of course goes way off line for the steering wheels)
carVelocity is the car velocity w.r.t. the road (points forward usually, or in the direction the car/tyre is travelling if you're skidding/spinning or sliding - adding in angular velocity of the car as necessary)
With the SlipVector for each tyre the force on the car is found by summing the result of the following for each tyre:
SlipForce = SlipVectorNorm * -mu(|SlipVector|*deltaTime, Fnorm)
SlipForce is the resulting force vector in Newtons
SlipVectorNorm is the normalized SlipVector (we just want the direction)
|SlipVector| is the length of the SlipVector
deltaTime (since the last frame) converts the SlipVector length into a displacement - how far the tyre slipped on the road surface (thus producing a friction force by stretching/twisting the rubber)
Fnorm is the weight on the tyre (standard friction stuff)
The 'magic formula' in the friction function mu (see Brian's site for derivation)
This 'magic formula' mimics the output from Genta's Ferrari tyre analysis and greatly simplifies the maths involved.
The weight transfer (i.e. Fnorm) on each tyre can be found following Brian's weight transfer method. I produced a four way version by taking the sum of all the forces (that's drag, acceleration/braking and steering) normal and tangent to the car body. These are converted to 'Gees' (divide by 9.8) and then a simple wheelbase ratio and tracking width ratio w.r.t. the Centre of Mass height produce the weight shift front to back using the normal force and then shifting the front-back values left or right with the tangential force. These are then stored and used for the values of Fnorm in the next loop. (I also use these to mimic the forces on the suspension, producing a tilt on the bodyshell so it appears we have nose lift and dip during acceleration and braking and the body tips sideways toward the outside of a turn.)
So, I've got a '2.5D' model of a racing car. It slides (understeers) when we try to take a corner way too fast. It spins (oversteers) if we're just a bit too fast into a corner or if we're trying to steer and brake (too hard) at the same time. And needless to say, if you get the entry speed just right you can take the corner and accelerate out sqeaking the tyres with no loss of control. Nice! :D
What I'm missing is a proper model of the engine power and revs. At present I'm using the torque at the back wheels (after going through the gears) to simply accelerate the mass of the car. To clarify: I'm not accounting for longitudinal slip in the drive wheels, I'm just assuming 100% grip and allowing the torque to accelerate the mass. This works ok(ish) - the acceleration slows as we move up the gears and eventually drag cancels out the driving force and we hit max speed. But I'm assuming that (even when skidding) the tyres are 'stuck' to the road so that the velocity in the direction the drive wheels are pointing gives me the engine revs (back through the gearbox). What I can't get my head around is the power consumption - how we account for hill starts, spinning the wheels on the start grid or performing power slides (rally style) around sweeping corners. I know I need to use the tyre friction to feedback the power used to the engine and so determine the revs (we could be stalling the engine or revving freely depending on the speed and grip).
I know that
work done = force * distance
power = work done / time
Here's my imaginery race car stats
mass = 1000kg
pwr = 74.5kW (~100HP)
torq. = 135Nm (~100ftlb)
1st gear ratio = 3:1
diff. = 3:1
tyre radus = 0.3m
For the engine we can assume constant torq. and a linear power output from 0 to 74.5kW @ 5000rpm (say 15kW per 1000rpm)
I'll want to go full 3D soon, so we'll need to factor in the mass and gravity on hills.
How do I figure out the force, distance and power? Is the force the reaction to the actual acceleration of the mass of the car against the driving wheels? - I'm thinking this force would be increased by the drag which is trying to stop the car along with the inertia of the car (sounds about right to me).
How do I feed this force back to the engine accounting for grip/friction at the drive wheels? If the wheels leave the ground or skid on an oil patch the engine should rev freely...also if we're on sand or grass we might have reduced grip but increased drag on the wheels.
As ever any help/corrections much appreciated.
martinbaker) - 2007-07-07 03:26By: Martin Baker (
This is impressive, you are way ahead of me, I think it would be useful to link this message to the web pages, if thats alright with you, as I think it would help others.
It seems to me that one of the reasons this is difficult to model is that it can be very non-linear, for example, as we gradually increase the speed of the wheels then the road speed will increase in a linear way. Then suddenly, at a point determined by the road surface (oil on road etc.), the wheels will start to spin, we are then in a completely different mode (wheel spin) given by a different set of equations. Even if we reduce the wheel speed below the point where they started spinning they will still spin (hysteresis effect). I have just put some equations and diagrams to try to illustrate on this page:
It therefore seems to me that we need to identify different modes for the system, such as,
and then derive a set of equations for each together with a set of criteria which switches between these modes.
Do you think that would be a practical approach?
Martin, sorry for delay, I've been playing with work and power - got
something working but I'm not too sure it is correct.
Firstly, not sure about your idea of 'switching modes' - I don't think this is necessary as the maths should work it all out.
To answer your points:
1. Stalling - I think we can simply test if the power required by a manoever exceeds that being output by the engine (I'm now subtracting the power used from the current engine output, which determines the revs). I think asking for too much power will force the revs to fall below some predetermined tickover threshold - we can then perhaps flag a condition that the engine has stalled and cannot provide any power until restarted (perhaps this is a mode).
As for 2,3,4 - these are all pretty much covered by the Pacejka tyre friction formula(s) (as simplified in the mu function above). As I may not have made clear above, the formula uses the relative velocity of the tyre contact patch w.r.t. the road to determine the forces the tyre produces on the car. Spinning the wheels and hard braking (locking the wheels) produce similar relative velocities, only the directions are reversed - the rubber to road friction is however of the same order. Linear acceleration and controlled braking also produce similar relative velocities, and again, the forces are of the same order just in opposite directions.
The real issue with the actual Pacejka 'magic formula(s)' is that linear and lateral forces are treated separately, using different formulas and desparate inputs too (slip (ie. velocity) ratio for linear forces, and slip angle (ie. steering wheel angle) for lateral forces) BUT, the tyre can only provide a maximum combined force proportional to the load and rubber compound (the traction circle). 'Welding' the slip inputs together or combining the frictional forces output by these formulas is the subject of 4 or 5 of Brian's articles. I gave up on trying to get this working because I couldn't see how the lateral (turning) forces related to the car's speed - you can quite literally turn a stationary car on the spot according to the 'magic formula'. This is why I turned to the RARS method of obtaining a single slip vector and modified the input to the tyre model to get what appear to be very acceptable results.
Just to clarify the above:
In my sim I actually slow the wheels when applying the brakes - the friction function then converts the resulting slip ratio into a braking force acting on the car.
I've now got the opposite working too. I can spin the wheels and the friction function turns that slip ratio into a forward acceleration on the car.
As for oil/ice/grass etc. I think we can use something like a 'surface grip factor' to modify the output from the friction function. Say 1.0 for tarmac, 0.5 for grass/wet and maybe 0.1 for ice/oil. I used this method in the previous version of my sim and this seems to work fine. The thing to remember is that tyre only produces a force when there's a relative difference in speed between the tyre and the surface its on. Driving through a patch of oil or over ice at a consant heaading and speed isn't going to require a huge force. Braking, turning and accelerating while on oil or ice is going to generate a force and, when we modify this with the 'surface grip factor', if you're braking or trying to turn you can forget it because the surface won't provide the necessary traction (and off you go....).
Anyway, back to the main topic - work and power.
The story so far:
One of Brian's articles covers power consumed in overcoming drag. He states that to get the drag force into power you simply multiply the drag force by the speed, which is of course distance/time, so it makes perfect sense as far as the units of power go. I've tried this and it seems to work great.
Is it safe to assume then that the same holds true for the acceleration force at the drive wheels? - just multiply by the speed and presto we have the power? I've added this to power feedback and it seems to work ok but I'm just guessing that this is right...?
> Firstly, not sure about your idea of 'switching modes' - I don't think this
> is necessary as the maths should work it all out.
I'm afraid I haven't fully studied the Pacejka 'magic formulas but it just seemed to me that equations alone could not represent the hysteresis effects of friction? From what you say I guess this does not matter?
> One of Brian's articles covers power consumed in overcoming drag. He
> states that to get the drag force into power you simply multiply the drag
> force by the speed, which is of course distance/time, so it makes perfect
> sense as far as the units of power go. I've tried this and it seems to
> work great.
Seems right to me, although of course it is only the power consumed in overcoming drag, can we expand it to include the power required to overcome: drag, tyre friction and that which accelerates the car?
work(energy) = sum ((drag force + tyre friction force + acceleration force) • d x)
• = dot product
d = differential operator
x = change in position vector
force = total force vector = drag force + tyre friction force + acceleration force
d work = force • d x
but power = rate of change of energy = d work /dt
therefore power = force • dx/dt = force • v
so the power is the dot product of velocity and force
> Is it safe to assume then that the same holds true for the acceleration
> force at the drive wheels? - just multiply by the speed and presto we have
> the power? I've added this to power feedback and it seems to work ok but
> I'm just guessing that this is right...?
Can we use Newtons second law: F = m a
Where F is the force left over after drag force and tyre friction force are subtracted.
ijaygee) - 2007-07-23 06:59By: Ian Greenwood (
Martin, I think the crux to the power issue is how you model the
engine. I've taken a pragmatic approach and said that (assuming 100%
throttle) the engine can only accelerate if there's a surplus of power
available. I've calculated available power as current engine output
less current load (from drag and acceleration). I've then taken this
'available power' (which can be zero, positive or negative) and fudged
a factor to convert it into revs (e.g. revs += available power * dt/10
- there's no scientific basis to this factor but it works reasonably
well and I suppose mimics the acceleration of the flywheel, drive
train, and internal friction etc.)
I ran some numbers based on accelerating the drive wheels with the torq on the axle. I think I need to divide this between the rear wheels but, taking the rear wheels as a unit the power is of course P = Tw. Needless to say this power is identical to the engine output (all we did was reduce the revs by the gears ratios and increase the torq by the same factor). Now, that's not the same as the power coming back from the tyre model by P = Fv because this encorporates slipping and is usually less than or equal to the power being delivered to the wheels by the engine.
As far as I can see, the linear form, P = Fv (i.e. P = F . d v) based on the force at the wheels plus drag and the velocity of the car is correct. This wheel force is zero when we're cruising at a constant speed - the tyre model does that for us. The only power consumption then is in overcoming drag.
I guess we've got 2 modes here esp. with respect to racing. The first is when we've got the throttle open, accelerating as fast as possible and placing full demand on the engine. The second is when we're braking (for corners) - the engine is usually helping with braking. The only time a racing car cruises is when we're flat out, consuming all the power the engine has to give to overcome drag and friction.
I'm getting a clearer picture of what's going on and where I need to go.
In the current setup, I'm spinning the drive wheels based purely on the engine revs through the gears. This gives artificially high acceleration (it's all down to revs and that dt/10 fudge factor). So, now I'm thinking about accelerating the wheels with the torq on the axle. From the tests I've been running we can spin a wheel up to full revs in less than a second in 1st (but that's with 1 wheel getting all the torq so, it'll probably be more like 2 seconds to spin up both wheels receiving half the torq each via the diff). Now this is going to have an effect on engine revs, after all, the wheels can't spin faster than the axle and vice versa. Now I see where your hysterisis loop fits in to the picture and, we've got a physical reason why the engine revs can only increase at a certain rate (no more fudge factors!). Also, I see that power is directly proportional to revs so, when we use power we actually use up revs.
By Jove I think I've got it!