Optimizing Car (And Cyclist) Speed
JeanFrancoisPuget 2700028FGP Visits (10843)
What is the optimal way to adjust one's car speed in order to minimize fuel consumption (or CO2 emission) while meeting desired travel time?
The answer to that question came to me after I wrote my last blog entry on Predicting Cyclist Speed . In that post I explained how an endurance cyclist, Dave Haase, was using his power. He wasn't using constant power as most cyclists do. This made me think about what would be the best strategy. Use constant power, or use something closer to what Dave was doing?
After answering that question I realized that the same answer applies to car driving.
Are you hooked enough?
Enough teasing, here is what I looked at. Assume you have a limited amount of energy you can use. For a car this would correspond to the fuel you have in the tank. For a cyclist, this would be the amount of energy stored in muscles and other body organs. Assume further you have a predefined route to follow. How should you use your available energy to reach out the route endpoint as soon as possible?
The answer is deceptively simple: One should ride at constant speed. Indeed, as we shall show below,
Driving at constant speed whatever the slope of the road is what minimizes energy consumption as well as CO2 emission
In particular, it is more efficient to use constant speed than constant power. This may sound counter intuitive but it is true nevertheless. The rest of this blog explains why this is true. It also discusses the consequences for cyclist racing. In the latter case, maintaining constant speed may not be doable because of the limited power a cyclist can deliver.
Minimizing energy consumption
Let us model the physical forces a cyclist or a car must fight when moving. A thorough discussion can be found in Modeling Cyclist Power . We will focus on a simpler case where there is no wind, and where we can ignore the effect of air pressure varying with elevation. Assume m is the mass of the car with its load, or the mass of cyclist with his bike, for instance 80kg (176 lbs) for the cyclist and his bike. There are three forces that one must fight when moving:
The energy spent in fighting these forces is the travel distance d times the forces intensities. Therefore, if we drive (or cycle) at constant speed over a constant slope s road of given length d, then the energy we spend is
E = dcxV2 + dfgm + dsgm
Let us assume that we have a fixed amount of energy E to use. Then, solving for V in the above equation we get.
V2 = [ Ed-1 - fgm -sgm ]cx-1
VE,d,s = [ Ed-1 - fgm -sgm ]1/2 cx-1/2
We claim that driving at this speed is what minimizes the time to traverse the road. Any speed variation will slow us down.
Moreover, we claim that this is still true if the slope isn't constant at all as in the picture above. The fastest way to reach the end of the route is to drive at the speed VE,d,s whatever the current slope is. This is what minimizes the time to end of the road. This may sound counter intuitive but it is true nevertheless. We provide a sketch of a proof below for those interested. It uses elementary math, but it is a bit technical still.
If driving at constant speed is what minimizes time to destination given fixed energy consumption, then we also have that driving at constant speed is what minimizes energy consumption for a given travel time. The conclusion is rather simple:
Driving at constant speed, and never braking is what minimizes fuel consumption and CO2 emission
That is easy if your car has cruise control and you are on a highway. If you are in a city and must stop at red lights (I think you should stop indeed), then minimizing energy consumption is an entirely different story. Indeed, we made a couple of important assumptions in the above reasoning. The first one is that we ignored the energy it takes for accelerating. For a distance d long enough, this energy is negligible compared to the energy it takes to traverse the road. It is no longer negligible if you must stop and accelerate many times as you would do in a city. A second assumption we made is that we do not use brakes. Indeed, braking dissipates energy by adding friction. Said differently, braking decreases the energy available for moving the car, hence it will increase the time to destination. Our assumptions about no braking, and no energy for accelerating, are no longer valid in typical city driving. Note that electric cars can get some energy back while braking, which opens a new, interesting angle at optimizing energy consumption in cities transportation. I'll keep that for another post maybe.
What about cycling?
There is a fundamental difference between a cyclist and a car. The cyclist has a rather limited power. Moreover, there is a level above which power cannot be sustained for a long time. This may impact the above strategy. Indeed, physical effort creates toxic waste in muscles, like lactic acid. The waste production is proportional to the power you deliver. These wastes are processed by the body and are eliminated. But the processing rate is limited. If you are exercising too much, i.e. if the power you use is too high, then lactic acid is produced faster than your body can process it, and it accumulates. When the level of lactic acid reaches some threshold then you no longer can use your muscles. Let us call sustainable power the level of power where the production of lactic acid is equal to the rate at which it is eliminated. Any effort delivering more power than the sustainable power will lead to lactic acid accumulation, and eventually to stopping the effort altogether. Using less power than the sustainable level enables very long lasting effort. Effort will eventually stop when you run out of energy. This is why conventional wisdom says that endurance athletes should stay near their sustainable power levels, but never above it.
Our findings show that this may not be the best racing strategy. The best racing strategy is to race at constant speed, not constant power. What does it mean in practice? What happens if racing at constant speed leads to power above the sustainable level?
Let us first assume that we are always under the sustainable power level. Power is the energy divide by time. Therefore, power P is defined by
P = cxV3 + fgmV + sgmV
The above result says that we minimize the time to completion of the race if we ride at constant speed VE,d,s. In that case, power becomes
P = cxVE,d,s3 + fgmVE,d,s + sgmVE,d,s
This equation is of the form
P = As + B
A = gmVE,d,s
B = cxVE,d,s3 + fgmVE,d,s
We see that the optimal power should be increasing linearly with the slope. This is exactly what Dave Haase was doing! Indeed, here is Dave's power as a function of slope (see Predicting Cyclist Speed for details):
It is close to a linear function of the slope. The red line give the closest linear function.
Was Dave using the optimal linear function? To see that we mapped Dave speed as a function of slope. Here is the result:
We see that Dave isn't riding at constant speed. He is not using the optimal speed strategy. Why is that? One answer could be that Dave avoids being too much and for too long above his sustainable power level. Yet he is doing something better than constant power. He is using more power when climbing than when descending.
A better answer IMHO is because power must always be positive. As we saw above, the power needed to move on the road at any point is
P = cxV3 + (f+ s)gmV
Note that the slope s can be negative. If the slope is steep enough this could lead to negative power! This would correspond to a case where we generate energy from braking. This is true to some extent with electric cars, but not for a cyclist! We must ensure that we do not use negative power, i.e. that we always have
cxV3 + (f+ s)gmV ≥ 0
Given speed is positive, the condition becomes
cxV2 + (f+ s)gm ≥ 0
It means that our claim that a constant speed equal to VE,d,s is only valid if
VE,d,s + ≥ Vlim
where Vlim is such that
Vlim2 = -(f+ s)gmcx-1
Let's see what this speed is for a cyclist of 80 kg, with a cx of 0.25 and a slope of 10%. We should have
Vlim2 = -(f+ s)gmcx-1 = -(0.01 - 0.1) x 9.81 x 80 / 0.25 ≈ 282.5
Vlim ≈ 16.8
This is a speed in meter per second. It is about 60 km/h. It means that our cyclist should race at a that speed or higher in order to minimize energy consumption.
Of course, we cannot expect a cyclist to climb at this speed because it would require too much power. This shows one of the limit of our model when it comes to a cyclist. It is not possible to use a constant speed in that case.
Understanding how to adapt the optimal speed strategy to take into account power upper bound (sustainability) and lower bound (0) seems an interesting follow up. I hope I will have time to model it correctly in which case I'll blog about it.
Let me stop here for now. Interested readers will get a sketch of the proof of my claim below, assuming the speed is large enough to always yield a non negative power.
Proving that constant speed is optimal
Let us start with a simple case first. We are given two road sections, see figure below. Each road section has constant slope si, and a length di. If these slopes are non null, then there is an elevation difference hi between the start and the end of each road section. The total length of the road is d1 + d2 = d, and the total road elevation difference is h1 + h2 = h
We are given a fixed energy amount E. We assume that we drive (or cycle) at a constant speed Si on the i-th road section. What should be the value of S1 and S2 so that the overall time to go through the two sections is minimal?
From the above equations we must have
E = d1cxV12 + d1fgm+ d1s1gm + d2cxV22 + d2fgm + d1s2gm
d1cxV12 + d2cxV22 = E - gm( d1f + d1s1 + d2f + d2s2 )
Given that hi = disi we get
d1cxV12 + d2cxV22 = E - gm( d1f + h1 + d2f + h2 )
Given that d1 + d2 = d, and h1 + h2 = h we get
d1cxV12 + d2cxV22 = E - gm( df + h )
Dividing by cx yields
d1V12 + d2V22 = R2
R2 = E/cx - gm( df + h )/cx
Note that the right hand side only depends on the energy E, the total road length d, and the total elevation difference h. It does not depend on the particular values for the slopes and lengths of the two road sections. The left hand side does not depend on the slopes s1 and s2. It means that the optimal values for V1 and V2 are the same whatever the slopes s1 and s2. In particular they are the same as the case where s1 = s2:
Back to our problem. The time needed to traverse each section is ti = diVi-1
Therefore, we need to solve this constrained optimization problem
minimize t1 + t2
d1V12 + d2V22 = R2
V1, V2 > 0
We claim this is minimized when V1 = V2 . The proof is given at the end of the post.
We can now look at a more complex case where our road is made of a series of sections with constant slope as in the figure below.
We assume that we ride at a constant speed on each section. By the above result, the speed of any two consecutive sections must be the same. This entails that the speed must be constant over the road.
The last part of our proof is to look at cases where the slope evolves continuously, like in the picture below.
I will only sketch the proof here. The idea is to approximate the actual road by a finite set of sections of constant slope. The figure below gives such an approximation
Whatever the approximation we make, the speed must be constant on the approximated road in order to minimize energy consumption. We then take the limit of these approximations when the section lengths tend to zero. The limit is the actual road, and the speed on the limit must also be constant. That concludes the proof. We give the details of the first step of our proof at the end of the post.
Proof of step 1
We look for the values of V1 and V2 that solve this constrained optimization problem
minimize t1 + t2
d1V12 + d2V22 = R2
V1, V2 > 0
Let Wi = di1/2Vi
Our problem becomes
minimize d13/2W1-1 + d23/2W2-1
W12 + W22 = R2
W1, W2 > 0
W1 = R cos(θ)
W2 = R sin(θ)
Our problem becomes a univariate minimization problem
minimize d13/2/ Rcos(θ) + d23/2/ Rsin(θ)
0 < θ < π/2
We can get rid of the R factor. More precisely, the value θ minimizing the above problem also minimizes this problem:
0 < θ < π/2
f(θ) = d13/2/ cos(θ) + d23/2/ sin(θ)
Let's compute the first and second derivatives of the function f we minimize. We have
f'(θ) = d13/2sin(θ)/ cos2(θ) - d23/2cos(θ)/ sin2(θ)
f'''(θ) = d13/2/ cos(θ) + 2d13/2sin2(θ)/ cos3(θ) + d23/2/ sin(θ) + 2d23/2cos2(θ)/ sin3(θ)
The second derivative is strictly positive for 0 < θ < π/2 . Therefore the minimum of f is obtained where the first derivative is null. It is null when
d13/2sin(θ)/ cos2(θ) = d23/2cos(θ)/ sin2(θ)
d13/2sin3(θ) = d23/2cos3(θ)
Taking the cubic root we get
d11/2sin(θ) = d21/2cos(θ)
Let us see what it means in term of our original problem.
By definition of cos(θ) and sin(θ) we get
d11/2W2 = d21/2W1
By definition of W1 and W2 we get
V1 = V2
Which is what we wanted to prove.
Acknowledgement Philippe Grégoire pointed me to the need to take into account a lower bound on the power as well. I added some content about it in the cyclist section of the post.