# computer averge speed algorithm

Discussion in 'Cycling Equipment' started by Allan Leedy, Jun 21, 2003.

Not open for further replies.
1. ### Allan Leedy Guest

Anybody know what formula is used by cycle computers to calculate average speed? It doesn't seem to
be d/t=r on mine or any of the others I've checked. Average speed, based on recorded distance and
riding time, is underreported. I'm wondering how & why.

Tags:

2. ### John Tserkezis Guest

Allan Leedy wrote:

> Anybody know what formula is used by cycle computers to calculate average speed? It doesn't seem
> to be d/t=r on mine or any of the others I've checked. Average speed, based on recorded distance
> and riding time, is underreported. I'm wondering how & why.

It appears to depend on your unit.

On my Cateye, the average is determined from the running time and distance since last reset, up to
24:00 hours, because this is the max of the unit.

--
Linux Registered User # 302622 <http://counter.li.org

3. ### Harris Guest

"Allan Leedy" wrote:

> Anybody know what formula is used by cycle computers to calculate average speed? It doesn't seem
> to be d/t=r on mine or any of the others I've checked. Average speed, based on recorded distance
> and riding time, is underreported. I'm wondering how & why.

Are you saying that if you ride 18 miles in one hour (actual elapsed time) the computer displays
less than 18 mph? Or are you factoring in times when the bike is not moving? How much of a
difference are you seeing?

Most computers don't count times when the bike is stopped into the calculation. But if you're say
stopped at a traffic light, and you rock the bike ever so slightly back and forth, it will lower the
average. And walking the bike even a short distance will have an effect.

I use an Avocet 40, and the average speed seems to be quite accurate for non-stop rides such as
time trials.

Art Harris

4. ### James Annan Guest

Harris wrote:

> Are you saying that if you ride 18 miles in one hour (actual elapsed time) the computer displays
> less than 18 mph? Or are you factoring in times when the bike is not moving? How much of a
> difference are you seeing?

Don't know what the OP is saying, but certainly they use some funny rounding method (or something)
which produces odd results sometimes. Eg I can be riding along at 20mph+, the average was 18.0 and
then it jumps to 17.9 for a while.

I think I remember someone explaining this some time ago, but I don't recall the details.

James

5. ### Andyk Guest

> > Anybody know what formula is used by cycle computers to calculate
average
> > speed? It doesn't seem to be d/t=r on mine or any of the others I've checked. Average speed,
> > based on recorded distance and riding time, is underreported. I'm wondering how & why.
>
> It appears to depend on your unit.
>
> On my Cateye, the average is determined from the running time and
distance
> since last reset, up to 24:00 hours, because this is the max of the unit.

I've noticed this on a couple of computers I've used. Divide trip distance by trip time and the
"average" speed it quotes often does not agree this.

The "computer" used probably doesn't have the ability to divide - so instead it's using some sort of
mathematical "trick", effectively adding the current speed onto the accumulated average, using a
weighting factor. Or sumfink like that

AndyK

6. ### Allan Leedy Guest

"Harris" <[email protected]> wrote in message
news:[email protected]...
> Are you saying that if you ride 18 miles in one hour (actual elapsed time) the computer displays
> less than 18 mph?

Exactly that, based on the computer's displayed data for time and distance.

Or are you factoring in times when
> the bike is not moving?

As you suggest, the settings are for time in motion only, ignoring time stopped and total
elapsed time.

How much of a difference are you seeing?

3-5% (e.g., 15.4 instead of 16)
>
> Most computers don't count times when the bike is stopped into the calculation. But if you're say
> stopped at a traffic light, and you rock
the
> bike ever so slightly back and forth, it will lower the average. And
walking
> the bike even a short distance will have an effect.

Why should it matter? Presumably, nothing registers unless the magnet passes the sensor. If it does,
won't it record time and distance?

7. ### Steve Blankensh Guest

"Allan Leedy" <[email protected]> wrote in message news:[email protected]...
>
> "Harris" <[email protected]> wrote in message
> news:[email protected]...
> > Are you saying that if you ride 18 miles in one hour (actual elapsed
time)
> > the computer displays less than 18 mph?
>
> Exactly that, based on the computer's displayed data for time and
distance.
>
>
> Or are you factoring in times when
> > the bike is not moving?
>
> As you suggest, the settings are for time in motion only, ignoring time stopped and total
> elapsed time.
>
>
> How much of a difference are you seeing?
>
> 3-5% (e.g., 15.4 instead of 16)
> >
> > Most computers don't count times when the bike is stopped into the calculation. But if you're
> > say stopped at a traffic light, and you rock
> the
> > bike ever so slightly back and forth, it will lower the average. And
> walking
> > the bike even a short distance will have an effect.
>
> Why should it matter? Presumably, nothing registers unless the magnet passes the sensor. If it
> does, won't it record time and distance?
>

