From 68992c129dfc22e476f6ff52a2022b1b5799ec9b Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sat, 23 Aug 2014 20:08:46 +0100 Subject: [PATCH] Matches metric .. how many >2kj matches did you burn ? .. also taken out the power/slope derived data series since Jon is migrating it to a fix tool --- src/DBAccess.cpp | 3 ++- src/RideFile.cpp | 8 +++++++- src/WPrime.cpp | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/DBAccess.cpp b/src/DBAccess.cpp index d26b781a4..566e5d998 100644 --- a/src/DBAccess.cpp +++ b/src/DBAccess.cpp @@ -100,8 +100,9 @@ // 79 20 Jun 2014 Mark Liversedge Change the way average temperature is handled // 80 13 Jul 2014 Mark Liversedge W' work + Below CP work = Work // 81 16 Aug 2014 Joern Rischmueller Added 'Elevation Loss' +// 82 23 Aug 2014 Mark Liversedge Added W'bal Matches -int DBSchemaVersion = 81; +int DBSchemaVersion = 82; DBAccess::DBAccess(Context* context) : context(context), db(NULL) { diff --git a/src/RideFile.cpp b/src/RideFile.cpp index c54dab733..6075ee0ef 100644 --- a/src/RideFile.cpp +++ b/src/RideFile.cpp @@ -1235,6 +1235,7 @@ RideFile::recalculateDerivedSeries() if (oCP) CP=oCP; } +#if 0 // use a fix tool // Power Estimation Constants double hRider = 1.7 ; //Height in m double M = getWeight(); //Weight kg @@ -1255,6 +1256,7 @@ RideFile::recalculateDerivedSeries() double adipos = sqrt(M/(hRider*750)); double CwaBike = afCdBike * (afCATireV * ATire + afCATireH * ATire + afAFrame); qDebug()<<"CwaBike="< 2KJ"); + } + void initialize() { + setName(tr("W'bal Matches")); + setType(RideMetric::Total); + setMetricUnits(tr("matches")); + setImperialUnits(tr("matches")); + setPrecision(1); + } + void compute(const RideFile *r, const Zones *, int, + const HrZones *, int, + const QHash &, + const Context *) { + + int matches=0; + foreach(Match m, const_cast(r)->wprimeData()->matches) { + if (m.cost > 2000) matches++; // 2kj is minimum size + } + setValue(matches); + } + + bool canAggregate() { return false; } + RideMetric *clone() const { return new Matches(*this); } +}; + class WPrimeTau : public RideMetric { Q_DECLARE_TR_FUNCTIONS(WPrimeTau); @@ -777,6 +810,7 @@ class CPExp : public RideMetric { static bool addMetrics() { RideMetricFactory::instance().addMetric(MinWPrime()); RideMetricFactory::instance().addMetric(MaxWPrime()); // same thing expressed as a maximum + RideMetricFactory::instance().addMetric(Matches()); RideMetricFactory::instance().addMetric(MaxMatch()); RideMetricFactory::instance().addMetric(WPrimeTau()); RideMetricFactory::instance().addMetric(WPrimeExp());