Proposed Algorithms for Rating the ``Difficulty'' of Climbs

Dan Connelly

The following is my lame attempt at rating the "difficulty" of climbs. It assumes the availability of a profile, in terms of (altitude gained, local gradient) data. Two versions are presented, the first simpler at the expense of neglecting the important issue of gearing limitations.


Version 1: Effective Gradient Proportionality Model

Click here to jump to the enhanced version extensions

This is the simpler of the two proposed algorithms, based on the simplifying assertion that steeper is always tougher.


ASSERTIONS

The following are asserted:

  1. Given a climb of a given uniform grade, the "difficulty" of the climb is generally proportional to the altitude gained by the climb (for climbs in the limit of being unaffected by (5)). This is obvious from energy expenditure considerations.
  2. Given a climb of a given altitude gained, and of uniform grade, the difficulty of the climb is generally proportional to the grade of the climb (for climbs in the limit of being unaffected by (5)). Note steeper climbs actually require less energy due to reduced wind and rolling resistance in climbing them, so this assertion is non-trivial, but I'll take it as given. Here "grade" is defined as rise over run (tangent of angle) rather than rise over hypotenuse (sin of angle). While from strictly gravitational considerations the latter is preferred, using the former introduces an implicit secant-of-angle factor to represent traction, orientation, and balance problems associated with steep grades.
  3. The difficulty of a climb with non-uniform effective grade (see assertion 5 for definition of effective grade) can be expressed as a sum over the difficulties over the sections of piecewise-constant effective grade.... the rating system is linear.
  4. A "climb" is defined to have no negative grades -- it is positive or zero gradient the whole way. (zero grades can be evaluated in the zero-gradient limit.... a further approximation can treat short intermediate descents as the zero-gradient limit, as well.)
  5. The body has the ability to "smooth out" short, steep sections by drawing upon anaerobic reserves, or whatever. This effect can be described by an "effective grade" which is a convolution of the actual grade with a smoothing function with respect to the altitude. Thus the following two climbs are not equivalent; the first is harder.
           ___
          /    
         /      
        /        
    ___/        
    
    steep, uniform
            __
          _/   
        _/      
      _/         
    _/            
    
    steep, "staircase"

  6. Nothing else matters (altitude, road surface, presence of switchbacks, sun exposure, wind, air temperature, extent of local emissions controls, driver hostility, the presence of Oliverio Rincon shredding the pack from the front....). This is obviously unrealistic, but simplifies things.

DEFINITIONS

The following variables are defined:

g(z) := dz/dx (derivative of change in altitude with respect to
        horizontal position
geff(z):= the effective grade, derived from g(z) convolved
        with f(z).
z    := altitude relative to start of the climb
zf   := the final altitude of the climb relative to the
        initial altitude of the climb.
x    := position, as determined in the sum of the magnitude of
        translations in altitude and longitude, but not altitude.
zt   := a "threshold altitude change" representing the change in
        altitude of a climb which one can "smooth out"... for
        "stair-steps" which gain much less than this, the nearby
        average grade, and not the local grade, matters.
        zt=25 meters is proposed as a good trial value.
f(z) := a smoothing function incorporating zt, expressed as a function
        of z.  geff(z) = f(z) * g(z).
f0   := the usual Gaussian normalization constant (a function of zt),
        or for discrete data, a value calculated to normalize
        the weighted-sum approximation to the gaussian convolution.
r    := the rating of the climb's difficulty.

FORMULAS

A formula which captures the above assertions is then the following:

    
f(z)     = f0 exp[-z2/(2 zt2)]
geff(z) := f(z) * g(z)
r        = integral[0, zf] geff(z) dz

note: "*" is the convolution operator, in this case:

  f(z) * g(z) := integral[0, zf]{ f(z-z') g(z') dz' }

If the data available are discrete points, this convolution and integration can be approximately carried out as follows, assuming data describing constant-grade road segments with index running from 1 to n:

   f[i,j] := exp[(z[i] - z[j])2/(2 zt2)]
   f0[i]   = sum[j=1, j=n]{ f[i,j] }
   geff[i] = sum[j=1, j=n]{ f[i,j] g[j] } / f0[i]
   r       = sum[i=1; i=n] { geff[i] dz[i] }
where dz[i] is the altitude gain associated with road segment i, and g[i] is the slope (rise/run) of road segment i.

DISCUSSION

The result? It's simple, really. For long, steady climbs it simplifies to:

  r -> (altitude gained)2 / lateral position change
or, to high accuracy for typical climbs:
  r -> (altitude gained)2 / distance travelled.

Note the "rating" has units of distance. For a 45 deg hill, the rating is the altitude gained.


EXAMPLE

Unfortunately, on-line data on hill profiles appears to be spotty, and thus evaluating hills based on this formula is presently difficult. However, here is the result as applied to a previously posted profile of L'Alpe d'Huez. "Rating" is the rating of the climb, in meters, for all road segments up to and including the road segment described in the table row. "z" is the mean altitude of the road segment, relative to sea level. "g" is the slope of the road segment (rise/run). "geff" is the slope convolved using the discrete approximation to the smoothing function for zt = 25 meters. Each segment in this description has a road length of 500 meters. Going to finer resolution can only increase the rating by enhancing non-uniformity of the slope, but due to the smoothing function the effect on the results of undulations gaining less than 25 meters is diminished.

 

z       g         geff      rating 
832.104 0.0856565 0.0829803 3.54093
871.728 0.0733485 0.0794553 6.44709
914.4   0.0980033 0.0931377 10.9892
961.644 0.0918247 0.0925473 15.2205
1007.36 0.0918166 0.0896961 19.3210
1050.03 0.0795101 0.0775347 22.3937
1086.62 0.0672113 0.0612444 24.4473
1112.52 0.0365845 0.0597871 25.5402
1152.14 0.122836  0.100655  31.6761
1202.43 0.0795101 0.0820164 34.9264
1240.53 0.0733364 0.0745542 37.6529
1277.11 0.0733566 0.0734801 40.3408
1313.69 0.0733566 0.0782419 43.2029
1362.46 0.122836  0.106524  49.6966
1406.65 0.0549427 0.0669758 51.5337
1437.13 0.0672113 0.0657201 53.7373
1472.18 0.0733364 0.0714754 56.3512
1508.76 0.0733566 0.0690801 58.8781
1540.76 0.0549427 0.0666736 60.7070
1577.34 0.0918247 0.0796566 64.3489
1616.97 0.0672113 0.0740483 66.8317
1653.54 0.07949   0.0779405 69.9197
1694.68 0.0856525 0.0834585 73.4809
1735.84 0.0795101 0.0805263 76.6722
1775.46 0.07949   0.0795184 79.8227
1815.09 0.0795101 0.0795057 82.9735

total rating: 83.0 meters
L'Alpe d'Huez calculation, effective-grade-proportional algorithm

Note the uniform-effective-grade approximation yields:
rating = rise2/run = 74.5 meters


APPENDIX: source code, data

The following is the quick-and-dirty nawk (see note below) script used in the L'Alpe d'Huez example. It assumes an input stream with columns labeled "km" and "m", the former for distance along the road in kilometers, the latter for altitude in meters, for points along the road, including the start and finish of the climb.

 

km   ft   m      
0.0  2660 810.768
0.5  2800 853.440
1.0  2920 890.016
1.5  3080 938.784
2.0  3230 984.504
2.5  3380 1030.22
3.0  3510 1069.85
3.5  3620 1103.38
4.0  3680 1121.66
4.5  3880 1182.62
5.0  4010 1222.25
5.5  4130 1258.82
6.0  4250 1295.40
6.5  4370 1331.98
7.0  4570 1392.94
7.5  4660 1420.37
8.0  4770 1453.90
8.5  4890 1490.47
9.0  5010 1527.05
9.5  5100 1554.48
10.0 5250 1600.20
10.5 5360 1633.73
11.0 5490 1673.35
11.5 5630 1716.02
12.0 5760 1755.65
12.5 5890 1795.27
13.0 6020 1834.90
L'Alpe d'Huez data

 

(NF==0){
  NR--;
  next;
}
(NR==1){
  for (i=0; i++<NF; )
    if ($i == "km")
      x_col = i;
    else if ($i == "m")
      z_col = i;

  if ((x_col == 0) || (z_col == 0)){
    if (x_col == 0)
      print "x column not found";
    if (z_col == 0)
      print "z column not found";
    exit;
   }

  xnew = 0.0;
  znew = 0.0;
  n = 0;

  zt = 25;
  twoztsquared = 2*zt*zt;

  next;

}

{
  xold = xnew;
  zold = znew;
  xnew = 1000.0*$x_col;
  znew = 1.0*$z_col;
}
(NR>2){
  if (xnew==xold)
    next;
  else if (znew > zold){
    gavg = (znew - zold)/(xnew - xold);
    gavg /= sqrt(1 - gavg*gavg);
  }
  else
    gavg = 0.0;

  if (znew>zold)
    dz[n] = (znew-zold);
  else
    dz[n] = 0.0;
  g[n]  = gavg;
  z[n]  = (znew+zold)/2;
  n++;
}
END{
  /* calculate the hill's rating */
  r=0;
  print "z","g","geff","rating"
  for (i=0; i<n; i++){
    f0 = 0.0;
    f1 = 0.0;
    for (j=0; j<n; j++){
      f0 += (df0=exp(-((z[i]-z[j])2)/twoztsquared));
      f1 += g[j]*df0;
    }
    r += dz[i] * (geff = f1/f0);
    print z[i],g[i],geff,r;
  }
  
}
nawk script

Note: nawk is a simple interpreted stream-oriented language with C-like syntax commonly found on UNIX systems.


Version 2: Anaerobic Threshold Cadence Dependent Model

Click here to jump to the simplified version.
Click here to jump to the inverse-speed-convolution enhancement.

This is the more complicated of the two proposed algorithms, based on the assertion that steepness becomes a concern when and only when a desirable cadence can no longer be maintained.


ASSERTIONS

The following change in the assertions from the simple model is here applied:

  1. Effect of Grade on Difficulty
    1. Given a climb of a given altitude gained, and of uniform effective grade, when one is forced to ride in a gear yielding a cadence at anaerobic threshold much below the optimal cadence, difficulty is superlinear with the ratio of the optimal cadence to the actual cadence.
    2. Given a climb of a given altitude gained, and of uniform effective grade, when one is able to ride at or below anaerobic threshold at optimal cadence, the difficulty of the climb is roughly independent of grade.

 


DEFINITIONS

The following variables are defined:

g(z) := dz/dp (derivative of change in altitude with respect to
        distance along the road)
geff(z):= the effective grade, derived from g(z) convolved
        with f(z).
g0:= The critical effective grade above which one is
        no longer able to maintain the optimal cadence at powers
        at or below anaerobic threshold.
z    := altitude relative to start of the climb
zf   := the final altitude of the climb relative to the
        initial altitude of the climb.
p    := position, as determined by position along the road, as one
	would measure with an odometer.
seff(z):= secant of road angle associated with road at grade 
        at effective grade (used to represent traction, balance,
	and orientation difficulties associated with steep roads)
zt   := a "threshold altitude change" representing the change in
        altitude of a climb which one can "smooth out"... for
        "stair-steps" which gain much less than this, the nearby
        average grade, and not the local grade, matters.
        zt=25 meters is proposed as a good trial value.
f(z) := a smoothing function incorporating zt, expressed as a function
        of z.  geff(z) = f(z) * g(z).
f0   := the usual Gaussian normalization constant (a function of zt),
        or for discrete data, a value calculated to normalize
        the weighted-sum approximation to the gaussian convolution.
c0   := the optimal pedalling cadence
lmin := the minimum development available with ones gearing, defined
        as the distance the bike travels with one full turn of the cranks
        in the lowest gear.
vzat := the rate of altitude gain when riding at anaerobic threshold
        assuming the amount of power available for overcoming gravity is independent
	of the grade of the road.  This assumption is tested only for grades above
	the critical grade, so that it breaks down for shallow grades is not of
	concern.  This parameter is a measure of ones power/weight ratio, where
	weight includes the weight of the bike, clothing, etc.
r    := the rating of the climb's difficulty.

FORMULAS

The effective slope is calculated as in the simple model, as follows (note a different definition of "grade" is used here):

f(z)     = f0 exp[-z2/(2 zt2)]
geff(z) := f(z) * g(z)

The maximum effective grade at which one can optimally spin below anaerobic threshold can then be calculated thus:

g0    = vzat / (c0 lmin)

Then a formula for climb difficulty, consistent with the assertions (including 2a and 2b), is the following. Note the inclusion of seff(z), which is singular for extended sheer cliffs, to represent the difficulties associated with traction, balance, and orientation imposed by steep grades. This term was implicitely included in the effective-grade-proportional model through the use of the tangent rather than the sine of the road angle in the definition of grade used there. The secant of the effective angle (after convolving the grade over altitude) is used rather than the secant of the actual, local road angle due to several factors, the most important being the large amount of "discretization noise" typically found in grade data.

seff(z)  = 1 / sqrt[1 + geff(z)2]
r        = integral[0, zf] {geff(z) ( 1 + K (geff(z) / g0)^n ) seff(z) dz}
for some empirically-determined value of K and n. This is a strictly ad-hoc formula designed to analytically capture the essense of the situation -- that difficulty is roughly grade-independent until one runs out of gears, when the difficulty becomes strongly grade-sensitive. Trial values might be:
K        = 1/4
n        = 2   
Then at half-optimal cadence, difficulty is increased by a factor of two. At third-optimal cadence, difficulty is increased by a factor of 3.25. And at quarter-optimal cadence, difficulty is increased by a factor of 5. At the threshold of degradation of cadence, difficulty is increased by a factor of 1.25 (representing the fact that one has no room below AT at optimal cadence).

EXAMPLE

The L'Alpe d'Huez example will be used again. However, specification of the additional parameters is needed. The following values will be assumed:

vzat      = 15 meters/min
lmin      = 3.4 meters  (39/24 w/ 700c tires)
c0        = 90/min

Then,

g0     = 0.049

 

z       g        geff      rating
832.104 0.085344 0.0849828 60.9406
871.728 0.073152 0.073914  109.347
914.4   0.097536 0.0970781 185.391
961.644 0.09144  0.091482  253.803
1007.36 0.091432 0.0912249 322.083
1050.03 0.07926  0.0788687 376.319
1086.62 0.06706  0.0621727 417.531
1112.52 0.03656  0.0441092 437.907
1152.14 0.12192  0.119245  550.466
1202.43 0.07926  0.079175  604.814
1240.53 0.07314  0.0733638 653.039
1277.11 0.07316  0.0731591 701.213
1313.69 0.07316  0.0733938 749.46
1362.46 0.12192  0.120819  863.377
1406.65 0.05486  0.0569856 896.072
1437.13 0.06706  0.0660944 938.275
1472.18 0.07314  0.0727841 986.318
1508.76 0.07316  0.0715313 1033.99
1540.76 0.05486  0.0581107 1066.89
1577.34 0.09144  0.0890213 1134.11
1616.97 0.06706  0.0683241 1176.9
1653.54 0.07924  0.0787919 1231.09
1694.68 0.08534  0.0850696 1292.07
1735.84 0.07926  0.0793934 1346.5
1775.46 0.07924  0.0792412 1400.86
1815.09 0.07926  0.0792594 1455.23


Total rating = 1455 meters.
L'Alpe d'Huez calculation, cadence-at-AT algorithm

Note the rating here represents the equivalent small-grade climbing. Thus, despite the section of road described here gains only 1024 meters, for the individual with the gearing described by these values of geff and vzat, it is of "equivalent difficulty" to a shallow-grade climb gaining 1455 meters, given the assumptions about the form of the model. With lower gearing, or with higher power/weight at AT, the rating would be closer to the net altitude gained.


Version 3: Inverse-Speed Profile-Convolution Enhancement to Cadence-Dependent Model

Click here to jump to the simplified version.
Click here to jump to the basic cadence-dependent model.

This enhancement to the cadence-dependent model better models the time spent on reduced grade sections for purposes of assessing their effect on the climb difficulty.


ASSERTIONS

The following change in the assertions from the cadence-dependent model is here applied. Note this assertion is actually a carry-over from the effective-grade-proportional model.

 

  1. The body has the ability to "smooth out" short, steep sections by drawing upon anaerobic reserves, or whatever. This effect can be described by an "effective grade" which is a convolution of the actual grade with a smoothing function with respect to an estimate of the time spent on the section of road while riding at anaerobic threshold. Thus the following two climbs are not equivalent; the first is harder.
           ___
          /    
         /      
        /        
    ___/        
    
    steep, uniform
            __
          _/   
        _/      
      _/         
    _/            
    
    steep, "staircase"

 


DEFINITIONS

The following variables are defined:

 
g(p) := dz/dp (derivative of change in altitude with respect to distance along the road)
g(z') := the same value represented as a function of transformed altitude z', which is a function of p.
geff(z'):= the effective grade, derived from g(z') convolved with f(z'(p)).
g0:= The critical effective grade above which one is no longer able to maintain the optimal cadence at powers at or below anaerobic threshold.
z:= altitude relative to start of the climb
z'(p):= transformed altitude, a coordinate proportional to the time it takes to reach position p on the road from the start of the climb while riding at anaerobic threshold, scaled by the anaerobic-threshold-limited climbing rate.
sat(p):= speed-at-anaerobic-threshold as a function of position.
z'f := the final effective altitude of the climb relative to the initial altitude of the climb (probably zero).
p:= position, as determined by position along the road, as one would measure with an odometer.
seff(z'):= secant of road angle associated with road at grade at effective grade (used to represent traction, balance, and orientation difficulties associated with steep roads)
zt := a "threshold altitude change" representing the change in altitude of a climb which one can "smooth out"... for "stair-steps" which gain much less than this, the nearby average grade, and not the local grade, matters. zt=25 meters is proposed as a good trial value.
f(z'):= a smoothing function incorporating zt, expressed as a function of z. geff(z') = f(z') * g(z').
f0 := the usual Gaussian normalization constant (a function of zt), or for discrete data, a value calculated to normalize the weighted-sum approximation to the gaussian convolution.
c0 := the optimal pedalling cadence
lmin := the minimum development available with ones gearing, defined as the distance the bike travels with one full turn of the cranks in the lowest gear.
vzat := the rate of altitude gain when riding at anaerobic threshold assuming the amount of power available for overcoming gravity is independent of the grade of the road. This assumption is tested only for grades above the critical grade, so that it breaks down for shallow grades is not of concern. This parameter is a measure of ones power/weight ratio, where weight includes the weight of the bike, clothing, etc.
vxat := the rate at which one can ride on a windless, flat road at anaerobic threshold.
r:= the rating of the climb's difficulty.


FORMULAS

The transformed altitude z' is an altitude-equivalent of the time it takes to reach a particular point in the road. Note that even on descents, which take positive time to traverse, the effective altitude is thus increasing, despite the fact that the true altitude is decreasing.

To calculate the time taken to reach a particular location in the road, one must have a model for speed as a function of grade. The conventional (see Whitt and Wilson, "Bicycle Science", MIT Press, 1994) model for power versus speed, when evaluated at anaerobic threshold power, and cancelling out the anaerobic threshold power, yields the following:

(sat(p)/vxat)3 + (sat(p)/vzat) * g(p) - 1 = 0

This can be evaluated numerically to solve for speed as a function of p, sat(p).

One then can then derive the following transformation:

 

dz'(p) = dz(p) [ vzat / {g(p) sat(p)}]

For zero grades, this must be evaluated in the zero-grade limit, where it becomes:

 

limg(p)->0 dz'(p) = dp / vxat

Then, the convolution of grade with effective altitude can be carried out to yield the effective grade, similar to in previous models. Note the non-analytic hack of clipping effective grade at zero -- it is assumed riding on the flats and riding on descents can both be done at optimal cadence within anaerobic threshold.

 
f(z')=f0 exp[-z'2/(2 zt2)]
geff(z') :={f(z') * g(z'), f(z') * g(z') > 0
0, f(z') * g(z') <= 0
where the anaerobic-threshold-effective grade is:

 

g0    = vzat / (c0 lmin)

The effective-secant-model for ultra-steep-induced difficulties is then factored into the cadence-based formula to yield:

 
seff(z') = 1 / sqrt[1 + geff(z')2]
r = integral[0, z<sub><small>f</small></sub>] {g<sub><small>eff</small></sub>(z') ( 1 + K (g<sub><small>eff</small></sub>(z') / g<sub><small>0</small></sub>)^n ) s<sub><small>eff</small></sub>(z') dz}
for some empirically-determined value of K and n.

Note: In the above equation the integration is carried out with respect to the true altitude and not the effective altitude. This is somewhat of a subtlety, and its use is a matter of judgement. The reasoning is that flat sections, despite their positive effective altitude change (recall effective altitude change is proportional to the time needed to traverse the road segment at anaerobic threshold), should not contribute positively to the hill difficulty. In the hill-smoothing convolution integral in the determination of the effective grade, however, they are of significance, since they provide aerobic riding at optimal cadence for short-term recovery. Thus in the convoltion integral the effective altitude is the variable of integration.

Trial values of K and n remain:
K        = 1/4
n        = 2   

Additionally, the parameters associated with gearing and fitness may be chosen as follows for a typical rider, perhaps:

 
vzat= 15 meters/min
vxat= 550 meters/min(33 kph)
lmin= 3.4 meters(39/24 w/ 700c tires)
c0= 90/min

 

Copyright © 1995-2007 Western Wheelers Bicycle Club, Inc.
All Rights Reserved