dvmarinoff / Flux

Indoor Cycling App for Structured Training
https://flux-web.vercel.app
GNU Affero General Public License v3.0
541 stars 92 forks source link

SteadyState with PowerLow /PowerHigh Attribute #119

Closed TClin76 closed 2 years ago

TClin76 commented 2 years ago

image Hi @dvmarinoff I found that there are some zwo files downloaded from Whatsonzwift use PowerHigh and PowerLow within SteadyState Duration command. FLUX does not recognize this kind of syntax but only accept PowerHigh and PowerLow within Warmup/Cooldown Duration. In this case, FLUX shows power target =0 in this interval.

dvmarinoff commented 2 years ago

Having Low and High attributes on a SteadyState doesn't make any sense to me, but indeed it is working in this unexpected way: Screenshot 2022-05-05 at 9 10 28

Source: https://github.com/h4l/zwift-workout-file-reference/blob/master/zwift_workout_file_tag_reference.md#attribute-PowerHigh

dvmarinoff commented 2 years ago

Just pushed a fix for this case to the development version.

My guess is that this situation arises from visual editors transforming SteadyState intervals to Ramps and back. So if PowerLow and PowerHigh are present on a SteadyState the App will take the higher value from the 2 and use it as Power.

In this example workout all SteadyState will result in intervals of 60s at 0.70% of FTP:

    <workout>
        <SteadyState Duration="60" Power="0.70"/>
        <SteadyState Duration="60" PowerLow="0.70" PowerHigh="0.70" />
        <SteadyState Duration="60" PowerLow="0.40" PowerHigh="0.70" />
        <SteadyState Duration="60" PowerLow="0.70" PowerHigh="0.40" />
        <SteadyState Duration="60" Power="0.70" PowerLow="0.70" PowerHigh="0.70" />
    </workout>

Screenshot 2022-05-05 at 12 26 35

Here are the test cases: https://github.com/dvmarinoff/Flux/blob/85612444508da832ab021e76b465c8551ce1305c/test/workouts/zwo.test.js#L549

dvmarinoff commented 2 years ago

@TClin76 Thanks for reporting the issue!

TClin76 commented 2 years ago

Just pushed a fix for this case to the development version.

My guess is that this situation arises from visual editors transforming SteadyState intervals to Ramps and back. So if PowerLow and PowerHigh are present on a SteadyState the App will take the higher value from the 2 and use it as Power.

In this example workout all SteadyState will result in intervals of 60s at 0.70% of FTP:

    <workout>
        <SteadyState Duration="60" Power="0.70"/>
        <SteadyState Duration="60" PowerLow="0.70" PowerHigh="0.70" />
        <SteadyState Duration="60" PowerLow="0.40" PowerHigh="0.70" />
        <SteadyState Duration="60" PowerLow="0.70" PowerHigh="0.40" />
        <SteadyState Duration="60" Power="0.70" PowerLow="0.70" PowerHigh="0.70" />
    </workout>

Screenshot 2022-05-05 at 12 26 35

Here are the test cases:

https://github.com/dvmarinoff/Flux/blob/85612444508da832ab021e76b465c8551ce1305c/test/workouts/zwo.test.js#L549

I modify the zwo file and let powerHigh and powerLow have different value, and then test it in Zwift. FYI, the result will be the average of two values.

dvmarinoff commented 2 years ago

True that, just checked it in Zwift! Will update the code.

Screenshot 2022-05-05 at 13 38 49 Screenshot 2022-05-05 at 13 38 03
dvmarinoff commented 2 years ago

Updated the code to take the avg value if powerLow and powerHigh differ:

Screenshot 2022-05-05 at 13 57 01

dvmarinoff commented 2 years ago

Merged into master, closing this one.