Task Transition

Purpose

Transfer data between tasks using a double buffer.

Library

System

Description

../../_images/tasktransition.svg

The Task Transition block is used to influence the execution of a model in a multi-tasking environment (see Task Transitions in Multi-Tasking Mode).

The schematic in Fig. 144 shows a block in a fast task that receives an input from a block in a slow task. If the sample time of the slow task is an integer multiple of the sample time of the fast task, PLECS silently inserts a Delay that operates with the sample time of the slow task in order to ensure that the data is exchanged in a deterministic manner. This introduces a maximum latency of one sample period of the slow task.

../../_images/tasktransition_schematic1.svg

Fig. 144 Default task transition with deterministic delay.

If you wish the block in the fast task to receive the data as soon as possible with minimum (but non-deterministic) latency, you need to insert a Task Transition block in front of the receiving block as shown in Fig. 145.

../../_images/tasktransition_schematic2.svg

Fig. 145 Task transition with minimum latency.