racer home

Differentials

 

Home Go for the GT5 look using vertex and fragment shaders!


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

Introduction

To explain the workings of differentials would require too much text; there's enough literature to deal with that; check for esxample this very easy to follow explanation at Youtube. I'll only explain Racer's physical view on differentials.

Most differentials work alike; there are only a couple of types that Racer supports (v0.6.3+); open, spool (locked), LSD and viscous. Most real-life diffs fall into the LSD (limited slip diff) category.

What does a differential do?

Imagine a car in a turn; the outer wheels want to rotate faster than the inner wheels. If you have a spool (locked axle), the wheels physically can't move with respect to eachother. The result quickly is squealing wheels. Go-karts for example have locked axles, and can be hard to turn.

The differential is a clever mechanism to let each wheel rotate semi-independently. The left & right wheel can rotate at different velocities. The sum of both though, divided by 2, is the speed at which the input of the diff (from the engine) rotates. That is a given fact resulting from the way diffs are built.

The extremes in differentials are open and locked (spool, not really a diff). The open diff does nothing to prevent the wheels rotating away from eachother, while the locked diff is the opposite - the wheel velocities will always match (left & right). The open diff does allow the wheels to have different velocities in a turn, so no slipping & tire wear.

Why locking?

There are locking differentials. Why? Imagine an open diff and a car with the left wheel on the road, the right on ice. When applying throttle, the wheel on ice will start spinning, while the wheel on the road will stay still. This is due to the fact that the road counteracts the engine torque routed to the wheel, and this effectively helps spin the wheel on ice.

So, say you're coming out of a right turn and you stomp on the throttle. The inside right wheel will be light. With an open diff, chances are big that your inside wheel begins to spin. Even worse, if that wheel is on grass, the left wheel hardly accelerates and you spin out. What you want is to lock both wheels in this case, so that more force is available at the left wheel, to avoid power oversteer (which means: if you apply power, your car starts spinning; the back breaks out).

How to lock?

How does one lock a differential. Looking at it mechanically, there are 2 mechanisms:

differential

The differential mathematically

One of the hardest things in a car sim can be the differential. The best way to get a feel is to have an actual diff at hand. Lego makes differentials which can be useful, while you must take into account the fact that they have a lot of friction, so can be a bit confusing when trying to figure out the forces.

Also, you can find many articles on differentials on the internet, but they are not really useful for *programming* a differential.

In Racer, you have the following inputs for the diff software: engine input torque, wheel road reaction torques (left & right) and wheel velocity difference.

Some software uses torque transfer to calculate accelerations, but Racer uses another approach (courtesy of Gregor Veble); given the input torque and the road reaction torques (the 3 torques in the image above), it calculates the accelerations of all 3 sides. For a locking diff (LSD for example), an extra locking torque is calculated internally. For this to work, the system is viewed as a symmetrical part (the engine side) and an asymmetrical part. For example, if the left wheel is rotating at 1 rad/s, and the right wheel at 3 rad/s, the symmetric velocity is 1, and the asymmetric velocity is 2 (velRightWheel-velLeftWheel).

The maths - an open diff

The engine torque is normally divided into 2 and goes to both axles (outputs). For example, if Te=100 Nm then the axles will both in principle receive 50Nm. The road will push back and these torques will lower the wheel acceleration (plus, this torque goes back to the engine).

*actual formulae here*

The maths - preload

Now it's time to checking locking diffs, such as LSD's. Here I'm focusing on a Salisbury diff (as used in Grand Prix Legends). This diff can be preloaded, which means you add clutches near the wheel axles to keep them rotating at the same velocity.

Below is an image displaying how this can work: the whole cage, including axles, are rotating. As soon as one axle starts rotating faster than the cage, the axle plate gets friction from the clutch plates mounted to the cage. The plates are pushed against eachother using the preload spring. It's like a regular clutch in the engine; as soon as the axle & cage start rotating with respect to eachother, the plates give friction, and attempts to make them have the same velocity again.

