The Physics of Zwift Cycling

Disclaimer

I have no inside knowledge of Zwift and know nobody that works, or has ever worked, for Zwift. So what follows are just some thoughts on cycling in general and how Zwift might have implemented their game. It might be completely wrong!

If you are not familiar with cycling on Zwift this may not mean much.

Introduction

Zwift is probably the most popular and well known virtual cycling environment on the market covering basic virtual cycling, training plans for cycling and racing. For those that have not tried it, you need a bike, a so-called “turbo-trainer”, a computer to run the Zwift program on and a means of having the components communicate.

Along with most people, I have started doing indoor cycling in the winter when outdoor cycling is not much fun.

There are several products on the market that provide some sort of virtual environment that translates the power you output on your bike / turbo trainer to an on-screen avatar in the virtual environment. So basically, the harder you pedal, the faster your avatar goes. Smart trainers are able to interact with the software environment (e.g. Zwift) to give an experience that mimics real life in a multi-player game environment, e.g. by simulating hills, drafting, etc.

Zwift do not publish the equations of motion the software uses, so I thought it would be interesting to reverse engineer what Zwift does in order to produce the outcomes it generates and see how this compares to what might happen “in real life”.

Standard Cycling Equation of Motion

bicycle_physics_3Consider riding a bike up a hill of grade G%, at speed, v, in still conditions (i.e. no wind):

  • M is the mass of the rider and bike
  • g is the acceleration due to gravity
  • C_{rr} is the coefficient of rolling resistance
  • ρ is air density
  • C_D is the coefficient of drag
  • A is cross sectional area of the rider, bike and wheels
  • ε is the drive chain efficiency

If you are familiar with cycling physics you will probably recognise this equation for the power, P, required to sustain a steady velocity, v:

P = \epsilon.(M.g.v.\cos (\arctan (G)).C_{rr} + M.g.v.\sin(\arctan(G)) + \frac {1} {2} \rho.C_D.A.v^3)

If the rider applies more power than P, (s)he will accelerate; if less then (s)he will decelerate.

The three terms on the right of the power equation refer to components that consume power:

  1. Rolling resistance, or friction.
  2. Power required to overcome gravity. This term will be zero on the flat. When going downhill gravity becomes a source of power, rather than a consumer.
  3. Drag, or power needed to overcome air resistance. If there is wind then it is easy to replace the velocity, v relative to the ground with a velocity relative to the wind to allow for this.

How might this apply to Zwift?

What does Zwift know about you?

Zwift needs the following information about you and your ride:

  • Weight
  • Height
  • Power. When you are in game Zwift needs to receive how much power you are putting out. It doesn’t care about how fast you are going on your turbo trainer, what gear you are in or how much resistance the turbo trainer is applying. All it needs is power.
  • Heart rate. This is optional so you can see how hard you are exercising
  • Cadence. This is optional, again for you to see in stats.

Obviously Zwift may use a completely different equation of motion, or they may vary the equation and/or the coefficients over time. Who knows?

Starting Assumptions

Lets make some assumptions to get us going:

Wind

There does not appear to be any wind in Zwift so lets assume this is true.

Drive chain efficiency, ε

Now it gets a bit complicated. There are two bikes involved:

  • The real life bike you are riding.
  • The Zwift bike you are riding in game.

So, if you are using a turbo trainer to supply power to Zwift then the trainer will measure the power at the trainer, after any losses in your real life bike’s drive chain. If you have a power meter it will be somewhere in the drive chain, for example in the pedals or the crank so you will be measuring power at a slightly different point so the drive chain efficiency may be slightly different.

Anyway, the point is, there are 2 bikes so 2 drive chain efficiencies involved. So, to avoid double-dipping, I’m going to assume the drive chain efficiency of the Zwift bike is 100%. This means we can ignore ε in the equation. If this assumption is wrong the impact of ε will be factored into other constants.

Do not forget, though, that you are probably loosing drive chain efficiency on your real world bike. Typical values are from 95% to 98% assuming you maintain your drive chain. So if you are generating 100w power, the trainer may be receiving 95w of power.

Rider Weight

Zwift ask you to input your weight. But what is this weight? Is it your weight naked, fully clothed, wearing cycling kit, helmet on or off, carrying a water bottle, etc, etc.? Zwift does not really specify this.

So again, there are 2 riders in play:

  • You, in real life.
  • Your in-game avatar that you can select different kit for.

So Zwift could give weight to the different pieces of kit you choose. Some kit is mandatory, some like gloves and helmet are optional.

I am going to assume that the kit you choose in Zwift does not contribute to your weight and that you should weigh yourself in your real world kit. If you want to compare Zwift to real life include anything you would carry with you on your ride in the weight you enter into Zwift, e.g. cycling kit, helmet, water, food, spare tube, cuddly toy, etc.

Bike and Wheel Weights

So there are 2 bikes involved:

  • Your real world bike. Zwift does not need to know about this.
  • Your in game Zwift bike and wheels. Zwift offers many bikes and wheels and each has a one to four star weight rating. Two possible systems spring to mind:
    • Each bike in Zwift is mapped to one of four weights. Same for each wheel set.
    • Each bike and wheel set has its own weight. The possible range of weights is divided into 4 buckets and marked with the appropriate number of stars.

Different frame sizes would, of course, weigh different amounts so Zwift could take the height you supply and use that to determine the frame size and adjust the weight for that, but I am going to assume this does not happen, i.e. each bike has a single weight.

The Zwift bike and wheel weights are added to the user supplied rider weight to make up the total weight used in the calculations.

Air Density, ρ

