SFC Flags

For controlling the operation of SFC POUs flags can be used, which are created implicitly during running the project. To read this flags you have to define appropriate global or local variables as inputs or outputs. Example: If in a SFC POU a step is active for a longer time than defined in the step attributes, then a flag will be set, which is accessible by using a variable “SFCError” (SFCError gets TRUE in this case).

The following flag variables can be defined:

  • SFCEnableLimit: This variable is of the type BOOL. When it has the value TRUE, the timeouts of the steps will be registered in SFCError. Other timeouts will be ignored.
  • SFCInit: When this boolean variable has the value TRUE the sequential function chart is set back to the Init step. The other SFC flags are reset too (initialization). The Init step remains active, but is not executed, for as long as the variable has the value TRUE. It is only when SFCInit is again set to FALSE that the block can be processed normally.
  • SFCReset: This variable, of type BOOL, behaves similarly to SFCInit. Unlike the latter, however, further processing takes place after the initialization of the Init step. Thus for example the SFCReset flag could be re-set to FALSE in the Init step.

Note

As from compiler version 2.3.7.0 SFCReset also can be used to reset boolean actions associated to IEC steps, which was not possible before.

  • SFCQuitError: Provided that the Execution of the SFC diagram is stopped for as long as this boolean variable has the value TRUE whereby a possible timeout in the variable SFCError is reset. All previous times in the active steps are reset when the variable again assumes the value FALSE. It is a pre-condition that the flag SFCError has been defined also, which registers any timeout in the SFC.

  • SFCPause: Execution of the SFC diagram is stopped for as long as this boolean variable has the value TRUE.

  • SFCError: This Boolean variable is TRUE when a timeout has occurred in a SFC diagram. If another timeout occurs in a program after the first one, it will not be registered unless the variable SFCError is reset first. It is a pre-condition that SFCError is defined, if you want to use the other time-controlling flags (SFCErrorStep, SFCErrorPOU, SFCQuitError, SFCErrorAnalyzation).

  • SFCTrans: This boolean variable takes on the value TRUE when a transition is actuated.

  • SFCErrorStep: This variable is of the type STRING. If SFCError registers a timeout, in this variable is stored the name of the step which has caused the timeout. It is a pre-condition that the flag SFCError has been defined also, which registers any timeout in the SFC.

  • SFCErrorPOU: This variable of the type STRING contains the name of the block in which a timeout has occurred. It is a pre-condition that the flag SFCError has been defined also, which registers any timeout in the SFC.

  • SFCCurrentStep: This variable is of the type STRING. The name of the step is stored in this variable which is active, independently of the time monitoring. In the case of simultaneous sequences the step is stored in the branch on the outer right. No further timeout will be registered if a timeout occurs and the variable SFCError is not reset again.

  • SFCErrorAnalyzationTable: This variable of type ARRAY [0..n] OF ExpressionResult provides the result of an analyzation of a transition expression.  For each component of the expression, which is contributing to a FALSE of the transition and thereby to a timeout of the preceding step, the following information is written to the structure ExpressionResult: name, address, comment, current value.

    This is possible for maximum 16 components (variables), thus the array range is max. 0..15).

    The structure ExpressionResult as well as the implicitly used analyzation modules are provided with the library AnalyzationNew.lib. The analyzation modules also can be used explicitly in other POUs, which are not programmed in SFC.

    It is a pre-condition for the analyzation of a transition expression, that a timeout is registered in the preceding step. So a time monitoring must be implemented there and also the variable SFCError (see above) must be defined in the declaration window.

  • SFCTip, SFCTipMode: This variables of type BOOL allow inching mode of the SFC. When this is switched on by SFCTipMode=TRUE, it is only possible to skip to the next step if SFCTip is set to TRUE. As long as SFCTipMode is set to FALSE, it is possible to skip even over transitions.

Note

Regard also the Implicit variables in SFC usable for scanning the status and time of steps/ actions.