You are here: Core Reference > Coding > Logic > How Sequential Function Charts Work

How Sequential Function Charts Work

Sequential Function Charts depict a sequence of steps. Each step represents a state that the program is to monitor. For example, a step could represent a check for the state of a particular point.

Steps cannot be connected directly to other steps—each step has to be connected to one or more transitions.

Transitions represent a condition such as a point value or state. For example, a transition could represent the value of an analog point being greater than 50. When a transition's condition is true, the step before the transition is deactivated and the step that follows the transition is activated. This allows you to design a flow of Logic.

ClearSCADA begins executing a Sequential Function Chart (SFC) from the step that is defined as the initial step. When the condition of the transition between the initial step and the second step is true, the system will proceed to the second step. When the second steps becomes active, the initial step becomes inactive. Similarly, when the condition for the transition between the second step and third step is true, the system will proceed to the third step and the second step becomes inactive. This process continues throughout the Sequential Function Diagram.

Transitions can be connected to multiple steps. This allows you to create multiple branches of steps and transitions that work independently and simultaneously (see Simultaneous Sequences).

Steps can be associated with an action. This means that a specified action occurs when the step becomes active. The configuration for the action includes ST code that defines the result of the action, for example, Value:=TRUE; could be used to set a variable named Value to state 1 (True).

Actions can also be configured to reference method variables. The method variables are associated with a specific method, such as Enable Alarms or Override, and a specific database item. If an action references a method, the action will cause that method to be performed on the database item that is associated with the method when the action becomes active. For example, if an action references a method named Alarms, the Alarms method will be performed when the action becomes active. The configuration of the method associates the method with a database item and a specific method for that item.

Example:

The following SFC shows how the sequence can be structured from top to bottom:

  1. S1 is step 1. The system begins executing the SFC from this step.
  2. If the condition for the DoReset transition is true, the S1 step is deactivated and the Check step is activated.
  3. If the TRUE transition has a condition that is true, the Check step is deactivated and the OpenTP step is activated.
  4. If the OpenTP step is activated, the DoOpenTP action is performed. The configuration for the action defines what happens when the action is performed—it could write a value or state or could execute a method.
  5. If the OpenTP.T variable value is greater than 2 seconds, the OpenTP step is deactivated and the Close CB step is activated.
  6. If the CloseCB step is activated, the DoCloseCB action is performed.
  7. If the CloseCB.T variable value is greater than 2 seconds, the CloseCB step is deactivated and the Close MP step is activated.
  8. If the CloseMP step is activated, the DoCloseMP action is performed.
  9. If the CloseMP.T variable value is greater than 2 seconds, the CloseMP step is deactivated and the S6 step is activated.
  10. If the S6 step is activated, the ResetAll action is performed.
  11. If the condition for the transition that follows S6 is true, the whole sequence repeats itself, starting from S1.

ClearSCADA 2015 R2