The Workbench 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 system version SR7-1 or later.
From the Workspace contextual menu, run the "Insert New Program" command. Then specify a valid name for the function block. Select "SFC" language and "UDFB" execution style.
When a UDFB programmed in SFC is created, the Workbench 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:
|FALSE||FALSE||TRUE||kill the SFC chart|
|FALSE||TRUE||FALSE||reset the SFC chart|
|FALSE||TRUE||TRUE||kill the SFC chart|
|TRUE||FALSE||FALSE||activate the SFC chart|
|TRUE||FALSE||TRUE||kill the SFC chart|
|TRUE||TRUE||FALSE||reset the SFC chart|
|TRUE||TRUE||TRUE||kill the SFC chart|
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.
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
2- Cross TRUE valid transitions
3- Execute relevant actions of the active steps
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.