Introduction to Mathematical Cycling

October 16, 2018

Share this article:

[supsystic-social-sharing id='1']

It is a remarkable sport, time trial cycling. It seems comparable to road racing and at the same time it has nothing to do with it. In a road race one tries to conserve energy as long as possible, while during a time trial you want to use all the power you have got during the whole event. Spending 200 hours in a wind tunnel during the winter months to find out that you have to adjust your shorts length with four millimetres. Crazy things like switching your socks five minutes before the start of a time trial due to changing weather conditions. Does it have any effect? Well, it helped Tom Dumoulin to become world champion in time trialing in 2017. The results of a time trial are not decided by craftiness or understanding race developments, it all comes down to cold numbers. Time trial cycling is purely mathematical.
The goal of a time trial is to cover a certain distance in the least amount of time. This has to be done by yourself, so without the help of teammates or the possibility to conserve energy by staying in the bunch. A lot of factors influence this finishing time: bicycle brands put effort in finding the perfect geometry for their bikes, clothing brands test their materials extensively to find the perfect fabric patterns and cycling teams spend hours in wind tunnels and on velodromes to research the perfect position on the bike. All this is done to make sure the cyclist is well prepared at the start of a time trial. Considerable amounts of advanced mathematics are used up until this point. However, the most interesting part is yet to come. This starts with the cyclist leaving the starting podium.

Power equation

To realise a time with winning potential, one has to find the perfect pacing strategy. Studies have shown that a suboptimal pacing strategy may have a substantial negative effect on finish times. Therefore it is an interesting problem to investigate more thoroughly.
The first step is looking at the power equation describing the cyclists momentum. The cyclist exerts a propulsive force F_p to counter the forces of air resistance F_A, gradient resistance F_G and rolling resistance F_R. Some argue that speed bumps add certain resistance during a time trial, however, due to the little occurrence this will be neglected. The deviation between the forward driving force and the resistance forces determines whether a cyclist will accelerate or decelerate. So we have the following equation:

    \[F_p= F_A+ F_G+ F_R+ F_{acc}\]

Now a method is needed to model the time trial. We will look into the most common form of time trials, where the course has an approximately level terrain and long straight and wide roads. Analysing the route gives the opportunity to divide it in short, straight segments without bends. Then it will be possible to model the power output for every segment.
Now we need to tackle the forces a rider has to overcome during each segments, beginning with the air resistance, also known as aerodynamic drag. It is given by F_A= K_A (v+ v_w)^2 where v is rider velocity, v_w is wind velocity and K_A is the drag coefficient, which depends on factors discussed above like position on the bike and the fabric patterns.
The next resistance is the gradient resistance. When the cyclist is travelling uphill, a component of its weight will be perpendicular to the road surface and will work in a direction opposite to its motion. This resistance is given by F_G= mg \text{ sin } \phi where m is mass, g is gravitational acceleration and \phi is the angle of inclination.
Furthermore, the rolling resistance is given by F_R=mgC_R where C_R is the resistance coefficient, which depends on the tyres and the road surface. Lastly, F_{acc}=m_ea, where me is the effective mass, this is slightly higher than the total mass of the rider and bike, to account for the kinetic energy of the spinning wheels. The a in this part of the formula is the acceleration of the cyclist. We can now conclude that the power formula can be written as:

    \[F_p= K_A (v+ v_w)^2+ mg \text{ sin } \phi  +mgC_R+ m_ea\]

Resistance forces

Since all forces are known, the power equation can be constructed, which is given by u(t) = F_pv(t). Using the fact that a is acceleration and therefore the rate of change in the velocity, this equation can be rewritten as a differential equation, known as the power equation:

    \[u(t) = \bigg( c_1v(t)^2+ c_2 + c_3 \frac{dv(t)}{dt} \bigg)vt\]

For the sake of simplicity we assume a situation where no head wind occurs, furthermore constant values are replaced. Here u(t) denotes the amount of Watt output at time t.

Power output

To solve this power equation one has to understand how a cyclist exerts power. This depends on the energy sources of the cyclists, which are aerobic and anaerobic. The first has an unlimited supply as long as the level of power is low, the latter has a limited supply, however the amount of power it can produce is way higher. The power output model that is going to be used is as follows: CP \leq u(t) \leq u_{max} where CP is the critical power level, which is sustained by aerobic energy, and u_{max} is the maximum power a cyclist can exert using anaerobic energy. The difference u(t) - CP is the excess energy, which is the extra energy above the critical power level which can be used for the time trial segment.
Each year cyclists have to do sports tests, during which the total excess energy is calculated. Teams know this for every cyclist and use this to allocate levels of excess energy to particular time trial segments. For most common time trials this comes down to allocating excess energy in proportion to the length of the segment. For example, if a time trial has two equally long parts divided by one bend, both parts will be allocated 0.5 of the total excess energy.

Control Problem

Using all above a model can be composed. One needs to minimize finish time, T, under the constraint \int_0^T u(t) - CP dt = W, the amount of excess energy allocated to the segment. CP \leq u(t) \leq u_{max}, and the solution v(t) of the power equation solves \int_0^T v(t)dt = L where L is the length of the time trial segment. This can be written in the form of an optimal control problem in the following way:

    \[max_{CP \leq u(t) \leq u_{max}} \int_0^T -1dt\]

Subject to the constraints

    \[\frac{dx_1}{dt}= x_2(t); \frac{dx_2}{dt} = \frac{u(t)}{c_3x_2(t)} - \frac{c_1x_2(t)^2}{c_3} - \frac{c_2}{c_3}; \frac{dx_3}{dt} = u(t)-CP\]

Here x_1 is distance with boundary conditions x_1(0) = 0 and x_1(T) = L, since for every segment the distance of the whole segment must be covered.
x_2 is the speed, where we assume x_2(0) > 0. This is done since initial velocity for all segments is greater than 0. For the first segment, this is due to the start on a starting ramp and for further segments since the corner is left with some speed.
Lastly, x_3 is power in Watt with x_3(0) = 0 and x_3(T) = W.
This boils down to the following Hamiltonian

    \[H(x, u, \lambda) = -1 + \lambda_1(t)x_2(t) + \lambda_2(t)\bigg( \frac{u(t)}{c_3x_2(t)} - \frac{c_1x_2(t)^2}{c_3} \bigg) + \lambda_3(t)(u(t) - CP)\]

It can easily be spotted that the Hamiltonian is linear in u, therefore the optimal control u* is of a simple form and it depends on the sign of the expression \frac{\lambda_2(t)}{c_3x_2(t)}+ \lambda_3(t) (1). From this it can be concluded that when the sign is negative, u*= u_{min}. If the sign is positive, u*= u_{max} and if the expression equals zero, u*= u_{sin}, which is a constant singular power level in between u_{min} and u_{max}. It is possible to prove that that the expression decays over time, however, for the sake of simplicity we just assume it to be given.


To understand what this tells us, we will look at an example. Suppose the segment is started with a velocity equal to 1 m/s, an excess energy of W=20,000 Joule, maximum power of 800 Watt and critical power CP = 300 Watt. Furthermore we use c_1 = 0.128, c_2 = 3.924 \text{ and } c_3 = 78.1, which are found by imputing certain values in the respective resistance forces.
If a cyclist goes all out at maximum power, then W is used after approximately 40 seconds (\frac{W}{u_{max} - CP}) and the rider will have covered roughly one kilometre. Hence for short time trials segments of approximately one kilometre, equation (1) will always be positive and a  [expand title=”bang-bang control”] a control which switches states abruptly. In this case from u_{max} to u_{min} at the moment the cyclist runs out of W [/expand] is optimal. Using similar steps, one will find that for extremely long time trial segments, equation (1) will always be negative and the optimal power output will be CP.
The most interesting are time trial segments for which the equation (1) changes sign, since optimal strategy will be a bang-singular-bang control. In other words starting on maximal power for a short time to accelerate to a certain speed, switching to the singular power level to sustain the speed and then for the last minute finishing the segment at CP level to coast to the next corner or the finish line.
Computing usin is possible from the above equations, however, it is very cumbersome and beyond the scope of this article. The equation can be found below, where \gamma = \frac{\lambda_2}{x_2}. This equation can be insightful, although mostly it is easier to enter the code in to a program like R and let it calculate usin iteratively.

    \[u_{sin} = \frac{(c_3 + 2c_2\gamma)\sqrt{\frac{c_3 - c_2 \gamma}{c_1 \gamma}}}{3 \sqrt{3} \gamma}\]

Using a program to solve the control problem for a segment of approximately five kilometres will result in the following power output, where the bang-singular-bang control can easily be seen. For the first few seconds the power output is at its maximum to reach 13 m/s, then a lower constant power output is used to for the remainder of the segment until the final part, where the cyclist freewheels to the finish:

W and v over time


We can conclude that it is possible to convert a time trial into an optimal control problem and solve it using mathematics. However, knowledge of advanced mathematics and programming is required. The problem studied in this article is a simplified version of the time trial problem and therefore there is much room for developing a more advanced model. First by relaxing the assumptions of no head wind. Furthermore we did not look into uncommon time trials, with a considerable amount of uphill sections. This would result in needing a linear program to allocate excess energy to the time trial segments.
Ideally, you would want to create a real time optimal control problem, including parameters explaining the changes in terrain and time varying weather forecasts. In principle building such systems is possible, although we have to note that more research is needed to accomplish this goal.
de Jong, J.; Fokkink, R.; Olsder, G.J.; Schwab, A.L. (2016) A variational approach to determine the optimal power distribution for cycling in a time trial. TU Delft, Nederland.

Dit artikel is geschreven door Jochem Hak

Read more

Regression analysis: A beginner’s guide

Regression analysis: A beginner’s guide

Econome­­trics, the int­­ersection of economics and statistics, employs sophisticated methods to analyse and quantify relationships within economic systems. One of its fundamental tools is regression analysis, a statistical technique that allows economists tot model...

Are you tying your shoelaces wrong?

Are you tying your shoelaces wrong?

We tie our shoelaces to ensure that our shoes stay on tight, and we do these by tying a knot. There are different ways to tie your shoelaces, you may have learnt the “around the tree” technique, but somehow, they still always come undone, why? This all has to do with...