Monday, November 30, 2009

Low-Key Hillclimbs: best scores ever

Since thanks to Ron Brunner and Dean Larson, I now have the complete set of Low-Key Hillclimb results (the '90's pages were lost when Giorgio Cosentino, the webmaster at the time, had his account expire, and I wasn't backing up his stuff, and I lost the older stuff when my UNIX account from grad school got flushed). Anyway, a bit of work saved then doing backups resulted in a lot more work today reconstructing results. After typing in data from scans of Dean's printouts, getting some of the HTML from the Wayback machine (and all of 1995), regenerating 1996-1997 HTML from the data I'd typed in, and mining data from the existing HTML, I now have a nice set of times for every week the series was run. The exception was 1998 where I barely had anything to work with, so generated all fresh HTML using my current scripts, modifying the scoring algorithm to match that year's.

The series started in 1995 with the top rider getting 100 points, everyone else a score equal to the % of this time. Men and women were grouped together. Then at the end of the series of twelve events the top six scores were summed. This worked out fairly well, except results were too strongly influenced by who showed up. A really fast guy shows and everyone else's score is reduced substantially from what it would have been, essentially reducing the importance of that week's result. I played around with some regression methods using a model assuming a linear combination of rider and climb coefficients, but that was too complex for general use. So I stuck with the simple normalize-to-the-fastest method.

In 1996 I separated men and women, so the fastest in each got 100 points. This was better, but since the number of women is generally small, they were even more subject to random fluctuation. Additionally this year I switched to a method where only one climb of the entire series was discarded, the lowest score for each rider, considering missed climbs to be zero. Then the next-lowest was multiplied by one, the next lowest by two, the next by three, etc, up to the highest scoring of the nine climbs which was multiplied by eight. These were then summed. This was okay, but led to some really high scores. It was also a bit too complex, as it wasn't so clear going into a given climb by how much one had to finish ahead of someone else to pull even in the overall, since the scores were resorted each week. Another issue is it still gave a lot of credit for simple attendance. Low-Key is supposed to be a fun fall activity, not an obsession, so when other life events get in the way, one shouldn't be punished for that. So in retrospect I think the 1995 method of keeping scores for only half the weeks was better.
Tracy Colwell, 1996 Low-Key Hillclimb men's point leader.

But I moved to Austin at the start of the 1997 series, so there wasn't any time to make any changes: 1997 used the same scoring scripts, written in awk, as 1996.

In 1998 I was barely involved at all, and Tracy Colwell took over the scorekeeping. Changes: more divisions with separate scores for not just men and women, but also for mixed tandems, recumbents, and tricycles. This year all scores counted and were simply added. It was a short series, with only five climbs completed, so this wasn't so bad.

That was it for version 1 of the Low-Keys. It was sort of a victim of its own success: bigger and bigger turnouts made it harder to manage, and with me not around to help, it simply didn't come back for 1999.

Kevin and I finally restarted the series in 2006 after meeting again at John Peckham's memorial ride. In a way the existence of the Low-Keys today is in memory of John, a way to use tragedy to catalyze good. A fresh start. I'd learned Perl while at Austin, and started redeveloping scoring scripts in that language. With a renewed appreciation for simplicity, I went back to the 1995 method of counting half the climbs completed so far, rounded up (modified for volunteer credit). But to avoid the issue with a fast rider suppressing everyone else's score, I used the median time for men and women (not counting tandems) as the 100 point reference. This worked out better: more consistent results for each rider week-to-week, at least among the men for whom the larger turnout provides for more stable statistics.
Tracy Colwell leads the pack in the first Low-Key of version 2: Montebello Road in 2006.

This system has worked so well, other than modifying volunteer credit a bit, it's stayed in place 2007-2009, and will be used again in 2010.

So here we are: thanks to Dean and Ron, and with a bit of work myself, we have eight years of wonderful data. Treating each week's climb with the "Low-Key version 2" algorithm of median normalization, I am able to accumulate lists of times and scores for each of the climbs or each of the riders. For example, here's the top twenty scores ever posted, out of 4945:
#  climb              week    name               time   score
1 Sierra_Road 2007(8) Christine_Thorburn 25:53 151.191
2 Bear_Gulch 2008(4) Jennie_Phillips 16:47 143.694
3 Montebello 1997(1) Tracy_Colwell 25:40 143.506
4 Bohlman_-_On_Orbit 1997(8) Tracy_Colwell 24:56 143.316
5 Mount_Diablo_(N) 2006(3) Kate_Ladan 62:57 142.759
6 Mt_Hamilton 1998(7) Joe_Lansing 132:31 141.687
7 Mount_Diablo_(S) 1997(3) Michael_Denardi 48:04 140.967
7 Mount_Diablo_(S) 1997(3) Tracy_Colwell 48:04 140.967
9 Quimby_Road 1998(5) Tracy_Colwell 24:18 140.466
10 Montebello 1997(1) Michael_Denardi 26:18 140.051
11 Montebello 1996(1) Henrik_Johansson 27:04 138.978
12 Lomas_Cantadas 2008(8) Tim_Clark 15:16 138.865
13 Soda_Springs 1997(5) Tracy_Colwell 30:03 138.602
14 Bohlman_-_On_Orbit 1996(6) Tracy_Colwell 26:13 138.525
15 Bohlman_-_On_Orbit 1997(8) Eric_Albrecht 25:58 137.612
16 Sierra_Road 2007(8) Lucia_Mokres 28:30 137.31
17 Montebello 2007(1) Chris_Phipps 26:05 137.252
18 Page_Mill 2006(6) Tracy_Colwell 33:12 137.199
19 Lomas_Cantadas 2008(8) Clark_Foy 15:28 137.069
The top score by far is from a multi-time Olympian. That seems right.

One note in the above: Joe Lansing's score was as a tricyclist. There were two tricyclists on Mt Hamilton that Thanksgiving of 1998. Pretty cool. Mark King broke Joe's trike record this year. Mark also rode the MegaMonster in 1998.

I'll post more such stuff on the Low-Key pages, as soon as I am able to write some HTML generators...

Sunday, November 29, 2009

Caltrain weekend "service"

Caltrain is tasked to be public transportation, not commuter rail. However, weekend service, especially "counter-commute" (SF->SJ AM, return PM) is so marginal to be almost useless. This weekend really reinforced that point. My coach was running a weekend training camp: rides daily at 8:30 am. I couldn't make it. Not Sunday, not Saturday, not even Friday which isn't an official holiday. Not even close.

I thought things were bad when service was restored in June 2004 following a two-year down-time due to track work to allow for "Baby Bullet" service, which required passing zones. After a period of debate in which four different scheduling options were considered, the worst of the four, full local service on each hourly train, was chosen. Every time it was suggested various stations would be omitted from the service of some or all of the trains, people from those stations would complain. People from places like Atherton, where the local station is within walking distance of the Menlo Park station, and also quite close to the Redwood City station. But it's the principle of the thing, after all.

So each additional stop adds two minutes. Only two minutes, right? But these two minutes quickly add up. And they can be the difference between making it somewhere in time or not doing so.

This used to be the case when the Alto Velo A-ride met at Peets in Los Altos at 8:30 am. The 7 am train from SF would get to San Antonio with just enough time for me to ride to Peets in time. That is if the train wasn't late at all. So sometimes I didn't make it. Those two minutes per stop at places like Atherton, Broadway, and Hayward Park were the difference.

But then the 7 am train was eliminated. Good bye, A-ride.

Eventually the A-ride moved to 9 am. Now it was back in the game. If it was headed north, I had a chance to intercept it, if I was lucky, by getting off the train further north of San Antonio and plotting an optimized trajectory. This took luck, and once again those two extra minutes were often the deciding factor. On the other hand, if the ride was heading south, game over.

A similar scenerio occurred with the Spectrum Ride, or with the Alto Velo B ride on Saturday. Early southbound train was 8 am. A bit of luck, and I could intercept.

It was harder for the Low-Key Hillclimbs, which I organize. These used to start at 10:00, with registration closing ten minutes before. I moved them back to 10:10 with reg closure @ 10 am to improve chances with the train at locations such as Montebello Road or Windy Hill Open Space Preserve. Again, a bit of luck was needed.

But then the coup de grâce . The first morning train was moved back to 8:15. Crash and burn A ride. Crash and burn Spectrum Ride. Crash and burn B ride. Crash and burn Low-Key Hillclimb. Not to mention those climbs which had required the 7 am train to reach in time, a significant number, including the traditional Thanksgiving climb of Mt Hamilton road. Caltrain was to me now essentially useless on weekends.

Someone was once quoted in the Caltrain newsletter that he'd only drive to work if he had to.... then he'd look for a new job. Well, an alternate spin on that is I'll only drive to play if I have to, but then I'll look for new places to play. So instead of riding down on the Peninsula (which is spectacular), I'm far more likely to ride up into Marin, or to take BART, a truly useful mode of public transit (at least on Saturdays), into the East Bay. BART runs every minutes in comparison to Caltrain's every hour. And on Saturday BART starts early: way early enough for me.

Caltrain claims there is insufficient demand to justify increasing the frequency or broaden the schedule range of weekend service. Yet with the level of service so wretched, so pathetic, so useless is it at all surprising demand for that service is weak? Who wants to show up at the station only to realize the next will arrive in 55 minutes, then it's up to an additional 1:30 to reach the destination? That's well over twice the time it would take to drive. Indeed, BART with its much denser schedule has weekend trains filled to a considerable fraction of capacity.

No, this is a parody of public transit. The bus is even worse, so I won't even go there. Someone should be able to get useful places by the crack of 9 am, if not sooner, and shouldn't need to make every stop along the way to get there.

Where else in the developed world is the public transit so poor on weekends?

Monday, November 23, 2009

Tandem Climbing Analysis from Brian and Janet

It's often suggested that tandems are slower climbing than single bikes. Yet it's rare that one gets to see solid data supporting this.

One nice thing about the Low-Key Hillclimbs is they generate a lot of interesting data. One nice thing about this year is we have Brian and Janet. They each did a climb solo, and did another climb as a tandem pair. Brian further ran another climb, but that's another matter.

While each climb is different, as long as a climb is continuous and doesn't provide much opportunity for drafting, the ratio of a rider's speed to the median male speed, using single bikes only (I specifically refer to male speed as the number of males tend to be a lot more than the number of females, so there's less random variation in the median male speed), tends to be fairly constant one climb to the next. So I'll use the ratio of climbing speed to median male climbing speed as a measure of general climbing speed.

So here's a comparison:
  1. Brian and Janet on Mt Diablo in the Low-Key Hillclimbs: 110.3% of the male single median speed.
  2. Janet on Alba in the Low-Key Hillclimbs: 81.3% of male single median speed.
  3. Brian on Old La Honda at Low-Key Hillclimbs: 131.8% of median single male speed.
I'll assume the ratio of masses of Brian to Janet is 4:3. Then I should weight their speeds (roughly proportional to power:mass) proportionately. Doing this, using their individual speeds normalized to the median male single speeds, I get 110.2% for the predicted tandem speed. As a tandem they were 110.3%.

Not bad, all things considered. Of course, there's a ton of flaws with this analyis. But it's interesting how close the result is. Certainly there's no indication that the tandem is particularly slower than what would be predicted from the individual riders.

I was interested to see how out of phase their cranks were: 90°. It's more conventional for cranks to be in-phase, or sometimes 45° out of phase. Some people think out-of-phase cranks smooths out the pedal stroke. Brian and Janet make a strong case for this. It certainly doesn't seem to slow them down much.

Brian and Janet on Diablo

Metrigear Vector: orienting test data

Last time on this subject I came up with the following relation for determining the orientation of the spindle-based accelerometers relative to the desired coordinate axes:

tan Δφ = <a2> / <a1> ,
<ar> > 0,

where "<>" refers to a time average. But the time average isn't as straightforward as might initially be thought. Consider the case where the rider pedals a bit then the bike sits for several minutes. The accelerometers are accumulating data associated with the pull of gravity in a particular direction for an extended period of time. This isn't what's wanted. For the average of the transverse component of acceleration to go to zero (the component associated with the pedal around the circumference of its circle), we want to average over the angles of the circle, not really over time. A time average is a convenience, since accelerometers sample the acceleration at specific intervals in time. But if the pedals are sitting idle, we don't want to continue to accumulate the accelerations associated with that particular angle every single sample.

Ideally, then, to get an average not over time, but rather over angle, we'd take the time average weighted by the rate of change of the angle. I'll use brackets with a subscript φ to refer to the average with respect to angle:

<ax>φ = <ax (∂φ/∂t)> / <φ/∂t>.

So we need a way, even a crude way, of estimating how fast the cranks are turning. Well, the obvious approach is to use that oscillating gravity signal: it oscillates one per pedal revolution. It's probably not a bad approximation to assume the pedal is moving at a constant rate during each full oscillation of the gravity signal.

To isolate the gravity signal, we want to filter the data first. At the high-frequency end, there's all sorts of noise sources which get in the way. We can assume the rider will only be pedaling up to a cadence of for example 220 rpm ≈ 23 radians/sec. This is pretty much the top-end spin of even the best track rider. So the time constant shouldn't be much larger than 1/23 sec = 40 msec. Anything varying faster than this is likely from vibrations in which we have no interest. I'll recommend the smoothing time be set to double this: 80 msec. This will still preserve those 220 rpm oscillations, although the magnitude will be reduced around 50%. For the more common cadence range of 60 to 130 rpm, however, it will do a better job than a shorter time constant.

A simple "causal" low-pass filter ("causal" means referring only to past data, not future data) is to convolve the data with an exponential decay function with the desired time constant. In this case, we want to use a time constant of 80 msec. I'll admit right here I think another filter would work better. Decaying exponentials have a hard edge which preserves a bit too much noise. Gaussians are the best, but are in their pure form non-causal. A good compromise might be a gated sine wave (ie one half-period of a sine wave, using positive values only). I've been a bit lazy about implementing one of these, however. So for now I'll stick with the exponential.

But we also want to filter the data at the other end. Things which vary slowly over time need to be filtered, as well. For example, the bike's acceleration, the rate of change of cadence, and the centripetal acceleration proportional to the square of the cadence likely all vary more slowly than the gravity component. So a "high-pass" filter which filters out low-frequency components is also wanted.

A natural high-pass filter is differentiation: take the rate of change of the accelerometer readings with respect to time. In a discrete sense, differentiation corresponds to the ratio of the change in the accelerometer reading to the difference in time between the accelerometer readings.

So this is the resulting approach:
  1. Smooth the data with an exponential smoothing function with time constant 80 msec to filter out high-frequency noise.
  2. Take the discrete-time derivative of the smoothed data to filter out smoothly-varying contributions to the accelerometer readings.
  3. Measure a pedal stroke as the time between two zero crossings of an accelerometer signal.
A quick test of this can be applied to the Metrigear test data. First, it's important to note my version of the data was extracted from their low-resolution plot. Therefore I'm introducing a relatively random error which effectively increases the noise. But this is a good thing: a Vector on an actual bike will obviously be subject to more noise sources than the accelerometers attached to Guitar Hero hardware. Indeed, I liked the added noise so much I added more: to each data point I added a random perturbation with a roughly normal distribution function with σ = 0.1 g.

Here's the plots:

The top plot show the data before and after smoothing. You can see the effect: the data is obviously smoother, but also since these data are at the upper range of the targeted cadence range, the signal is somewhat attenuated. Smoothing also introduces a small delay, approximately equal to the smoothing time constant, which isn't important to this analysis.

The bottom shows the result of the differentiation step, done either after smoothing or without the smoothing step. The differentiation has eliminated the offset from a zero mean evident in the top plot. Furthermore, here the advantage of the smoothing is even more clear: the unsmoothed curve is essentially useless. The smoothing provides something for which we can have reasonable hope to get cadence from zero crossings if we take care to not accept multiple zero crossings which are too close together.

I'd like to repeat these plots with a better low-pass filter. When I get a chance.... certainly after I'm done scoring tomorrow's Low-Key hillclimb, the final for the 2009 series!

To be continued...

Metrigear Vector: accelerometer orientation

Last time I described modeling some MetriGear Vector test data. The data were from two accelerometers which appeared to be misaligned relative to the radial and tangential axes of the test rig.

What I'll do here is a bit of a restatement of a previous post. Yet since I have real data to chew on here it's worth starting from the beginning.

Suppose we have two acceleration components, a1 and a2. We know these accelerometers are oriented at a right angle (90°) relative to each other, and that they're perpendicular to the principal axis of the spindle. However, we aren't sure of the orientation of the spindle with respect to the end of the crank. This orientation can be described by an angle Δφ.

We wish to derive acceleration components ar, a radial acceleration component toward the center of the pedal's orbit, and at, an acceleration component in the direction of the pedal's motion. Then we can write a relation:

a1 = ar cos Δφat sin Δφ ,
a2 = ar sin Δφ + at cos Δφ ,

so if Δφ = 0, then a1 = ar, and a2 = at.

What we want is the opposite: based on a measure of a1 and a2, we want to solve for ar and at. This is a simple algebra problem: two equations, two unknowns:

ar = a1 cos Δφ + a2 sin Δφ ,
at = a1 sin Δφa2 cos Δφ .

One way of looking at this is it is just a change in sign of Δφ from the previous equations, which makes sense: undo the rotation of misaligment.

We can then take the time-average of these quantities. We assume Δφ is constant, so no need to average that. We use angled brackets ("<>") to signify a time-average:

<ar> = <a1> cos Δφ + <a2> sin Δφ ,
<at> = <a1> sin Δφ<a2> cos Δφ ,

Now we can assert that the average value over time of at goes to zero, while the average value of ar over time is positive:

<at> = 0,
<ar> > 0.

So, using the first of these relationships:

<a1> sin Δφ<a2> cos Δφ = 0.

That's simple enough:

tan Δφ = <a2> / <a1> ,

where we handle the case where cos Δφ = 0. There's only one issue left: that equation has two possible solutions for Δφ, separated by 180°. But here's where we use the other constraint, that <ar> > 0. Only one of these two solutions will meet this condition.

So now having solved for Δφ, it's straightforward to extract ar and at from a1 and a2.

Next time I'll apply this transformation to the MetriGear Vector test data, which may require a bit of care.

Sunday, November 22, 2009

Metrigear Vector test data: modeling

Enough political commentary! Back to science and engineering.

In the MetriGear Blog they published data from a test rig in which accelerometers were rotated in a circle, and orthogonal components of acceleration were measured. Here's their plot:


Metrigear accelerometer data from their test rig

The blue curve represents data from an accelerometer measuring primarily tangential acceleration (in the direction of motion of the pedal as it rotates). The red curve represents data from an accelerometer measuring primarily radial acceleration (perpendicular to the direction of pedal motion through its circular orbit). The radial direction includes components due to gravity (the accelerometer rotates relative to the direction of gravity) and due to the centrifugal acceleration. The tangential acceleration also includes the gravity component, 90 degrees out of phase with the radial gravitational component, plus it has a component proportional to the rate of change of rotation.

This appears to be what is evident in the plot: a big centrifugal offset to the gravity signal on the radial accelerometer, the red curve, and a smaller offset of the gravity signal on the blue curve, due to the rate of change of rotation. But if you run the numbers, this offset of the blue curve is too large. Around 0.5 g, the initial value of the offset, is a much larger acceleration value than one gets rotating down to a state of rest over 17 seconds for this structure with its initial rotation rate. So another explanation is needed.

That explanation is that the accelerometers are misaligned. Around a 6 degree misalignment explains what's seen in the data. Therefore the blue curve is contaminated with radial acceleration, and the red curve is contaminated with tangential acceleration.

For the rate of change of acceleration, I assume a simple model in which frictional force is fixed, and therefore the rate of change of rotation is constant to the point the rotation ceases. This is obviously simplistic. For example, it neglects the effect of wind resistance, which presents a larger retarding force the greater the rate of rotation. But the simplifying assumption fits the data fairly well, as I'll show.

Parameters I use in my fit include:
  1. radius of rotation = 8 cm
  2. initial rate of rotation = 21.8 radians/second
  3. rate of change of rotation rate = ‒1.2 radians/second²
  4. tangent of misalignment angle: 0.1 (offset angle of 6°)

Results are plotted here, where the Metrigear data I extracted with g3data:

Simple analytic model compared with measured data

The model works quite well. The phase doesn't track perfectly, but given the simplisty of the assumed constant rate of radial deceleration, I'm pleased.

Next time, I'll look at how Metrigear could process their data to eliminate the misalignment.

Friday, November 20, 2009

MetriGear Vector in CyclingNews Readers' Poll

It's been awhile since I mentioned the Metrigear Vector; I've been interested lately in solving the more fundamental issues of how fluctuations in speed, wind speed, and road grade affect power. Indeed, I fear that I may have made an error in my analysis of grade fluctuations. But I'm still checking over these calculations, so back to the Metrigear Vector for now.

First, congratulations to Metrigear for getting the Vector nominated as one of candidates for "best new product" in the 2009 CyclingNews reader poll! And they clearly contributed to the nomination of "Power Meters" in the nomination for "best tech innovation". Now I need to come clean here. I didn't vote for it in either category. Well, for "best new product", it's not a product until the blue tape is retired.


And for tech innovation power meters have been around for a long time, and there continues to be incremental improvement. And while the Vector promises to take a major step forward (or perhaps back to 1992?) with its focus on force measurement, that's not demonstrated yet. So I'm all over it for the 2010 poll, but not quite yet.

Instead I voted for SRAM XX for the product and "electronic shifting" for the tech innovation. Love it or leave it, and I choose the latter, you've got to admire the engineering of Di2.

So I'm looking forward to 2010 as being the year where Metrigear takes the CyclingNews Poll. However, Vector winning CyclingNews best product for 2009 is a bit like Obama winning the Peace Prize in 2009.

Next time I'll look at some data just posted to the MetriGear blog.

Sunday, November 15, 2009

the effect of road grade variations on climbing power: comments

I'm afraid I played a bit fast and loose with my assumptions in the last post.

Here's the deal: two ways to calculate work done are to either integrate power with respect to time (which I did) or to integrate force with respect to distance.

So what I did: first I considered the effect of bike speed fluctuations on average power. Bike speed varies over time with a particular average value, this yields fluctuations in power as a function of time, and these fluctuations in power average to a larger value than the power which would result from a constant speed equal to the average speed. But if average speed over time is the same, then distance covered is the same, which is the desired constraint of the calculation.

Then I considered the effect of grade fluctuations on speed. But the speed must average the same over time, while grade was analyzed over distance.

All good if the speed is constant, in which case distance and time are proportional. But it's not. If the grade is 7%, for example, then at constant power in the absence of other variable effects I maintain the same speed. However, if the grade is 10% half the time and 4% half the time, the same average grade, I'll spend more time on the 10% than I do on the 4%. It gets hard to wrap your head around. It seems like average power should increase: I'm spending more than half the time at increased power, less than half the time at decreased power, a net average change greater than zero.

But there's that other approach to extracting work: force integrated over distance. Change in force is proportional to change in grade. So if the grade is higher for half the distance, lower by the same amount for the other half, the force averaged over distance in the absence of wind resistance is the same. Thus for f = 0 the result needs to be zero, as I derived. The key is that total time, and therefore average speed, is fixed.

The only thing left is whether the variation in grade therefore needs to be calculated differently than simply deriving statistics from a profile with respect to distance. For example, one could calculate a weighted distribution, with weighting proportional to the inverse of the speed associated with a given grade. Well, maybe or maybe not. These things tend to be tricky, and if you forget the final constraint of fixed average speed, you get the wrong answer. But my suspicion is you want to calculate the fluctuations with respect to time.

Fortuitously, in my last result I used iBike data, which provides grade as a function of time, so all was good. More typically I don't have iBike data, and so have grade over distance instead. Of course for a given hill grade over time will vary depending on who rides it, while grade over distance in the absence of seismic activity is the same.

So would it make a difference? Well, easily checked for this particular data set. I took the data I used from that analysis and calculated the standard deviation of grade, as before. Then I interpolated the data onto a uniform mesh of 6000 points equally spaced in distance, and took the standard deviation again. Here's the results:
  1. over time: σ = 2.03622%
  2. over distance: σ = 2.03626%
This difference in grade is equivalent to an extra 2 mm climbed over the distance of Old La Honda Road. So I'll allow myself to calculate grade fluctuations from profile data if I want.

Tuesday, November 10, 2009

the effect of road grade variations on climbing power: pt 2

To summarize from last time, the physics behind the effect of grade variations on bike speed is that at constant power grade variations lead to speed variations, and speed variations lead to variations in wind resistance. When the bike moves faster than average, wind resistance is higher, but when it moves slower than average, wind resistance is less. To first order, these cancel, but to second order, the increase in wind resistance from riding above average speed is less than the reduction in wind resistance from riding at below average speed. So the greater the grade fluctuations the speed fluctuations and the higher the average power, even if the average speed is the same.

We've already analyzed the effect of speed fluctuations on average power. That result, assuming no wind resistance, is:

Δp ≈ 3 f p0 <Δs²> / s0²,

where Δp is the change in the average power, p is the average power calculated without modeling the fluctuations, f is the fraction of power from wind resistance, and s0 is the average speed.

So all we need to do to model the relationship between grade changes and speed changes. Well, we've already done it in a previous post; we calculated the effect of fractional mass changes on speed. The key insight is that fractional changes in mass and (grade + CRR) have the same effect. So the model for the result of fractional changes in (grade + CRR) is the same as the modely for the result of fractional changes in mass.

Therefore, almost by inspection the result can be written:

<Δs²> =
s0² [ <Δgrade²> / (grade0 + CRR)² ] × [ ( 1 - f ) / ( 1 + 2 f ) ]²

Then this can be inserted into the first equation, relating speed fluctuations to power:

Δp / p0
3 f [ <Δgrade²> / (grade0 + CRR)² ] × [ ( 1 - f ) / ( 1 + 2 f ) ]²

That was easy. Note the result is to first order proportional to f. Obviously, if there's no wind resistance, there's no effect: the speed fluctuations only add power because of wind resistance fluctuations; the total energy from climbing depends on total elevation gained, while rolling resistance depends on how far the wheels roll.

So, let's run some real numbers. Assume when climbing Old La Honda Road wind resistance is 12% of the total power.

From iBike data for Old La Honda:

grade0 = 7.26%,
<Δgrade²> = 1.32%,

where in calculating <Δgrade²> the measured gradient was convolved with a smoothing function, a Gaussian profile of σs = 50 meters, to account for the fact we're neglecting inertia; coasting over small grade fluctuations fails to change speed as much as the quasi-static approximation predicts. Note I was careful to use iBike data. That's because the iBike has a built-in gradiometer, which measures grade directly. An alternate would be to use altitude data then differentiate it. But since differentiation tends to amplify the effect of small errors in the estimation of altitude, it would be easy to overestimate the variations in road grade.

CRR = 0.4%,

assuming I'm on my Veloflex Record tubulars, which have nice low rolling resistance.

With these numbers,

Δp / p0 ≈ 0.54%

Wow -- that's quite significant. From a baseline climbing power of 290 watts, that's 1.56 watts.

This can be checked against the actual speed fluctuations recorded by the iBike. Now the iBike data aren't mine, as I noted, so I'll run with the numbers from the iBike rider. A very nice thing about iBike is that it allows for an extraction of an estimate of rolling resistance and wind resistance coefficients from ride data. So I'll use these numbers for the rider in question, who had relatively higher rolling resistance clinchers with butyl inner tubes at lower pressure:

CRR = 0.74%

mass = 75.75 kg

fw = 0.24 kg / m

These yield:

f = 0.66%

I can use the grade fluctuations to estimate the power increase, as before:

Δp / p0 ≈ 0.44%

Or I can use the speed fluctuations directly:

<Δs²> = 11.9%

Then with the first equation:

Δp / p0 ≈ 0.36%

Okay, not perfect, but in the ballpark. We can plot the speed fluctuations versus grade, where I did a 3-second exponentially-weighted smoothing of the grade data to try and account for inertia, to check how well the constant power quasi-static model predicts the effect of grade on speed variation:


Old La Honda iBike data: effect of grade fluctuations on speed fluctuations


The trend is right, but obviously there's a lot of deviation from the trend. It's clear there are plenty of points where the grade has increased but the speed has not decreased with the trend line. The rider thus tended to try to keep constant speed rather than ride at constant power. This reduced the required power generated, but may have taken a physiological toll. However, analyzing that is beyond the scope of simple physics.

Thursday, November 5, 2009

the effect of road grade variations on climbing power: pt 1

The last post looked at the effect of wind speed and bike speed variations on climbing speed. However, often it may be difficult to estimate what these quantities are. However, even without metrology, if you have good profile data for a climb, you can at least estimate the variations in the road grade. These may provide an estimate for the road speed variations.

Grade variations on Old La Honda Road (Lucas Pereira)

One can imagine two simplifying cases for how a non-uniform grade may be approached. One is to ride it at constant speed. In this case, estimating the effect of wind resistance on power is simple: in still air (or a constant relative wind) and with a fixed riding position ride wind resistance is constant. Obviously power fluctuates, perhaps wildly as the grade changes. Interestingly, from a pure physics standpoint this is the most efficient way to climb the hill. For a given speed, it minimizes energy used.

However, physiologically it may not be efficient. There is an increasing marginal cost associated with producing higher powers than lower powers. As a fraction of your functional threshold, it's likely more difficult to alternate 1-minute intervals between 150% and 30% than it is to stay at a steady 90%, even though the average power is the same. It is for this reason the "normalized power" concept (a weighted average power) was invented. But that's off-topic.

An alternate approximation is that power is held constant. This may be considered a physiologically efficient approach in the limit of an infinite normalized power coefficient. With this approach, to stay at a near-optimal cadence, a lot of shifting may be involved, which may provide its own inefficiencies. But this analysis ignores shifting issues, of course.

A realistically optimized power schedule is neither constant speed nor constant power. But discussing that is way beyond the scope of this analysis. We'll assume constant power is the better choice of the two.

Furthermore, the analysis will again use the "quasi-static" approximation of ignoring acceleration power. Everyone knows if you go down one side of a dip you can coast part way up the other side. This analysis assumes you instantly hit terminal velocity going down, then need to start pedaling immediately when you hit the opposite side. This coasting effect, due to inertia, tends to smooth out the effective grade somewhat. So the grade variations discussed here are those which can't be smoothed over with coasting. For example, every small bump in the pavement isn't counted.

Okay, enough discussion. We assume constant power and neglect inertia.

The usual model: we have a wind resistance component of power

pw = fw (ssws,

where s is bike speed and fw is a coefficient. We also have a mass-proportional component of power

pm = fm m s,

where m is total mass and the coefficient fm is modeled as:

fm = g ( cRR + grade ),

where g is the acceleration of gravity, cRR is the coefficient of rolling resistance and grade is the road grade (linear approximation).

These power components can be combined to get total power (neglecting drivetrain losses, which as usual we assume are proportional to total power, and end up not affecting the final result):

p = pw + pm.

I'll hit the calculus next post.

Tuesday, November 3, 2009

Effect of Wind and Bike Speed Fluctuations on Climbing Power: pt 3

Last time on this topic, I ended with the following equation:

<pw>fw [ s0 ( s0sw0 )² + ( 3 s0 ‒ 2 sw0 ) <Δs²> + s0 <Δsw²> + ( 2 sw0 ‒ 4 s0 ) <Δs Δsw> ] .

Up to this point, there's nothing climbing-specific about this analysis: it applies as much to descending or riding on the flats as it does to climbing. But the goal of this post is to simplify it a bit, using the result of the last analysis, the effect of headwinds on bike speed.

In that analysis, which was corrected on 31 Jan 2013, it was derived that for an absolute wind speed which is relatively small in comparison to bike speed, and for a relatively small (say 20% or less) of the power going into wind resistance, then a change in wind speed change dsw (positive = tail wind, negative = head wind) changes bike speed by ds ≈ 2 dsw f, where f is the fraction of power going into wind resistance. Here's the first "climb approximation". Obviously on a descent the assumption that wind resistance power is a small fraction of total is a bad one. On a descent, in fact, wind resistance power is likely greater than the total power.

Given this relationship, we can simplify that first equation with the relationship (corrected 31-Jan-13)

<Δs Δsw> ≈ 2<Δsw²> f.

The assumption here is that the only correlated change between s and sw is that when sw changes, the rider attempts to maintain the same power, and the speed increases (if sw increases) or decreases (if sw decreases). Of course this depends on behavior: a rider may try to maintain the same speed and apply a lesser or greater power. But we're assuming constant power for the climb.

There's also uncorrelated variations in s. These may be due to variations in grade, variations in rolling resistance due to rougher or smoother pavement, or simply variations in rider power not correlated with wind changes. Nobody can maintain perfectly steady power, and typically power fades over the course of a climb due to fatigue, but then is increased approaching the top of the climb.

Anyway, these assumptions yield (corrected 31-Jan-13):

<pw>fw { s0 ( s0sw0 )² + ( 3 s0 ‒ 2 sw0 ) <Δs²> + [ s0 + 2 ( 2 sw0 ‒ 4 s0 ) f ] <Δsw²> },

or slightly simplifying (corrected 01-Jan-13):

<pw> ‒ pw0≈ fw {( 3 s0 ‒ 2 sw0 ) <Δs²> +
[ ( 1 ‒ 8 f ) s0 + 4 f sw0 ] <Δsw²> },

where pw0 is the wind resistance power calculated using the average bike speed and the average wind speed.

A quick warning: remember the power-speed relationship we're using here yields a sign error for pw if sw > s (wind is pushing the rider or the rider is moving the opposite direction). So in this instance you'd need to carry that sign difference through; this result is not applicable.

A simplified case: if sw0 = 0 and f is sufficiently small, the result can be approximated:

<pw>pw0fw s0 ( 3 <Δs²> + <Δsw²> ),

which clearly shows bike speed fluctuations are more important than wind speed fluctuations. If you prefer unitless quantities, as I do, this can be rewritten:

<pw> / pw0 ‒ 1 ≈ ( 3 <Δs²> + <Δsw²> ) / s0².

Anyway, let's run some numbers: from the Soda Springs climb analysis:

fw = 0.20 W/(m/sec)³,
sw0 = 0,
s0 = 10 mph = 4.5 meters/sec.

Then let's assume my speed differed by around 20% from the mean typically, and the wind speed was typically around ± 1 mph, then:

<Δs²> = 0.80 meters²/second²,
<Δsw²> = 0.20 meters²/second²,
f = 0.068,

yielding (result unaffected to listed precision by revisions of 31-Jan-13):

<pw>pw0 ≈ 2.3 watts.

Okay, not a huge amount: less than 1% of total power. But it's perhaps surprising the result is even this big for such small fluctuations in bike and wind speed on a steep climb where over 90% of the power is going into either gravity of rolling resistance.

Effect of Wind Speed on Riding Speed

Recall in the last post there was a term in the result representing the correlation between wind speed and bike speed. To estimate this term, a relationship between wind speed and bike speed is needed. This is a relationship interesting on its own merit, anyway.

For this I start, as always, with a bike speed-power relationship, in this case without the usual assumption of zero wind. There are two components to power considered here: one from wind resistance and independent of mass, the other mass-proportional and due to either rolling resistance or to altitude change. Drivetrain frictional losses are assumed proportional to these other two components, and thus don't enter into this analysis.

First, the wind resistance component is:

pw = fw (ssws,

where pw is the power due to wind resistance, s is the bike speed, and sw is the speed of the wind in the direction of the bike (a head wind would be negative).

Then, we have a mass-proportional component, which we'll simply model as:

pm = fm m s,

where pm is the mass-proportional power, fm is a the sum of road grade and coefficient of rolling resistance times the acceleration of gravity, m is the total mass of the rider and bike and all equipment, and s is again the bike speed.

Then to get total power I add these components:

p = pw + pm

I'm neglecting the energy associated with acceleration in this analysis because I assume speeds change slowly. Thus I am making a "quasi-static" approximation.

So the question I need to answer is: if I change sw, how must I change s to get back the original value of p?

One approach would be to analytically solve s as a function of p and sw, then take the partial derivative with respect to sw with p fixed. That would work, but to do that I'd need to solve a cubic equation. Quadratic equations are straightforward enough, but cubic equations are yucky. Better to sidestep the need to solve for s.

Instead, we'll follow the steps I described:
  1. Change sw by the differential increment dsw, and see what the resulting change in power is dp.
  2. To restore p to its original value, change it by the differential increment ‒dp, and see what the resulting change ds is in s.
This sort of problem is the bread and butter of partial derivatives. Partial derivatives are essentially the answer to the question, "if I change one thing and leave some other things unchanged, what's the effect on a quantity of interest?"

So for the first step, we want the partial derivative of p with respect to sw. Since only pw and not pm depends on sw, we need only differentiate the equation for pw. The result is simple enough:

p / ∂ sw = ‒2 pw / ( ssw ).

From this, I can calculate:

dp = dsw ( ∂ p / ∂ sw ).

Okay, so then the next step: I want to restore p to its original value, so need to figure out how much to shift s (by ds) in order to do this. This is easily answered:

ds = ‒dp / ( ∂ p / ∂ s ).

So we need to solve for ∂ p / ∂ s. This is again easily done:

p / ∂ s = 2 pw / ( ssw ) + p / s.

So we have all the parts we need.

d s / d sw = 2 pw / [ 2 pp (1 + sw / s ) ]

I prefer writing these equations in terms of a parameter f, which is the fraction of power which goes into wind resistance (although my past analysis has assumed zero headwind, and I'm not assuming that here). Plugging in that parameter f yields:

d s / d sw = 2 f / [2  f + 1 ‒ sw / s ]

The first thing to do when deriving a formula is to check the units. That's not an issue here: all units cancel, as they should, since we're looking for a ratio of values with the same units. The next thing is to try some simple cases.

First consider the case where all resistance is from the wind resistance, and there is no wind. Then in this case, we get a ratio 2 / 3. This is correct: wind resistance force comes from wind speed and wind momentum, both proportional to relative wind speed, and then for power there is an additional component from rider speed.  So two parts decrease with increased tailwind, while three parts increase with increasing rider speed, so I balance 3 parts wind speed with 2 parts rider speed.

Then you can ask what happens if f is small and sw a small fraction of s? In this case, the small headwind reduces the speed by 2 f times the headwind speed. That's a nice easy-to-remember result.

So that's it. We can use this result to finish the analysis of wind speed fluctuations.

Monday, November 2, 2009

Effect of wind and bike speed fluctuations on climbing power: pt 2

Okay, last time I discussed the problem of why climbing power depends not just on average bike speed and average wind speed, but also on fluctuations in these parameters. So let's break down climbing speed and wind speed into two components each, a constant component and a variable component, the variable component having a zero time-average:

s = s0 + Δs,

sw = sw0 + Δsw,

where, for <s> signifying the average of s, etc:

<s> = s0 + <Δs> = s0,

and similarly:

<sw> = sw0 + <Δsw> = sw0.

So these can be plugged into the wind power calculation:

pw = fw (ssws.

First, a word of warning: this equation only applies if sws, otherwise you need to flip the sign. If sw > s, then it could mean a tailwind is pushing the rider, or else the rider is moving in the negative direction. These sign issue is a big clue that this equation is not grounded in fundamental physics, and its not, it's an approximation. But given that, we'll assume the rider keeps moving forward, and continue:

    = fw (s0 + Δssw0 - Δsw)² ( s0 + Δs ).

Okay, that obviously needs to be expanded:

pw = fw ( s0² + 2 s0 Δs ‒ 2 s0 sw0 ‒ 2 s0 Δsw + Δs² ‒ 2 Δs sw0 ‒ 2 Δs Δsw + sw0² + 2 sw0 Δsw + Δsw² ) ( s0 + Δs ).

A clarification of sloppy notation: Δs² refers to the square of the difference, not the difference of the square. This is an important distinction.

Anyway, we're not done expanding yet (gulp):

pw = fw ( s0³ + 2 s0² Δs ‒ 2 s0² sw0 ‒ 2 s0² Δsw + s0 Δs² ‒ 2 s0 Δs sw0 ‒ 2 s0 Δs Δsw + s0 sw0² + 2 s0 sw0 Δsw + s0 Δsw² + Δs s0² + 2 s0 Δs² ‒ 2 Δs s0 sw0 ‒ 2 Δs s0 Δsw + Δs³ ‒ 2 Δs² sw0 ‒ 2 Δs² Δsw + Δs sw0² + 2 Δs sw0 Δsw + Δs Δsw² ).

It's downhill from here, I promise. First, it's clear there's some terms in the above listed twice (those with both s0 and Δs). These can be combined:

pw = fw ( s0³ + 3 s0² Δs ‒ 2 s0² sw0 ‒ 2 s0² Δsw + 3 s0 Δs² ‒ 4 s0 Δs sw0 ‒ 4 s0 Δs Δsw + s0 sw0² + 2 s0 sw0 Δsw + s0 Δsw² + Δs³ ‒ 2 Δs² sw0 ‒ 2 Δs² Δsw + Δs sw0² + 2 Δs sw0 Δsw + Δs Δsw² ).

Still ugly. But we care only about the average of power. For this, remember that s0 and sw0 are constants, and the average of a constant multiplied by either Δs or Δsw is zero:

<pw> = fw ( s0³ ‒ 2 s0² sw0 + 3 s0 <Δs²> ‒ 4 s0 <Δs Δsw> + s0 sw0² + s0 <Δsw²> + <Δs³> ‒ 2 <Δs²> sw0 ‒ 2 <Δs² Δsw> + 2 <Δs Δsw> sw0 + <Δs Δsw²> ).

Two assumptions:
  1. We assume the probability distributions of Δs and Δsw are symmetric, and therefore<Δs³> = 0. <Δsw³> doesn't appear in the equation, but it's also zero.
  2. Retain only a first-order correlation between Δs and Δsw, eliminating <Δs Δsw²> and <Δs² Δsw>. Perhaps this assumption should be revisited later.

Then this simplifies further:

<pw>fw ( s0³ ‒ 2 s0² sw0 + 3 s0 <Δs²> ‒ 4 s0 <Δs Δsw> + s0 sw0² + s0 <Δsw²> ‒ 2 <Δs²> sw0 + 2 <Δs Δsw> sw0 ).

Combining Δ terms and removing a common s0 from the rest yields:

<pw>fw [ s0 ( s0² ‒ 2 s0 sw0 + sw0² ) + ( 3 s0 ‒ 2 sw0 ) <Δs²> + s0 <Δsw²> + ( 2 sw0 ‒ 4 s0 ) <Δs Δsw> ].

The first term is an obvious square, so we can simplify once again, happy to see the relative wind speed back:

<pw>fw [ s0 ( s0sw0 )² + ( 3 s0 ‒ 2 sw0 ) <Δs²> + s0 <Δsw²> + ( 2 sw0 ‒ 4 s0 ) <Δs Δsw> ].

First, a sanity check: if all of the Δ terms are zero (constant bike and wind speed), we have the first equation back. This had to be the case. If it weren't, then we'd made an error.

Then an observation: it's only true that Δs and Δsw have the same effect if s0 = sw0, implying the wind is the same speed as the rider and in the same direction. If the wind is less of a tailwind or a headwind, then fluctuations in bike speed have a stronger effect than those of wind speed. In zero wind, bike speed fluctuations have three times the effect of wind speed fluctuations of the same magnitude. Why? When wind speed increases without bike speed changing, the retarding force increases and power increases in proportion to the retarding force increase. But when bike speed increases the same amount, the retarding force increases the same amount, but further the bike is moving faster against this increased retarding force. Okay, perhaps a bit too much on this...

The remaining terms feature:
  1. <Δs²>: the expectation of the square of the deviation in bike speed,
  2. <Δsw²>: the expectation of the square of the deviation in wind speed,
  3. <Δs Δsw>: the expectation of the product of the deviations of bike speed and wind speed.
The first two terms are straightforward: obvious "model parameters" which could be estimated. The third term merits further discussion.

Now suppose that bike speed varied randomly, and wind speed varied randomly, but the variations were uncorrelated. For example, if I told you just the relative wind speed, you'd have no further information about the bike speed. This would be a convenient assumption, as then this term would average out to zero, and we could neglect it. Maybe on a very steep hill in light wind, where the small wind variations might have a very small effect on bike speed in comparison to variations in road grade, this might be an acceptible approximation. Or when riding in deep mud, where the depth of the mud results in variations in rolling resistance which strongly limit speed, it would also be a good assumption. But in general if the head wind is stronger, the bike moves slower, and vice versa. So a model is needed for the correlation of bike speed and wind speed.

Alternately this parameter could be evaluated directly, for example from iBike data. I love the iBike. It's amazing I haven't gotten one yet. Maybe when I switch to the Metrigear Vector and need an ANT+ Sport head unit, and when iBike reveals their new version in March 2010 around the time the Vector is due for release. But I digress.

Another approach is to model it. The simplest model is a quasi-static model: assume the bike has no inertia, and accelerates or decelerates instantly to the speed at which propulsive force and retarding forces cancel. This is a good approximation if the variations in bike and wind speed tend to be relatively gradual.

But this blog post is getting a bit long, and my train is almost at Palo Alto station, so it's a good time to pause. Next time I'll analyze the quasi-static effect of wind speed on bike speed. This will provide an estimate of <Δs Δsw>.

Sunday, November 1, 2009

Effect of wind and bike speed fluctuations on climbing power: Introduction

Even when climbing steep hills, wind resistance is a considerable contributor to total power. Wind resistance force, in the absence of a cross-wind, is typically modeled as proportional to the square of the relative speed of the wind relative to the bike. To get power, you multiply this force by the bike speed. The standard model, neglecting drivetrain efficiency (we assume drivetrain losses are proportional to transmitted power):

pw = ( CDA ρ / 2 ) (ssws,

where s is the bike speed, sw is the speed of the wind (positive for headwind) relative to the Earth's surface at the typical rider height (not 10 meter height, as is typically reported), CDA is the coefficient of drag times effective cross-sectional area of the rider and bike, and ρ is the air density. Too much detail: all we care about is there's a coefficient for wind resistance, which we assume is held constant, fw:

pw = fw ( ssws

Now, assuming we know the average value of s and the average value of sw, we can estimate the average value of pw and therefore total power (assuming we can model other components, specifically climbing power and rolling resistance power). But what if s and/or sw are varying?

Of course, on any real-world climb, grade varies, and at constant power, when the grade is reduced, the speed s increases. Or power varies at a constant grade, and again s varies. And sw varies, either due to changing wind itself, or changing shelter from the wind, for example the proximity of terrain, trees, houses, or other riders. Or the road isn't perfectly straight, so the component of the wind in the direction of bike motion changes. Reality is far messier than is convenient.

Before answering this question, consider the effect of speed variations on climbing and rolling resistance power. One is proportional to weight × speed × road grade, the other proportional to weight × speed × rolling resistance coefficient (assuming the standard model, for modest road grades). So they're basically indistinguishable. But in either case, if we know the average speed, since these power components are proportional to speed, we know the average power. Power fluctuations don't affect the result.

There is the whole issue of "micro-accelerations" which people argue cause increased power: accelerating a bike once takes a certain amount of energy, so accelerating it multiple times takes multiple doses of this energy, right? Well, yes if the reason we need to accelerate again is we dumped energy into our brakes. But for a typical climb we don't brake (I'm assuming no braking in this analysis) and these "microaccelerations" where power is increased are balanced by "micro-decelerations" where we gain the benefit of that power. The energy which went into acceleration during a climb is proportional to the difference in the squares of the final speed and the initial speed. What the speed did in between, whether increasing steadily or oscillating around a bit, doesn't matter.

It only matters when analyzing losses to the wind. And this is because the dependence of wind losses on bike speed and on wind speed are not simply linear, they also have seoond-order and, in the case of bike speed, third-order components. When bike speed or wind speed increases, the associated power components increase a lot. But when bike speed or wind speed decreases, these components decrease not quite as much. So fluctuations add more than they subtract from power. In other words, you need to know more than just the average bike and wind speed to model the power. The assumption of constant speeds for the bike and wind are always optimistic: it predicts the lowest possible value for average wind resistance power.

In other words, if I estimate the power it took to do a climb in a certain amount of time, and I assume constant speed for the bike and the wind, I will only underestimate that power. And underestimating my power makes me cranky.

So the point of this analysis is to find a relationship between the magnitude of fluctuations of bike speed and wind speed and the average power required to overcome wind resistance.

Okay, enough introduction. More to follow.