Professional Documents
Culture Documents
Programming PLCs Using Sequential Function Chart - Journal Paper PDF
Programming PLCs Using Sequential Function Chart - Journal Paper PDF
Programming PLCs Using Sequential Function Chart - Journal Paper PDF
Martin Bruggink
Department of Computing Science, University of Nijmegen
Toernooiveld 1, NL-6525 ED, Nijmegen, The Netherlands
martinb@sci.kun.nl
Abstract
In designing PLCs (Programmable Logic Controllers) many
companies have used a lot of different languages. In the desire to
improve the capability of these PLCs, these languages have
become more complex. This is in contradiction with one of the
main goals of PLCs, which is that PLC are relative simple systems
because it is very import that a PLC is reliable.
That is why a standard has been developed, called the IEC
1131-3 standard. This standard describes 5 languages for
programming PLCs. In this article I will study Sequential Function
Chart (SFC), which is one of the 5 languages of the standard. SFC
is mainly based on Petri net with a few adjustments in order to
make communication with the other languages possible. I will
make a comparison between Petri net and SFC and will look at
how a SFC diagram can be turned into a Petri net. By doing this
some things can be said about the reachable states of the system
being modelled.
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 shouldn’t 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.
IF SPEED1>100.0 THEN
Flow_Rate := 50.0 + Offset_A1;
ELSE
Flow_Rate := 100.0; Steam := ON;
END_IF;
Figure 2 An example of structured text
Transitions can either be described directly on the sequential function chart using ST, FBD or LD
or can be described on an associated diagram using any of the languages ST, FBD, LD or IL, in which
case the definition is associated with the name of the transition.
Figure 4 A sequential function chart
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.
C = (P,T,I,O)
P = {p1,p2,p3,p4,p5}
T = {t1,t2,t3,t4}
C = (P,T,I,O)
P = {p1,p2,p3,p4,p5,p6}
T = {t1,t2,t3,t4,t5,t6,t7}
The Petri net and the SFC are related to each other in the following way:
p1 = ‘Start’ t1 = ‘StartSwitch = 1’
p2 = ‘Fill’ t2 = ‘Tran2’
p3 = ‘Stir’ t3 = ‘Tran3’
p4 = ‘Filter’ t4 = ‘Tran4’
p5 = ‘Drain’ t5 = ‘Tran5’
p6 = ‘Stop’ t6 = ‘StartSwitch = 0’
t7 = ‘StartSwitch = 1’
Figure 9 The associated Petri graph of figure 4
Definition: A marking u of a Petri net C=(P,T,I,O) is a function from the set of places P to the Boolean
set {0,1}: µ:P→B
In a Petri net graph, tokens are represented by small dots in the circles which represent the places
of a Petri net.
The use of tokens is to define the places that are active. Places that contain a token can be
compared to a step that is active. When a SFC is first executed, the initial step becomes active. In other
words a token is being placed in the associated step.
Tokens can be propagated from one place to another during executing. We will now look at the
execution rules.
Figure 10 Petri graph with a marking in p2
One has to be very careful not to define a SFC, which doesn’t have these properties. We will now
look at an example of an unreachable SFC.
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 let’s 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}
The Petri net and the SFC are related to each other in the following way:
p1 = ‘Start’ t1 = ‘StartSwitch = 1’
p2 = ‘Step1’ t2 = ‘Tran1’
p3 = ‘StepA’ t3 = ‘TranA’
p4 = ‘Step2’ t4 = ‘Tran2’
p5 = ‘StepB’ t5 = ‘TranB’
p6 = ‘Step3’ t6 = ‘TranC’
p7 = ‘StepC’ t7 = ‘TranD’
p8 = ‘StepD’
p9 = ‘Stop’
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.
Let’s 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) = µ’
The reachability set R of this Petri net and marking µ is the set of all markings that can be reached.
So at least µ’ is a element of R. We can compute R by releasing all reached markings and all enabled
transitions on the δ function. In µ’, transition t2 and t3 are enabled. Now we can compose new
markings, which are elements of R.
So ν is not reachable from µ. This means that, as we concluded before, the Stop step in the
associated SFC will never be activated. Because the set R can sometime be very large it is not always
possible to just write down all element of R. Using an occurrence net it is possible to see which
markings are elements of R. We will not deal with this here.
When programming in SFC one has to be very careful. It is very well possible that a SFC doesn’t
perform the way as expected. By transferring a SFC into a Petri net it is possible to calculate the states
which can be reached in an SFC. This way it is much easier to predict the behavior of the system being
modeled by the SFC diagram.
Of course by computing the reachability set of a certain Petri net, one can still not be sure the
associated SFC will perform the way one would expect. For example, one also has to make sure that
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 Einfürung, 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.