Interval planning function

Discussion in 'Power Training' started by frost, Jul 28, 2009.

  1. frost

    frost New Member

    Joined:
    Oct 25, 2007
    Messages:
    414
    Likes Received:
    3
    I have been missing a formula that could calculate the Normalized Power for a given interval workout and there's been some threads in the past about this issue too.

    NP can be easily calculated with a simple spreadsheet formula if you forget about the smoothed average and use plain 30s average instead, which will give totally adequate accuracy but anyway I had some spare time (read, I really should start work but am still in summer vacation mood and motivation is lurking somewhere behind the corner :D) so I decided to write a specific function for it.

    Just copy+paste the code below to Excel VBA module (preferably in 'PERSONAL' workbook which makes it available to all workbooks) and use it as any Excel funtion.

     
    Tags:


  2. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0
    do you mean for intervals shorter than 5min or for people without TrainingPeaks?

    Hope so or I've missed something :D:D
     
  3. frost

    frost New Member

    Joined:
    Oct 25, 2007
    Messages:
    414
    Likes Received:
    3
    Yes, you did. Emphasis on word Planning :)

    Maybe I wasn't clear enough: This is to plan eg. a L5 workout and estimate if it is doable from the NP point of view.
     
  4. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0
    yes.... planning............. :D:D
     
  5. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0
    Very nice by the way...
     
  6. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0
  7. Alex Simmons

    Alex Simmons Member

    Joined:
    Mar 12, 2006
    Messages:
    2,471
    Likes Received:
    20
    I might be being picky but I just tested it against a square wave power input:
    4-min @ 400W
    4-min @ 200W
    x 6

    This web page calculator gives me an NP of 344W, when the actual NP for a power file like that is 339W.

    I was going to test another sample but it crashes after the first time you use it.
     
  8. frenchyge

    frenchyge New Member

    Joined:
    Apr 3, 2005
    Messages:
    4,687
    Likes Received:
    4
    I havn't checked the math, but it appears that the calculator presented here snips the rest period off the last interval of the set, as mine does here at home. The last rest doesn't really contribute to making the workout more feasible, and I go straight into cooldown after the last interval anyway.
     
  9. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0

    I'm working off the above formula. Do you want to forward yours ? I can try build that in.

    Re: the crash, this could be the previous version I was working on. Let me know if it's still happening.
     
  10. frost

    frost New Member

    Joined:
    Oct 25, 2007
    Messages:
    414
    Likes Received:
    3
    Correct. I was thinking of putting an optional argument to control if last rest period should be included or not but then skipped it as for the planning purpose the interval parts is of interest.

    Anyway it is not a commercial product. I did it in about 15 minutes so if you find any bugs or errors in it, it is not being picky telling about it.

    I haven't have any crasing issues. Alex, which office version do you use? Does it get stuck or do you get some error message?
     
  11. frost

    frost New Member

    Joined:
    Oct 25, 2007
    Messages:
    414
    Likes Received:
    3
    If you want to include the last rest period to NP calculation change the following line:

    totalTime = t1 * intCount + t2 * (intCount - 1)

    to

    totalTime = t1 * intCount + t2 * intCount

    it gives 338,25 to the Alex' example. Minor difference could be explained by the way the first 30s is calculated. I do not know how it is actually handled in real NP calculation so I made a shortcut and just summed each second before 30 second and divided by smoothing window 30 which should probably be divided by the number of seconds.

    You may change the line:

    runningAverage = runningTotal / SWindowSize

    to

    If i < SWindowSize Then
    runningAverage = runningTotal / i
    else
    runningAverage = runningTotal / SWindowSize
    End if
     
  12. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0

    No the crashing was for the web page I created (it's fixed now) based on your formula. Hope that's ok. I though it might be nice for more people to have access to it as it's pretty handy.

    Calculate the Normalized Power for a given interval workout
     
  13. frost

    frost New Member

    Joined:
    Oct 25, 2007
    Messages:
    414
    Likes Received:
    3
    Ok, I just read your message about the web page after I had written my post. :)
     
  14. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0

    I've updated the site with the above changes .

    I am rounding off so the result for Alex's example is 340 (339.59)
     
  15. frost

    frost New Member

    Joined:
    Oct 25, 2007
    Messages:
    414
    Likes Received:
    3
    That's nice!! Maybe you could still add an argument if the last recovery should be included or not and control this with it:

    totalTime = t1 * intCount + t2 * (intCount - 1)

    to

    totalTime = t1 * intCount + t2 * intCount
     
  16. giannip

    giannip New Member

    Joined:
    Jul 7, 2005
    Messages:
    364
    Likes Received:
    0
    like so? Calculate the Normalized Power for a given interval workout

    would people prefer the rounded off figure ?
     
  17. frenchyge

    frenchyge New Member

    Joined:
    Apr 3, 2005
    Messages:
    4,687
    Likes Received:
    4
    Nawwww.... I like my workout estimators accurate to at least 3 digits. ;):D

    How about that typo, though?
     
  18. Squint

    Squint New Member

    Joined:
    Jul 27, 2003
    Messages:
    351
    Likes Received:
    0
    It is indeed 339W NP: View attachment 10847
     
  19. steve

    steve Administrator
    Staff Member

    Joined:
    Aug 12, 2001
    Messages:
    5,271
    Likes Received:
    214
    Hi there

    Instead of post wide images that mess up the thread layout, you can use a neat attachment function that will display your image as a thumbnail within the post text.

    So do it, simply click the [​IMG] icon and upload your image(s), close the popup window once complete.

    Now the same icon [​IMG] will have a drop down menu, this allows you to select your images and they will be inserted into your post (where your cursor is positioned).

    View attachment 10846

    Text can be displayed under attachments managed this way.

    regards
     
  20. Piotr

    Piotr New Member

    Joined:
    Jan 29, 2007
    Messages:
    794
    Likes Received:
    0
Loading...
Loading...