Sequential function charts
In this section you will learn
- What a sequential function chart is
- How to create compound transitions
- Create AND/OR conditions
- Skip steps
The International Electrotechnical Commission standard IEC-61131-3 includes something called a sequential function chart (SFC) as a programming language. Existing products, including DCS and PLC programming software and batch control packages, use SFCs to represent executable procedures. We’re first going to introduce two common elements of an SFC: steps and transitions. Figure 1 illustrates an SFC.
Figure 1: Elements of a Sequential Function Chart
A block containing either a step number or step name represents an SFC step. Vertical lines link the steps. The initial step of a sequence is drawn as a box with a double line. A step is either active or inactive at any given time.
A horizontal line represents a transition across the vertical link between two steps. It represents the condition for transferring control from the active step preceding the transition to the step following the transition. That is, when a transition is true, or fires, the active step immediately before the transition becomes inactive and the step immediately after the transition becomes active. We talk about an active step because a transition can be true anytime, but for a transition to activate the step following it, the step preceding it must be active when the transition fires.
Figure 2 shows a real example of these two SFC elements.
Figure 2: SFC Example, Mixing Milk and Cream
Notice a couple things in Figure 2. First, the “initial step” is not labeled, it is just a double box. Second, a TRUE transition is allowed. Keep in mind that a TRUE transition will pass control to the next step or steps in line immediately. If a TRUE transition existed between Add Milk and Add Cream, Add Milk would stop and Add Cream would start right away, even though all the milk had not been added. To prevent this from happening, the most common type of transition is the “step complete,” as shown in Figure 2.
SFCs handle AND/OR branching pretty well, also. An OR condition, or what IEC-1131-3 calls a divergence and convergence of sequence selection, is shown in Figure 3.
Figure 3: Divergence and Convergence of Sequence Selection (OR Condition)
In this example, we only add one type of cocoa, high-fat or low-fat, depending on what the recipe calls out. Note how only one alternate path is taken, but no matter which cocoa is used, the sequence converges back to adding cream. When designing your control scheme, construct mutually exclusive conditions in your transitions. Even if both transitions were to fire above (let’s say you wanted to mix both types of cocoa in a recipe), SFC rules only allow one path to run. (Which path runs depends on the SFC implementation of the batch engine you’re using.)
Figure 4 shows an AND condition, or a simultaneous divergence and convergence.
Figure 4: Simultaneous Divergence and Convergence (AND Condition)
Notice how a single transition (in this case, TRUE) starts all three steps simultaneously. The double horizontal line is called the line of synchronization. With a simultaneous divergence, the transition must occur above the line of synchronization.
Notice that a compound transition is allowed (Add Water completes AND Add Sweetener completes). Also pay attention to what happens after that transition fires. According to SFC rules, when this transition is true, Add Cream becomes active, and Add Water, Add Sweetener and Mix all become inactive. So with Mix, you now see how a step can become inactive even without a transition indicating the step has completed.
In at least some batch control products, you can skip steps, as shown in Figure 5.
Figure 5: Skipping Steps
One last rule on SFCs: If you look through all of the diagrams above, you’ll notice that no two steps occur without a transition in between, and no two transitions occur without a step in between. This is a golden rule with SFCs. If two transitions need to fire in order for a step to start, create a compound transition. If one step needs to start immediately after another starts, use a TRUE transition.