Optimizing Car (And Cyclist) SpeedWhat 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 consumptionLet 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 = dc_{x}V^{2} + 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. V^{2} = [ Ed^{1}  fgm sgm ]c_{x}^{1}
V_{E,d,s} = [ Ed^{1}  fgm sgm ]^{1/2 }c_{x}^{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 V_{E,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 = c_{x}V^{3} + fgmV + sgmV The above result says that we minimize the time to completion of the race if we ride at constant speed V_{E,d,s}. In that case, power becomes P = c_{x}V_{E,d,s}^{3} + fgmV_{E,d,s} + sgmV_{E,d,s} This equation is of the form P = As + B where A = gmV_{E,d,s} B = c_{x}V_{E,d,s}^{3} + fgmV_{E,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 = c_{x}V^{3} + (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 c_{x}V^{3} + (f+ s)gmV ≥ 0 Given speed is positive, the condition becomes c_{x}V^{2} + (f+ s)gm ≥ 0 It means that our claim that a constant speed equal to V_{E,d,s} is only valid if V_{E,d,s} + ≥ V_{lim} where V_{lim }is such that V_{lim}^{2} = (f+ s)gmc_{x}^{1} Let's see what this speed is for a cyclist of 80 kg, with a c_{x} of 0.25 and a slope of 10%. We should have V_{lim}^{2} = (f+ s)gmc_{x}^{1} = (0.01  0.1) x 9.81 x 80 / 0.25 ≈ 282.5 Hence V_{lim} ≈ 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 s_{i}, and a length d_{i}. If these slopes are non null, then there is an elevation difference h_{i} between the start and the end of each road section. The total length of the road is d_{1} + d_{2} = d, and the total road elevation difference is h_{1} + h_{2} = h We are given a fixed energy amount E. We assume that we drive (or cycle) at a constant speed S_{i} on the ith road section. What should be the value of S_{1} and S_{2} so that the overall time to go through the two sections is minimal? From the above equations we must have E = d_{1}c_{x}V_{1}^{2} + d_{1}fgm+ d_{1}s_{1}gm + d_{2}c_{x}V_{2}^{2} + d_{2}fgm + d_{1}s_{2}gm i.e. d_{1}c_{x}V_{1}^{2} + d_{2}c_{x}V_{2}^{2} = E  gm( d_{1}f + d_{1}s_{1} + d_{2}f + d_{2}s_{2} ) Given that h_{i} = d_{i}s_{i} we get d_{1}c_{x}V_{1}^{2} + d_{2}c_{x}V_{2}^{2} = E  gm( d_{1}f + h1 + d_{2}f + h_{2} ) Given that d_{1} + d_{2} = d, and h_{1} + h_{2} = h we get d_{1}c_{x}V_{1}^{2} + d_{2}c_{x}V_{2}^{2} = E  gm( df + h ) Dividing by c_{x} yields d_{1}V_{1}^{2} + d_{2}V_{2}^{2} = R^{2} where R^{2} = E/c_{x}  gm( df + h )/c_{x} 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 s_{1} and s_{2}. It means that the optimal values for V_{1} and V_{2} are the same whatever the slopes s_{1} and s_{2}. In particular they are the same as the case where s_{1} = s_{2}:
Back to our problem. The time needed to traverse each section is t_{i} = d_{i}V_{i}^{1} Therefore, we need to solve this constrained optimization problem minimize t_{1} + t_{2} such that d_{1}V_{1}^{2} + d_{2}V_{2}^{2} = R^{2} t_{1} =d1V_{1}^{1} t_{2} =d_{2}V_{2}^{1} V_{1}, V_{2} > 0
We claim this is minimized when V_{1} = V_{2} . 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 V_{1} and V_{2} that solve this constrained optimization problem minimize t_{1} + t_{2} such that d_{1}V_{1}^{2} + d_{2}V_{2}^{2} = R^{2} t_{1} =d1V_{1}^{1} t_{2} =d_{2}V_{2}^{1} V_{1}, V_{2} > 0 Let W_{i} = d_{i}^{1/2}V_{i} Our problem becomes minimize d_{1}^{3/2}W_{1}^{1}_{ }+ d_{2}^{3/2}W_{2}^{1} such that W_{1}^{2} + W_{2}^{2} = R^{2} W_{1}, W_{2} > 0
W_{1} = R cos(θ) W_{2} = R sin(θ)
Our problem becomes a univariate minimization problem minimize d_{1}^{3/2}/ Rcos(θ)_{ }+ d_{2}^{3/2}/ Rsin(θ) such that 0 < θ < π/2 We can get rid of the R factor. More precisely, the value θ minimizing the above problem also minimizes this problem: minimize f(θ) such that 0 < θ < π/2 Where f(θ) = d_{1}^{3/2}/ cos(θ)_{ }+ d_{2}^{3/2}/ sin(θ) Let's compute the first and second derivatives of the function f we minimize. We have f'(θ) = d_{1}^{3/2}sin(θ)/ cos^{2}(θ)_{ } d_{2}^{3/2}cos(θ)/ sin^{2}(θ) f'''(θ) = d_{1}^{3/2}/ cos(θ) + 2d_{1}^{3/2}sin^{2}(θ)/ cos^{3}(θ)_{ }+ d_{2}^{3/2}/ sin(θ) + 2d_{2}^{3/2}cos^{2}(θ)/ sin^{3}(θ) 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 d_{1}^{3/2}sin(θ)/ cos^{2}(θ)_{ }= d_{2}^{3/2}cos(θ)/ sin^{2}(θ) This yields d_{1}^{3/2}sin^{3}(θ)_{ }= d_{2}^{3/2}cos^{3}(θ) Taking the cubic root we get d_{1}^{1/2}sin(θ)_{ }= d_{2}^{1/2}cos(θ) Let us see what it means in term of our original problem. By definition of cos(θ) and sin(θ) we get d_{1}^{1/2}W_{2 }= d_{2}^{1/2}W_{1} By definition of W_{1} and W_{2} we get V_{1} = V_{2} 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.