So density of air varies as follows:

  • Inversely with temperature. The higher the temperature the less dense the air.
  • Inversely with humidity. The more water vapour in the air, the less dense the air. This one is counter-intuitive.
  • Inversely with altitude. The higher up you are the less dense the air.

Starting with the ideal gas law:

P.V = n.R.T

Where P is the pressure of a gas, V its volume and T its absolute temperature, n is the number of moles of the gas and R is the universal gas constant.

Now: n = \frac {m} {M} where m is the mass of the gas and M the mass of 1 mole of the gas.

The density, ρ, is given by: \rho = \frac {m} {V}

So:

P.V = \frac {m} {M}.R.T

P = \frac {m} {V} \frac {R} {M}.T = \rho. \frac {R} {M}.T

For a gas its specific gas constant is given by R_{spec} = \frac {R} {M}

\rho = \frac {P} {R_{spec}.T}

For humid air its possible to treat the air as a combination of two gases; dry air (da) and water vapour (wv) where the density is given by:

\rho = \frac {P_{da}} {R_{da}.T} + \frac {P_{wv}} {R_{wv}.T}

The molecular mass of water vapour is less than dry air so adding water vapour actually reduces the air density, so humid air had a lower density than dry air.

Both temperature and pressure fall as altitude, h, increases:

P = P_0.(\frac {T} {T_0})^\frac {g.M} {R.L}

where P_0 is the sea level pressure, and L is the lapse rate, the rate of temperature decline with altitude. T varies with altitude according to:

T = T_0 - L.h

where T_0 is the sea level temperature.

So atmospheric conditions and altitude all affects ρ, and therefore drag.

It is possible that in Zwift, there is a model to adjust the air density used in calculations depending on your altitude and details of the weather, temperature, etc. It is also possible that different “worlds” in Zwift use different parameters; London will be at a different temperature to Watopia in the Solomon Islands, for example.

Atmospheric pressure on the earth’s surface ranges from about 950 millibar to 1050 millibar which is a range of 100 / 1000 or 10%. The density of air, ρ, will therefore move by around 10% based on the atmospherics at the time.

The table below shows how air density, ρ, varies with temperature. Again you can see that there is quite a significant decrease in air density as the temperature increases.

Screen Shot 2018-05-28 at 11.54.24

The graph below shows how air density varies with altitude.

Screen Shot 2018-05-28 at 12.00.33

Again, there is a significant change in air density, ρ, with altitude. So at the top of Alpe du Zwift the air density should be lower than at the bottom, and you should therefore move faster, right? Well kind of. The other effect is that human power output declines with altitude (there is less oxygen to power your muscles). Different people behave differently at altitude, mainly depending on how well adapted they are to it. Here is a graph for elite athletes showing VO_{2max} decline with altitude for acclimated and non-acclimated athletes, along with the equations of best fit.

Screen Shot 2018-06-01 at 18.23.03

There has been quite a bit of discussion as to the sweet spot for attempting the 1 hour cycle record. The higher above sea level you are the lower the air density and therefore the drag, but the lower your power output will be. As a cyclist moves higher in altitude initially the benefit of a lower air density outweighs the negative impact of a reduced power output and speed increases. As the cyclist moves higher, there comes a point where power output drops away faster than the benefit of lower air density accrues and speed would decrease.

There was work done using Chris Boardman’s hour record speed (using the superman position) to plot the distance he would have travelled at different altitudes using both the acclimated and non-acclimated equations.

Screen Shot 2018-06-01 at 18.31.04

Zwift could argue that modelling a changing air density is more hassle than its worth; even though they have visually taken the time to model weather in-game. I think there is enough research available and the equations would are not too difficult, so it could be done.

However, I am going to assume that Zwift use a single value of ρ = 1.225 kg/mwhich is a value at sea level at 15C and seems to be a commonly quoted value. If Zwift use a different value then, providing it is constant, it would be absorbed into the other CD.A constants.

Rolling Resistance or Friction

The power required to overcome rolling resistance P_{rr} is given by:

P_{rr} = M.g.v.\cos (\arctan (G)).C_{rr}

ck_56f2422a030f9This equation is derived as follows. Consider a wheel on an inclined road as per the diagram opposite. The frictional force f is given by:

f = \mu \times N

where the force perpendicular to the surface which is given by:

N = M.g.\cos(\theta)

and μ is called the coefficient of friction which is a constant for the two surfaces in contact.

So:

f = M.g.\cos(\theta).\mu

The next thing to know is how grades are quoted on roads. 500px-Grade_dimension.svg

So what does a 25% grade mean? The convention is that its the vertical distance divided by the horizontal distance (not the distance you actually travel on the road). So:

\tan(\alpha) = \frac {h} {d}

where \frac {h} {d} is the grade, lets call it G

\alpha = \arctan(G)

Remembering Power P_{rr} is related to force, f and velocity, v by:

P_{rr} = f \times v, or

P_{rr} = M.g.v.\cos (\arctan (G)).C_{rr}

where I have replaced μ with C_{rr}, usually called the coefficient of rolling resistance.

So this is where the rolling resistance term comes from.

There are plenty of sites on the internet testing and comparing the C_{rr} for different tyres, for example:

TireCrr

Rolling Resistance in Zwift

So how might Zwift have modelled C_{rr}? Well, there is no option to select different tyres which implies they will have modelled a single tyre. There are different road types, e.g. good quality roads, less well maintained ones, dirt roads and some cobbles. Also, Zwift has weather with rain for example. All of these things would change the C_{rr}.

My assumption is that Zwift have a single value for C_{rr} for all bike / wheel combinations, in all weather and on all surfaces.

