# 2D Car Simulation with Throttle Linear Physics

I'm trying to make a simulation game for an automatic cruise control system. The system simulates a car on varying inclinations and throttle speeds.

I've coded up to the car physics but these do note make sense.

The dynamics of the simulation are specified as follows:

``````a = V' - V

T = (k1)V + θ(k2) + ma

V' = (1 - (k1 / m) V) + T - ( k2 / m) * θ
``````

Where

• T = throttle position
k1 = viscous friction
V = speed
V' = next speed
• θ = angle of incline

k2 = m g sin θ
a = acceleration
m = mass

Notice that the angle of incline in the equation is not chopped up by sin or cos. Even the equation for acceleration isn't right.

Can anyone correct them or am I misinterpreting the physics?

Source: "scribd.com/doc/105335356/124/INDUSTRIAL-APPLICATIONS"; Page 508. Number 13.2.

-

## 1 Answer

I agree that parts of this might not make sense initially. Disclaimer, I am not sure of the following, this is just my "gut feeling" of how these equations should probably work :)

I guess that you would prefer to have an equation on the form V' = V + a*dt which is equivalent to a = (V - V')/dt. When applying this you would probably use a*dt in most applications. If you use a fixed timestep then you would always be able to calculate the "correct" value of the acceleration whenever you need it and can use this expression instead. You could read more of this in the first paragraph in the article Advanced character physics, using Verlet integration, that i was made aware of in this thread: How to implement friction in a physics engine based on “Advanced Character Physics”

I find it odd that there are two usages of θ, I wonder if you maybe should use just the expression for k2 instead of θ(k2), this feels sort of right when calculating the throttle position.

In the real world I belive most car manufacturers use PID-controllers for their cruise control systems.

-
I've coded the simulation exactly according to the equations and they do not work. I've added the source of the equations if you want to look at the full picture. I would be glad to use the Verlet integration but our professor insists that these equations are correct, and so I must prove that something's wrong or try to dig-up some sense in throttle physics. – helix Sep 18 '12 at 20:53
Could you ask him to explain θ(k2)? I don't really understand that part. As for the article that was mostly to prove that a = V' - V is correct in some cases, like verlet integration with fixed timestep. – Mikael Högström Sep 18 '12 at 21:19