SFCs aid program development and maintenance

A graphic outline often helps a programmer organize thoughts; maintain an internal logic to program development; and troubleshoot problems during debug, run-off, and validation. Sequential function charts (SFCs) are defined in IEC 61131 as a program organizing method writing programs for logic controllers.

By Gary A. Mintchell October 1, 2002

A graphic outline often helps a programmer organize thoughts; maintain an internal logic to program development; and troubleshoot problems during debug, run-off, and validation. Sequential function charts (SFCs) are defined in IEC 61131 as a program organizing method writing programs for logic controllers.

Mathematicians had developed modeling tools for discrete events called Petri Nets. Grafcet grew from work on Petri Nets and was designed to model logic controllers. Controller manufacturers saw an opportunity to provide a graphical organizing and modeling tool and developed SFCs.

SFCs consist of ‘steps’ and ‘transitions.’ A step is represented by a rectangular box with a label. Transitions are represented by a single horizontal line. Steps are ‘wired’ together via a vertical line with a transition line intersecting it between steps.

Steps are either active or inactive. A step will become active with its internal algorithms or program executed until it is finished. At this time, logic within the transition becomes true, the previous step becomes inactive, and the next step is activated.

Applications that readily lend themselves to SFC programs include machining lines, certain batch processes, material handling, and packaging lines. Consider an automated line with a pallet containing an engine block to be machined. On Start, the conveyor moves the pallet to Op 1 station. A proximity switch goes true, enabling a pallet stop and activating the Step for Op 1-say a drilling operation.

Op 1 algorithm controls the drill process end point by setting a bit in transition code; dropping the pallet stop; and allowing the pallet to move to Op 2, where the process is repeated, this time for a reaming operation. The process repeats through the final operation and unloading.

The process could just as easily have been a filling line; in which a container moves along a conveyor under mixers where the program steps control material mixing and dispensing. Final packaging is completed on a step and transition basis.

Programming within steps and transitions under the standard can be accomplished with any of the IEC 61131-3 languages-structured text (ST), instruction list (IL), ladder diagram (LD), and/or function block diagram (FBD). Some programming editors will also support C.

For instance, a transition could be a rung of ladder diagram with a couple of contacts. When the contacts go ‘True,’ then the transition occurs, deactivating the previous step and enabling the next step. Boolean logic in ST could also be used.

Should an OEM have some specialized algorithms that are important intellectual property granting a competitive edge, then the ability to write the algorithm in C and compile it within a Step becomes very beneficial. In this case, it would be important to search for an editor and a controller that support this feature.

Branching SFCs

SFCs can contain branches that either are parallel ‘AND’ branches or selective ‘OR’ branches. Consider the accompanying diagram. After the initial step is completed and transition 003 is True, the controller will execute Step 004 through 014 branch and Step 005. When both are complete, transition 015 goes True, deactivating both 014 and 005.

Notice that after Step 004 there are two branches and two transitions. The controller scan will look at both transition 006 and 007 after completing Step 004. The first transition that goes True will determine which branch will become active. This is similar to OR logic.

Different editors and controllers will have different rules on how the steps and transitions are scanned and in what order events happen. Good programmers will always be aware of this order and write the program accordingly.

The graphic nature of SFCs lends itself to troubleshooting during the debug and validation phases. Programmers or technicians can watch progress of the program as steps become active then are deactivated. When trouble occurs, simply clicking on the step will lead directly to the code problem. Since these are the critical phases of an automation project where profits for an OEM are often won or lost, every helpful tool is a tremendous asset. SFCs can be one of those important tools.

A good reference document from PLCopen (Zaltbommel, Netherlands) can be found at www.plcopen.org/training_education/SFC-textual.doc .

Gary A. Mintchell, senior editor gmintchell@reedbusiness.com