Power to Overcome Gravity

The power required to overcome gravity when going up hill, P_g, is given by:

P_g = M.g.v.\sin(\arctan(G))

This equation is derived as follows. Consider the wheel from the last section on an inclined road. The gravitational force f pulling down the hill is given by:

f = M.g.\sin(\theta)

Again, using:

P_g = f \times v, and tan(\theta) = G, gives:

p_g = M.g.v.\sin(\arctan(G))

This is where the gravity term comes from and is what I will assume Zwift uses.

Drag

The power required to overcome drag, P_D, is given by:

P_D = \frac {1} {2} \rho.C_D.A.v^3)

The starting point would a fluid flowing around some obstacle:

Laminar_V_Tubulent

The Navier Stokes equation is the general equation for this:

Navier-Stokes equation

The problem is that this is a very complex equation. There is an unclaimed $1m prize for anyone who can prove that this equation will actually have a solution in the general case (no need to find the solution just prove there must be one).

So clearly some simplification is going to be required!

Lord Rayleigh (1842 – 1919) came up with a drag equation for the force F_D exerted by turbulent flow:

F_D = \frac {1} {2} \rho.C_D.A.v^2)

Converting to a power equation, for P_D:

P_D = \frac {1} {2} \rho.C_D.A.v^3)

Zwift and CD.A

So how would Zwift calculate CD.A?

The “A” is related to the cross-sectional area in the direction of motion through the air, and CD is related to the shape of the rider, bike and wheels.

200px-14ilf1l.svgHere are some examples of CD for simple objects. As you might expect, the more “streamlined” the object, the lower the CD.

So given each bike and wheelset has a 1 to 4 star “Aero” rating in Zwift it seems likely that these will contribute to CD.A in some way.

There are many ways Zwift could have set this up but I’m going to make some assumptions that cross-sectional area, A is predominately determined by the rider and that CD is calculated as follows:

C_D = C_{Dr} + C_{Db} + C_{Dw}

where:

C_{Dr}  is the coefficient of drag due to the rider which is a constant for everybody.

C_{Db}  is the coefficient of drag due to the bike based on the bike’s aero star rating.

C_{Dw}  is the coefficient of drag due to the wheelset based on the wheelset’s aero star rating.

Doing some internet research, it seems that a rule of thumb is that CD is roughly 70% due to the person, 20% due to wheelset and 10% due to the bike frame.

So how would Zwift get cross-sectional (or frontal) area, A. We supply height and weight. Looking at some research papers on the topic, people have attempted to do regression analysis on various datasets to find a formula linking weight, height and A.

The starting point seems to be the relationship between height, weight and body surface area. There are several formulae in use but the most common seems to be the Du Bois & Du Bois formula from 1915, for body surface area, A_{BSA} which is related to height, h, and weight, m, by:

A_{BSA} = 0.2025.h^{0.725}.m^{0.425}

Work was then done to relate body surface area to cyclist cross-sectional area. There is a quoted paper from 1999, “Comparing cycling world hour records, 1967–1996: modeling with empirical data” that includes this graph:

Screen Shot 2018-05-18 at 10.32.47

So, using the upper line of best fit for regular racing bikes on the drops, frontal area, A is given by:

A = 0.1366.A_{BSA} + 0.1647 = 0.0276.h^{0.725}.m^{0.425} + 0.1647

Note the R squared is terribly low (0.4013) and there are only a few data points, and this is for the best cyclists ever, but at least its something!

Similarly, for the TT bike line of best fit, frontal area, A is given by:

A = 0.1447.A_{BSA} + 0.0604 = 0.0293.h^{0.725}.m^{0.425} + 0.0604

The R squared is better, but still low at 0.757.

So there are certainly a lot of issues with taking these formulae and applying them outside of elite cyclists but it does provide a one size fits all pair of equations to use for all riders on Zwift based on simple, easy to get data of weight and height.

Since the weight and height part of the equation comes from medical research outside cycling I suspect the numbers are for the naked individuals (i.e. without kit)! Which creates a bit of a conundrum as to what weight to enter into Zwift. If it is naked weight then the weight used for the gravity and rolling resistance terms will probably be understated but the drag term should be more accurate. If it is weight of the person in riding kit then the gravity and rolling resistance terms will likely be more accurate but the drag will be overstated. This might be why Zwift keep this vague.

What does it mean?

What can an equation like this actually mean:

A = 0.0276.h^{0.725}.m^{0.425} + 0.1647

Well, the 0.1647 will probably refer to the bike and wheels. But what about the h^{0.725}.m^{0.425} part; what is going on here?

The taller you are the larger the frontal area. That seems reasonable. The heavier you are the larger the frontal area. Again, this seems reasonable.

220px-Cylinder_geometry.svgBut what about those strange fractional powers of weight and height? A human is a very complex shape but lets simplify the situation and look at a cylinder of height, h and radius, r.

The volume, V is given by:

V = \pi.r^2.h

and the surface area, S is given by:

S = 2.\pi.r.h + 2.\pi.r^2

If h is much bigger than r, then approximately:

S \approx 2.\pi.r.h

If the cylinder has constant density, ρ, then its mass, m, is given by:

m = \rho.V = \pi.\rho.r^2.h

Rearranging this gives:

r = \sqrt (\frac {m} {\pi.\rho.h})

So substituting this into the formula for approximate surface area:

S \approx 2.\pi.h.\sqrt (\frac {m} {\pi.\rho.h})

S \propto h^{0.5} \times m^{0.5}

