freewheeling vs cyclic task

Inna
2021-12-13
2021-12-17
  • Inna - 2021-12-13

    Hello,
    1.What are the advantages and disadvantages of using freewheeling task?
    2.What are the advantages and disadvantages of using cyclic task?
    3.How to determine what task type(freewheeling or cyclic) to use?

    Thanks in advance.

     
  • dFx

    dFx - 2021-12-15

    1.
    Pros
    Freewheel task length can be increased without much care
    Gives the fastest treatment and I/O refresh if you only need a task
    Cons
    As next scan depends on previous scan time, scan time is inconsistent with jitter, depending on your code and the machine situation
    Don't use it with any PID/PWM regulator, it's a bad idea (really bad)
    2.
    Pros
    As scan times are more consistent, the machine tends to react the same, even if you have difference in scanned code from cycle to cycle
    Tasks can be priorized to do critical stuff faster, thus giving more reactivity to important stuff you want and less to stuff that don't need it.
    Only way to do motion or regulators
    Decrease cpu usage with a lower schedule of some tasks (network stuff ? HMI ?)
    Cons
    Cycle time should be defined with care
    Increasing scanned code may lead to a watchdog trigger
    Priorization should be done correctly or some task may take very long to end
    Priorization may lead to big time slice between two instructions

    3.
    Mostly if you need motion/regulators/safety, you will use cyclic tasks. Or to optimize some critical stuff and some less important.

     

    Last edit: dFx 2021-12-15
  • Inna - 2021-12-15

    Thanks for your response.
    Regarding "Increasing scanned code may lead to a watchdog trigger" , it is relevant only if watchdog is enabled. Am I correct?
    What happens if some scans take more time than Interval time?

     
  • dFx

    dFx - 2021-12-17

    Maybe you could have a read of Online Help - Task configuration

    Watchdog is a protection mecanism. I don't know the exact behavior, but scheduling a task shorter than its execution time usually leads to schedule kill by the OS.

     

Log in to post a comment.