Hi Mark,he userwhere can I find the user formula editor?Could you post some screenshots?
Hi,I'm looking for a way to create a chart to plot the average powers of a specific interval called "Hill #1" (the same interval is many different rides).The purpose of this chart is to compare my improvement in this interval in a speficia range of time.Could the "User Formula" be useful?Any other idea?
Which formula could I use if I would track the time I spent between CP and Vo2max higher limit? For example If my CP is 300 and my Vo2max il between 320 and 360, I would like to track the time spent between 300 and 360 watt. Thanks
I thought the same but I hoped for a less destructive way
To do this I need to add up all my Running mileage over the previous 8 weeks & all my running time over the last 8 weeks. Using the conditional statement I think I am getting both Bike and Run data put just plotted on days where isRun>0. Do you have any thoughts on how I may be able to just add my total running time and total moving times over the last 8 weeks?
i want to plot power profile (critical power chart) for different period of time, on the same chart, to see the evolution of th epower profile during the season. e.g. jan-feb, and then mar-apr, on the same chart.is there a way to do so with the formula?thanksR
Hi,Firstly can I say what a great tool this is especially with the ability to add user formulas. I’ve got two questions as I am attempting to implement Tanda Marathon Predictor Formula: Ref: https://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&uact=8&ved=0ahUKEwiRxfeU85TKAhWBiRoKHUuwBrMQFggyMAM&url=http%3A%2F%2Fwww.jhse.ua.es%2Fjhse%2Farticle%2Fdownload%2F190%2F385&usg=AFQjCNFpaKHqyfjvWsOHNAlGxpoeALLZbA&sig2=KRPh0ldHn5xZa-QY6oWIZw&bvm=bv.110151844,d.d2sTo do this I need to add up all my Running mileage over the previous 8 weeks & all my running time over the last 8 weeks. Using the conditional statement I think I am getting both Bike and Run data put just plotted on days where isRun>0. Do you have any thoughts on how I may be able to just add my total running time and total moving times over the last 8 weeks? As I have written it:#Tanda Pm# Pm(sec/km)=17.1+140e[-0.0053k(km/week)]+0.55P(sec/km)isRun>0 ?17.1+(140*exp(-0.0053*(sum(Distance[Date-56:Date])/8)))+(0.55*(sum(Time_Moving[Date-56:Date])/sum(Distance[Date-56:Date]))):0
SWOLF... not sure how to do this in GC because I cant seem to get a length time in S from the variables available.
for the attached file i used the formula Elevation_Gain["2015/11/01" : date], but since mid april it don't add meters, which is the problem? thx
It just shows a constant 21.8 if I enter the formula. Also, would we have to rewrite this every time for different pool length? Is there anyway to get the pool length from the data?
Ta,
Jean
Hey AleIt just shows a constant 21.8 if I enter the formula.
Is there anyway to get the pool length from the data?
I had put the formula into the chart data. Can post screens tonight, if you like?
My pool swim lengths are a bit fuzzy.. 23m, 54m, etc.
I had put the formula into the chart data. Can post screens tonight, if you like?
Is it possible to isolate the data from only a portion of a ride file with these custom formulas, for example the first 30 or 60 minutes?
Thanks Mark,
So, looking at the 3.4 release candidate
Is the idea that I create a sample of data using the SECS < 3600 and then apply a formula to the data from that sample either by analysing second by second data or averages for that sample?
That would be the beez knees!
((sum(Distance[Date-7:Date]) / (sum(Distance[Date-28:Date]))))
Hi Ale,I'm not doing well at building formulas. I'm trying to create a formula to calculate acute to chronic workload ratio from mileage. I want the most recent week's mileage divided by the average weekly mileage over the past four weeks. It doesn't return any information if I enter:
((sum(Distance[Date-7:Date]) / (sum(Distance[Date-28:Date]))))
Where am I going wrong? Thank you.
I don't know, vector formulas on Metric Trends chart are not working for me either...
How can I set a chart if I would like to track the percentage of time spent each ride in polarised zone? I'm only able to get a simple chart where I can see the percentage in polarized zone during all season.Thanks
library('caTools')
data <- GC.activity()
n <- length(data$speed)-90
lagSpeed <- c(tail(data$speed,n),rep(NA,90))
data$lagSpeed <- lagSpeed
range <- runmax(data$heart.rate,90) - runmin(data$heart.rate,90)
data$range <- range
stable_data = subset(data, range<=4 & heart.rate > 110 & lagSpeed > 10, select =c(heart.rate, lagSpeed))
fit <- lm(stable_data$lagSpeed~stable_data$heart.rate)
cf <- round(coef(fit), 3)
intercept <- cf[1]
slope <- cf[2]
plot(stable_data$heart.rate, stable_data$lagSpeed)
abline(fit, col="red")
#eq <- paste0("speed = ", intercept, " + ", slope, "*HR")
#mtext(eq, 3, line=-1, col="green")
him <- (1.61*60)/(intercept + slope*155)
him_min <- floor(him)
him_sec <- round(60*(him - him_min),0)
mtext(paste0("HIM Pace [min/mile] = ", him_min, ":", him_sec), 3, line=-1, col="red")
I would LOVE to have the ability to create a User Metric in R and "insert" it into CG (e.g., GC.metrics() <- myNewMetric).
Hi Mark,Is this still an outstanding issue? I have been looking at one of the trend charts which is supposed to give Tanda Marathon Prediction but it doesn't plot anything. I'm not quite across the array formula syntax, but also tried a simplified formula ofsum(Distance[Date-56:Date])in a Trend chart, and this also gives no output. Have tried this in the latest 3.5-DEV1704 with no luck.
To help out a little, we also have access to the athlete configurations, via a function called config(), for example to use the athlete weight (on the date of the ride) we can rewrite the formula as;(config(weight) * 2.2) * (Distance * 1.609)The config function will return values for; cp, cv, scv, w', pmax, height, weight, units, lthr, maxhr, rhr. All of which are returned in metric units. So you will need to convert if you prefer imperial units, the config(units) will be non-zero if imperial units are preferred.
# only calculate for swim workouts
relevant { isSwim=1; }
# calculate metric value at end
value { config(scv) ; }
}
{
relevant { Data contains "P"; }
value { NP / Athlete_Weight; }
count { Duration; }
}
Hi.
I want to create a formula of 20min peak power for each ride, and want to the Efficency factor of that 20 min. to see a trend in my training.
Hi Guys,
I will like to make a formula for calculate the MMP Percentage of selected intervals not in base of full history of mean max power
but calculated only a selected period (example last year or last 3 months or last month or last weeks)
Wow, this is really fantastic. I am trying to create a couple of charts which I want to use for my performance planing on the bike.- 28 Day rolling average for TSS to be calculated for each day from cycling activities onlyI've been using the 'Running Total' option from the aggregate drop down list and can get the TSS running total using just TSS, however when I try to filter for a date range I don't seem to be able to get any results.sum(TSS[date-28:date]) or sum(TSS[[date-28:date]])There's a comment earlier in the thread saying that vectors aren't working in 3.4, would this cause problems with what I'm trying to do?
Also, how do I use a gchart file in GC? I downloaded an example from this thread but couldn't work out how to add it to GC.
Thanks for the info, much appreciated. Would the formula above give the result I was after when in the working version?
We will release 3.3 at Christmas, it will contain user formulas and a metric scatter plot, and maybe a few other little fixes. We will also release 4.0 sometime around next years TdF that will contain planning and impulse-response modelling.I said, for those that are playing along with the master repo (3.3 development) that I would document the User Formula stuff, so here is a very brief and to the point summary of what formulas can do. As ever, it is likely to change rapidly over the next few weeks, but these are the current features.[FWIW, I am entirely conflicted about allowing vector operations by default; on the one hand they are elegant but in the other they aren't exactly user friendly ! Also, the Eigen matrix lib is likely to become a dependency for some new work on impulse response that needs matrix functions so we may also extend to allow that. But then, this "simple" idea is turning into a clone of R and I think that is wrong...]GOLDENCHEETAH FORMULAS1. EXTENDING DATA FILTERSWe have extended the datafilter functionality that allowed you to write logical expressions to filter rides to return values that can be used when charting.For example, in the past you could write;NP > Average_PowerTo find NP busters in your ride collection. We have now updated this to allow the result to be a value, that you could then chart, in this case how much of an NP buster is it:NP - Average_Power2. WORKING WITH RIDESAt present, the formulas are being used to generate values to plot on long term metric charts. They are applied for each ride and the result is then plotted. There are drawbacks to this approach, but for now, they allow us to get started and we can then consider using them in more complex ways.Certainly in the future I would like to use them to compute new metrics from ride data, dervice data series from ride data and compute impulse-response models or even power duration models. But for now they are applied to rides when plotting LTM charts.3. GETTING STARTEDIf we create a new LTM chart and add a curve we can choose a 'Formula'. This formula can be entered into the formula editor. The editor has autocomplete, syntax highlighting and brace matching. The autocomplete will offer completions for all the named metrics (things like Average_Power, TSS, IF) as well as metadata (things like Sport and Workout_Code) as well as all the built-in functions (things like min(), max(), sum()).The very simplest formula would be:1This will plot the value 1 for every ride. We can extend this a little and change that to a ride metric:TSSThis will plot the TSS value for every ride. And of course we can then extend this with some arithmetic:TSS/2Will plot half of TSS for every ride. But you will quickly want to use the metrics in more interesting computations. For example you might want to calculate how many calories were burned in a workout, for bike rides that is really easy (its essentially the 'Work' metric), but for runs we will need to calculate it, e.g. as weight * distance in imperial;(Athlete_Weight * 2.2) * (Distance * 1.609)
To help out a little, we also have access to the athlete configurations, via a function called config(), for example to use the athlete weight (on the date of the ride) we can rewrite the formula as;(config(weight) * 2.2) * (Distance * 1.609)The config function will return values for; cp, cv, scv, w', pmax, height, weight, units, lthr, maxhr, rhr. All of which are returned in metric units. So you will need to convert if you prefer imperial units, the config(units) will be non-zero if imperial units are preferred.
There is also a const() function that will return high precision mathematical constants for e and pi that can be used in more advanced formulas. As you might expect we also have math functions to use to; cos/tan/sin and acos/acosh friends, exp, log/log10, fabs, ceil, floor, round as well as isinf/isnan. They all call standard math functions (see C++ math.h).4. MAKING DECISIONSIn our example of calories burned we use two different formulas depending on if the activity is a bike ride or a run. So we need to decide which one to use in our formula. There is a conditional statement that will be familiar to C and Java developers:isRun>0 ? (config(weight) * 2.2) * (Distance * 1.609) : WorkUnpicking this, the '?' operator and ':' operators are the key piece. The '?' after 'isRun>0' tells us it is a conditional statement. If isRun>0 then evaluate the expression to the left of the colon, otherwise the one to the right. They can be nested so you can get quite funky.5. BESTS, TIME IN ZONE AND ESTIMATESAs well as all the pre-computed metrics available to use, we can also work with the mean maximal data for the ride as well. We use the best() function for this:best(power, 3600)Will return the best 1hr power within this ride. The duration is always in seconds, and we can choose from power, hr, apower, cadence, speed, torque, vam, xpower, np and wpk. There are lots of formulas in the literature that use power for a duration to derive other markers. Naturally we may also want to plug in an estimated value from the power duration models too. So to access an estimate that applied on the date of the ride use:estimate(2p, 3600)As you would imagine this will return the estimated 1hr power using the 2 parameter critical power model. You can use other models; 2p, 3p, ext, velo and ws are classic CP, morton 3 parameter, GC extended model, veloclinic and ward-smith respectively. You can also get the parameters that applied;estimate(2p, cp)Will return the estimated value for CP from the 2 parameter model. Where we supplied a duration in the previous example as the second parameter we can also request the parameters by name; cp, w', ftp, pmax can all be extracted.We also provide functions for extracting time spent in zone, currently it is just for the configured power and hr zones;tiz(power, 4)Will return the time spent in seconds at power zone 4.6. WORKING WITH DATESWhen filtering it is quite useful to filter rides based upon when they occurred. The date of the current ride is 'date', the current date is 'today' and we can create a specific date via the string format "yyyy/mm/dd". This string format was chosen to be independent of regional conventions and (hopefully) easy to remember.The filter below will select activities where the date is greater than 90 days ago.date > today-90Also, to get access to the currently selected daterange (when on trend or diary view there is always a date range selected to chart for) we can use the daterange function; daterange(from) is the first date of the currently selected range, and daterange(to) is the last date.6. WORKING WITH LOTS OF ACTIVITIES (VECTORS)So far all we have done is compute a result on the basis of details regarding the current ride, but there are situations where we need to know a little more. For example, I want to know when I have done more than one workout in a day.So to support these kinds of things we can create a list of rides and apply a formula to them:Activities["2015/01/01" : "2015/12/31"]This will evaluate the expression Activities (which is always 1 for a single ride) for all rides in the year 2015. When working with ranges we basically apply an expression to the range selected:(expression) [ from : to ]For every activity in the range from/to the expression is applied and stored away. This results in a list of values rather than a single result. This list is referred to as a vector. If you use a vector in another operation e.g.Activities["2015/01/02" : "2015/12/32"] > 10Then the list is evaluated as a sum of all entries. So the example above will evaluate to true if there are more than 10 rides in 2015. So back to our example, where we wanted to find 2-a-days;Activities[date:date] > 1Will count all activities on the same date as the one being evaluated and if there is more than one it returns true. But we often want to do a little more than sum, we might want to find the average TSS. So there are functions we can use to work with each of the vector elements;mean(TSS["2015/01/01":"2015/12/31])Will find the average TSS in 2015. But it will be skewed by activities that have a zero TSS (maybe they are runs or swims), so we can also filter vectors;which(x>0, TSS["2015/01/02" : "2015/12/31"])Will create a vector of all rides. The expression 'x>0' is applied to every element replacing x with the value of the element.Other functions that we can use to work with vectors include;sum() - to calculate the sum of the elementscount() - to provide a count of elementsmax() - to return the largestmin() - to return the lowestLastly, these functions can be passed a list of parameters and will work on those as well as vectors;max(BikeScore, SwimScore, GOVSS)for example will return whichever is the highest value, a sneaky way of getting stress across multple sports without having to check if its a run, swim or ride.7. WORKING WITH PMCLastly, we have functions for calculating PMC stress metrics; sts, lts, sb and rr will calculate short-term, long-term, stress balance and ramp rate for the supplied formula.So if you like to use TSS then its straight forward;sts(TSS)will return the CTL for the day of the ride. But you can provide a formula too, so a triscore type pmc might have an expression likests(max(BikeScore,SwimScore,GOVSS))to cascade between the three as an input. There is no limit to the expression you provide as an input, so you could usests(mean(TSS[date:date-30]))To calculate stress based upon a rolling 30d average TSS.CheersMark