Added vdottime(VDOT, distance) to formulas

Computes the equivalent time (in seconds) for distance (in km)
at VDOT, tipically used with VDOT metric as first parameter.
This commit is contained in:
Alejandro Martinez
2015-10-30 13:36:43 -03:00
parent c299717bc4
commit aee176baf1

View File

@@ -23,6 +23,7 @@
#include "RideNavigator.h"
#include "RideFileCache.h"
#include "PMCData.h"
#include "VDOTCalculator.h"
#include <QDebug>
#include "Zones.h"
@@ -95,6 +96,9 @@ static struct {
{ "unset", 2 }, // unset(symbol, filter)
{ "isset", 1 }, // isset(symbol) - is the metric or metadata overridden/defined
// VDOT functions
{ "vdottime", 2 }, // vdottime(VDOT, distance[km]) - result is seconds
// add new ones above this line
{ "", -1 }
};
@@ -1951,6 +1955,15 @@ Result Leaf::eval(Context *context, DataFilter *df, Leaf *leaf, float x, RideIte
}
break;
case 35 :
{ // VDOTTIME (VDOT, distance[km])
if (leaf->fparms.count() != 2) return Result(0);
return Result (60*VDOTCalculator::eqvTime(eval(context, df, leaf->fparms[0], x, m, p).number, 1000*eval(context, df, leaf->fparms[1], x, m, p).number));
}
break;
default:
return Result(0);
}