mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Add W' Power metric
.. as W' work (joules from time spent above CP) divided by duration. This represents the W' contribution to Average Power.
This commit is contained in:
@@ -111,8 +111,9 @@
|
||||
// 105 09 May 2015 Ale Martinez Added PeakPace and PeakPaceSwim metrics
|
||||
// 106 09 May 2015 Mark Liversedge Added MMP Percentage - %age of power for duration vs CP model
|
||||
// 107 29 May 2015 Mark Liversedge Added AP as percent of maximum
|
||||
// 108 29 Jun 2015 Mark Liversedge Added W' Power - average power contribution from W'
|
||||
|
||||
int DBSchemaVersion = 107;
|
||||
int DBSchemaVersion = 108;
|
||||
|
||||
RideMetricFactory *RideMetricFactory::_instance;
|
||||
QVector<QString> RideMetricFactory::noDeps;
|
||||
|
||||
@@ -721,6 +721,47 @@ class WPrimeExp : public RideMetric {
|
||||
RideMetric *clone() const { return new WPrimeExp(*this); }
|
||||
};
|
||||
|
||||
class WPrimeWatts : public RideMetric {
|
||||
Q_DECLARE_TR_FUNCTIONS(WPrimeWatts);
|
||||
|
||||
public:
|
||||
|
||||
WPrimeWatts()
|
||||
{
|
||||
setSymbol("skiba_wprime_watts");
|
||||
setInternalName("W' Watts");
|
||||
}
|
||||
void initialize() {
|
||||
setName(tr("W' Power"));
|
||||
setType(RideMetric::Total);
|
||||
setMetricUnits(tr("watts"));
|
||||
setImperialUnits(tr("watts"));
|
||||
setPrecision(0);
|
||||
}
|
||||
void compute(const RideFile *r, const Zones *zones, int zonerange,
|
||||
const HrZones *, int,
|
||||
const QHash<QString,RideMetric*> &,
|
||||
const Context *) {
|
||||
|
||||
int cp = r->getTag("CP","0").toInt();
|
||||
if (!cp && zones && zonerange >=0) cp = zones->getCP(zonerange);
|
||||
|
||||
double total = 0;
|
||||
double secs = 0;
|
||||
foreach(const RideFilePoint *point, r->dataPoints()) {
|
||||
if (cp && point->watts > cp) {
|
||||
total += r->recIntSecs() * (point->watts - cp);
|
||||
secs += r->recIntSecs();
|
||||
}
|
||||
}
|
||||
setValue(total/secs);
|
||||
setCount(secs);
|
||||
}
|
||||
|
||||
bool canAggregate() { return false; }
|
||||
RideMetric *clone() const { return new WPrimeWatts(*this); }
|
||||
};
|
||||
|
||||
class CPExp : public RideMetric {
|
||||
Q_DECLARE_TR_FUNCTIONS(CPExp);
|
||||
|
||||
@@ -773,6 +814,7 @@ static bool addMetrics() {
|
||||
RideMetricFactory::instance().addMetric(MaxMatch());
|
||||
RideMetricFactory::instance().addMetric(WPrimeTau());
|
||||
RideMetricFactory::instance().addMetric(WPrimeExp());
|
||||
RideMetricFactory::instance().addMetric(WPrimeWatts());
|
||||
RideMetricFactory::instance().addMetric(CPExp());
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user