So, the above gives some sort of clue as to where the fractional powers of rider weight and height might come from in the surface area equation.

Back, to the formula… for a 75kg 1.83m rider A = 0.433.

Increasing height by 1cm increases A by 0.25%

Increasing weight by 1kg increases A by 0.35%

Given where this formula has come from its likely to be better at the pro-rider end of the spectrum where the rider is riding in an aerodynamic way. The frontal area for casual riders is likely to be higher, which would make drag higher and therefore the speed slower in real life compared to Zwift.

The other point to bear in mind is that the formula came from elite male cyclists who would have minimum body fat. Applying this to less well trained individuals is likely to understate the frontal area for a given weight (fat is less dense than bone and muscle) and therefore the drag, so again Zwift may overstate your speed slightly.

Rider Position

In real life, how the rider is riding, e.g. on the drops, on the hoods, etc. has an impact on drag by affecting the frontal area, A and shape, CD.

In Zwift, the avatar rides in one of the following positions:

  • On the hoods, when going slowly or drafting
  • On the drops when going quickly
  • Standing, when climbing at low cadence
  • Sprinting when outputting a large number of Watts
  • Supertuck when free-wheeling down a steep hill.

For each of the these positions Zwift could change CD.A. Supertuck is a free-wheeling position which I have not considered, so putting this to one side, in my analysis I am assuming Zwift do not change CD.A based on avatar position.

Zwift Equation of Motion

I am going to ignore the TT bike and concentrate on the road bike for the rest of this blog. The overall equation of motion is now:

P = M.g.v.\cos (\arctan (G)).C_{rr} + M.g.v.\sin(\arctan(G)) + \frac {1} {2} \rho.C_D.(0.0276.h^{0.725}.m^{0.425} + 0.1647).v^3

where m = mass of rider, M = m + mass of bike + mass of wheelset

So, given we know in-game speed, v, power, P and the grade of the slope, G, along with rider height and weight, the unknowns in the above equation become:

  • Mass of the bike (we know a 1 – 4 star rating)
  • Mass of the wheelset (we know a 1 – 4 star rating)
  • C_{rr} which is constant
  • C_D = C_{Dr} + C_{Db} + C_{Dw} where the rider component is constant and the bike and wheels component varies with the equipment chosen.

So now we need some data.

ZwiftInsider Dataset

ZwiftInsider has very kindly made some test lap data available here. The way this works is that a simulator has been built to output a constant amount of power and then to send an avatar around various loops of Zwift at certain power levels. Various heights, weights, bikes and wheelset combinations have been tried out.

The advantage of looking at this data is that power is constant, not something that happens if you just ride on a turbo trainer.

The downside is that the gradient on Zwift is almost always constantly changing so the rider’s speed rarely reaches equilibrium, i.e. the rider is always accelerating or decelerating. This is fine but makes solving the equation of motion much more tricky.

So, the test laps are on Strava where its possible to look at performance across various segments. The problem with this is that the segments have varying gradients so again I cannot just use average speed for the segment and average grade because the power equation is a polynomial in speed.

What I have done is look for parts of the loop where grade is constant and used the segment analyser tool in Strava to get the speed.

Richmond Dataset

I started with the Richmond dataset because this is the largest number of laps and has variety of weight, height etc. for the same bike and wheelset.

I picked the Zwift W Broad St Sprint as it is completely flat and the terrain before it is quite flat so the entry speed to the segment is close to the speed through the segment. The speed towards the end of the segment is as close to equilibrium as I could get.

Screen Shot 2018-05-23 at 07.53.45

So, what speed to use? Strava gives an average and a max speed for the segment. It also calculates a value every second if you look at the analyser tool. In general, for this segment the entry speed increases slightly over the first half of the segment and then fluctuates by a small amount (e.g. 0.2 mi/h over the second half). Using the average value I think would understate the number due to the slower speed in the first half and using the maximum I think would overstate it due to what look like random fluctuations in the speed; so I manually averaged the speed over the end section of the segment.

Initial Analysis on CRR and CD

So the first thing to note, is that on level ground (zero grade) the equation becomes:

P = M.g.v.C_{rr} + C_D.(0.016905.h^{0.725}.m^{0.425} + 0.10087875).v^3

For the same bike and wheelset, M and CD will be constant at different power levels, so the equation becomes:

P = X.v + Y.v^3 where X, Y are constant.

So using the Zwift Carbon bike with Zwift 32mm Carbon wheels there are 9 runs at 150 to 500 watts for a 75kg rider with 1.83m height. Running an excel regression analysis on the above formula gives:

X = 3.3219, Y = 0.1893

From which X gives M.C_{rr} = 0.3386. If we assume a 7.5kg bike and wheels this gives:

C_{rr} = 0.0041

and Y gives CD = 0.7143

These are “realistic” values.

Regression analysis is just a statistical way of fitting a equation to a set of data. Excel is quite good at this. You need to get an equation of the form:

y = c_1 + c_2.x + c_3.x^2 + c_4.x^3 + ...

where the c_n values are constants. Regression analysis will then give you the constants.

The adjusted R squared was 86%. I tried some regression formula for terms with v^2 and v^4 but the adjusted R squared was 75% and the coefficients did not make any physical sense (i.e. they were negative) so it looks like Zwift is using the predicted type of equation.

Analysis on how Height Effects Drag

Starting with the equation for level ground:

P = M.g.v.C_{rr} + \frac {1} {2} \rho.C_D.(0.0276.h^{0.725}.m^{0.425} + 0.1647).v^3

