Power@145bpm chart

I’m working on a number of Z2 custom fields and the code could do what you want with some small modifications. I don’t know how familiar you are with the JS scripts, so shoot your questions if needed. I will try to help but I’m also a ‘beginner’.
This is the code I have now:

// Only activities Run or Virtual Run ,
// not tagged with ignore HR and/or Pace
// With mimnimal 900 points (15 min) in defined range
hr_target = 118
hr_range = 5
hr_min = hr_target - hr_range
hr_max = hr_target + hr_range
gap_target = 570
gap_range = 60
gap_min = 1000 / (gap_target + gap_range)
gap_max = 1000 / (gap_target - gap_range)
pwr_target = 115
pwr_range = 15
pwr_min = pwr_target - pwr_range
pwr_max = pwr_target + pwr_range
valid = 900
if ((activity.type == “Run”
|| activity.type == “VirtualRun”)
&& !activity.icu_ignore_hr
&& !activity.ignore_velocity)
{
// get data streams
hrStr = streams.get(“fixed_heartrate”).data
velStr = streams.get(“ga_velocity”).data
pwrStr = streams.get(“fixed_watts”).data
count = 0
rEFF = 0
rFIT = 0
rTECH = 0
rPwr = 0
rGap = 0
// iterate over data streams
for (let i = 0; i < velStr.length; i++)
{
hr = hrStr[i]
gap = velStr[i]
pwr = pwrStr[i]
// verify if point is in range for HR, gap and power
if(hr >= hr_min && hr <= hr_max && gap >= gap_min && gap <= gap_max && pwr >= pwr_min && pwr <= pwr_max)
{
// count number of points in Green Zone
count++
// acumulates metric points
rFIT = rFIT + (pwr / hr)
rTECH = rTECH + 60 * (gap / pwr)
rPwr = rPwr + pwr
rGap = rGap + gap
}
}
}
if (count >= valid)
{
// rEFF = (rFIT /count) * (rTECH / count)
// rFIT = rFIT / count
// rTECH = rTECH / count
rPwr = rPwr / count
// rGap = 1000 / rGap
}

Some info: the script looks for datapoints in the activity where HR, GAP and Power are within a certain range. It accumulates the results for the different parameters and returns the avg.
You need to set the targets for HR, GAP and Power to values that ‘go together’ or nothing will be processed. Or you set a big range.
The reason I’m doing it this way, is that this will avoid most of the anomalies from glitches, sudden spikes and HR lag (especially at the start and end of HIT intervals)
Once the fields are ready, I will share all of them. Should be later this week.

  • Running Efficiency in meter/beat
  • Running Fitness in watt/beat
  • Running Technique in meter/watt
  • Running Power in watt
  • Running GAP in min/km
  • Running cadence in spm
2 Likes