Building workout using zone number instead of percentage range

Oops I didn’t realise I got rid of those fields. They aren’t supposed to be there actually and sometimes would have been missing. The “ftp” one is good and is chosen from the athlete’s settings for indoor/outdoor workouts.

I have added “sportSettings” which gives you all of the athletes zones etc… I have also restored “zoneTimes”. Note that this has different format for power and HR/Pace workouts. The power one includes extra fields for legacy reasons. They will probably go away. Just use “id” and “secs”.

An athlete can configure how they would like to do workouts in /settings:

So for me if a workout has power and HR and it gets uploaded to my Garmin the power targets will be used. The “target” field is what was chosen after applying this setting and looking at the workout.

“hide power” is a flag for Zwift that disables the average power display during the workout. It can be set in the workout editor.

The powerRange etc. parameters are based on these settings for Suunto/Garmin:

Except that they are always applied regardless of indoor/outdoor.

Here is an HR example:

{
  "description": "Easy toddle around the block.",
  "duration": 3150,
  "sportSettings": {
    "id": 56086,
    "athlete_id": "2060784",
    "types": [
      "Run",
      "VirtualRun"
    ],
    "warmup_time": 1200,
    "cooldown_time": 600,
    "use_laps_for_power_intervals": false,
    "lthr": 178,
    "max_hr": 192,
    "hr_zones": [
      147,
      156,
      165,
      174,
      179,
      184,
      192
    ],
    "hr_zone_names": [
      "Recovery",
      "Aerobic",
      "Tempo",
      "SubThreshold",
      "SuperThreshold",
      "Aerobic Capacity",
      "Anaerobic"
    ],
    "hr_load_type": "HRSS",
    "threshold_pace": 2.7777777,
    "pace_units": "MINS_KM",
    "pace_zones": [
      77.5,
      87.7,
      94.3,
      100.0,
      103.4,
      111.5,
      999.0
    ],
    "pace_zone_names": [
      "Zone 1",
      "Zone 2",
      "Zone 3",
      "Zone 4",
      "Zone 5a",
      "Zone 5b",
      "Zone 5c"
    ],
    "pace_load_type": "RUN",
    "gap_model": "STRAVA_RUN",
    "elevation_correction": "AUTO",
    "use_gap_zone_times": true,
    "load_order": "POWER_PACE_HR",
    "tiz_order": "POWER_HR_PACE",
    "workout_order": "POWER_HR_PACE",
    "default_gear_id": "g152587",
    "other": false,
    "eFTPSupported": false,
    "use_distance_for_intervals": false
  },
  "target": "PACE",
  "steps": [
    {
      "duration": 3150,
      "distance": 7000.0,
      "pace": {
        "value": 80.0,
        "units": "%pace"
      },
      "_pace": {
        "value": 2.222222089767456,
        "start": 2.1666665375232697,
        "end": 2.2777776420116425
      }
    }
  ],
  "zoneTimes": [
    {
      "id": "Z1",
      "secs": 0
    },
    {
      "id": "Z2",
      "secs": 3150
    },
    {
      "id": "Z3",
      "secs": 0
    },
    {
      "id": "Z4",
      "secs": 0
    },
    {
      "id": "Z5",
      "secs": 0
    },
    {
      "id": "Z6",
      "secs": 0
    },
    {
      "id": "Z7",
      "secs": 0
    }
  ],
  "options": {}
}

Thanks for that. Finally managed to refactor all of it based on this new format. Hope it doesn’t change :-p

I’m taking maxHR and LTHR from SportSettings and using the FTP from the main block.

Noted for the “hide power” and “powerRange” parameters. Not using these.

Please help to verify if this is the intended behaviour of this workout and the resultant JSON.
Note that for ramp of 100-50% should have Start: 100% and End:50% (correct in power, but _power is flipped)

This is what I ended up with when I plot it.
Screenshot 2022-04-16 at 2.01.46 AM

  "target": "POWER",
  "steps": [
    {
      "duration": 300,
      "ramp": true,
      "power": {
        "start": 100,
        "end": 50,
        "units": "%ftp"
      },
      "_power": {
        "value": 150,
        "start": 100,
        "end": 200
      }
    },
    {
      "duration": 300,
      "ramp": true,
      "power": {
        "start": 50,
        "end": 100,
        "units": "%ftp"
      },
      "_power": {
        "value": 150,
        "start": 100,
        "end": 200
      }
    }
  ],

No thats a bug. Will fix!

1 Like

Thanks… I really need to sleep… 3am here :rofl:

@david The Zones don’t match using Zone Ranges

Same for HR Zones

i did a cursory check on the JSON downloaded from web-frontend and seems to also be mismatched.

yday i reported the mismatch in the ramp start and end for Power. Seems like it’s also affecting the JSON for HR as well. After parsing, the intervals looks like these

pwrInt:[[0.0, 50.0], [5.0, 100.0], [5.0, 50.0], [10.0, 100.0]]
hrInt :[[0.0, 116.0], [5.0, 232.0], [5.0, 116.0], [10.0, 232.0]]

Sorry about digging so much into this, been doing A LOT of different permutations to test my “parsing engine”. It was SO FUN :yum:

My next headache is how to parse HR only workouts

  1. due to the existent of HR ramps.
  2. Lack of Power Based Intervals that confuses the Indoor Turbo Trainer (and basically the entire architecture of the app)

Hi David,

How this zone range will translate to Garmin’s range settings?

Tks,

image

Intervals.icu resolves zones to actual watts/bpm/pace before sending to Garmin/Suunto etc…

So, if I understood correctly, in the exemple bellow, Intervals will send ROUND((136+123)/2) and the specified range on settings, is that it?

tks.

No it will send 123 to 136 because the zone already defines a range. The ranges in settings are used for fixed steps.

Hi,

I’ll give a new try on both steps bellow because back on June 2021 I couldn’t make the secondo to work ( FTP/MMP/eFTP how in calculates - #10 by Gato_Felix) on Garmin Fenix 5x.

Tks,

not to mention they ended up being slight different on the top end