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
This commit is contained in:
Mark Liversedge
2014-08-23 20:08:46 +01:00
parent 85fc57de37
commit 68992c129d
3 changed files with 43 additions and 2 deletions

View File

@@ -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)
{

View File

@@ -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="<<CwaBike<<", afCdBike="<<afCdBike<<", afCATireV="<<afCATireV<<", ATire="<<ATire<<", afCATireH="<<afCATireH<<", afAFrame="<<afAFrame;
#endif
// last point looked at
RideFilePoint *lastP = NULL;
@@ -1398,6 +1400,7 @@ RideFile::recalculateDerivedSeries()
p->antiss = anTISS;
}
#if 0 // updating the primary data series should be done via a Fix Tool
// Slope
// If there is no slope data then it can be derived
// from distanct and altitude
@@ -1418,6 +1421,7 @@ RideFile::recalculateDerivedSeries()
// last point
lastP = p;
#endif
}
// Averages and Totals
@@ -1430,6 +1434,7 @@ RideFile::recalculateDerivedSeries()
avgPoint->apower = APcount ? (APtotal / APcount) : 0;
totalPoint->apower = APtotal;
#if 0 // again use a fix tool
// Smooth the slope if it has been derived
if (!dataPresent.slope && dataPresent.alt && dataPresent.km) {
int smoothPoints = 10;
@@ -1497,5 +1502,6 @@ RideFile::recalculateDerivedSeries()
// and we're done
dstale=false;
}
#endif
dstale=false;
}

View File

@@ -659,6 +659,39 @@ class MaxMatch : public RideMetric {
RideMetric *clone() const { return new MaxMatch(*this); }
};
class Matches : public RideMetric {
Q_DECLARE_TR_FUNCTIONS(Matches);
public:
Matches()
{
setSymbol("skiba_wprime_matches");
setInternalName("W'bal Matches > 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<QString,RideMetric*> &,
const Context *) {
int matches=0;
foreach(Match m, const_cast<RideFile*>(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());