From 89a5ca26348c270d92e034d330e46a9ee8e97f82 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 20 Jan 2014 20:33:33 +0000 Subject: [PATCH] Added W' expenditure metric .. energy spent above CP --- src/DBAccess.cpp | 3 ++- src/WPrime.cpp | 37 +++++++++++++++++++++++++++++++++++-- src/WPrime.h | 2 +- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/DBAccess.cpp b/src/DBAccess.cpp index 5f86c0909..6dbb0d236 100644 --- a/src/DBAccess.cpp +++ b/src/DBAccess.cpp @@ -75,8 +75,9 @@ // 54 07 Jan 2014 Mark Liversedge Revised Estimated VO2MAX metric formula // 55 20 Jan 2014 Mark Liversedge Added back Minimum W'bal metric and MaxMatch // 56 20 Jan 2014 Mark Liversedge Added W' TAU to be able to track it +// 57 20 Jan 2014 Mark Liversedge Added W' Expenditure for total energy spent above CP -int DBSchemaVersion = 55; +int DBSchemaVersion = 57; DBAccess::DBAccess(Context* context) : context(context), db(NULL) { diff --git a/src/WPrime.cpp b/src/WPrime.cpp index 7eef12eff..367d1db99 100644 --- a/src/WPrime.cpp +++ b/src/WPrime.cpp @@ -125,6 +125,7 @@ WPrime::setRide(RideFile *input) double totalBelowCP=0; double countBelowCP=0; QVector inputArray(last+1); + EXP = 0; for (int i=0; i &, + const Context *) { + + WPrime w; + w.setRide((RideFile*)r); + setValue(w.EXP/1000); + } + + bool canAggregate() { return false; } + RideMetric *clone() const { return new WPrimeExp(*this); } +}; + // add to catalogue static bool addMetrics() { RideMetricFactory::instance().addMetric(MinWPrime()); RideMetricFactory::instance().addMetric(MaxMatch()); RideMetricFactory::instance().addMetric(WPrimeTau()); + RideMetricFactory::instance().addMetric(WPrimeExp()); return true; } diff --git a/src/WPrime.h b/src/WPrime.h index baeede074..b99a70e0d 100644 --- a/src/WPrime.h +++ b/src/WPrime.h @@ -54,7 +54,7 @@ class WPrime { double maxMatch(); double minY, maxY; - double TAU, CP, WPRIME; + double TAU, CP, WPRIME, EXP; QList matches; // matches burned with associated cost