S EQUENTIAL F UNCTION C H A RT S (SFC)

S EQUENTIAL F UNCTION C H A RT S (SFC)

Sequential functional chart, or SFC, is a graphical “language” that provides

a diagrammatic representation of control sequences in a program. Basically, sequential function chart is a flowchart-like framework that can organize the subprograms or subroutines (programmed in LD, FBD, IL, and/or ST) that form the control program. SFC is particularly useful for sequential control operations, where a program flows from one step to another once a condition has been satisfied (TRUE or FALSE).

The SFC programming framework contains three main elements that orga- nize the control program:

• steps • transitions • actions

A step is a stage in the control process. For example, the mixing application shown in Figure 10-14 has three steps—the initial step, the mixing step, and the emptying step. When the control program receives an input, it will execute each of these steps starting with step 1. Each step may or may not have an action associated with it. An action is a set of control instructions prompting

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

STEP ( means initial step)

2 Mix_Batch (Ladder Diagram)

2 Trans_2 3 Empty_Batch (FBD)

3 Trans_3

Figure 10-14. Sequential function chart of a mixing process.

the PLC to execute a certain control function during that step. An action may be programmed using any one of the four IEC 1131-3 languages. After the PLC executes a step/action, it must receive a transition before it will proceed to the next step. A transition can take the form of a variable input,

a result of a previous action, or a conditional IF statement (e.g., IF Temp_1 ≥ 100). So, for the application shown in Figure 10-15, the PLC will execute action 2 only after step 1 receives a valid input and transition 1

1 1 LS_Reach 2 Action_2 2 IF Temp_1 ≥ 100 3 Action_3 3 PB_Return

Figure 10-15. Transitions in a sequential function chart.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

occurs (i.e., the limit switch LS_Reach triggers). After the PLC finishes action

2, it will wait for transition 2 (IF Temp_1 ≥ 100) to occur and then move to step 3.

As mentioned earlier, the sequential function chart language has its origin in the French standard Grafcet, a flowchart-like programming language. The Grafcet graphic language also uses steps, transitions, and actions, which operate in the same manner as in SFC. In Grafcet, when a step is active, the processor scans the I/O logic and program pertinent to the step’s action, as well as the logic for the transition immediately after it (i.e., the transition that deactivates the step and action).

Like Grafcet, SFC is similar to a flowchart in the way control is passed from one step to another (see Figure 10-16). Also, like in Grafcet, SFC can

be programmed to directly relate to timing or event diagrams. Figure 10-17 shows a comparison of a timing diagram and its related Grafcet and SFC programs. As shown in the timing diagram (see Figure 10-17a), if the condition Part_Present_LS is satisfied (the limit switch closes), the Advance_Solenoid output will turn ON. Once the Part_In_Position_LS vari- able is ON, the Clamp_Solenoid output will turn ON. Then, when the At_Depth_LS condition becomes TRUE, the Drill_Motor output will turn ON for 10 seconds. Note that the Clamp_Solenoid output is also activated during the Drill_Motor action. Once the time expires, the timing diagram indicates that the Clamp_Solenoid and Drill_Motor outputs will both turn OFF and stay OFF, while the Return_Solenoid output turns ON. No further

Start

Trans_1 OFF 1 ?

1 Trans_1

ON Step 2 Action

2 Action_2

2 Trans_2

Trans_2 OFF ?

Step 3 Action

(b) Flowchart Figure 10-16. Comparison of (a) an SFC diagram and (b) a flowchart.

(a) SFC

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

action will occur until the At_Top_LS command is satisfied, at which time, the process will stop and the Return_Solenoid output will reset for another sequence. Figures 10-17b and 10-17c illustrate the timing diagram as implemented in Grafcet and SFC, respectively. Both of these programming languages graphically represent the timing diagram implementation using

Outputs

Activation

Advance_Solenoid Clamp_Solenoid Drill_Motor Return_Solenoid

op_LS At_T

At_Depth_LS Part_Present_LS Part_In_Position_LS Timer_10_Sec_Up

Transitions (a) Timing diagram (a) Timing diagram

1 Wait

Part_Present_LS

Part_Present_LS

2 Advance_Solenoid

2 Advance_Solenoid:=True

Part_ In_Position_LS

Part_ In_Position_LS

3 Clamp_Solenoid

3 Clamp_Solenoid:=True

At_Depth_LS

At_Depth_LS

Clamp_Solenoid

Clamp_Solenoid:=True

4 Drill_Motor

4 Drill_Motor:=True

TMR/Step_4/10 Sec

TMR/Step_4/10 Sec

5 Return_Solenoid

5 Return_Solenoid:=True

At_Top_LS

At_Top_LS

(c) IEC 1131-3 SFC (c) IEC 1131-3 SFC Figure 10-17. Comparison of (a) a timing diagram with its associated (b) Grafcet

(b) Grafcet (b) Grafcet

and (c) SFC programs.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

steps, actions, and transitions. The actions represent the activation of the solenoid and drill motor, while the transitions represent the limit switch inputs and timer status.

The major difference between Grafcet and SFC is that Grafcet employs only written action statements, such as Open_Variable (e.g., Open_Valve) to implement its action blocks and turn devices ON and OFF. SFC, on the other hand, implements actions in a number of ways using LD, IL, ST, and FBD or a combination of these languages, including custom function blocks. For example, in action 2 of the Grafcet program in Figure 10-17b, the statement Advance_Solenoid indicates the turning ON of the field device associated with the output variable assigned to Advance_Solenoid. In other words, if an output variable is stated in a Grafcet action, it will become TRUE or ON. In the SFC-equivalent program in Figure 10-17c, the step 2 instruction indicates that the Advance_Solenoid will be equal to TRUE (ON). Thus, SFC does not actually contain a statement of the output variable, but rather an instruction that turns the device ON or OFF (TRUE or FALSE) during that action.

Sequential function charts can be thought of as building-block objects used to create the “total” control program, or the big picture, while the other languages are used to implement detailed programming within the SFC. In fact, SFCs can have what are known in Grafcet terms as macrosteps, which allow one master sequential function chart to have other sequential function charts as its actions (see Figure 10-18). These smaller, embedded sequential function charts, which have their own steps, transitions, and actions, are similar to subroutines in a program.

Main

SFC

Macrostep SFC

Figure 10-18. Macrostep within an SFC program.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

One of the greatest advantages of sequential function charts is that they are easier to troubleshoot than standard ladder diagram programs. For example, in the sequential function chart shown earlier in Figure 10-17c, if the action Clamp_Solenoid (solenoid ON) at step 3 does not make the transition to step

4, it is easy to recognize that a problem occurred at the transition after step 3, which corresponds to the activation of the At_Depth_LS transition. Thus, an SFC pinpoints the step or transition where a fault occurs.