Professional Documents
Culture Documents
Programming PLCs Using Sequential Function Chart PDF
Programming PLCs Using Sequential Function Chart PDF
Martin Bruggink
Department of Computing Science, University of Nijmegen
Toernooiveld 1, NL-6525 ED, Nijmegen, The Netherlands
martinb@sci.kun.nl
1 Introduction to PLC
The programmable logic controllers (PLC) market is growing. PLCs are the backbone of most
automation projects of the process control and instrumentation sector. They are being used in many
places where some kind of control is needed to run a real-time system. For example, PLCs are being
used in complex petro-chemical plants, smelting furnaces, automobile production lines and so on.
Because PLCs are being used to control real-time systems they have to be reliable and robust. If a
system doesn't work properly, this could result in high financial losses. This is why the progress in the
development of PLCs is so low. It is a big risk to try to improve PLCs. When new PLCs are being
introduced, we want to be sure that the new controller is reliable and robust. Producers are confronted
with the question whether or not to install new PLCs. The old system is reliable, because it has been
working for some time. But the performance of that system wouldn't be as high as when new PLCs
were installed. On the other hand, can we rely on the new PLCs? Are they reliable and robust?
In the design of the first PLCs two characteristics were very important. First, a PLC has to be fast.
They are being used in real-time systems and the controller sometimes has to react within fractions of
a second. Secondly, a PLC shouldnt be to complicated. A simple PLC is easier to program and gives
more insights in its structure. So, a simple PLC is more reliable. Strangely enough, these
characteristics don't apply any more for the PLCs of today. Although they are still very fast, they have
become very complex. Multiprocessor PLCs have been introduced. PLCs can be used in distributed
networks. Some of the current PLCs look like small computers. This is all hardware design.
Of course, software is also needed. This brings us to the programming languages. Many
programming languages have been developed for programming PLCs. Each manufacturer has its own
language. These languages are sometime in contradiction with techniques developed in the computing
world. To improve the software used in PLCs, the International Electrotechnical Commission (IEC)
has tried to define a standard for programming languages which is called IEC 1131-3. The IEC 1131-3
standard tries to bring together the languages from the PLC world and the computing world.
RESET:
LD
JMPC
LD
ST
LD
ST
R1
RESET
PRESS_1
MAX_PRESS
0
A_X43
Global variables can also be used to exchange data between function blocks and other program
organisation units. Global variables can be defined at the configuration, resource or program level.
Global variables are accessible to all program organisation units contained within the parent entity in
which they are declared.
The standard also specifies ways for communication between configurations. We won't deal with
them here.
3.2 Actions
A we saw before, steps describe the state of the system being represented. In a real system, each step is
required to perform certain control actions that are applicable for that particular state.
In SFC methodology, every step can be associated with one or more actions. An action contains a
description of some behaviour that should occur as a result of the step being activated. The description
of an action can be given using any of the IEC languages.
Actions can be depicted in SFC language by an action box, which is connected with the particularly
step. An action box consists of three parts: the action qualifier, the action and the indicator variable,
which is optional.
The action contains a description of the actions being performed when the associated step is active.
This can be the name of some actions described some where else in the program, or it can be a
description of the action in one of the five languages. The qualifier determines when the action is
executed. For example, the action could be executed again and again, while the associated step is
active, or the action could only be executed when the step becomes deactivated. We will see later
which qualifiers are defined in the standard.
The indicator variable is optional. This is only used for annotation purposes. The indicator variable
names a key variable that is changed by the action and indicates that the action has completed its
execution.
Qualifier
None
R
S
L
D
P
SD
DS
SL
Description
Non-stored, default, same as N
Resets a stored action
Sets an action active, i.e. stored
Time limited action, terminates after a given period
Time delayed action, starts after a given period
A pulse action that only executes once when a step is activated,
and once when the step is deactivated
Stored and time delayed. The action is set active after a given
period, even if the associated step is deactivated before the
delay period
Action is time delayed and stored. If the associated step is
deactivated before the delay period, the action is not stored.
Stored and time limited. The action is started and executes for
a given period
O(t1) = {p2,p3,p5}
O(t2) = {p5}
O(t3) = {p4}
O(t4) = {p2,p3}
O(t1) = {p2}
O(t2) = {p3}
O(t3) = {p4}
O(t4) = {p5}
O(t5) = {p5}
O(t6) = {p6}
O(t7) = {p2}
The Petri net and the SFC are related to each other in the following way:
p1 = Start
p2 = Fill
p3 = Stir
p4 = Filter
p5 = Drain
p6 = Stop
t1 = StartSwitch = 1
t2 = Tran2
t3 = Tran3
t4 = Tran4
t5 = Tran5
t6 = StartSwitch = 0
t7 = StartSwitch = 1
5 Unreachable SFC
We will now look at an example of a SFC diagram, figure 12. In this SFC the Stop step will never be
activated. Because the diagram has a non-simultaneous divergence sequence, stepC and StepD will
never be activated at the same time. Because StepC and StepD are followed by a simultaneous
convergent sequence, the Stop step will never be reached.
Now lets convert the SFC diagram to a Petri net. This Petri net has the following structure.
C = (P,T,I,O)
P = {p1,p2,p3,p4,p5,p6,p7p8p9}
T = {t1,t2,t3,t4,t5,t6,t7}
I(t1) = {p1}
I(t2) = {p2}
I(t3) = {p3}
I(t4) = {p4}
I(t5) = {p5}
I(t6) = {p5}
I(t7) = {p6,p7,p8}
O(t5) = {p7}
O(t6) = {p8}
O(t7) = {p9}
t1 = StartSwitch = 1
t2 = Tran1
t3 = TranA
t4 = Tran2
t5 = TranB
t6 = TranC
t7 = TranD
When the SFC is executed, the Start step will be activated. So in the Petri net a marking is put in
p1. So the marking function of this Petri net is as follows.
= {(p1,1),(p2,0) ,(p3,0) ,(p4,0) ,(p5,0) ,(p6,0) ,(p7,0)}
Lets look what happens when t1 is fired. t1 is enabled because all of its input places have a
marking. The function gives us the next marking function when firing t1.
(,t1) =
= {(p1,0),(p2,1) ,(p3,1) ,(p4,0) ,(p5,0) ,(p6,0) ,(p7,0)}
an active step cannot have both a firable input transistion and a firable output transistion. How this can
be done is, will not be dealt with here.
References
[1] R.W. Lewis, Programming industrial control systems using IEC 1131-3, The Institution of
Electrical Engineers, London, 1995.
[2] Wolfgang A. Halang & Krzystof M. Sacha, Real Time Systems Implementation of Industrial
Computeriezed Process Automation, World Scientific.
[3] James L. Peterson, Petri net theory and the modeling of systems, Prentice-Hall Inc, Englewood
Cliffs, N.J. 07632, 1981.
[4] W.Reisig, Petrinetze Eine Einfrung, Springer-Verlag, Berlin Heidelberg New York, 1982.
[5] Ren David, IEEE Transistions on control systems technology, 3: 253- 268, september 1995.
[6] Kenneth C. Crater, President Control Technology Corporation Hopkinton, MA, When Technology
Standards Become Counterproductive.