Skip to content

Engine and Car Physics

Ted Dunning edited this page Sep 27, 2015 · 3 revisions

Engine Output, Torque, Drag and Acceleration

I assumed that the engine would have an absolute maximum output of 200 bhp which corresponds to 150 kW. In addition, I assume that the torque will be maximum at 0 RPM and drop to zero at 3500 RPM (aka ZERO_TORQUE_RPM in the code). This is a fairly idealistic point of view, but not entirely unreasonable. These assumptions give a broad power maximum and a zero RPM torque of (4 * MAX_POWER / ZERO_TORQUE_RPM).

The available torque can be converted to force on the vehicle using the gear ratios and that force can be used to compute the acceleration of the vehicle after accounting for drag. The drag is assumed to be entirely turbulent, but that assumption could be improved if we cared enough about the details. The drag coefficient as calculated also incorporates rolling resistance, drive train losses and engine rotating losses. It was computed by picking a relatively arbitrary absolute top speed of 150 MPH for the vehicle at top power. This is not a speed that the vehicle could actually reach since it would have zero power to accelerate as it gets near that speed.

The force applied on the vehicle by the engine is further limited by an assumption that the tires cannot accelerate the vehicle at greater than about 8 m/s/s without breaking loose. The impact of these heuristic approximations is probably mostly noticed in that the car seems to accelerate at low speeds a bit faster than is realistic, but the overall effect is pretty close to a realistic feel for a heavy sedan such as a BMW 3 series.

Here is the result of punching the accelerator and going flat-out from zero to 60 in 7.1 seconds:

The right hand axis is RPM and corresponds to the green trace. The left hand axis is speed in MPH.

The Gears

To get some kind of reasonable values for gear ratios, I used the following RPM data that I had kicking around and drew some kind of sort of straight lines to work out some relationships.

This gave me the raw ratios that I used:

private static final double[] MPS_BY_RPM = {
            4.4704 / 2000, 8.9408 / 2000, 13.4112 / 2000, 13.4112 / 1500, 17.8816 / 1500, 22.3520 / 1500, 22.3520 / 1000
    };

I assume that there is about 200 RPM slippage in an automatic gear box so converting from speed to RPM goes like this:

            currentRPM = currentSpeed / MPS_BY_RPM[currentGear] + 200;

Shifting

Currently, shifting uses a very basic algorithm. Each time RPM climbs above 2000 RPM, we shift to the next higher gear (if there is one). Each time that the RPM drops below 1000 RPM, we shift to a higher gear. There is also a 100ms timeout after each gear shift during which no torque is produced. This dead-time turns out to be pretty important in getting realistic drag race times.

The slippage is also nice in that it allows the engine to produce power when the car is not moving.

Clone this wiki locally