ZwiftInsider did a few runs where everything was kept constant except height. So, again picking the “Zwift W Broad St Sprint” in Richmond, and using the Zwift Carbon bike with Zwift 32mm Carbon wheels there are 3 runs at 225 Watts with heights 1.53m, 1.68m and 1.83m.

So to check how speed is related to height, it is necessary to get to get the above power equation into a form that allows regression analysis to be run on it. Lets assume z is the exponent on height and lets see what we get:

P = X.v + (Y_1.h^z+Y_2).v^3 where X, Y1 and Y2 are constant

Rearranging and taking logs gives a linear equation:

\ln (\frac {\frac {P - X.v} {v^3} - Y_2} {Y_1}) = z.\ln(h)

Running excel regression on this gives z = 0.69. Bear in mind I only used 3 data points and the R squared is only 50% though!

So it seems possible that Zwift is using height to the power of 0.725 in their drag equation.

Analysis on how Weight Effects Drag

Starting with the equation for level ground:

P = M.g.v.C_{rr} + \frac {1} {2} \rho.C_D.(0.0276.h^{0.725}.m^{0.425} + 0.1647).v^3

ZwiftInsider did a few runs where everything was kept constant except weight. Weight, however, effects both the rolling resistance and drag terms so its difficult to algebraically produce an equation to run regression analysis on.

However, Excel has a cute “solver” function where you can set a target by varying a particular cell. So I picked 3 runs at 200 watts where the only difference was a rider weight of 50kg, 75kg and 100kg.

The only thing we do not know in the above equation is the weight of the bike and wheels. This seems to be a bit mysterious in Zwift but I did see a comment on the Zwift website from the head developer a couple of years back saying that all bikes weighed about 7.5kg but that Zwift were about to change this so each component would have its own weight.

So 7.5kg is not a bad weight for a racing bike and wheels so I used this in the above equation. Setup a variable, z, to represent the power of the rider’s weight and calculate the power using the formula. I set “solver” to minimise the square of the sum of the difference in power from the equation versus 200 watts by varying z. Its kind of a quick and dirty “least squares” approach.

Solver came out with z = 4.2. Again, its only 3 data points!

It seems posible that Zwift is using weight to the power of 0.425 in their drag equation.

Problems with the Richmond Dataset

I tried doing regression above on datasets with a 50kg and 100kg rider. With this information it is possible to calculate CD and M.C_{rr} again. Unfortunately, the numbers do not agree very well.

Looking at the dataset:

  • An obvious problem occurs at 400W and 500W where speed seems to be independent of rider weight, e.g. a 50kg rider goes at the same speed as a 100kg rider. This does not seem right. It is, of course, possible that at some threshold power, Zwift change the equation of motion but I am going to assume this is not what Zwift does.
  • The way Strava is calculating the speed seems wrong in certain cases. E.g. for a 50kg rider at 400W, the segment average is 27.9 mi/h and max is 27.7 mi/h (obviously this is not possible).
  • Some data looks wrong, e.g. 100kg rider doing 250W, segment average is 21.6 mi/h whereas max is 23.7 mi/h which is a significant difference.

So, I could not get anymore information from the Richmond dataset.

Watopia 2016 and 2017 Datasets

This dataset is mainly for a 75kg, 1.83m rider with different bike and wheel combinations riding a loop around Watopia at 225 watts. I used the “ocean reverse” segment because it starts after 0.6km of flat riding and is itself about 1km long. Unfortunately the end of the segment is not completely flat so I manually took the speed towards the end of the segment whilst the gradient was zero.

So, once again the equation for level ground:

P = M.g.v.C_{rr} + \frac {1} {2} \rho.C_D.(0.0276.h^{0.725}.m^{0.425} + 0.1647).v^3

So with this dataset, power, rider weight, height and contribution to CD are constant and the variables are all to with the equipment:

  • Bike weight and CD contribution
  • Wheel weight and CD contribution

So, that’s 4 unknowns so time for some more assumptions!

Zwift give a 1 to 4 star rating to the weight and aero’ness of each bike and wheelset. These star ratings would be turned into actual kg and used in the power equation. Weights are obviously just additive, i.e. add the bike weight to the wheel weight to the rider weight.

Not so obvious what to do about about aero’ness. I have assumed Zwift convert the aero’ness star rating into a contribution to CD that obeys:

C_D = C_{Dr} + C_{Db} + C_{Dw}

Wheelsets

I looked at the ZwiftInsider data for the wheels that I have unlocked in game (and see the star ratings for) using the Zwift Carbon bike.

Wheelset Weight star Weight (real) Aero star
Zwift Classic 2 1
32mm carbon 3 2
Zipp 202 4 1.45 2
Mavic Cosmic  CXR60c 1 1.986 3
Bontrager Aeolus 5 3 1.605 3
Zipp 404 3 1.69 3
Zipp 808 2 1.885 4

Doing a bit of googling its possible to get values for the real-world wheelsets. There are many options so its not obvious which ones Zwift would use but its possible to a variation of 1.45kg for a 4 star wheelset to 1.986kg for a 1 star wheelset.

From this I constructed a simple matrix of star rating versus weight:

Wheel Weight star Weight (kg)
1 2.0
2 1.8
3 1.6
4 1.4

For aero’ness I assumed a similar approach that each star changed the CD value by a set amount. To get a starting point, for the 32mm Carbon wheelset and Zwift Carbon bike I know the total CD, and assuming the rider is 70%, bike 10% and wheels 20% I have a value for the contribution of the 2 star wheels of 0.1429.

So for all these wheelsets I setup an Excel Solver equation to work out the contribution each star makes to CD for the wheelset which came out at 0.0186.

