Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Codesys - Cycle Time and Jitter

pkennedy
2021-03-16
2021-03-18
  • pkennedy - 2021-03-16

    I have an issue with on of my programs, the cycle time seems to be extremely long.

    Based on the task configuration:

    Last Cycle Time (us) = 680000 - 720000
    Average Cycle Time (us) = 117920 - but constantly climbs the longer the program runs
    Max Cycle Time (us) = 807659

    Jitter (us) = 806802

    I ran the PLC load average in the PLC Shell command and it's only showing 49%.

    I set up timers and noted one PRG was taking quite a bit more time:

    Task End Time PRG Start Time Difference
    Time 1 5168987211 5168987174 37
    Time 2 5168987212 5168987174 38
    Time 3 5168987218 5168987174 44
    Time 4 5168987267 5168987174 93
    Time 5 5168987275 5168987174 101
    Time 6 5169607023 5168987174 619849
    Time 7 5168986684 5168987174 -490

    I comment out that PRG in the code and the times drop drastically:

    Last Cycle Time (us) = 78000 - 82000
    Average Cycle Time (us) = 17000 - but constantly climbs the longer the program runs
    Max Cycle Time (us) = 156104

    Jitter (us) = 155213

    However my PLC load actually increased to 69%.

    The program is taking data points and writing them to a file on a USB, using the CAA File (3.5.12.0) library. Is there a chance it's taking so long because of writing to the USB directly? Should I look to save directly to the HMI/PLC and then transfer to the USB after saving all the required data?

     
  • aliazzz

    aliazzz - 2021-03-17

    If you really need to know what the root cause is without too much hassle, you should give the CODESYS professional developer Edition "Profiler" plugin a try.
    It's very suited for identifying the root cause of your timing issue's!

    You can always run a month demo for free ;-)

     

    Last edit: aliazzz 2021-03-17
  • pkennedy - 2021-03-18

    Okay, I'll have a look and see, thanks.

     

Log in to post a comment.