How can I simulate a car's acceleration using torque and RPM?

AI Thread Summary
To simulate a car's acceleration, it's essential to understand the relationships between torque, RPM, horsepower, and force. Torque does not convert to RPM; instead, horsepower can be calculated using the formula (torque * RPM) / 5,252. Key parameters such as mass, drag coefficient, and friction must be defined to accurately model the car's behavior, including wind resistance, which is calculated as drag coefficient times velocity squared. The simulation should account for control inputs like the accelerator and brakes to adjust force accordingly. Properly organizing these parameters and utilizing Newton's laws will enhance the simulation's accuracy and realism.
tarik666
Messages
2
Reaction score
0
Hey guys I need a bit of help with car physics type thing. I am trying to create a simulation of a car moving in a straight line. I have been searching the internet for two days but have not been able to find much.

I want the user to input the cars torque and then on a little simulation the user presses up and it does exactly what a car would do if you pressed down on the accelerator.

I need some help thou. What I have figured out lately is things live
velocity
acceleration
mass
momentum
torque
rpm
horsepower
force
energy
air resistance
friction

but I want to completely simulate a car on a road with air resistance. I have tried and tried but my figures are not. I need some formulas like how to convert the energy into speed and how to convert horspe power into energy.
I have a formula for converting torque and rpm into horsepower but I have no idea how to convert torque into rpm. Any help would be appriciated. Thanks
 
Physics news on Phys.org
I think you would benefit from first creating an organizational strategy. In particular, you should first separate the types of data which you are working with. Some data will exist as input parameters; things like the car's horsepower, torque, red-line parameter, drag coefficient, etc. You can build up sets of input parameters corresponding to different cars, and so on.

Next, isolate the parameters which are known as "control" parameters. These are things like the gas-pedal, break-pedal, and so on, which the actual driver of the car controls; these are somewhat similar to the inputs mentioned above, but they are still a separate category.

Finally, you want to set up your other parameters as functions of the input and control parameters. Then, the simulation basically must accomplish the task of computing these other unknowns.

You will certainly be able to find expressions and information to construct a model. I'm sorry but it is asking quite a lot for someone to provide all of these expressions for you. If you made a more specific inquiry, I'm sure people would be able to furnish you with some help. However, your main resources for this endeavor should be books. Look up some books on car mechanics, or automobile engineering, and so on, and you should be in good shape.
 
This is asking a lot, and the equations should be easy to find (mostly it's Newton's laws of motion), but a few things:

Torque doesn't get converted into RPM.
Horsepower doesn't get converted into energy (you can multiply by time to get energy, but I don't know why you'd need it anyway).
horsepower is rpm times torque
Torque times the diameter of the tires gives you the force. acceleration is force/mass
For a car, wind resistance (force) is drag coefficient times velocity squared

You'll need a bunch of assumptions and givens, like drag coefficient, friction loss in the car's transmission, mass, the car's torque curve (perhaps in table form), physical dimensions, etc.
 
I did some reading up and studying here is what I have so far.
Firstly I set some variables

brake=0;
global.speedy=0
global.force=0;
global.velocity=0;
acceleration=0;
mass=1000;
momentum=0;

Then in the game loop here is what I did

also one thing.
Once I have figured out wind resistance force how do I apply it to the car?
Cause the wind resistance force is larger than the cars force at the moment it I just say
speed-=resistance

acceleration=global.force/mass
global.velocity=global.velocity+mass*acceleration
momentum=global.velocity*mass

speed.y-=brake
speed.y+=acceleration
y-=speedy

global.speedy=acceleration/30*3600

and the above is to figure out the speed at which the car is moving. I don't quite know the forumula.

Anyways, a few questions what role does momentum play
what is torque and rpm, i know the formula to find horse power using them
(torque*rpm)/5,252 = horsepower.

so when the driver pushed full pedal down he applys what to the car, more torque, more energy I don't know?

At the moment in my code I just say if key_press up
{
apply more force
}

and finally brakes. How should I do brakes?
thanks for the help so far:D
 
Last edited:
I have recently been really interested in the derivation of Hamiltons Principle. On my research I found that with the term ##m \cdot \frac{d}{dt} (\frac{dr}{dt} \cdot \delta r) = 0## (1) one may derivate ##\delta \int (T - V) dt = 0## (2). The derivation itself I understood quiet good, but what I don't understand is where the equation (1) came from, because in my research it was just given and not derived from anywhere. Does anybody know where (1) comes from or why from it the...
Back
Top