# Car Physics

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

## Recommended Posts

Hi, I'm trying to simulate a car, using the Unity Game Engine. Unfortunately, I don't have a very god knowledge of cars. There are several things I was wondering. Given the gear ratio, and differential ratio: 1.) For a sports car (lets say a corvette), what are acceptable values for the minimum torque when the motor RPM is zero, the maximum torque when the motor RPM has reached it range (maximum?), and the RPM range (maximum) value? 2.) How you calculate the approximate peak (max) motor torque from the current motor rpm? This is the torque curve. 3.) How do you calculate a wheel axle's torque from the motor torque? Thanks!

##### Share on other sites
RPM of zero, no torque (clutch disengaged). If you leave the clutch in, you'll stall the engine.

here are torque curves for a few corvettes.

idle = 275 lb-ft @ 800 rpm
peak = 385 lb-ft @ 4800 rpm

Best is to use a ploted curve to decide what would be the torque for a given rpm. This is also scaled by the throttle input.

The torque at the wheel is the torque at the engine flywheel * gear ratio * rear diff ratio.

##### Share on other sites
Thanks, this helps a lot!

One last question. Is there someway to mathematically figure out an approximation of the torque for a given RPM, instead of having an array of values?

##### Share on other sites
Quote:
 Original post by bronxbomber92Thanks, this helps a lot!One last question. Is there someway to mathematically figure out an approximation of the torque for a given RPM, instead of having an array of values?

Yes - but this is very complicated and a rough approximation. You could study some thermodynamics books for this.

You will need to know the type of the engine (I assume 4-stroke), the engine number of cylinders, volume of the engine cylinders, the bore and stroke of a cylinder, compression ratio, engine inertia, atmospheric pressure (which depends on super/turbochargers, air temperature and humidity, slipstreaming and altitude), air temperature, amount of energy in fuel, the type of fuel (octane is good for gasoline calculations, methanol for duh, methanol), and a number of other factors. Some of these factors can figured out by calculating and/or looking at tables, other factors you will have to guess.

Then you calculate the amount of fuel that can be burned in the combustion chamber at the current pressure (I remember that it's 1 part fuel per about 15 parts air at 1 atm, can't remember if this was volume or mass, probably mass). This requires some chemistry skills. Then you calculate the mechanical energy produced by burning this amount of fuel. This is how much the engine produces energy in one cylinder in the power stroke, that is once per 4 revolutions.

Next thing you need to know is the amount of mechanical energy wasted in the compression stroke, ie when the air (at atmospheric or charger pressure) sucked in during the intake stroke is compressed by the piston moving upwards. You know the initial volume of the gas and the volume it's compressed to and the chemical compound of the gas (fuel + nitrogen and oxygen of the air), you also know the speed of the compression process (cyclic motion, rpm and cylinder bore and stroke will tell you). This should be enough to calculate the mechanical energy wasted, if not, you may need to add a few temperature parameters here. Now you should know how much the energy is wasted in one cylinder during the compression stroke, again, once in 4 revolutions.

If the engine runs on nitromethane or uses chemical charging (aka nitrous oxide), the compression stroke is where it breaks down to oxygen and nitrogen. This process affects the amount of energy wasted in the compression stroke. You may need to consult your chemistry books for advice here.

I guess it would be safe to assume that no energy is wasted or produced during the intake and exhaust stroke (assuming no turbocharger). You may need to add a frictional model of some sort if your results seem to be unrealistically big.

Turbochargers may require a bit of extra calculation to get working correctly. You need to figure out the volume and/or mass of the burnt gasoline and air and use that to calculate the amount of compression the turbocharger can provide and how much energy is wasted by the turbocharger during the exhaust stroke.

Superchargers could probably be modelled with an extra amount of inertia that increases as the engine RPM increases and use that information to calculate the boost delivered by the charger.

Now you know how much one cylinder creates and wastes energy in 4 strokes. This should be enough to calculate the energy production of the engine, which in turn should be enough to calculate the engine torque.

As I said this is pretty complex, but this should get you started with the resources (books, tables, data, formulae) you need to acquire. Please let me know if you figure out a way to calculate this.

Using a spreadsheet application or a numerical computation software may be better to solve the model than writing some code would be. You may also use this kind of utilities to reverse engineer missing parameters, etc.

Hope this helps,
-Riku

##### Share on other sites
Wow, that's really complicated. Thanks. I'm not really looking to do a realistic simulation. Maybe if this project goes anywhere, I'll look back at this, and do a real simulation.

I was hoping you it would be possible to use a simple parabola (fake a torque curve).. Oh well. I guess I'll have find an array of torque/rpm pair values.

Thanks a lot guys!

[Edited by - bronxbomber92 on August 22, 2007 2:15:14 PM]

##### Share on other sites
Yes - as I said the model is complex. I know that some games actually use such model (Live for Speed uses AFAIC). However, most games just use lookup tables or do something even more simple.

You could try whipping up a model by tracing a few curves into a numerical computation software, a graphic calculator or a spreadsheet application and try to figure (using regression or whatever it was called) out a model - perhaps a polynomial one. 2nd degree (parabola) might not be very good but perhaps a 3rd degree polynomial would do it.

-Riku

##### Share on other sites
You may also get some good results by combining functions. For example, those torque curves look a lot like skewed parabolas, which you may be able to attain by playing around with the x parameter somehow before squaring it.

##### Share on other sites
I have a car physics resource download available on my website at

www.kjmsoftware.co.uk/

It includes, source code, demos, tutorials and various physics papers all relating to car physics for the programmer.

I hope theres something there of value.

KJM

Thanks a bunch!

##### Share on other sites
OP, just so you know the way you model the torque curve is not that important, and might possibly not even be noticable (if for instance the player always mashes the throttle the vehicle will always burn out, who cares how much torque is actually applied). In other words, use which ever model works best. I personally use around 8 torque samples and linearly interpolate between them.

So I store torque something like:

float torqueCurve[] = { 0, 100, 200, 300, 500, 500, 400, 300};

You'll need a total transmission ratio also, how you break it up is not important but typically you'll have the current gear ratio and a constant transmission ratio which takes into account the differential.

Everytime you update the engine simulator:

1.) calculate currentRPM = currentwheelspeed * inverseTransRatio;
2.) torqueAvailable = torqueCurve(currentRPM);
3.) torqueOutput = torqueAvailble * throttle * transRatio;