You probably need to query users of the brand of cyclo-computer you use, as brands will differ.
FWIW, I just checked the numbers for my last ride on my Sigma Sport BC800 and the average speed
readout is accurate to the limit of its display, or .01mph.

8. ### Andrew Webster Guest

"AndyK" <[email protected]> wrote in message news:<[email protected]>... <cut>
> The "computer" used probably doesn't have the ability to divide - so instead it's using some sort
> of mathematical "trick", effectively adding the current speed onto the accumulated average, using
> a weighting factor. Or sumfink like that
>
> AndyK

My cateye unit certainly does something odd, I can be riding along steadily at below my current
average speed and see the average speed go up.

When average is increasing it often goes up by 0.2 more a minute or so, then down by 0.2 then up
0.1 again.

I wonder if this is what Intel did with all those reject Pentiums that couldn't divide properly.

Andrew Webster

9. ### David L. Johnso Guest

On Sat, 21 Jun 2003 21:51:32 +0000, Allan Leedy wrote:

> Anybody know what formula is used by cycle computers to calculate average speed? It doesn't seem
> to be d/t=r on mine or any of the others I've checked. Average speed, based on recorded distance
> and riding time, is underreported. I'm wondering how & why.

It probably is correct. It knows the distance, since it counts the pulses from the magnet. If the
rolling speeds and distances tend to be right (check the odometer against a calibrated roadway
sometime), then the average is going to be as well. They all basically have the same chip in them.
There may be a setting to include/exclude time spent standing still, but let's presume that is set
correctly.

Averages may be deceiving. Consider the following Gedankenexperiment: you climb a really, really
tough hill. It's so steep that you climb it at 1 mph. It's also a mile long, so it takes you an
hour to get to the top. You then turn around and zoom down, say at 100 mph. What is your average
speed? As unfair as it may seem, your average speed is about 2mph since it took you over an hour
just to go 2 miles.

We tend to think in terms of averaging over distance. You know, the headwind part of the time-trial
course was tough, so you went only 15mph, but you were able to fly on the tailwind part, going
30mph. You check your average and are disappointed that you did not get an average speed of 22.5
mph. But if the course were, say, 30 miles long, that trip would have taken you 1.5 hours (one hour
headwind, 30 minutes tailwind). So your average comes out as only 20.

--

David L. Johnson

