Max Average Power Data Field for specific time intervals

It would be super helpful to have a data field with the maximum rolling average power calculations during a ride. Data fields already exist that perform this rolling calculation, but this is always just the current time period. I would like to see my best average power for the current activity (e.g., my best 10 second power output).

It would be great to be able to see the best max average is for the following time periods: 5 seconds, 30 seconds, 1 minute, 5 minutes, 8 minutes, 12 minutes, 20 minutes, 30 minutes, and 60 minutes. Wahoo has this out of the box.

It would be even more awesome if it classifies these averages on the fly using a modified version of Andrew Coggan’s watts/kg chart I created, based on the user's profile weight:

Category

Gender

5 sec

30 sec

1 min

5 min

8 min

12 min

20 min

30 min

60 min

WT Pro

Men

21.86

12.70

10.58

6.77

6.35

6.05

5.99

5.84

5.69

Women

17.70

10.27

8.56

5.87

5.50

5.25

5.29

5.16

5.03

Semi-Pro

Men

20.23

11.87

9.89

6.15

5.75

5.48

5.42

5.28

5.15

Women

16.40

9.62

8.02

5.31

4.98

4.75

4.78

4.66

4.54

Cat 1

Men

18.60

11.04

9.20

5.53

5.18

4.94

4.86

4.74

4.62

Women

15.11

8.98

7.48

4.76

4.46

4.25

4.26

4.15

4.05

Cat 2

Men

16.97

10.21

8.51

4.91

4.60

4.38

4.31

4.20

4.09

Women

13.82

8.32

6.93

4.20

3.93

3.75

3.74

3.64

3.55

Cat 3

Men

15.07

9.25

7.71

4.19

3.92

3.74

3.65

3.56

3.47

Women

12.31

7.56

6.30

3.56

3.34

3.18

3.14

3.06

2.98

Cat 4

Men

13.44

8.42

7.02

3.57

3.34

3.18

3.08

3.01

2.93

Women

11.01

6.91

5.76

3.00

2.81

2.68

2.62

2.55

2.49

Cat 5

Men

11.80

7.60

6.33

2.95

2.76

2.63

2.53

2.46

2.40

Women

9.72

6.25

5.21

2.45

2.29

2.18

2.09

2.04

