SysTaskActualCycleTime block

Short summary

Name

SysTaskActualCycleTime

→POU type

→function

Category

more system blocks, blocks for target-system diagnostics, block with internal error diagnostic

Graphical interface

images/download/thumbnails/414780304/SysTaskActualCycleTime-version-1-modificationdate-1534499073049-api-v2.png

Available since

Functionality

The block returns the actual cycle time of the previous execution of the →task in the context of which the block is called.

The block requires up to 3 cycles in order to determine the cycle time. Hence, the return value is correct only with the 4th cycle onwards.

Return value


Identifier

→Data type

Description

Return value:

TIME

the actual required cycle time for the execution of the application (the generated code)

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block

If the required information is not provided by the PLC, the output ENO of the block is set to value FALSE (or an equivalent).

Example for usage within ST-editor

FUNCTION_BLOCK TestSysTaskActualCycleTime
VAR
actual : TIME;
okActual : BOOL;
cycle : INT := 1;
END_VAR
IF cycle > 3 THEN (* SysTaskActualCycleTime needs three cycles to determine the correct cycle time*)
actual := SysTaskActualCycleTime(ENO => ENO);
(* Function 'SysTaskActualCycleTime' returns the actual cycle time. *)
okActual := actual > T#450ms AND actual < T#550ms;
ENO := AND(ENO, okActual);
END_IF;
cycle := cycle + 1;
END_FUNCTION_BLOCK

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.

Restriction for test framework

Do not use this block within a POU under test (see "Testing single POUs by using the test framework") because this block is not supported when a test is executed. Reason: The cycle time is adjusted during the test execution so this block returns faulty data.