Saturday, January 19, 2013

modeling average speed versus hilliness

Recently I described a heuristic bike-speed formula which I thought came close to describing the behavior of a typical cyclist riding on hilly terrain. On climbs the rider tends to go relatively hard, approaching a constant rate of vertical ascent (VAM) until the road becomes too steep for gearing and balance, then the VAM drops. On descents, the rider's speed increases until it reaches a perceived safe limit, with additional delays for curves.

It's interesting to take this model and predict how hills affect average speed. To first order, in other words for hills of near-zero grade, a rider goes a bit faster uphill, a bit slower downhill, and on average the speed is the same. But for any significant grades this is no longer the case.

First, I'll run the model in terms of a "modified grade", which is the climbing per unit distance of travel, the sine of the angle, rather than conventional grade, which is the climbing per horizontal distance, the tangent of the angle. I do this because it avoids extra math, and it's more closely tied to the power-speed equations.

I start the analysis by assuming there is a particular statistical distribution of road grades on any course. By grade, I don't mean for 1 cm, but rather for distances beyond which inertia can extend. It's tempting to assume a normal distribution for grades per the Central Limit Theorem, but road grades don't happen by chance; they happen by design. A course over mixed roads will encounter a range of grades, but at some point there's a hard cut-off. This is important because my speed model includes a term proportional to an exponential of grade to the fourth power for time taken to ride a section of road, so if the statistical probability of grades only falls off proportional to an exponential of grade to the second power, pathlogically large grades will dominate the result. Since these grades don't exist on bikeable routes, a statistical distribution which truly goes to zero is needed.

So I used the square of a cosine, a nicely analytic function which goes to zero. The probability function of a given grade is then:

P(g) = cos2(π g / 2 gmax) / gmax

This can be simplified:

P(g) = (1 + cos(π g / gmax)) / 2gmax

I can then integrate it:

∫ P(g) dg = [ g / gmax + 1/π sin(π g / gmax) ] / 2

So then if I want to calculate the delay associated with grades from (g − Δg /2) to (g + Δg /2) I can take the definite integral of the probability distribution over the interval and multiply it by the inverse-speed associated with the speed at grade g. That provides an approximation to the amount of time spent in that grade range divided by the total course distance.

If I want to go from this statistical distribution of graded to total climbing for the course, total climbing is the weighted sum of positive grades (since I'm using an effective grade equal to the sine of the road angle) multiplied by total course distance. I'll call that γ, a grade-like quantity representing the total climbing divided by the total course distance. For example, a threshold which was recommended to me by Bill Bushnell as a metric for an exceptionally steep century ride is 100 feet of climbing per mile (10 thousand feet per 100 miles). This corresponds to γ = 1.89%.

I can calculate γ as follows, where the integral is from 0 to gmax (ignoring descents):

∫ P(g) g dg =
∫ (1 + cos(π g / gmax)) ( g / 2gmax ) dg =
gmax [ z2 / 2 + z sin(π z) / π + cos(π z) / π2] / 2,

where I've substituted z = g / gmax. I evaluated this using The Wolfram Integrator, since my analytic integration skills are lame (it smells like integration by parts).

After evaluating this at the end-points, which are z = 0 and 1, the sine term goes away:

γ = gmax [ 1/2 − 2/π2 ] / 2

Or evaluating this numerically yields:

γ = 0.149 vmax

Or conversely:

vmax = 6.72 γ

So this suggests if I know the total climbing per unit distance, and I assume the grades approximate a cosine-squared probability function, then the maximum grade is around 6.72 times the total climbing per unit distance. For 100 feet per mile of total climbing, this corresponds to 12.74%.

Realistically this is probably low, because it neglects the observation that roads often have extended flat portions and isolated hills. It applies more to rolling hills where the road is constantly going either up or down. So it's just a plausible example, not necessarily typical.

With this assumption, the following relative difference in course versus climbing density results:

plot

So for the y-axis = 0.2, the a course would take 6 hours instead of 5 had it been flat, neglecting fatigue. I'll define δ to be the fractional delay.

I played around with various equations to model this and found an excellent fit with the following differential equation:

dδ/δ = (dγ/γ) [ 2.19 - 46.7 γ + 786.8 γ2 ]
d ln δ = 2.19 d ln γ - 46.7 dγ + 786.8 γ dγ

Integrating yields

ln δ = 2.19 ln γ - 46.7 γ + 393.4 γ2
δ = K γ2.19 exp(-46.7 γ + 393.4 γ2)

I did a one-parameter fit to determine K:

δ = 3585 γ2.19 exp(-46.7 γ + 393.4 γ2)

The fit is shown on the prior plot.

This model assumed the course was uniformly hilly. However, typical courses aren't: they have flat sections and hilly sections. If I assume a fraction f of a course is hilly and a fraction 1 − f is flat with negligible climbing, then the climbing density of the hilly section is γ / f. From this, I get a net δ:

δ = 3585 f (γ / f)2.19 exp(-46.7 (γ / f) + 393.4 (γ / f)2)

This, however, is also a gross simplification because even flat sections have finite climbing density. But it gives me an extra knob to turn: one for total climbing, one for how steep the climbs and descents are.

So overall, the calculation yields an interesting and plausible result for the effect of rolling terrain on a typical cyclist's net pace.

No comments: