Tuesday, July 20, 2010

Rating Climbs: testing the new formula

So to summarize, I developed a hillclimb rating algorithm using full profile data, which is the following, where I've made a few tweaks:
  1. Preferably interpolate initial profile data to a uniformly spaced mesh. This facilitates smoothing. I use a 10 meter mesh spacing. This step is optional.
  2. Smooth the initial profile, as needed, to reduce measurement noise (for example altimetric data from a Garmin Edge 500). I use convolution of a single period of a cosine-squared function with full-width-half-maximum of 50 meters.
  3. Calculate a "typical" time for each position point using a heuristic equation: dt/ds = (1 second/14 meters) ln [ 1 + exp(50 g) ], where t is time, s is distance, and g is the derivative of altitude with respect to s.
  4. Smooth grade versus time with a smoothing function. I use convolution with a single period of a cosine-squared with full-width-half-maximum of 30 seconds, yielding a smoothed function g*. This operation, if done properly, should reduce the grade at the start and finish of the climb, which reduces the eventual rating of very short climbs like Filbert Street (which gains 18 meters).
  5. Find the average value of f(g) = exp(g / g0) with respect to distance.
  6. Multiply this by the net altitude gained.

The key parameters in all of this are the smoothing time (I used 30 seconds here) and the scale rate of altitude gain g0. I initially proposed g0 = 10%, but then decided to use g0 = 8% instead. This latter choice placed increased emphasis on steep segments within a longer climb, for example if two climbs have the same net climbing and distance, the one with the more nonuniform grade will benefit from the lower g0.

Note the smoothing time I've changed from 15 seconds to 30 seconds. The choice of 15 seconds had been relatively arbitrary, based primarily on how far one could coast. But 30 seconds is the number used by Andrew Coggan in his power analysis metrics ("Training Stress Score" and "Effective Power"). So it makes sense to try and be consistent with that precedent. Note Coggan uses a square smoothing function rather than a cosine. Cosine is less prone to edge artifacts: the Fourier transform reveals a much more rapid attenuation at high spatial frequencies. But by matching the full-width-half-maximum of the two I yield similar smoothing at lower spatial frequencies.

An interesting aspect of this algorithm is the effect of descents on the final result. The algorithm isn't linear: the rating of two road segments is not the sum of the ratings of those segments. So you can't consider a descent segment in isolation. Rather it must be considered in the context of a full route profile. This is easy to see when the net climb gains zero altitude. You could argue the climbing section and the descending section have equal and opposite impact. But that means the contribution of the climbing segment depends on the details of the descending segment, and vice-versa. This is silly, so the notion that a segment of a total climb has a distinct contribution to the total rating is invalid. A rating is for a whole route, not a sum of parts from that route.

To test the algorithm, I'll consider a set of routes which have the same net climbing and net distance. Thus all of these routes have the same Fiets/Summerson rating, or the same rating using my simple formula, since each of these ratings depends only on net climbing and net distance. Additionally, each of the routes I'll consider has the same gross climbing (and gross descending).

I'll consider a "climb" which gains 300 meters at a climbing grade, then loses 100 meters at a descending grade, then climbs 300 meters at the climbing grade, all in 6 kilometers. Thus net climbing is 500 meters, gross climbing is 100 meters, and gross descending is 100 meters. The average magnitude of the rate of climbing with distance is therefore (gross climbing + gross descending) / distance = 11.7%. However, the climbing may be steeper if the descending is more gradual, or vice-versa.

Here's a representation of some of the profiles used:

profiles

I then calculated a rating for each of these profiles. To see if the rating behaves correctly, it's important to first say what "correct" is. It's fairly obvious that the rating should be harder the steeper the climbing portion. True, a more gradual descent provides more recovery than a steep descent ridden at the same speed, but more recovery isn't going to offset the increased difficulty of steeper climbing. Running the numbers yields the following:

rating versus climbing/distance

As hoped, the rating increases as the grade of the climbing portion increases, while both Fiets/Summerson and the simple formula yield the same rating for all cases. So is this better? Ratings are always subjective, and maybe it could be argued the "merit" of increased climbing grade is cancelled by the "demerit" of a lower fraction of the total distance being uphill. But if rating difficulty is the goal, the full-profile scheme is on target.

No comments: