User defined metrics, is there documentation ?

743 views
Skip to first unread message

Thin Lenny

unread,
Mar 9, 2017, 4:46:37 PM3/9/17
to golden-cheetah-users
Hi,

I woud like to add a metric that give time spent between two fixed power values, ie : [100,200]

I've created à user defined metrics like that :

{

# only calculate for rides containing power

relevant { Data contains "P"; }


# initialise aggregating variables

init { seconds <- 10; }


sample {

if (POWER > 100 and POWER < 200) {

seconds <- seconds + RECINTSECS;

}

}


# calculate metric value at end

value { seconds / 60; }

}


Type = sum


But it give me a flat chart in the trends after creating a new one for this metric.

Can you help me ?


Another question, what is the use of conversion factor, conversion sum and the test button ?


Thanks :-)


Mark Liversedge

unread,
Mar 9, 2017, 4:59:03 PM3/9/17
to golden-cheetah-users

Ale Martinez

unread,
Mar 9, 2017, 5:00:34 PM3/9/17
to golden-cheetah-users
On Thursday, 9 March 2017 18:46:37 UTC-3, Thin Lenny wrote:
Hi,

I woud like to add a metric that give time spent between two fixed power values, ie : [100,200]

I've created à user defined metrics like that :

{

# only calculate for rides containing power

relevant { Data contains "P"; }


# initialise aggregating variables

init { seconds <- 10; }


sample {

if (POWER > 100 and POWER < 200) {

seconds <- seconds + RECINTSECS;

}

}


# calculate metric value at end

value { seconds / 60; }

}


Type = sum


But it give me a flat chart in the trends after creating a new one for this metric.

Can you help me ?



Another question, what is the use of conversion factor, conversion sum and the test button ?

Test button is to test your metric on the selected activity, conversion factor and sum are used to convert from metric to imperial units 

Thanks :-)

YW 
Message has been deleted

Thin Lenny

unread,
Mar 10, 2017, 4:26:28 AM3/10/17
to golden-cheetah-users
Thank you for your answer.
I've found the main problem : if I remove this line :

relevant { Data contains "P"; }

I get the right computed result, otherwise I get 0
What is wrong with this ?

Mark Liversedge

unread,
Mar 10, 2017, 6:46:21 AM3/10/17
to golden-cheetah-users
It will only bother to compute the metric if power is present in the file.

The "Data" metadata field contains a letter for each data series that is present.
P=Power
H=Heartrate etc

I should describe this in the wiki, will fix it now.

Mark
Reply all
Reply to author
Forward
0 new messages