As long as the torques on the axles (the road reaction torques) don't overcome the clutches, the diff stays locked. In software, it seemed necessary to have a 'locked' state instead of regarding everything as a spring. If you do the latter, one timestep the friction torque will point one way, overshooting the acceleration. The next timestep it will be the other way round and friction will point the other way. The end result in Racer was that the car froze on the spot; things just jittered back & forth.

So, how to know whether to lock the diff? The answer is difference velocity reversal. You may have heard of velocity reversal, which means the velocity changing sign, or in plainer English, something starts to move the other way. In this case, the velocity of the wheels can be non-zero, as long as they are the same. If the velocity of the wheels is the same, the diff is in a locked state. Once the velocity of the wheels start to drift apart (the diff isn't able to lock it anymore), the diff becomes unlocked.

So, for programmers, you get:

diff preload

The maths - torque bias ratio

The torque bias ratio was, as shown above, the ratio of road reaction torques from the wheels.

*more here*

The maths - preload & torque bias ratio

Now that you have seen both preload & torque bias ratio, how do they work together? Well, the diff only gets unlocked if BOTH the preload AND the torque bias ratio is exceeded. Otherwise one of them will provide enough locking to prevent this from happening. But what torques appear when the diff starts unlocking? Surely the wheels will gradually accelerate away from eachother. Keep that in mind with the following example.

Say you have a torque bias ratio of 1.5, and a preload of 50Nm. The engine is torque is set to 0 for clarity. The left wheel returns 100Nm of road reaction torque, the right wheel returns 150Nm. Does it stay locked? The bias ratio is 100:150 => so is 150:100 (bias ratio is always >=1) so 1.5. So it stays locked. Also, the preload is 50Nm, and 150-100=50Nm so it also stays locked due to preload.

Now the right wheel returns 160Nm. Does it stay locked? The bias ratio has increased to 160:100 = 1.6. The preload was 50Nm and the difference is now 160-100 = 60Nm, so this is also overcome. How much torque is used to accelerate the wheels away from eachother? 60-50 = 10 Nm.

You're calculating how much the road reaction torque exceeds the locking torque here. The locking torque is the maximum of preload vs torque bias ratio force. In the above case, both were 50, so that wasn't really too clear. If preload was 60Nm then the 160:100 case would still lock the diff. If then a 170:100 road reaction bias would be generated, the torque bias ratio (1.5) couldn't keep this, preload as well, and you take 170-100 = 70Nm, and 70Nm - 60Nm (the biggest locking factor) = 10Nm of accelerating the wheels away from eachother.

Why not ADD preload & torque bias ratio? This is a difficult one. But, the preload spring is inside the same system as the torque bias wedges. This means that any torque applied by the wedges will only add to the total locking torque as soon as the torque bias is LARGER than the preload.

Differential connections

A differential connects 1 incoming component to 2 outgoing components. Currently only 1 diff can be defined (v0.5.0), but you can select the wheels that the diff connects to with differential.output0 and differential.output1. So for example, setting differential.output0=2 means one end of the diff connects to wheel 2 (the placement of the wheels is normally FL=0, FR=1, RL=2 and RR=3; most default settings rely on this behavior, see [wheel placement]).

Friction

In differential.friction you can specify a constant friction (in Nm). This always works to counter the driveline rotation. It is viewable with Ctrl-8 and its value is 0 at zero speed, and the friction itself (though negative) when the driveline is rotating.

Differential type

differential.type contains the type of differential:

Viscous differentials - locking torque

In differential.locking_coeff you state the amount of locking. For the viscous locking differential, this is used as: torqueLocking=wheelSpeedDifference*lockingCoeff. Note that torqueLocking is in Nm, wheelSpeedDifference is in radians/sec (!) and the lockingCoeff is just a magic number. Values from 0 (open diff) to 100 seem to work reasonably ok, but experimenting in this area may prove useful.

Limited slip differentials

LSD's exist in 3 types; 1-way, 1.5-way and 2-way. To Racer they seem mostly alike. The following parameters work for LSD diffs (that use a clutchpack to apply torque):

Note that LSD diffs currently (v0.8.3) seem to be very buggy. v0.8.6 is a lot better (also changed the naming of 'power_coeff' to 'power_ratio').

Salisbury differentials

These are supported from v0.8.6 onwards. They are the Grand Prix Legends type differential.

Racer (v0.8.6) handles Salisbury diffs just as LSD diffs. The calculation done is: power_ratio=cos(power_angle)*(1+clutches)*clutch_factor. Preload is handled explicitly from v0.8.7 on.

The GPL diff setups can vary; Carroll Smith seems an advocate of 45/85/1 (quite a bit of power-on lockup, almost no lockup during braking, just a bit of clutching to avoid the wheel-on-ice scenario). GPL drivers often use something more in the direction of 85/45/1, or 60/30/2. The latter gives more lockup, so more stability (understeer), but making the car easier to drive ofcourse means to go slower.

A nice article on GPL diffs, Carroll Smith and such can be found here.

Active differentials (Racer v0.9.0RC5+)

Active differentials just have 1 parameter, but are the most flexible, though you will have to program them with actual code in Onyx.

To learn how to actually code an active diff, read this article.

Ratio

The rear differential ratio is given in ratio in the diff section. If not defined, it will use gearbox.end_ratio, but that is old behavior; you should really define the diff ratio in your diff tree (in the same location as power_ratio etc). Typical values range from 2 to 5. It has an effect on the gearing of the total drivetrain for all gears, because totalGearing=currentGearRatio*differentialGearRatio.
More differentials may be added in the future (for 4WD cars).

Differentials - faking 4WD

Although not really real, you can fake a form of 4 wheel drive on the car.

A faked 4WD example

This example was originally published on RSC (forum) by Miura. Very useful since the 4WD as it is currently can be hard to grasp.

Let's say we have a car with 400 Nm of torque at wheels, 30% of power in front axle and 70% in rear, and a 4.5:1 differential ratio. It would have the following code parts in car.ini.

Racer has only one differential, so this is only a fake 4WD. It doesn't work very well if you have more than 30% of power on the weaker axle, or if you have lots of power, or short gear ratios. If the wheels with no differential have powered=1 but no power_gearing defined, it defaults to 1. This adds about 30% of power to these wheels.

engine
{
   torque=280   ;400 Nm * 0.70 = 280 Nm (70% power in rear)
 ...
}
differential { type=1 ratio=4.5 inertia=0.1 locking_coeff=100 output0=2 ;set these to 2 and 3 if rear axle has more power than front, output1=3 ; or 0 and 1 if front has more power }

wheel_front { powered=1 power_gearing=0.96 ; 4.5 * 30 / 70 / 2 = 0.96
...
}
wheel_rear { powered=1 ;(if the car had 70% front and 30% rear power distribution, ; you'd have power_gearing=0.96 here instead of at the front) ... }

Grand Prix Legends differentials

As an interesting note, I'll explain a bit on how differentials from the game 'Grand Prix Legends' work. An explanation of the differential for GPL can be found for example on one of Allison Hine's sites. The original text is from a mail in 2001 from Niels Heusinkveld (thanks to him); I only have a print of the mail left (8 years later!) so it's good to throw this on the internet. ;-)

The GPL diff is of the Salisbury type. It allows to independently set the power and coast characteristics of the diff (accelerating and decelerating engine). For this it uses ramps and clutches. The clutches provide a spring force which pushes the two axles together, and the ramps are used to decide the torque bias ratio at which point the diff starts to slip. In GPL terms you could have a 60/30/2 setup, which means 60 degrees at power, 30 degrees at coasting and 2 clutches (1 clutch pack = 2 clutches).

The way the degrees work is: ratio = cos(angle)*(1+2*clutchPacks). The 'ratio' is the torque bias ratio upto which the diff is locked. The '2' factor is due to the fact that you need 2 clutch sides per pack.

For example, if you have a 60/30/2 setup, you get:

Coasting: cos(60)*(1+2) = 1.5
Power: cos(30)*(1+2) = 2.598

These give the torque bias ratios (the ratio of the road reaction torques).

 


Dolphinity Organiser - free planning, project management and organizing software for all your action lists

(last updated November 13, 2012 )