- #1
electrodruid
- 17
- 0
I'm a games programmer working on a (simple, so far) physics engine for a driving game. Right now I'm interested in acceleration, and in particular trying to estimate the forces that go into it. I've got basic data for a bunch of cars (0-60 time, 0-100 time, top speed, mass) and a brute-force algorithm that tries out a bunch of combinations of values for tractive force, drag and rolling resistance to try to generate acceleration curves that match the data that I have for each car. I'm aware that the physics model I'm using is a good deal simpler than real life so I'm just looking for something that's broadly within the bounds of plausibility and provides a reasonable fit. Not total accuracy in the values, but something in the right ballpark.
I'm using this page, and the sources it cites, as my inspiration. And I'm only interested in acceleration in one dimension, so my calculations are all just using floats rather than vectors. It looks like this:
I call this in a loop that tries different values for EngineForce and Cdrag, and for each combination calculates Crr such that (Cdrag * topSpeed * topSpeed) + (Crr * topSpeed) = EngineForce. I calculate the resulting velocity curve, and use the least squares method to find the combination that gets closest to 60mph at the 0-60 time, to 100 mph at the 0-100 time and to the top speed.
The problem I have is that the closest curve always ends up with Cdrag = 0, and just uses a high value of Crr to enforce the speed limit. Seems wrong to me, like driving a car in a vacuum but on a really sticky surface. I'd expected drag to be the main factor, with RR being of less importance. That page I'm working from (and its sources) are pretty wooly on the subject of the subject of rolling resistance: one paper says that for one particular car, RR = drag at "about 60mph", and from that concluded that RR rose linearly with velocity and should be "about" Cdrag * 30. But nowhere does anything state how the resistances were measured, whether the same is true for all cars, etc. Conversely, I find pages like this which state that RR has nothing to do with velocity, and is just derived from properties of the tyres and the vehicle's weight... But if that was the case, how does that even work? RR is not pushing backwards on a stationary car, is it? Velocity has got to be a factor in there somewhere, hasn't it?
What is the relationship between a car's velocity and the amount of rolling resistance acting upon it?
I'm using this page, and the sources it cites, as my inspiration. And I'm only interested in acceleration in one dimension, so my calculations are all just using floats rather than vectors. It looks like this:
Code:
float Ftraction = EngineForce;
float Fdrag = -Cdrag * v * v;
float Frr = -Crr * v;
float totalForce = Ftraction + Fdrag + Frr;
float a = totalForce / Mass;
v += a * dt;
I call this in a loop that tries different values for EngineForce and Cdrag, and for each combination calculates Crr such that (Cdrag * topSpeed * topSpeed) + (Crr * topSpeed) = EngineForce. I calculate the resulting velocity curve, and use the least squares method to find the combination that gets closest to 60mph at the 0-60 time, to 100 mph at the 0-100 time and to the top speed.
The problem I have is that the closest curve always ends up with Cdrag = 0, and just uses a high value of Crr to enforce the speed limit. Seems wrong to me, like driving a car in a vacuum but on a really sticky surface. I'd expected drag to be the main factor, with RR being of less importance. That page I'm working from (and its sources) are pretty wooly on the subject of the subject of rolling resistance: one paper says that for one particular car, RR = drag at "about 60mph", and from that concluded that RR rose linearly with velocity and should be "about" Cdrag * 30. But nowhere does anything state how the resistances were measured, whether the same is true for all cars, etc. Conversely, I find pages like this which state that RR has nothing to do with velocity, and is just derived from properties of the tyres and the vehicle's weight... But if that was the case, how does that even work? RR is not pushing backwards on a stationary car, is it? Velocity has got to be a factor in there somewhere, hasn't it?
What is the relationship between a car's velocity and the amount of rolling resistance acting upon it?