Jump to content
  • Advertisement
Sign in to follow this  
plug

straight line car acceleration

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I've been trying to create a simulation of a car accelerating in a straight line using this http://home.planet.nl/~monstrous/tutcar.html article, in flash. there is something not right as the car will accelerate to 97km in first gear. which seems pretty fast to me. i wanted to try to swap the car data from the article (which is based on a chevy) and put in a car that i know (i have a little renault clio). but when i putin the gear ratios and engine torque values for mycar, it goes faster than the chevy. what am i doing wrong? I am a bit confused about how to 'change the enging' of the simulated car. i don't really understand how horspower comes in to this either. The chevy has a really powerful engine compared to a clio?? below are parts of the code that i think are important. If any one can shed spme light on this it would be great. i'm quite new to this and now my head hurts. -------------------------------------- //GETS THE CURRENT GAR RATIO gearRatio = gearArray[currentGear] wheelRotationRate = vel/wheelRadius rpm = wheelRotationRate * gearRatio * diffRatio * 60 / (2*3.141) //The 60 / 2 pi is a conversion factor to get from rad/s to revolutions per minute // THIS GETS THE MAX TORQUE VALUE FOR THE CURRENT RPM - THE RPM/TORQUE VALUES WERE TAKEN FROM A ENGINE TEST GRAPH maxTorque = torqueLookup(rpm); engineTorque = maxTorque * throttle; //calculates the drive force at the wheel fDr fDr = engineTorque * gearRatio * diffRatio * efficiency / wheelRadius; //defines the maximum traction force that can be applies (to the rear wheels) //assuming they are carrying 50% of the cars weight. maxTractRear = (carMass*rearWeightPerc)*cGrav * mu EngineForce = fDr; //calculates the forces on the car-------------------------------------------------------------------- //calculates the tractive force of the road pushing the car forwards fTraction = engineForce ; //calculates the air drag //where vel is the velocity(speed)of the car and cDrag is a constant fDrag = (-1)* cDrag * vel*vel; //calculate the rolling resistance drag //where v is the vlocity and cRr si a constant fRr =(-1)* cRr * vel; //calculate the total longitudinal force fTot = fTraction + fDrag + fRr; //calculates the acceleration accel = fTot / carMass; //defines the car velocity vel += dT*accel //defines the cars position pos += dT*vel //---------------------------------------------------------------------- ----------------------------------------

Share this post


Link to post
Share on other sites
Advertisement
Hi plug, always nice to see someone trying to accurately model car motion!

Quote:
fTraction = engineForce ;
Power = Force * speed. So if you divide the horsepower data you have with current speed, you have your new engineforce, wallah!

The torque value must be lower for the clio. Don't change the gear ratios yet, they can be the same, no harm. And if you think the car is going too fast, just change the value of carMass to something greater.

I hope this helped you!

Share this post


Link to post
Share on other sites
could be, but there are so many parameters to take into acount.

first off, I think taking the torque into consideration is a moot point. The car red lines, say at 5000 rpm, and that trickles down the line into the maximum straight line velocity, regardless of the torque. It all depends on gear ratios, diff ratio, and wheel radius, and that will give you the maximum velocity. I guess you have the ratios slightly wrong somewhere. The gear ratios would be a lot closer, the wheel smaller. Gear ratios are ultimately chosen to give a car with a given torque / power enough acceleration / terminal velocity in fith gear. That will also be impacted on the aerodynamics, efficiency, and rolling resistance. Gears are staged so that the car is in its most favorable power band when shifting, ect...

But ultimately, the maximum straight line velocity in a given gear would just be a product of max rpm and ratios. I think we can all agree that a car would be able to reach it's max rpm in any gear, otherwise, what's the point! :)

After that, you check on the 0-60 times and top speed to tweak the resistances and torque curve, although things like the torque curve, the weight and the aerodynamic coefficient should be relatively accurate if taken from a published datas. Gears ratio should be too, but you never know.

Final drive in small cars are relatively high, say 3, and gear ratios close, to compensate for the lack of power and a low top speed. Wheels are small, around 15'', with extra rubber, giving maybe 16'' in radius.

((max_rpm / minutes_to_seconds) / (first_gear * diff_ratio)) * wheel_radius = ((5500 / 60) / (3 * 3)) * 0.35 = 10 m/s = 35 km/h = 22 mph, which would be reasonable for a Clio.

[Edited by - oliii on September 13, 2005 4:16:10 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by oliii
Final drive in small cars are relatively high, say 3, and gear ratios close, to compensate for the lack of power and a low top speed. Wheels are small, around 15'', with extra rubber, giving maybe 16'' in radius.


Slight nit to pick
a "high" gear ratio is numerically lower. like 2.73 is a tall/high final drive.
Small 4cyl econobox things will be much lower, 3.90->4.56 area as they dont have the torque that larger engines do, so they need to multiply it more.

Wheel size is about right, I guess. You can figure out the actual diameter though. Usually the size will be something like 205-60-R15. 205 is width in mm.
60 is the percent of that width that makes up the sidewall. 15 is the wheel diameter.

So total wheel diameter is 15in + (205mm*.60*2)

http://www.tirerack.com/tires/tiretech/techpage.jsp?techid=7

Share this post


Link to post
Share on other sites
Quote:
Original post by Eelco
Quote:

maxTorque = torqueLookup(rpm);

i strongly suspect this is a unit problem.


I was gonna say the same thing. what kind of function are you using for that? for my sim, I use a quadratic regression on 3-5 points that I copy off the torque curves

Share this post


Link to post
Share on other sites
maxTorque = torqueLookup(rpm) works in the following way

an array is created that holds the max torque values at 1000 rpm intervals (rpmArray[1] holds the value for max torque at 1000 rpm, rpmArray[2] - 2000rpm , etc...)

//rpmArray - the value of each array element corresponds to the torque at element*1000 rpm
rpmArray = new Array();
rpmArray[0] = 0;
rpmArray[1] = 400;
rpmArray[2] = 440;
rpmArray[3] = 460;
rpmArray[4] = 485;
rpmArray[5] = 480;
rpmArray[6] = 390;
rpmArray[7] = 0;


then i use the following function to calculate the torque value needed.

function torqueLookup(rpm){
rpmDec = rpm/1000;

rpmFloor = Math.floor(rpmDec);

rpmCeil = Math.ceil(rpmDec);

midPerc = rpmDec - rpmFloor;

midTorque = ((1-midPerc) * rpmArray[rpmFloor]) + ( midPerc * rpmArray[rpmCeil])
return midTorque;
}


it made this from an article on linear interpolation.

Share this post


Link to post
Share on other sites
aahh i thin i'm going round and round in circles,

if anyone is up for a challenge then i cluld email them more of the script, i'm slowly going mad as i go through it with a tooth pick

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!