The Workbench Studio enables you to create User Defined Function Blocks (UDFBs) programmed with SFC language. This section details specific features related to such function blocks.

The execution of UDFBs written in SFC requires a Runtime Service system version SR7-1 or later.

Declaration

From the Workspace context menu, run the Insert New Program command. Then specify a valid name for the function block. Select "SFC" language and "UDFB" execution style.

Parameters

When a UDFB programmed in SFC is created, the Workbench Studio automatically declares 3 special inputs to the block:

RUN: The SFC state machine is not activated when this input is FALSE.
RESET: The SFC chart is reset to its initial situation when this input is TRUE.
KILL: Any active step of the SFC chart is deactivated when this input is TRUE.

You can freely add other input and output variables to the UDFB. You can also remove any of the automatically created input if not needed. If the RUN input is removed, then it is considered as always TRUE. If RESET or KILL inputs are removed, then they are considered as always FALSE.

Below is the truth table showing priorities among special input:

RUN

RESET

KILL

Description

FALSE

FALSE

FALSE

do nothing

FALSE

FALSE

TRUE

kill the SFC chart

FALSE

TRUE

TRUE

kill the SFC chart

FALSE

TRUE

FALSE

reset the SFC chart

TRUE

FALSE

TRUE

kill the SFC chart

TRUE

FALSE

FALSE

activate the SFC chart

TRUE

TRUE

TRUE

kill the SFC chart

TRUE

TRUE

FALSE

reset the SFC chart

Steps

All steps inserted in the SFC chart of the UDFB are automatically declared as local instances of special reserved function blocks with the local variables of the UDFBs. The following FB types are used:

isfcSTEP : a normal step
isfcINITSTEP : an initial step

The editor takes care of updating the list of declared step instances. You should never remove, rename or change them in the variable editor. All steps are named with GS followed by their number.

Execution

The SFC chart is operated only when the UDFB is called by its parent program.

If the RESET input is TRUE, the SFC chart is reset to its initial situation. If the KILL input is TRUE, any active step of the SFC chart is deactivated.

When the RUN input is TRUE and KILL/RESET are FALSE, the SFC chart is operated in the same way as for other SFC programs:

  1. Check valid transitions and evaluate related conditions.
  2. Cross TRUE valid transitions.
  3. Execute relevant actions of the active steps.

info Information

In a UDFB programmed in SFC, you cannot use SFC actions to pilot a "child SFC program". This feature is reserved for SFC programs only. Instead, a UDFB programmed in SFC can pilot from its actions another UDFB programmed in SFC.

User Defined Function Blocks programmed in SFC

IEC 61131-3 Automation platform > Programming - Reference guide > Programming languages - Overview > Sequential Function Chart (SFC) > User Defined Function Blocks programmed in SFC

Previous chapterNext chapter


Created with the Personal Edition of HelpNDoc: Simplify Your Help Documentation Process with a Help Authoring Tool