1.99

  • I have a Connect IQ data field that can do this - to a limited extent.

    It's a field that allows you to specify a generic calculation of your choice (kinda like Excel for your watch), and it's limited by the available memory on your watch, which means that for most watches, a rolling average period of 10 to 30 seconds should be ok, but 60 minutes is probably out of the question for some watches. (CIQ data fields are pretty limited in the amount of memory they can use, especially for older devices.)

    The other limitation is that you can really only calculate (and record) one of the values you're interested in.

    The data field is called AppBuilder 5.

    Here's an example of settings that could fulfill one of your use cases:

    - Label: MAX 10s POWER
    (or whatever you want)

    - Formula: setv(1, timeavg(power, 10)); recordsummary(max(getv(1))); record(getv(1)); max(getv(1))
    (capitalization is not important)

    - Display Format: Auto

    - Record to FIT file: Yes

    These settings will:

    - Set the data field label to whatever you decide

    - Display max 10s power as the data field value

    - Record 10s power to the activity graph

    - Record max 10s power to the activity summary

    Ofc all of this assumes that your power meter is natively paired to your device. (The app has no provision for connecting to a power meter on its own.)

    Maybe you want to display both max and current 10s power at the same time. This is possible, but the font will be a lot smaller, due to the need to use non-numerical characters in the data value (Garmin's numerical-only fonts are bigger than its fonts which also support characters other than numbers.)

    e.g. Use the following formula instead

    - Formula: setv(1, timeavg(power, 10)); recordsummary(max(getv(1))); record(getv(1)); getv(1) + " | " + max(getv(1))

    If you want a larger averaging window, change 10 to whatever number you want. Setting a number that's too large for your CIQ device will cause the field to crash immediately (as the required memory is preallocated.)

    Note that the timeavg() function does not wait until the window is full, meaning that there will be rolling average data for the first 10 seconds of an activity (or for the first 10 seconds after you unpause your activity), which may be contrary to your expectations. Pausing an activity resets the rolling average data.

    You can override both of these limitations by adding a 3rd or 4th parameter to timeavg (after the time period, which in the above example is 10).

    [https://ciq-appbuilder.blogspot.com/p/functions.html#fn_avg]

    3rd parameter: strictWindow: (optional)
    0 (default): Does not wait until the sample window is full
    Returns an average even when the number of samples is less than the window size
    1: Waits until the sample window is full
    Returns null when the number of samples is less than the window size
    4th parameter: pauseMode: (optional)
    0: (default): Reset data on pause
    When timer is paused, discards all samples (previous and current). Returns null
    1: Keep old data during pause
    When timer is paused, keeps existing samples but does not collect new ones. Returns last known average
    2: Collect new data during pause
    When timer is paused, samples are collected. Returns the current average. Samples are also collected before the start of an activity, which may not be what you want. But this can be overridden with an explicit check — e.g. if (timer_raw eq 0, null, timeavg(...))
  • Awesome, thank you for the detailed response! I will try this soon.  

    Would you consider these requirements possible for newer Edge devices (assuming someone develops this as a data field)? 

  • No worries!

    It might be possible, yeah. On Edge 1050, there's 128 KB available to a data field. The memory needed to calculate all of the rolling average power values is roughly 40 KB, which leaves plenty of breathing room. On the flip side, it would be impossible to implement this data field on a Forerunner 935, Edge 130 or Edge 130 Plus, which only have 32 KB available to CIQ data fields. (It could work if 2 or more apps were implemented, where each app records a subset of the data you are interested in.)

    To record all that data:

    - The app would need at least 8 session fields (which are visible in the activity summary)

    - The app would optionally need at least 8 record fields (visible in the activity graph)

    There is a limit on the *total* number of FIT fields that can be recorded by all CIQ data fields, in a single activity. (Meaning it doesn't matter whether it's a single app or multiple apps recording all that data.) Idk what the limit is for Edge, but on watches, somebody claimed they were able to record 12 session fields and 16 record fields.

    Since you are on an Edge, and most Edges have a limit of 10 Connect IQ fields in a single activity, I will point out that AppBuilder 5 has an additional 3 clones in the store (for a total of 4 apps), so you could use 4 versions of the field to display and record 4 different formulas.

    I know it's not exactly what you're looking for, but AppBuilder does give you a way to record some of your data now.

  • AppBuilder is a great work-around!

    If you don’t mind, I have a couple of questions:

    1. Is there a way to remove the decimal fractions? (e.g., have the field display 250 instead of 250.44)
    2. I am having trouble adding the additional parameters. Should it look like this? setv(1, timeavg(power, 60)); recordsummary(max(getv(1))); record(getv(1)); getv(1) + " | " + max(getv(1)) + strictWindow (1)
    3. This may be a problem with my Edge 540, but I can only seem to be able to add 1 data field instead of 4. I configured 4 field in the Appbuilder settings in the Garmin IQ app, but in the Garmin Connect App I can only add 1 Appbuilder 5. Tere are no options, I can only select it as 1 data field and it automatically just picks up Profile 1 only. See screenshot below:
  • 1. If displaying one value, use the Number display format, which will round the value to the nearest integer. If displaying multiple values, use the round() function. e.g.

    Replace  getv(1) + " | " + max(getv(1)) with round(getv(1)) + " | " + round(max(getv(1)))

    2. Sorry I didn’t make it clear, but to add the strictWindow parameter with a value of 1, replace timeavg(power, 60) with timeavg(power, 60, 1). strictWindow is the 3rd parameter to timeavg and pauseMode is the 4th parameter — the names are only informative as the actual parameters don’t have names (they’re determined by their position in the list of items in the parens following timeavg.)

    3. Idk what the limit is for Edge 540 but I saw somewhere that the limit for 520 is 4 CIQ fields. There may be a bug in the Connect app regarding CIQ data fields, so you might want to try setting up the data fields on the device itself. There’s def known bugs regarding changing activity screens within the Connect app.

    To put that all together:

    setv(1, timeavg(power, 60, 1)); recordsummary(max(getv(1))); record(getv(1)); round(getv(1)) + " | " + round(max(getv(1)))

    (I recommend copy and pasting the formula when entering it settings, but if at any point you need to type this stuff on a phone, make sure you use straight quotes by holding down the quote button on your phone’s keyboard. Curly/smart quotes won’t work)

    Explanation:

    - setv(x, y) saves the value y in the numbered slot x, so you don’t have to repeat y a bunch of times in your formula

    - getv(x) loads the value saved in the numbered slot x

    - timeavg(value, duration, strictWindow, pauseMode): Takes the rolling average of value over the last duration seconds (at a sample rate of roughly once per second.) strictWindow and pauseMode are optional, and are described in the comment above.

    - recordsummary(x) records x to the activity summary

    - record(x) records x to the activity graph

    - x; y; z: the final value (in this example, z) in a semicolon separated list is used as the value that will be displayed in the data field. (the other values are only used for their side effects, as in setv() and record())

    - x + "[some text]" + y: when “+” is used on 2 numbers, it naturally returns the result of adding the 2 numbers. when “+” is used with a number and text, then the number is changed to text and the two pieces of text are joined together.

    e.g. 1 + 2 = 3

    1 + " | " + 2 = "1 | 2"

    As mentioned before, text formulas will be displayed in a smaller font than numerical formulas. Numerical formulas *should* be displayed in the largest font possible, but there’ve been known to be device bugs over the years which cause numerical data to displayed in a tiny font, for CIQ data fields such as this one.

  • Absolutely fantastic, thank you so much! The internet is a wonderful place thanks to people like you Slight smile

    I got around the issue of only being able to select 1 data field by downloading the data field clones (AppBuilder B, AppBuilder C, AppBuilder D). 

  • No worries! Hope you find it useful.