Wheelset Weight star Weight (kg) Aero star Cdw
Zwift Classic 2 1.8 1 0.1615
32mm carbon 3 1.6 2 0.1429
Zipp 202 4 1.4 2 0.1429
Mavic Cosmic  CXR60c 1 2 3 0.1243
Bontrager Aeolus 5 3 1.6 3 0.1243
Zipp 404 3 1.6 3 0.1243
Zipp 808 2 1.8 4 0.1057

Bikes

So following the same process for bikes as I followed for wheelsets:

Bike Weight star Weight (Kg) Aero star
Zwift Steel 2 1
Zwift Carbon 3 2
Parlee ESX 3 5.6 3
Trek Emonda 4 5 2
Zwift Aero 3 3
Canyon Aeroad 3 5.6 3
Trek Madone 3 6.1 3

There are even more options for bikes so it is very difficult to know what to choose for real world weights. But again, creating a simple matrix:

Weight star Weight (Kg)
1 7
2 6
3 5
4 4

Following the same approach for aero’ness, I started with a value for the Zwift Carbon bike of 0.714. So again using Excel solver to work out a contribution of each star to the bike’s CD contribution of 0.0080.

Bike Weight star Weight (Kg) Aero star Cdb
Zwift Steel 2 6 1 0.0794
Zwift Carbon 3 5 2 0.0714
Parlee ESX 3 5 3 0.0634
Trek Emonda 4 4 2 0.0714
Zwift Aero 3 5 3 0.0634
Canyon Aeroad 3 5 3 0.0634
Trek Madone 3 5 3 0.0634

I have one more unlocked bike, the Tron which has its own wheels:

Bike Weight star Weight (Kg) Aero star Cdb
Tron 4 5 4 0.0555
Wheelset Weight star Weight (Kg) Aero star Cdw
Tron 4 1.4 4 0.1057

So it is possible to come up with some numbers for the dataset for weight and CD. The dataset is not accurate enough to know which model Zwift has actually chosen but I would guess the following:

  • Weights are probably entered specifically for the equipment as this is publicly available information. Zwift would have to specify some guidelines but could obtain weights from the manufacturers or just purchase and weigh the equipment. Zwift would have to specify the weights of Zwift-only equipment that does not exist in the real world. Based on weight buckets, each piece of equipment would then be assigned a star rating.
  • Aero. This would be more contentious for Zwift as it would be difficult to get a CD for a piece of equipment and presumably Zwift would not want to get involved in wind tunnel tests, etc. To take some of the contention away, Zwift may have assigned a star rating based on information from the manufacturer and / or public reviews and then used the star rating to come up with a CD for each piece of equipment.

However Zwift have done this, the full lap times show that different equipment with the same star rating performs very slightly differently.

Alpe du Zwift Dataset

I hoped to be able to use this dataset to investigate inclines and how Zwift works. Unfortunately, the Alpe has continuous gradient changes, so the rider does not get into a steady state where speed stabilises on a certain gradient so I could not get any new information. It does look like Zwift obeys the basic equation of motion though.

Next Steps

To get more accurate information on the performance of different bikes and wheelsets would be possible but it would require laps of of areas with long stretches of constant gradient when the rider gets into speed equilibrium.

It would also be possible to investigate the features like free-wheeling downhill and the “super tuck” position where frontal area is likely reduced. Some laps of the radio tower in Watopia would help here.

It would be interesting to investigate drafting and see what equations are used here. This would be tricky to setup as it would require multiple bots to ride together in close proximity.

So what does it all mean?

Going back to the general power equation:

P = M.g.v.\cos (\arctan (G)).C_{rr} + M.g.v.\sin(\arctan(G)) + \frac {1} {2} \rho.C_D.(0.0276.h^{0.725}.m^{0.425}+0.1647).v^3

Riding on the Flat

Here the gravity term is zero and the equation reduces to a rolling resistance term and a drag term. The rolling resistance is proportional to speed and is relatively small. Drag is proportional to speed cubed. Here is a typical graph.

Screen Shot 2018-05-29 at 10.54.36

At higher speeds we can ignore the rolling resistance:

P \approx \frac {1} {2} \rho.C_D.(0.0276.h^{0.725}.m^{0.425}+0.1647).v^3

v \propto \sqrt[3] { \frac {P} {Cd.A}}

So to double your speed you would need 2 cubed = 8 times the power.

So, for sprinting (assuming no drafting) top end speed is dependent upon the ratio of Power to CD.A.

In Zwift, CD does not vary by rider and has only a very small equipment dependency. Frontal area, A, is fixed based on weight and height so the only thing you can vary is your power. You can sprint in whatever position generates the most power for you, irrespective of how aerodynamic (or not) that position is. In real life the compromise is to optimise the power to CD.A ratio not to optimise absolute power.

In Zwift, for a group of people sprinting, ignoring differences in equipment and drafting effects:

v \propto \sqrt[3] { \frac {P} {h^{0.725}.m^{0.425}}}

Climbing a Steep Hill

Here the gravity term dominates:

Screen Shot 2018-05-28 at 12.30.46

Because speed is low, drag is low, and the power equation can be approximated by:

P \approx M.g.v.\sin(\arctan(G))

v \propto \frac {P} {M}

So here climbing speed is proportional to the ratio of power to total weight of rider and equipment. Top climbers are usually smaller, lighter people. The important thing for speed is not absolute power but the power to weight ratio. Lightweight equipment helps.

Zwift is probably an idealised situation with top class, lightweight equipment. Things like carrying water, food or spare kit and equipment like tubes are likely not factored in, in Zwift. So Zwift would represent a lightweight you, unless you factor all the things you take on a real world climb into the weight you enter into Zwift.

