Cegge

Periodic Task Overlap Issue

6 posts in this topic

So I have done quite a bit of googling and i even reached out to our integrator but i am having a nuisance fault of "Watchdog Fault" Caused by periodic task overlap. The task is scheduled to start again before it is finished. I added all of the Programs in this task MAX scan time and it only came out to 102 ms. the task is scheduled for every 100 ms. The watchdog is set at 500 ms. The task is currently running at 146-148 ms and i confirmed this using a TON instruction at the end of the task followed by a reset.

What can i do to get this down?? What would be the best practice? Move programs into another task? Make the task continuous? What would happen if i did make it continuous?

I tried setting the task to 150 ms and the controller DID NOT like that. I was barely able to get back on line with it to change it back to 100 ms.

CPU usage is at 91% and this task accounts for around 50% of that. Thank you all in advance for your help.

Share this post


Link to post
Share on other sites

Resolving task overlap requires you to look not only at the task that is overlapping but at every task that is running.

You may have a higher priority task interrupting this task and so while the individual programs take 102 ms the start to finish time from first ladder scanned to last ladder scanned could be 4x-10x that.

If it were my code and I know what each program does, I'd probably create two tasks {one at 83 ms and the other at 89ms) and split the programs between them.

You may want to check with your integrator.

Share this post


Link to post
Share on other sites

As you described, taking 102 ms to execute something that is supposed to occur every 100 ms is a perfect example of task overlap. When this happens you would get an execution at 100 ms, miss the execution at 200 ms (because it took until 202 ms to finish), get the next execution at 300 ms, and so on. If you scheduled the executions further apart your task overlap counter should've stopped (regardless of problems it may have caused with your process) but you said when you tried that it gave you even more trouble. What happened?

(Make sure you have a solid backup project in your laptop. If you're having trouble getting back online after making changes you may be forced to download the whole project again.)

Task overlaps by themselves do not cause watchdog timer faults, that I'm aware of. Overlaps do reduce the efficiency of the processor by a small degree and (might) set a minor fault bit to true. But when the watchdog timer is tripped it's because the programs within that task tried to take longer to execute than what the timer was set for, not because of overlap.

Task priorities are something that has to be given careful consideration. Event tasks are usually set to have the highest priorities. Periodic tasks are typically for regularly scheduled, lower priorities. In ControlLogix you can only have one continuous task and it has the lowest priority, which can not be changed. As such, the continuous task is constantly being interrupted by other, higher priority tasks which, as BobLfoot has already mentioned, may already be part of the problem. 

Have you checked that this troubled periodic task isn't sharing the same priority level as another task? If so and they execute simultaneously, they will start time-slicing, which is handing control back and forth to each other at 1 ms intervals. This could definitely cause a watchdog timer trip. You can have up to 32 tasks, but there are only 15 task priority levels. As you soon as you write the 16th task, you're sharing a task priority level somewhere. But I've seen and been guilty of accidentally setting the same priority level to more than one task, even when there were only three or four tasks in the whole project.

Also, have you tried adjusting the watchdog timer for this task? Though the default is set to 500 ms, it can be set to a max of 2B ms. I wouldn't recommend leaving it super high, but temporarily raising it might give you chance to observe which other task(s) could be contributing to it running past the watchdog timer.

Sorry this was so long. Would like to hear how this works out.

Share this post


Link to post
Share on other sites

Also keep in mind that the correct way to check for task timing is to go to the task properties and look at the monitor tab while online.  This will let you know the last scan time and the longest scan time.  There is also a count of task overlaps there. In addition there is a tool designed just for looking into task timing issues (task monitor tool).  Its odd that increasing your time period affected your communications.  I locked myself out of a processor once by setting the task time so short that there was no time for comms.  Had to take it to program mode to recover.  I think what happened in your case was you actually increase the number of times your task was scanned.  When there is an overlap, the next run of that task is canceled.  So if you run 150ms on a 100ms scan then you are actually operating every 200ms.  When you set yours to 150 then you had very little time left over for unscheduled comms.  Similar to what I did when I was messing around with that processor.  Keep in mind you can always get back on line by going to program mode, but not usually a great option with a running process.  I think when you go online and check the monitor tab, you will find you are having scans that are approaching your watchdog timer.  That probably is due to other tasks that are interrupting this one as other posters have mentioned already.  Could also be some loop that only operates sporadically.  That is actually how I messed around with scan time is by running a loop and just increasing the iterations to see the effects. 

1 person likes this

Share this post


Link to post
Share on other sites

Great input, PLCMentor! As a side-note, the Allen Bradley L8 (64 bit) controller cards are quad-core processors, with one core dedicated solely to communications. As such, there is no system overhead time slice, which all but eliminates the comm problems you described above. Not really related to this problem, but I'd throw that in there :-)

Edited by ElectronGuru

Share this post


Link to post
Share on other sites

Did not know that.  That would explain why when I was writing the post above I couldn't find the overhead settings on my L81.  Thats  a really nice feature!

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now