You are on page 1of 31

# Faculty of Applied Technology

## New Zealand Diploma in Engineering

Level 6

PLC Programming 2

## School of Science, Engineering and Primary Industries

Electrical Engineering

1
Contents
SEQUENTIAL FUNCTION CHARTS .................................................................. 3
M340 PLC programming ................................................................................... 13

2
SEQUENTIAL FUNCTION CHARTS

All of the previous methods are well suited to processes that have a single state active at any
one time. This is adequate for simpler machines and processes, but more complex machines
are designed perform simultaneous operations. This requires a controller that is capable of
concurrent processing - this means more than one state will be active at any one time. This
could be achieved with multiple state diagrams, or with more mature techniques such as
Sequential Function Charts.

Sequential Function Charts (SFCs) are a graphical technique for writing concurrent control
programs. (Note: They are also known as Grafcet or IEC 848.) SFCs are a subset of the more
complex Petri net techniques.

## Figure 1 Basic Elements in SFCs

3
Figure 2 Basic Elements in SFCs

Consider a simple SFC for controlling a stamping press is shown in figure 3 for controlling a
stamping press. (Note: this controller only has a single thread of execution, so it could also be
implemented with state diagrams, flowcharts, or other methods.) In the diagram the press
starts in an idle state. When an automatic button is pushed the press will turn on the press
power and lights. When a part is detected the press ram will advance down to the bottom
limit switch. The press will then retract the ram until the top limit switch is contacted, and the
ram will be stopped. A stop button can stop the press only when it is advancing. (Note:
normal designs require that stops work all the time.) When the press is stopped a reset button
must be pushed before the automatic button can be pushed again. After step 6 the press will
wait until the part is not present before waiting for the next part. Without this logic the press
would cycle continuously.

4
Figure 3 SFC for Controlling a Stamping Press

The SFC can be converted directly to ladder logic with methods very similar to those used for
state diagrams. The method shown is patterned after the block logic method. One significant
difference is that the transitions must now be considered separately. The ladder logic begins
with a section to initialize the states and transitions to a single value. The next section of the
ladder logic considers the transitions and then checks for transition conditions. If satisfied the
following step or transition can be turned on, and the transition turned off. This is followed
by ladder logic to turn on outputs as requires by the steps. This section of ladder logic
corresponds to the actions for each step. After that the steps are considered, and the logic
moves to the following transitions or steps. The sequence examine transitions, do actions then
do steps is very important. If other sequences are used outputs may not be actuated, or steps
missed entirely.

5
Figure 4 SFC Implemented in Ladder Logic

6
Figure 5 SFC Implemented in Ladder Logic

7
Figure 6 SFC Implemented in Ladder Logic

8
Figure 7 SFC Implemented in Ladder Logic

## Figure 8 SFC Implemented in Ladder Logic

Many PLCs also allow SFCs to entered be as graphic diagrams. Small segments of ladder
logic must then be entered for each transition and action. Each segment of ladder logic is kept
in a separate program. If we consider the previous example the SFC diagram would be

9
numbered as shown in figure 9. The numbers are sequential and are for both transitions and
steps.

## Figure 9 SFC Renumbered

Some of the ladder logic for the SFC is shown in figure 10. Each program corresponds to the
number on the diagram. The ladder logic includes a new instruction, EOT, that will tell the
PLC when a transition has completed. When the rung of ladder logic with the EOT output
becomes true the SFC will move to the next step or transition. when developing graphical
SFCs the ladder logic becomes very simple, and the PLC deals with turning states on and off
properly.

10
Figure 10 Sample Ladder Logic for a Graphical SFC Program

SFCs can also be implemented using ladder logic that is not based on latches, or built in SFC
capabilities. The previous SFC example is implemented below. The first segment of ladder
logic in figure 11 is for the transitions. The logic for the steps is shown in figure 12.

## Figure 11 Ladder logic for transitions

11
Figure 12 Step logic

12
M340 PLC programming

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31