Task Configuration
This topic contains the following sections:
- General information on tasks
- Execution order of tasks and programs
- Working with the 'Tasks and Events' table (non-safety-related controllers only)
- What do you want to do? (Procedures for non-safety-related controllers only)
General information on tasks
Tasks define the runtime properties for programs and their FB instances. The tasks are coordinated and processed in the Execution and Synchronization Manager (ESM). By defining tasks, specifying their properties and assigning programs to tasks, the runtime behavior and the execution order for program POUs is defined. The order of the task execution is defined by the task priority and execution condition. The condition on which a task is executed is specified by the task type. A condition can be a time (in case of a cyclic task) or a user/system event.
One or more programs can be assigned to each task. The assignment defines which programs will be started when executing the corresponding task. Programs which are not assigned to any task are not executed.
Note
If a Safety PLC is included in your project, the PLCnext 'Task and Events' editor contains a SafetyProxyTask which has been created automatically. This SafetyProxyTask triggers the execution of the Safety PLC. This task cannot be edited or deleted. Refer to the topic "Safety PLC Runtime Configuration" for details. |
Note
There must be at least assigned one program to each task. Otherwise the system reports an error. |
Note
The TASK_INFOS system variable (device-dependent variable) can be used for monitoring the application behavior. For details on the TASK_INFOS system variable, refer to the PLCnext Info Center and the respective controller manual. |
- In the PLANT (in programming mode), double-click the 'PLCnext' node.
- Left-click the 'Tasks and Events' editor in the editor group.
Example for a task configuration (AXC F 2152 controller)
Execution order of tasks and programs
Tasks and programs of non-safety-related controllers are executed according to their priority and condition (task cycle time or user/system event). For the execution order, the following applies:
- If the condition of several tasks is fulfilled, the task with the highest priority is executed first.
- If the condition of several tasks is fulfilled and they have the same priority within the same ESM (one ESM represents one controller core), the execution order of these tasks is unpredictable.Tasks with the same priority on different ESMs are executed at the same time / in parallel.
- The execution order of programs that are assigned to the same task is determined by the order they are listed in the table (from top to down).
You can
modify the order of the tasks and program instances in the corresponding table as follows.
While holding down the mouse button, left-click the first table cell in the table line, drag the selection to the desired position in the table and drop it (multi-selection is also possible). Alternatively, select the line and use the Cut/Paste commands (available in the context menu or as keyboard commands) or use the icons on the 'Task and Events' editor toolbar:
Working with the 'Tasks and Events' table (non-safety-related controllers only)
The 'Tasks and Events' editor contains a hierarchically structured table where tasks and events can be specified and program instances can be assigned.
Entries in the table can be expanded and collapsed by clicking the appropriate icons and
Each core of the controller used is represented as ESM node in the table. By expanding an ESM entry, the contained tasks with their task properties become visible. Here, new tasks are added and configured.
Note
In debug mode, the controller Cockpit shows the utilization of each controller core (each represented by one ESM in PLCnext Engineer) besides the total controller utilization. Use this information during commissioning of your application to optimize the distribution of program instances to the available cores. |
- Each task can be expanded in order to show the assigned program instances or to create further instances.
- Multi-selection can be done by pressing the <Ctrl> or <Shift> key while clicking on the desired table lines (<Ctrl>+<A> selects all table lines).
- The context menu of the table rows provides basic editing commands. Undo/Redo is also possible.
- Table cells can be edited by entering the desired value or selecting it from a drop-down list, if a value set exists. The drop-down list is displayed by left-clicking the table cell or pressing <Enter> in a selected cell. Table cells that are locked against entry are grayed out. If an invalid value or any invalid character is entered into a table cell, a red cell frame is shown.
What do you want to do? (Procedures for non-safety-related controllers only)
Add a program instance by assigning a program to a task
Integrate externally developed non-IEC 61131-3 programs into the PLCnext Technology task scheduling