[ Wolfgang Strobls Bicycling Page ] [ Simplified online version ] [download PyBikePower ]


Subject: bicycle power-output calculator: the program 's source (written in the C programming language).

Here is the description of the "bike_power" program written by Ken Roberts of the dept of computer science, Columbia University, New York. (You'll need the . INI file, too).

(revised since it was posted on July 18 1990)


This is a computer program called "bike_power", which calculates power output and power consumption for bicycling. You give it things like riding speed, body weight, hill grade, and wind speed. The program prints out a table with power output and power consumption, broken out in various ways.

The program can be used to answer questions like:

How many horsepower was LeMond putting out in the final 1989 TdF time trial? If he were turning a generator, could he produce enough electricity to read rec.bicycles on his home computer?

After climbing a 6% hill at 12 mph for half an hour in a 6.5 mph headwind, how many chocolate ice cream cones am I entitled to eat? [Answer: As many as you want. Or ... something like 1400 Cal/hr * 0.5 hr = 700 Calories worth.]

If I can go 22 mph on the flat, can I buy a bike with a low gear of 42 x 21 and be able to pedal up a 10% hill? [Answer: No -- unless you think a cadence of 40 rpm is acceptable.] [Related answer 1: Pros don't need triple chainrings.] [Related answer 2: 15% hills require an awesome power output.]

If I can ride at 19 mph, how fast could I go if I were drafting somebody? with a headwind? or a tailwind?

How fast would I descend a 12% hill? How much faster could I go if I used an enormous chainring so I wouldn't "spin out"? What if I attached a 50 lb weight to my bike?

Here are some examples of the program in use:

Example 1:

How much power was LeMond putting out in the final 1989 TdF time trial, riding at 34 mph with say a 5 mph tailwind:

   C> bike_pwr -D -vm34 -wc174 -wm21 -a0.17 -r0.004 -vw-5
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
 34.0   7.2   434   53     0   26   513  0.69  1546  111   2169    1865


513 Watts, which is over 2/3 horsepower. He was burning about 1865 calories per hour to produce that power. Frank Berto in Bicycling magazine says it was 3/4 horsepower, but perhaps he understates the significance of aero bars and tailwind.

What do all the columns in the output table mean?

   c> bike_pwr +O
        kph    = velocity [kilometers per hour].
        mph    = velocity [miles per hour].
        F_kg   = total force resisting forward motion [kilograms].
        F_lb   = total force resisting forward motion [lb = pounds].
        P_a    = power output to overcome air resistance [Watts].
        P_r    = power output to overcome rolling friction [Watts].
        P_g    = power output to climb grade [Watts].
        P      = P_a + P_r + P_g = total power output [Watts].
        hp     = total power output [horsepower].
        heat   = C - (P + BM) = power wasted due to human inefficiency [Watts].
        BM     = basal metabolism [Watts].
        C      = total power consumption [Watts].
        kJ/hr  = total power consumption [kilo-Joules per hour].
        Cal/hr = total power consumption [dietary Calories per hour].

What do all those command line flags mean?

   C> bike_pwr +H
        bike_power [flag]*
            +H = display this message
            +O = explanation of output table headings
            +P = power in Watts (program solves for velocity)
            +C = consumption in Calories/hour (program solves for velocity)
            +D = prints display of the parameters.
            +M = metric units  (velocity in kph, weight and force in kg)
            -M = English units (velocity in mph, weight and force in lb)
            -D = suppresses display of the parameters.
            -A = linear coefficient of air resistance (A1).
            -a = quadratic coefficient of air resistance (A2).
            -b = basal metabolism rate [Watts per kg]
            -e = human cycling efficiency
            -f = table format:  1 5 10 20 33
            -g = grade of hill = vertical_rise / odometer_distance
            -i = increment in output table
            -n = number of entries in output table
            -r = coefficient of rolling friction
            -s = set of pre-specified parameters:  u s d atb
            -t = transmission efficiency of bicycle drivetrain
           -vm = first velocity in output table
           -vw = velocity of the wind (+ for headwind, - for tail)
          -vwc = the wind given is a cross wind.
           -wc = weight of cyclist
           -wm = weight of and clothing

Example 2:

Suppose I'm going to climb a 6% hill into a 10 mph headwind. How fast do I have to go to burn Calories at a rate of 700, 800, or 900 per hour?

   C> bike_pwr -D +C700 -i100 -n3 -g.06 -vw10 -a.27
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
  5.9  14.6    36   12   122    9   179  0.24   540   95    814     700
  6.7  14.9    45   14   139   10   208  0.28   627   95    931     800
  7.4  15.2    54   16   155   12   237  0.32   715   95   1047     900

Example 3:

I'm going 22.3 mph on a flat smooth road, about as fast as I can sustain:

   C> bike_pwr -vm22.3 -r.004 -a.172
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
 22.3   4.5   170   31     0   11   212  0.28   640   95    947     814

In my mirror I see a paceline coming up at 25 mph, so I drop in behind and find that with the same 212 Watts power output, I can keep up with the paceline, because of the draft (A2 = 0.12 at 25 mph):

   C> bike_pwr +P212 -r.004 -a.12
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
 25.0   4.1   167   35     0   11   212  0.28   639   95    947     814

But then we hit this 10% hill, and I have to stand out of the saddle, and my speed quickly drops, and the paceline leaves me behind.

   C> bike_pwr +P212 -r.004 -a.36 -g.10
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
  5.4  18.7     5    8   189   11   212  0.28   640   95    947     814

With the 53-42T x 12-21T drivetrain on my bike, my lowest gear is (42/21)*27 = 54 inch. So my cadence is now 5.4/(0.003*54) = 33 rpm. And at the top of the hill I notice this pain in my left knee.

Exercise 3a:

If Pedro Delgado can produce a steady output of 375 Watts on a TdF road stage, and a can deliver 450 Watts for short very steep sections, what gear-inch will he need to maintain a cadence of 50 rpm on the steepest hill in the 1990 TdF? (The climb to Alpe d'Huez has an average grade of 8.1%, maximum grade of 14%. Assume that he climbs seated with air resistance coefficient A2 = 0.27).

Exercise 3b:

On the 8.1% grade, suppose he gets help by drafting a teammate, which reduces his air resistance coefficient by 7% down to A2 = 0.25. How much faster can he then go with his 375 Watts?

Example 4:

My usual time trial circuit has a 2% uphill grade on the 20 km going out, and then I turn around and enjoy the 2% downhill all the way back. I put out a constant 300 Watts and get a time of 1:01:43. (This is not the best way to ride this course.) What would be the slope of a constant-grade pure uphill course that would "equivalent" to my circuit? (i.e. require the same average power output to achieve the same time)

40 km / (1 + (1 + 43/60)/60) = 38.9 kph

A little trial-and-error with the -g flag gives:

   C> bike_pwr +P300 -r.004 -g.004 +M
  kph  F_kg   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    kJ/hr 
 38.9   2.7   218   34    34   15   300  0.40   905   95   1300    4680

So 2% up and 2% down is "equivalent" to at most 0.4% pure uphill grade. ("at most", because better strategy would have given a better time for the up-and-down circuit).

Exercise 4a (not easy):

What are the speeds going out and coming back on the up-and-down circuit that give the best time for an overall average output of 300 Watts? What is the equivalent pure uphill grade?

Exercise 4b (significantly harder):

What are the three speeds for a circuit that is 10 km uphill 2%, 20 km flat, 10 km downhill 2% that give the best time for an overall average output of 300 Watts?

Example 5:

How fast can a 150 lb rider on a 25 lb bicycle coast down a 12% hill?

Here the grade is -0.12. We will assume that the rider goes into a tuck which reduces the air resistance coefficient to 0.145.

   C> bike_pwr +P0 -wc 150 -wm 25 -a 0.145 -g -0.12
grade of hill = -12.0%                weight =  175.0 lb
air resistance coeff = (0.1450, 0)

  mph  F_lb   P_a  P_r   P_g    P    hp   heat   BM     C    Cal/hr
 55.3   0.0  2195  116 -2311     0  0.00     0   95     96      82


Just over 55 mph. That's where the air resistance P_a and rolling friction P_r finally overcome gravity P_g.

What if this rider had an enormous gear, and could apply additional power at those speeds?

   C> bike_pwr +P0 -n7 -i100 -wc 150 -wm 25 -a 0.145 -g -0.12
grade of hill = -12.0%                weight =  175.0 lb
air resistance coeff = (0.1450, 0)

mph F_lb P_a P_r P_g P hp heat BM C Cal/hr 55.3 0.0 2195 116 -2311 0 0.00 0 95 96 82 56.6 0.9 2344 118 -2362 100 0.13 323 95 518 446 57.7 1.7 2490 120 -2410 200 0.27 646 95 942 810 58.8 2.6 2632 123 -2455 300 0.40 969 95 1364 1173 59.8 3.4 2773 125 -2498 400 0.54 1292 95 1787 1537 60.8 4.1 2912 127 -2539 500 0.67 1615 95 2210 1900 61.7 4.9 3049 129 -2578 600 0.80 1937 95 2632 2263 So even applying 400 Watts, the speed is only increased by 4.5 mph. Adding a 50 lb weight, with no pedaling, raises the speed to 62.7 mph.

The program implements a simple model of human bicycling performance:

Force F = A2 * (v + h)^2 + A1 * (v + h) + (r + g) * (wc + wm)

Power_output P = (v * F) / t

Consumed_power C = (P / e) + (b * wc)

where the symbols are described by the command line flags listed above.

Comments in the source program include extended discussion of the derivation of parameter values from published sources. Suggestions for modifications of the model or its parameters are most welcome.

Revisions as of July 20, 1990: by

Ken Roberts roberts@cs.columbia.edu Columbia U. 212-854-8123, -8699 Home 201-862-0995

Since the posted description of July 18, three features have been added:

-t lets you specify the transmission efficiency of the bicycle drivetrain. The power loss due to drivetrain inefficiency is shown in the output table column labelled P_t.

+P lets you give the power output in Watts, and have the program solve for velocity, instead of the other way around.

+C lets you specify the power consumption on Calories/hour, and let the program find the appropriate velocity. The -n and -i flags can be used in the obvious way to create tables with multiple power output or calorie consumption values (see revised examples below).

-s lets you select a set of pre-specified parameter values. For example,

-ss gives values for a 175 lb rider with a 23 lb machine, position standing out of the saddle.

-sd gives values for a 150 lb rider with a 25 lb machine, position full downhill tuck.

By modifying the source code, you can make up your own sets.

There are also some new and modified examples in the description.

Also, the processing of +P and +C has been modified to handle speeds up to 286 mph (460 kph).

Revisions as of April 14, 1993: by

Mark Grennan markg@okcforum.uoknorm.edu Okla. State Finance 405-521-2780 Home 405-728-9836 CIS 76545,2506

This revision adds the " bike_pwr.ini " file to set defaults for the program. I also have change a couple of command line options to make room for more inprovements.

The -v options is now -vm, and the -h options is not -vw. This groups the major volicty controls together.

   -vm = first velocity in output table of the machine
        -vw = velocity of the wind (+ for headwind, - for tail)

I also included a new -vwc command line option to cacluate wind drag for cross wind problems.

I also found one bug. If you produce a table where a tail wind (-vw -20) is grater then the cyclist's speed (-vm 10), the graph show a positive P_a and calculated it as forware restance, not force.

Acording to Power bike it takes about 1.1 lbs of force to over come the basic internal friction of a bicycle. (your number may very)

   C> bike_pwr +P0
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
  0.0   1.1     0    0     0    0     0  0.00     0  111    111      96

So, how much of a tail wind does it take to over come this resitance? Answer: about 10mph.

   C> bike_pwr +P0 -vw-10
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
  0.0   0.0    -0    0     0    0     0  0.00     0  111    111      96

And with a 20mph tail wind we sould role how fast? Answer: about 9.8?

   C> bike_pwr +P0 -vw-20
  mph  F_lb   P_a  P_r   P_g  P_t    P    hp   heat   BM     C    Cal/hr
  9.8   0.0   -21   21     0    0     0  0.00     0  111    111      96

I'm not sure this number is right? so more calculations sould be made. However Power Bike does indecate it is is taking 21 Watts to overcome rolling restience and we are receiving 21 Watts from the wind.

www.mystrobl.de / ws / fahrrad /