Added a few new training stress metrics whilst discussing
and working on a multicomponent view of training stress.
This is all a wip falling out of discussions around stress
metrics beyond the old TSS/BikeScore models.
For now this just includes;
1. Aerobic Training Impact Scoring System on PM/PMC
2. Work (Kj) above/below CP on PM/PMC
3. Aerobic TISS on the Ride Plot
There is lots more to come; specifically around Anaerobic TISS,
looking again at polarised training and personalised training stress
based upon the individual's CP model.
.. the calculation assumed 1s recording (or was just wrong)
joules are now calculated properly, this is especially
important for SRM recordings of 0.5s samples
.. No more cutoff of the decay. Since we use threads its
not such a big deal as before.
.. We now get a full, smooth decay till the end of the ride
which was much more noticeable when predicting W'bal for
a workout, than it was for a ride.
.. to save on computing cost the W'bal decay was only
calculated to 20mins and also bounds checked to a
decay of 0.1w, but of course, the decay is more like
25 minutes and 0.1w * 1500 samples is a lot... so
I've removed them.
.. the key optimisation is the way the decay is integrated
and that is skipped for samples where W' exp is zero ..
that optimisation reduces the amount of computing cost
to 25% of doing it for all samples.
For maximum W' capacity expended i.e. Min W'bal
expressed as a percentage of W'.
So if W' is 20 kJ and W'bal is 2kJ then 18 kJ
have been expended, which when expressed as a
percentage of W' (18/20 %) would be;
Max W' Exp of 90%
I also cleaned up a few extra instances of WPrime
being created when calculatinf metrics which was
not a big deal for the Metric refresh but would make
interval metrics painful.
.. if duration is overly large we don't want to get some
massive array, it will exhaust heap and cause a crash ..
and it is likely to just be bad data.
.. don't be so keen to add zero values interpolating gaps
in recording when the gap is less than 2 samples wide.
.. previously we were adding way too may zero values at
subsecond intervals that caused an interpolated value
returned by the spline to be /practically/ zero.
.. offset needed to be a double not an int to ensure
we handle recording gaps from powertap etc where
it is not an whole number of seconds
.. Thanks for Armando Mastracci for highlighting this
and providing a test file to recreate
Fixes#773
.. just speeding up the autosolve by only looking in increments
of 3w, should speed up by a factor of 3 but will mean the result
is correct to +/- 3w .. which given the W' is usually only right
to +/- 2kJ should be about right.
.. don't rely on WPrime to compute it, its pretty simple
to compute as long as CP is set
.. add to the summary totals so always there to compare
against the total work
.. the optimisation was a little eager and took out
the integration step !
.. access to PCP is now hidden behind a function so
it is only computed when neccessary.
.. the calculation is still significantly faster than
the old one but not as instant as the non-integrating
version (but then it wasn't working either!).
.. on ride plot, when W'bal is plotted we put a mesage to say
that CP is wrong, and autosolve for W'bal to zero.
.. this patch also optimises WPrime to make it a member of the
ridefile class and this always available (even for intervals).
.. fixed a SEGV when computing metrics for intervals by shifting
the timestamps to always start from zero.
Instead of just reimplementing the spreadsheet we now
implement according to the original formulas as defined
in the W'bal paper.
This means there is no longer a 1200s limit to the decay
which was not part of the original paper.
We should be able to add some W'bal metrics now.
Added auto finding matches in Wprime, but there are
two areas to develop further;
1. Use the W'bal data to find matches instead of the
power above CP (which is really being used as a proxy
for the better approach).
2. Update the 'find intervals' dialog to allow you to
find matches and add them as normal intervals.
Pushing to repo as a version checkpoint, this function
will definitely need refining before 3.1 is released.
In preferences->athlete->power you can now set
your W' in joules alongside your CP.
This is also available in the new cyclist dialog
which also defaults to 20Kj.
Fix 1s smoothing to ensure time doesn't go backwards
as when the same timestamp is used more than once the
QwtSpline used to interpolate returns all zeroes.
The implementation set tau to a constant when it
should be derived from the recovery power across
the ride.
I've also added tau to the chart so you can see
what value has been derived.
It TREBLES the amount of time required to refresh the
metrics, so will need to be optmised before 3.1 is released.
But it should only need to run once.
I've also added a 'RideMetric::Low' type which we could
also apply to weight.