__o | Accept risk. Accept responsibility. Put a lawyer out of _`\(,_ | business. (_)/ (_) |

10. ### Chris Zacho "Th Guest

Your formula is correct. But many computers "stop the clock' after a few seconds of inactivity. That
way things like rest stops and stop lights are not taken into account. The avarage speed is the
avarage speed when you're actually moving.

If you want to include minor stops, use the stop watch function, if it has one, and calculate the
result with a pocket calculator.

May you have the wind at your back. And a really low gear for the hills! Chris

Chris'Z Corner "The Website for the Common Bicyclist": http://www.geocities.com/czcorner

11. ### Harris Guest

"Chris Zacho"
> Your formula is correct. But many computers "stop the clock' after a few seconds of inactivity.
> That way things like rest stops and stop lights are not taken into account. The avarage speed is
> the avarage speed when you're actually moving.

But he's saying the displayed average speed is LESS than the actual miles covered in an hour of
elapsed time. "Stopping the clock" would make the displayed average speed higher, not lower.

It can't be an intermittent sensor problem either because that would cause the distance to be
inaccurate.

I think it's possible the algorithm IS the culprit.

Art Harris

12. ### David L. Johnso Guest

On Sat, 21 Jun 2003 21:51:32 +0000, Allan Leedy wrote:

> Anybody know what formula is used by cycle computers to calculate average speed? It doesn't seem
> to be d/t=r on mine or any of the others I've checked. Average speed, based on recorded distance
> and riding time, is underreported. I'm wondering how & why.

In re-reading this I think I misunderstood you. So, you look at reported riding time, reported
distance, and reported average speed and see a discrepency. Hmm. I have not noticed that, but I can
check. Just checked my computer. It's accurate to within rounding error.

--

David L. Johnson

__o | Some people used to claim that, if enough monkeys sat in front _`\(,_ | of enough
typewriters and typed long enough, eventually one of (_)/ (_) | them would reproduce the
collected works of Shakespeare. The internet has proven this not to be the case.

13. ### JøRn Dahl-Stamn Guest

In article <[email protected]>, [email protected] (Andrew
Webster) wrote:
>"AndyK" <[email protected]> wrote in message news:<[email protected]>... <cut>
>> The "computer" used probably doesn't have the ability to divide - so instead it's using some sort
>> of mathematical "trick", effectively adding the current speed onto the accumulated average, using
>> a weighting factor. Or sumfink like that
>>
>> AndyK
>
>My cateye unit certainly does something odd, I can be riding along steadily at below my current
>average speed and see the average speed go up.
>
>When average is increasing it often goes up by 0.2 more a minute or so, then down by 0.2 then up
>0.1 again.

I suspect that it use only the hour and minute fields when calculating the average speed. I have
seen the same thing, but if you do a looooong ride, the behaviour less "visible".

Jørn Dahl-Stamnes, EDB Teamco AS e-mail: [email protected] (remove nospam first)
web: http://spiderman.novit.no/dahls/

14. ### Anonymous Guest

>> The "computer" used probably doesn't have the ability to divide - so instead it's using some sort
>> of mathematical "trick", effectively adding the current speed onto the accumulated average, using
>> a weighting factor. Or sumfink like that

Interesting. My Cateye Astrale 8 (new Astrale model) correctly averaged my last ride of just
over 2 hours.

If a small computer processor doesn't calculate math, it uses what's called a "lookup table."

x y
-------
1 6 2 9 3 13 4 19 5 28 6 40

So given a value 3, simple lookup in ROM gives a quick 13 as an answer. The y values are of course
precalculated by the manufacturer, allowing any level of equation difficulty to be handled by the
simplest on-board processor.

>My cateye unit certainly does something odd, I can be riding along steadily at below my current
>average speed and see the average speed go up.

Weird. I can see how this can happen in a lookup table situation, but...

>When average is increasing it often goes up by 0.2 more a minute or so, then down by 0.2 then up
>0.1 again.

this is a large discrepancy.

>I wonder if this is what Intel did with all those reject Pentiums that couldn't divide properly.

I wonder what's inside these pups. Small embedded processors are quite small and powerful now.
It's possible it does its own math. Even without explicit math ops in the instruction set, even
the simplest processors can be programmed to do math. Cateye and others surely developed such
code long ago.

Doug

15. ### Jasper Janssen Guest

>I wonder what's inside these pups. Small embedded processors are quite small and powerful now.
>It's possible it does its own math. Even without explicit math ops in the instruction set, even
>the simplest processors can be programmed to do math. Cateye and others surely developed such code
>long ago.

Especially modern bike computers with like several hundred functions need a fair bit of integer
processing capability just to run menu systems and cetera. All bike computers almost certainly use
specially designed ASICs, probably most often fliptop physcial packaging for cost and room reasons,
and they probably use the really simple embedded processors by now for easy of developing different
models. I mean, hell, for a couple of bucks nowadays you can buy an atmel AtTiny 8pin-SOIC processor
that runs at several megahertz with several k of program rom and half a k or so of ram integrated.
Those and similar processors are usually available for integrating into a custom chip of your own,
if necessary, as well.

Jasper

16. ### Allan Leedy Guest

Hey, David, I understand everything you said here, and I don't disagree with any of it, except that
all you've told me about the problem I posed is that the facts are probably not as I stated them.
And yet, they are!

"David L. Johnson" <[email protected]> wrote in message
news:[email protected]...
> On Sat, 21 Jun 2003 21:51:32 +0000, Allan Leedy wrote:
>
> > Anybody know what formula is used by cycle computers to calculate
average
> > speed? It doesn't seem to be d/t=r on mine or any of the others I've checked. Average speed,
> > based on recorded distance and riding time, is underreported. I'm wondering how & why.
>
> It probably is correct. It knows the distance, since it counts the pulses from the magnet. If the
> rolling speeds and distances tend to be right
(check the
> odometer against a calibrated roadway sometime), then the average is going to be as well. They all
> basically have the same chip in them. There may be a setting to include/exclude time spent
> standing still, but let's presume that is set correctly.
>
> Averages may be deceiving. Consider the following Gedankenexperiment: you climb a really, really
> tough hill. It's so steep that you climb it at 1 mph. It's also a mile long, so it takes you an
> hour to get to the top. You then turn around and zoom down, say at 100 mph. What is your average
> speed? As unfair as it may seem, your average speed is about 2mph since it took you over an hour
> just to go 2 miles.
>
> We tend to think in terms of averaging over distance. You know, the headwind part of the
> time-trial course was tough, so you went only 15mph,
but you
> were able to fly on the tailwind part, going 30mph. You check your average and are disappointed
> that you did not get an average speed of 22.5 mph. But if the course were, say, 30 miles long,
> that trip would have taken you 1.5 hours (one hour headwind, 30 minutes tailwind). So your average
> comes out as only 20.
>
> --
>
> David L. Johnson
>
> __o | Accept risk. Accept responsibility. Put a lawyer out of _`\(,_ | business. (_)/ (_) |

17. ### Allan Leedy Guest

David, I "flamed" your last post before reading this one. (Well, maybe just "embered".) Still,
thanks for getting back to the point I wanted help on. Allan "David L. Johnson"
<[email protected]> wrote in message news:[email protected]...
> On Sat, 21 Jun 2003 21:51:32 +0000, Allan Leedy wrote:
>
> > Anybody know what formula is used by cycle computers to calculate
average
> > speed? It doesn't seem to be d/t=r on mine or any of the others I've checked. Average speed,
> > based on recorded distance and riding time, is underreported. I'm wondering how & why.
>
> In re-reading this I think I misunderstood you. So, you look at reported riding time, reported
> distance, and reported average speed and see a discrepency. Hmm. I have not noticed that, but I
> can check. Just checked my computer. It's accurate to within rounding error.
>
> --
>
> David L. Johnson
>
> __o | Some people used to claim that, if enough monkeys sat in front _`\(,_ | of enough
> typewriters and typed long enough, eventually one of (_)/ (_) | them would reproduce the
> collected works of Shakespeare. The internet has proven this not to be the case.

18. ### David L. Johnso Guest

On Mon, 23 Jun 2003 14:12:51 +0000, Allan Leedy wrote:

> David, I "flamed" your last post before reading this one. (Well, maybe just "embered".) Still,
> thanks for getting back to the point I wanted help
on.

No problem.

It occurs to me that the issue for some of the disrepencies that have come up on this thread -- not
yours, though, which still baffles me -- is that the computation of current speed must do some sort
of short-time averaging:; say computing the time between sets of 4 or 5 pulses. This would open up
possible discrepencies -- lower speed readouts than the real speed due to missed pulses, and that
effect may be dependent on fault-inducing conditions like bumpy roads. It may be that over time the
effect of missed pulses becomes less important, but while you are looking at the speedometer they
accumulate. Or, the software sucks.

--

David L. Johnson

__o | Enron's slogan: Respect, Communication, Integrity, and _`\(,_ | Excellence. (_)/ (_) |

19. ### Rik Guest

"Allan Leedy" <[email protected]> wrote in news:[email protected]:

> Anybody know what formula is used by cycle computers to calculate average speed? It doesn't seem
> to be d/t=r on mine or any of the others I've checked. Average speed, based on recorded distance
> and riding time, is underreported. I'm wondering how & why.

If your reporting is consistently underreported (or, for that matter, overreported), you may have
set the wrong wheel size. The computers I have used need to be told the rolling circumference of the
wheel, and use that in the computation, some by direct entry in mm, some via a number taken from a
lookup table provided with the computer documentation. Even a small difference can be noticeable in
the result.

--
Rik Old enough to be an adult

20. ### David L. Johnso Guest

On Mon, 23 Jun 2003 23:21:23 +0000, Rik wrote:

> If your reporting is consistently underreported (or, for that matter, overreported), you may have
> set the wrong wheel size. The computers I have used need to be told the rolling circumference of
> the wheel, and use that in the computation, some by direct entry in mm, some via a number taken
> from a lookup table provided with the computer documentation. Even a small difference can be
> noticeable in the result.

No, in this case the average speed should agree with computing distance/time, using the distance on
the computer. It doesn't know you cheated by underreporting wheel size; but it still should be
internally consistent.

--

David L. Johnson

__o | "Business!" cried the Ghost. "Mankind was my business. The _`\(,_ | common welfare was my
business; charity, mercy, forbearance, (_)/ (_) | and benevolence, were, all, my business. The
dealings of my trade were but a drop of water in the comprehensive ocean of my business!"
--Dickens, "A Christmas Carol"