Intermediate Hills

Different inclines will have different mixes of gravity power and drag:

Screen Shot 2018-05-28 at 12.41.31

Different people can do better or worse on different inclines depending on their absolute power and power to weight ratio compared to their peers.

Downhills

One of Zwift’s badges is unlocked if you can hit 100kph.

For a 75kg, 1.83m rider on the Zwift Carbon bike with Zwift 32mm carbon wheels you would need to generate a whopping 4,150 watts for long enough to reach a steady state 100kph, which is obviously unrealistic.

Downhill however, gravity can help. The gravity term in the power equation is negative for a negative gradient which means gravity is now a source of power (as opposed to a consumer of the power the rider is generating). Consider a downhill of 15%, like for example the descent from Watopia’s radio tower.

Screen Shot 2018-05-31 at 11.07.33

At about 90kph, gravity is generating about 3,000 watts of power which more or less matches the drag and rolling resistance, so you can free wheel to this speed. To get to the magic 100kph you would need to put in about 850 watts of rider power.

However, a 100kg rider would only need to put in 195 watts of power on the same hill to hit the magic 100kph. This is because the gravity term is proportional to weight (as is rolling resistance but this is much smaller) whereas drag is scaling with m^{0.425} so the steady state is reached at a higher speed. So weight is not always a disadvantage!

Where do I get Most Return for Harder Efforts?

Consider the following ride:

  • 5k of 10% uphill, followed by
  • 5k of flat, followed by
  • 5k of 10% downhill

Assuming again a 75kg, 1.83m rider on the Zwift Carbon bike with Zwift 32mm carbon wheels riding at a constant 225 watts, (s)he would cover each section as follows:

Screen Shot 2018-05-31 at 17.16.48

I have ignored the impact of accelerating at the start of the ride and on gradient changes so the rider is assumed to always move at the steady state speed appropriate to his power output and the gradient. This is not how Zwift works, obviously, but I have done this just to make the maths simpler.

Now, if the rider wanted to do a single, 2 min effort at 300 watts, and ride the remainder of the course at 225 watts would it be more beneficial to do the effort on the uphill, the flat or the downhill? Lets simplify the maths again by ignoring the few seconds of acceleration and deceleration when the 2min effort starts and finishes. Here is what the three scenarios would look like:

Screen Shot 2018-05-31 at 19.14.57

In scenario 1, the 300 watt effort is put in on the uphill, taking his speed from 9.61kph to 12.67 kph for 2 minutes before reverting to 225 watts and a speed of 9.61kph. Watts were increased by 33% on a steep hill and speed increased by nearly 33% (as expected as speed is approximately proportional to power here). The time for the uphill section is reduced to 30:35 an overall time saving for the scenario of 38 seconds.

In scenario 2, the 300 watt effort is put in on the flat, taking speed from 36.2kph to 40.18kph. Overall time for the flat section is reduced to 8:04, an overall time saving for the scenario of 13 seconds. Here, power is being consumed mainly by drag which scales as speed cubed, so a 33% increase in power results is a 1.33^{1/3} \approx 1.1 increase in speed (or approximately 10%). This is a much smaller speed increase than scenario 1, and therefore the time saving of scenario 2 versus scenario 1 is much smaller.

In scenario 3, the 300 watt effort is put in on the downhill taking speed from 77.11kph to 78.55kph. Overall time for the downhill section is reduced to 3:51 an overall time saving for the scenario of 2 seconds. Here, before the effort, gravity is already contributing over 1,700 watts to the rider’s 225 watts so if the rider adds another 75 watts taking his output to 300 watts, that is only an increase of 75 / 1925 or 4%. This 4% power increase results in an approximate speed increase of 1.04^{1/3} \approx 1.01 or 1%. This small speed increase results in the smallest time saving of all scenarios.

So time your efforts for the uphills, the steeper the better!

Drafting

Zwift has implemented drafting where it is possible to stay “on the wheel” of another rider, i.e. going at the same speed, but by outputting less power. I have no real data on this to be able to analyse but ZwiftInsider wrote this article on drafting. In it he says: “Using power emulators on a closed course, we had one rider sustain 300 watts while another ride drafted behind. We found a rider could stay in this 300 watt draft at 225 watts while on relatively flat ground.”

So how might that work. The most obvious way would be to modify CD.A in some way, probably reduce it by some factor. Lets call it γ, and assume a 75kg, 1.83m rider on the Zwift Carbon bike with Zwift 32mm carbon wheels riding at a constant 300 watts on level ground.

P = 300 = M.g.v.C_{rr} + \frac {1} {2} \rho.C_D.A.v^3

Lets assume rider 2 has the same physical characteristics and the same equipment, travels at the same speed but is putting out just 225 watts:

P = 225 = M.g.v.C_{rr} + \frac {1} {2} \rho.\gamma.C_D.A.v^3

Subtracting these equations gives:

75 = \frac {1} {2} \rho.(1-\gamma).C_D.A.v^3 , or

1-\gamma = \frac {150} {\rho.C_D.A.v^3} = 0.285

Which gives γ as 71.5% or put another way the drafting effect of a single rider reduces CD.A by 28.5%

Multiple Riders

There have been studies in real life, mainly open track cycling where speeds are higher and the drag effect a bit more pronounced on multiple riders in a group. The draft effect is dependent upon the number of riders, how close together they are, etc.

Lead Rider Benefit

