Tasks
Tasks are the basic scheduling mechanism for executing a program. Each task can contain multiple programs, status information, and configuration information.
By default, when creating a project, the MainTask is already defined as a continuous task. When creating a Safety controller project, the
Logix Designer
programming application creates the SafetyTask, with a Safety program and a main Safety routine.After creating a task, configure other properties, such as how the programs within the task execute, how often the task is triggered, and in which priority the task runs. Prioritize the tasks up to 15 levels (3 for
Studio 5000® Logix Emulate™
controllers).- The continuous task has the lowest priority.
- A task at a higher priority preempts one at a lower priority.
- Tasks at the same priority execute on a time-slice basis at 1 msec intervals.
Logix controllers allow multiple tasks to schedule and prioritize the execution of your programs based on specific criteria. This balances the processing time of the controller across the different operations in your application. The controller performs certain operations as needed, while leaving enough CPU time for the remaining operations.
For example, using a continuous task that runs in the background to execute the majority of your logic. To guarantee the timely execution of a specific operation, schedule a periodic task that interrupts the continuous task, performs the operation, and returns control to the continuous task. And finally, set up event tasks that run only when triggered by specific conditions or operations.
The number of tasks supported in a project depends on the controller platform.
This platform: | Supports these tasks: |
ControlLogix | 32 tasks; only 1 may be continuous. There are 15 configurable priority levels for periodic and event tasks; these range from 1 (highest priority) to 15 (lowest priority). |
CompactLogix | 32 tasks; only 1 may be continuous. There are 15 configurable priority levels for periodic and event tasks; these range from 1 (highest priority) to 15 (lowest priority). The CompactLogix controllers use a dedicated periodic task at priority 6 to process I/O data. This task executes at the fastest RPI you have scheduled for the system. Its total execution time is as long as it takes to scan the configured I/O modules. |
Studio 5000 Logix Emulate | 32 tasks; only 1 may be continuous. There are 3 configurable priority levels for periodic and event tasks; these range from 1 (highest priority) to 3 (lowest priority). |
ATTENTION:
If the controller detects that a periodic task trigger occurs for a task that is already operating, a minor fault occurs.
Within a Safety task, schedule multiple Safety programs, composed of multiple Safety routines. However, the
GuardLogix
controller supports only a single Safety task. This task cannot be deleted or inhibited via programming. Furthermore, you cannot schedule standard programs or execute standard routines within the Safety task.Specifying the Task Period
For the standard task, configure the time period from 1 msec to 2,000 seconds. The default is 10 msecs. Ensure that the time period is longer than the sum of the execution times of all the programs assigned to the task. When working with multiple periodic tasks, make sure that sufficient CPU time is made available to handle task interruption.
The Safety task is a periodic/time task. Select the task priority and watchdog timer via the Task Properties dialog box for the Safety task.
The Safety task should be the controller’s top priority. Specify both the Safety Task Period (that is, the period at which the Safety task executes, in msec) and the Safety Task Watchdog (that is, the maximum time allowed from the start of the Safety task execution to its completion, in msec).
The Safety Task Period is limited to a maximum of 500 msec and cannot be modified online. Make sure that the Safety Task has enough time to finish before it is triggered again. Safety Task Watchdog Timeout, a non-recoverable safety fault in the
GuardLogix
controller, occurs if the Safety Task is triggered while it is still executing from the previous trigger.The Safety Task Period and Safety Task Watchdog affect the system reaction time. The , publication 1756-RM012, provides detailed information on calculating system reaction time.
GuardLogix
5580 and Compact GuardLogix
5380 Controller Systems Safety ReferenceTask Execution
Once a task is triggered, all the programs assigned to it execute in the order in which they appear in the Controller Organizer.
Each task has its own watchdog timer. If the task’s scheduled programs take too long to scan (or are interrupted by higher-priority tasks), exceeding the watchdog timer value, then the controller executes the fault routine for the program executing when the watchdog expired. (Change the watchdog timer on the Configuration Tab of the Task Properties Dialog Box.) The valid range is from 1 msec through 2,000,000 msec. The default is 500 msec.
Safety tasks execute in the same manner as standard periodic tasks, with these exceptions:
- The Safety Task does not begin executing until the Primary Controller and Safety Partner establish their control partnership. (Standard tasks begin executing as soon as the controller transitions to RUN mode.)
- All safety input tags (inputs, consumed, and mapped) are updated and frozen at the beginning of safety task execution.
- For standard tags that are mapped to safety tags, the standard tag values are copied into Safety Task memory at the start of Safety Task execution.
- Safety-produced tag (output and produced) values update at the conclusion of safety task execution.
Provide Feedback