Skip to main content

W'bal optimisation by a mathematician !

So the integral computation for W'bal was expensive.

I tried to optimise from a domain and  programming perspective, where Dave Waterworth, a mathematician found a much more elegant and fast reformulation.


This means W'bal can EASILY be computed as you ride.


To explain the math here are his words;


I posted a comment on you Blog post on optimising the Wbal model. I've done some more thinking and I defn think it can be done without visiting the previous samples as the Skiba formula can be decomposed further, i.e. 
From your blog I believe the integral part of the equation is:





Basically this takes a weighted sum of preceding W'exp samples where the weight decays at a rate determined by tau, older samples are weighted less than newer ones. We can approximate as a sum provided tau is large compared to Ts (the sample rate):






Basic properties of exponential functions allow the formula to be rearranged as below. Written this way, the integral can be computed as a running sum rather than an inner / out loop.







i.e. Decompose into:





The sum can be updated at each time step, then the integral calculated very efficiently.
The same logic can be applied if the time step isn’t uniform as the as the original integral can be rearranged before converting to discrete form – you’d just need to use a numerical integration technique which can handle variable step length (I'd imagine the above will be fine, just vary Ts).

Popular posts from this blog

W'bal its implementation and optimisation

So, the implementation of W'bal in GoldenCheetah has been a bit of a challenge.

The Science I wanted to explain what we've done and how it works in this blog post, but realised that first I need to explain the science behind W'bal, W' and CP.

W' and CP How hard can you go, in watts, for half an hour is going to be very different to how hard you can go for say, 20 seconds. And then thinking about how hard you can go for a very long time will be different again. But when it comes to reviewing and tracking changes in your performance and planning future workouts you quickly realise how useful it is to have a good understanding of your own limits.

In 1965 two scientists Monod and Scherrer presented a ‘Critical Power Model’ where the Critical Power of a muscle is defined as ‘the maximum rate of work that it can keep up for a very long time without fatigue’. They also proposed an ‘energy store’ (later to be termed W’, pronounced double-ewe-prime) that represented a finit…

Implementing the Banister Impulse-Response Model in GoldenCheetah

Over January 2019 I implemented the Banister model in GoldenCheetah, along the way I learned a little about its strengths and weaknesses.

This post is about that; explaining the Banister model and how it relates to the PMC, how it has been implemented in GoldenCheetah and what it's limitations are. I've also added a bit at the end covering some of the things I'm looking to do with this next from potential model improvements through to deep learning.

In some ways this post is a longer written form of this tutorial I recorded covering Banister and GoldenCheetah.
The Banister Impulse Response model In 1975 Eric Banister proposed an impulse-response model that could be used to correlate past training with changes in performance in order to predict future improvements from future training.

Originally proposed for working with collegiate swimmers it was reworked in 1990 for working with running and of course also applicable for cycling. Each type of sport needed a way of calcula…

Finding TTE and Sustained Efforts in a ride

Defining the problem
Any given training ride or race will contain periods of sustained effort, sometimes to exhaustion. Perhaps during the last sprint, or over a long climb, bridging a gap or chasing on after a roundabout or corner.

Being able to identify these efforts is rather useful.

The trouble is, deciding what represents a maximal or sustained effort is often discussed, and generally has fallen into discussions about intensity and FTP or Critical Power. These discussions have tended to then focus on trying to account for the interval duration, periods of freewheeling and applying smoothing etc.

But we already have an excellent description of what constitutes a maximal effort. It is the primary purpose of any power duration model.

Power duration models estimate the maximal effort you can sustain for any given duration through to exhaustion. So if you want to identify maximal efforts its your friend.

Using the model below we can see, for example, that the athlete it represents co…