There is also a benefit (though smaller) to a lead rider from being drafted. This is due to the change in the way the air flows around multiple riders, as opposed to how it would have flowed past a single, isolated rider. The impact of this is to reduce the drag of the lead rider which results in the lead rider moving more quickly at the same power.

Blob Effect

Zwift appear to have modelled the drafting benefit to both leader and follower. When a group of riders are close together, for example, in a race, not only do the riders behind the leader go faster than they would for the same power output if they were isolated, but the whole group goes noticeably faster. This gets called the “blob effect”. If a rider drops off the pace, “getting back on” becomes incredibly difficult once the isolated rider loses the drag benefit of drafting. Remember power in these situations scales as speed cubed, so even a modest increase in speed requires a significant uptick in power.

Powerups

Again, I do not have any data to analyse so these are just some thought.

image

There are 5 different Powerups in Zwift. The first 2 add to your rider score and the last 3 effect the physics of the game:

  • Lightweight. This reduces your weight. So this should impact the gravity term in the power equation. Going uphill it will make you go faster and coming downhill it will slow you down. On the flat, if Zwift adjust the drag term as well, you should see a small benefit to drag through a reduced CD.A. Although, from the analysis above, the biggest benefit from this powerup will be on the steepest incline.
  • Draft Boost. Increases the benefit of drafting. Would make sense to use it when travelling at high speed where drag is the dominant force to be overcome. Could be a factor applied to the drafting factor, γ, (that could be applied to CD.A).
  • Aero Boost. Makes you more aerodynamic which would imply a reduction to CD.A again most likely as a factor applied to the drafting factor, γ, applied to CD.A. Again, it would make sense to use it when travelling at high speed where drag is the dominant force to be overcome.

Is Zwift Realistic?

The equation of motion looks reasonable from the analysis. Its possible Zwift uses a more complex set of equations as the data I have used is not detailed enough for me to be completely sure on the equation I suspect is being used.

Speeds in Zwift are what you could do in real life in an idealised way, assuming you enter a height and weight into Zwift consistent with what you wear and carry on your real life rides, and ride in a highly trained, pro-like “aero” manner as you would if you were attempting a 1 hour record! Also, it would assume flawless equipment, correctly inflated tires, well-maintained drive-chain, etc. etc.

Ride on!

8 thoughts on “The Physics of Zwift Cycling

  1. Seb Ricciardi

    Now the 1million$ question becomes : where should a 85kg rider with 3W/kg FTP attack a bunch of 75kg riders with the same FTP by a 75W surge from 225W to 300W as depicted above?

    Please tell me that the answer is not “NEVER” 😥

    Like

    Reply
    1. johnedevans Post author

      Thanks for the question. I’m sure you saw the section “Where do I get Most Return for Harder Efforts?” which looks at where a rider gets the best time benefit from a surge when riding in isolation.

      Your question is slightly different as it moves the scenario from a time trial environment to a race with, lets assume, drafting.

      For the surge to work, two things would need to happen:
      1) the rider needs to get away so the remaining group aren’t drafting him/her.
      2. the rider needs to stay away until the end of race and not be swallowed up by the group before the line.

      In the “Drafting” section in the article the basic draft in Zwift allows riders at 225W to keep up with a lead rider at 300W on the flat. So, there’s no point on surging on the flat as the surge would just tow the peloton along and point 1) would not be achieved.

      The heavier rider has an advantage on the downhill as (s)he will roll faster than the lighter rider. However, because the speeds are relatively high, the power provided by the rider can be much less than that provided by gravity so the difference in speed between 225W and 300W on a downhill will be quite small, and would be counterbalanced by the drafting effect provided to the peloton, so whilst you might be able to stay away, point 2) if you got a gap, you may well not be able to get a gap on the downhill, point 1).

      On a steep hill (say over 10%) the drafting effect will be minimal and speed scales as power/weight so a surge here would work, point 1) providing the group stay at 3W/kg.

      On a shallower hill the advantage of the surge would be lessened as the drag effect would be higher.

      So, I would say the following:
      1. Pick a course with a hilly finish.
      2. Do the surge on an uphill, the steeper the better and use a lightweight powerup (if you can to maximise the advantage). A lightweight bike/wheel combo will help slightly.
      3. Once you have the gap, uphills and downhills are your friends, but on the flat the group will wind you back in by drafting together, so don’t surge far from the finish.

      Of course, this is just some simple physics and doesn’t take into account game play and other tactics.

      In the Zwift races I’ve done surging doesn’t seem to work because the draft effect is so large that an individual rider soon gets picked off (because by definition groups of racers of similar ability race together). It usually comes down to:
      1. Get in the lead group off the start. If you’re dropped you’ll never get back into the group.
      2. Stay in the lead group doing whatever surges are necessary. Again, if you get dropped then that’s it.
      3. Work on your sprint finish as this is where the race is won.

      Like

      Reply
  2. Steven Bottomley

    That is an absolutely fascinating and well-explained analysis of cycling dynamics. Kudos. I was searching to see if cycling apps (like Z) account for air resistance and, from what I undestand from your very detailed review, is “yes”. I have recently switched my allegences to RGTcycling which claims to have a more rigorous physics simulator at its core. Have you reviewed RGT by any chance? Thanks again for a review which I shall have to read two or three times to take in the implications.

    Like

    Reply
    1. johnedevans Post author

      Hi Steven, i did use RGT a couple of years ago for a bit but haven’t used it in a while. I didn’t do any specific analysis on RGT because in order to do so I would need some data to work with and at the time there was no way to get this. With Z, ZwiftInsider has a configurable robot that can ride segments that give some data that i used for the analysis.

      Like

      Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s