Homework Help: Driving simulator questions

1. Jul 15, 2010

wright593

Hi

I am hoping somebody can help me as I'm going round in circles trying to develop a driving simulator for my games programming dissertation.

I am modeling a car which is rear-wheel driven. Each wheel is modeled individually and determines the force it applies to the chassis.

I use the engine RPM to obtain a maximum engine torque value which I then multiply by the gear ratio and throttle position (between 0 and 1) to come up with the overall engine torque which I supply to each of my 2 drive wheels.

Each wheel then divides the engine torque by its radius to come up with the traction force. Rolling resistance is then subtracted from this and the result is multiplied by the direction vector and returned.

The force returned from each wheel is then summed up and aerodynamic drag is subtracted. The acceleration (force / inertia at the wheels) is calculated and then integrated for velocity.

My questions are:

1) To calculate the engine RPM and slip ratio (for braking), I need to keep track of the angular velocity of the drive wheels. However, when I attempt to integrate angular acceleration (total torque / inertia of wheel) to get this then it grows to big very quickly. What limits angular velocity, does the vehicle drag affect the wheels velocity somehow?

2) The inertia of the car wheel is: 0.5 * mass * radius^2. Is mass just the mass of the wheel or is it the mass distribution of the car on the wheel?

3) Is the engine torque applied to both wheels, or is it divided by the wheels?

Any help would be greatly appreciated. Thanks in advance

Last edited: Jul 15, 2010
2. Jul 15, 2010

Gear.0

Well I think I followed what you were doing pretty well, and from my understanding there seems to a be a problem after you subtract the drag force. The equation is not:
acceleration = force / inertia
it should be:
angular acceleration = torque / inertia

Also you might want to do this separately for each tire, so I would divide the drag force by two and subtract that half from each tire individually. Then you would need to convert that force back into torque by multiplying by the radius, and then find angular acceleration by dividing this torque by the inertia if the individual wheel.

As for the 3 questions:
1) Perhaps the above modification will correct this. Also, how are you integrating? Do you actually have a formula at that point for the acceleration? Because, if this is a computer program, I would think you would most likely only have a value.
As for the drag affecting the velocity, I think you already accounted for drag the right way through force (which will then be translated to angular acceleration). Normally I would say that this drag which is applied to the entire body, should be applied at the axle?? But it works either way, if you make the modification I suggested above I think it would be the same thing.
Remember, the magnitude of the drag force depends on the current velocity of the overall vehicle.

2) It's just the mass of the wheel. However, when you find the rolling friction make sure to use the mass of the entire vehicle.

3) The torque should be divided evenly across both wheels.

3. Jul 15, 2010

wright593

You're right, I should be using torque instead of force. Now my integration looks like this for each wheel:

totalForce = driveforce - rollingResistence

angularAcceleration = totalTorque / wheelInertia;

wheelVelocity += acceleration * angularAcceleration ;

With the torque modification, the problem with the integration still occurs. When you say "I would divide the drag force by two and subtract that half from each tire individually" do you mean the rolling resistance should or that I should apply the vehicle drag to the wheel

Thanks again

4. Jul 15, 2010

Gear.0

I thought you also subtracted drag force? In your first post I think you said you did something like:

totalForce = driveForce - rollingResistance - dragForce
So I was just saying to divide the dragForce term between both wheels.

Also, I don't think you really mean "integration" the way it is used in mathematics. It sounds like you just mean "calculate".
The only thing I can think of that might make your angular velocity grow too quickly is that you are applying the engine effects incorrectly maybe.
I don't know how real engines work, but can it really just apply a constant acceleration indefinitely? Meaning if your wheel is already going 1,000,000 radians /s and the engine is still running, it will actually increase this value?
That seems unlikely to me...

You said you are using the RPM of the engine? Isn't that "rounds-per-minute"? which is a velocity, not an acceleration... So the engine would not be applying a torque once it is at full speed. It only applies a torque while the RPM is changing.
At least that is my best guess as to how it works, but I know for sure it can't apply a constant unending acceleration, otherwise you could have vehicles basically traveling as fast as you want them with no limit.

5. Jul 15, 2010

wright593

Once I have summed up the forces from each of the wheels I then calculate and subtract the overall drag before calculating the acceleration of the vehicle as a whole. I think I need to calculate a drag value for each of the wheels though.

That last line of calculations was supposed to read

wheelVelocity += acceleration * deltaTime;

Isn't it the same form of integration? It is essentially finding a point on a curve.

RPM is revolutions per minute, it is how fast the drive shaft is rotating. As RPM increases, so does torque but only to a point after which it drops. I lookup the torque value from a torque curve. I think acceleration is unending but the vehicle drag eventually gets so high that it prevents the velocity from getting any higher. At least that's how I understand it.

6. Jul 16, 2010

Gear.0

Well, perhaps you could just do a calculation to see what the angular velocity should be at equilibrium.

You might just be using constants that aren't very well balanced, and you may find that equilibrium is reached at a very high angular velocity.

In that case your code would be fine, you would just need to tweak the values you are using for things like, gravity, coefficient of friction, RPM, etc etc..