You are on page 1of 6

ARTCULO NO.

ARTCULO

XIII CONGRESO NACIONAL DE INGENIERA


ELECTROMECNICA Y DE SISTEMAS (XIII CNIES)

Analysis of the Ladder Diagram a Packaging


System with Petri Nets
J. Carlos Quezada, Joselito Medina and Ernesto Flores

original program in LD. For switch contacts (normally open or


normally closed) two arcs are proposed: enabled arc and
inhibitor arc; for coils it is added an inhibitor arc from the
output to the transition activating the coil, which is to prevent
accumulating tokens at the output place. Regarding timers, it is
proposed the use of two transitions and two buffer places, and
their associated arcs to detect positive edge; besides, they
require places and transitions to store the accumulated time
and provide the timer output. In [9], an approach for
evaluating LDs and PNs methodologies, transforming them to
IF-THEN type instructions, is proposed; showing mainly the
logic gates AND and OR in both methodologies. In [10], the
authors propose the union and distribution in PN, equivalent to
logic gates AND and OR. This article proposes a PNLD for
the case study in particular packaging system with two
weighing scales and a single-discharge duct.

Abstract. Control of manufacturing systems and discreteevent processes, having as main control device a Programmable
Logic Controller (PLC) where the control algorithm is developed
on Ladder Diagram (LD), is considered. LD, standardized by
IEC-61131-3, is one of the most used languages in industry;
however, this is empirically developed and has no validation in
order to provide reliability and security to the processes which it
controls. Petri Nets (PN) have been used to analyze, model and
simulate basic structures of LDs. This paper analyzes a case study
of the ladder diagram to control a packaging system of two
weighing scales with a single-discharge duct.
Index Terms Control Algorithm, Ladder Diagram, Petri
Nets, Programmable Logic Controller.

I. INTRODUCTION (INTRODUCCIN)

ontrol algorithms developed by users in industry are not


based on formal theories to perform their simulation
and/or validation in order to ensure their quality be-fore being
implemented on a Programmable Logic Controller (PLC) for
processes control. These algorithms are developed based on
experience of programmers or engineers who are responsible
of operation, maintenance and upgrade of the industrial
process control system [1],[2]. Petri Nets (PN) [3],[4],[5] have
been used for analysis, simulation and validation of DiscreteEvent Systems (DES), and these are a powerful mathematical
formalism with an attractive graphical representation, suitable
for modeling and analyzing DES [6].
Ladder Diagram (LD) is one of the five languages specified by
the international standard IEC-61131-3 for PLCs [7], and
several papers have reported conversions or transformations
from LD to PN for analysis. In [8] it is proposed the creation
of PN cores equivalent to LD cores and later the synthesis of
the PN in order to generate another PN corresponding to the

II. LADDER DIAGRAM


Nowadays, safety in control is one of the most important
topics currently studied on the design and development of
automated production systems [11]. PLCs still remain the most
widely used devices in industry for controlling discrete
processes or Discrete-Event Control Systems (DECS),
dominating modern automated industry due to their robustness
and relatively low cost [1]. PLCs are a special type of
computer, as shown in Fig. 1, which are used in industry on
safety-critical applications. The purpose of a PLC is to control
a particular process or a set of processes through generating
electrical control signals in response to electrical input signals
coming from the process. In 2003, the International Electrotechnical Commission (IEC) standardized the programming
languages that are mainly implemented on PLCs, through the
international standard IEC-61131-3 which specifies the syntax
and semantics of those languages. The standard IEC 61131-3
proposes five programming languages, namely: Ladder
Diagram (LD), Function Block Diagram (FBD), Structured
Text (ST), Instruction List (IL), and Sequential Function Chart
(SFC) [7]. This paper focuses on the analysis of a control
algorithm developed on LD.
LD allows modeling networks of electromechanical
elements operating simultaneously, such as relay contacts and
coils, timers and counters, mainly.

Jos Carlos Quezada Quezada received the M. S. degree in Mechatronics


Engineering from Tecnolgico de Estudios Superiores de Ecatepec, Estado de
Mxico, Mexico, in 2008 (jcarlos@uaeh.edu.mx).
Joselito M. Medina Marin received the Ph.D. degree in electrical
engineering from Centro de Investigacin y de Estudios Avanzados del
Instituto Politcnico Nacional (CINVESTAV-IPN), Mxico City, Mxico, in
2005 (jmedina@uaeh.edu.mx).
Ernesto Flores Garca received his Ph.D. degree in Automatic Control
from Centro de Investigacin y de Estudios Avanzados del Instituto
Politcnico Nacional (CINVESTAV-IPN), Mxico City, Mxico, in 2011
(efloresg@uaeh.edu.mx).

MXICO, D.F., MXICO, NOVIEMBRE 2012

ARTCULO NO.
ARTCULO

XIII CONGRESO NACIONAL DE INGENIERA


ELECTROMECNICA Y DE SISTEMAS (XIII CNIES)

TABLE I. PETRI NET DEFINITION

A Petri net is a 5-tuple, PN {P, T , F , W , M 0 } where:


P { p1 , p 2 ,..., p m } is a finite set of places,
T {t1 , t 2 ,..., t n } is a finite set of transitions,
F ( P T ) (T P) is a set of arcs,
W : F {1,2,...} is a weight function,
M 0 : P {0,1,2,...} is the initial marking,
P T and P T .

Fig. 1. Block diagram of a PLC.

A. Dynamical Behavior
In modeling, by using the concept of conditions and events,
places represent conditions and transitions represent events.
An event has a certain number of input and output places
representing the pre-condition and post-condition of the event,
respectively.
The behavior of many systems can be described in terms of
systems states and their changes. With the aim of simulate the
dynamical behavior of a system, a state or marking in a PN is
changed according to the following transition rule (trigger):
a) A transition t is enabled if each input place p of t is
marked with at least w(p,t) tokens; where w(p,t) is the arc
weight from p P to t T.
b) One enabled transition can be fired or not (depending on
if the current event occurs).
c) Firing an enabled transition t removes the tokens w(p,t)
from each input place p of t, and adds w(p,t) tokens to
each output place p of t; where w(p,t) is the arc weight
from t T to p P.

The code structure on LD is developed by using graphic


symbols of the electro-mechanical elements, confined at left
and right by lines symbolizing the negative and positive of the
system power; these elements can be interconnected
horizontally (in series), or vertically (in parallel), ending the
line with a coil-type symbol. The electromechanical elements
can only have two states, off or on, which correspond to the
Boolean values 0 or 1, respectively. To this work, the initial
marking of the PN consider the contacts if they are able to pass
energy or not, and if the coils are energized or not.
III. PETRI NETS
PN constitute a tool employed to mathematical and
graphical modeling, and are used for describing and studying
information processing systems characterized as being
concurrent, asynchronous, distributed, parallel, nondeterministic, or stochastic. As a graphical tool, PN can be
used as a communication visual aid, in a similar way to flow,
block and network diagrams. On the other hand, as a
mathematical tool, PN are used to define state and algebraic
equations, as well as other mathematical models employed to
represent the systems behavior. In addition, markings are used
to keep the state in the nets places, allowing simulate the
dynamics and concurrent tasks of systems [12]. An advantage
of PN is they allow the mechanisms of DES to be represented,
such as sequential execution, decision making, concurrency,
synchronization, grouping and inhibition.
A PN is a particular type of directed graph with an initial
state called initial marking, M0 . The underlying graph N of the
PN is directed, weighted and divided into two type of nodes,
namely places and transitions, where the arcs join up the
places to the transitions, or conversely. Places are graphically
represented as circles, whereas transitions as bars or
rectangular boxes. Arcs are labeled with their weights (positive
integers), where a k-weighted arc can be interpreted as a set of
k-parallel arcs. Labels for arcs with unit weight, called
ordinary PN, are usually omitted. A mark (state) assigns a
nonnegative integer to each place. If a mark assigns a
nonnegative integer k to a place p, it is said that p is marked
with k-tokens. A marking is denoted by M and constituted by
its m-vectors, where m is the number of places. The
component p of M, denoted M(p), is the number of tokens in a
place p. Table I shows the formal definition of a PN [12].
MXICO, D.F., MXICO, NOVIEMBRE 2012

B. Petri Nets - Ladder Diagram


TABLE II. DEFINITION PNLD

A PNLD is a 5-tuple PNLD {P, T , F ,W , M 0 } , where:

P {I Q M Ti pa} is a finite set of places, where:


I {I m | I m physical inputs};
Q {Qn | Qn physical outputs};
M {M o | M o internal memory};
Ti {Ti p | Ti p auxiliary places to timed transitions};
pa { paq | paq auxiliaryplaces to distributive transitions}.

T {t t m' ta} is a finite set of transitions, where:


t {t r | t r transitions},
'

t m {t r' | t r' transitions to self - loop}, and


ta {tar | tar auxiliary transitions}.

t {1,2,...,r}; t m' {1,2,...,s}; ta {1,2,...,v}.


F P T T P

; is a set of arcs.

W : F {1} all arc weights are equal to 1,

M 0 P {0,1} ; where: 0 close circuit and, 1 open circuit.


2

ARTCULO NO.
ARTCULO

XIII CONGRESO NACIONAL DE INGENIERA


ELECTROMECNICA Y DE SISTEMAS (XIII CNIES)

The Table II shows the definition of Petri NetLadder


Diagram PNLD, proposed for the analysis of LD to control a
packaging system.

%I2
%I3
%I4
%I5
%I6
%I7
%I8
%I9
%I10
%I11
%I12
%I13
%I14
%I15
%I16
%Q1
%Q2
%Q3

S_ZUNCHO
S_CHAP_B1
S_CHAP_B2
PB_DESC_B1
SEL_AUT_B2
SEL_AUT_B1
SEL_FUNC_B1
S_GRUE_B1
S_FINA_B1
PB_DESC_B2
SEL_FUNC_B2
S_GRUE_B2
S_FINA_B2
BANEX_FUNC
ALIM_127VCA
V_ZUNCHO
V_CHAP_B1
V_PGRU_B1

I2
I3
I4
I5
I6
I7
I8
I9
I10
I11
I12
I13
I14
I15
I16
Q1
Q2
Q3

%Q4

V_PFIN_B1

Q4

%Q5

V_PALR_B1

Q5

%Q6
%Q7

V_CHAP_B2
V_PFIN_B2

Q6
Q7

%Q8

V_PGRU_B2

Q8

%Q9

V_PALR_B2

Q9

%Q10
%Q11
%M1
%M2
%M3
%M4
%M5
%M6
%M7
%M8
%M9
%M10
%M11
%M12
%M13
%R30
%R35

XL_B2
XL_B1
P_SISTEMA
P_ZUNCHO
F_AUT_ZUNCH
P_B1
P_B2
P_APER_B1
PESO_B1
P_APER_B2
ENC_PF_B2
PESO_B2
ENC_PG_B2
ENC_PF_B1
ENC_PG_B1
TON_0
TON_1

Q10
Q11
M1
M2
M3
M4
M5
M6
M7
M8
M9
M10
M11
M12
M13
pt0
pt1

IV. CASE STUDY

%R40

TON_2

pt2

This paper analyzes the control algorithm of a bag filling


system through a single-discharge duct and two weighing
scales or bascule (see Fig. 2). Each scale has its operation
selector, as well as its sensors for coarse weighing (to 45 Kg.)
and fine weighing (50 Kg.). By analyzing the LD, it is
determined the system has physical digital inputs and outputs
denoted by I and Q, respectively; internal memories having
contacts in the LD, defined by M and timers by T. Table IV
presents the items correlation with the PNLD.

%R45

TON_3

pt3

%R50

TON_4

pt4

C. Relationship between PN and LD


Table III shows the correlation between LD and PN
methods used for diagram transformations of study case. LD
contains the Boolean logic AND (1) and OR (2) gates,
whereas its equivalent PN is a synchronization and a group,
respectively. Al-so, LD has interlocks (3) with their respective
transformation to PN as a self-loop, as well as timers (4) in
both methodologies.
TABLE III. RELATIONSHIP PN-LD

LD
1

PN

IN
1

IN
2

IN n

OUT
1

IN 1
IN 2

OUT 1

IN n

IN
1

OUT
1

IN 2

IN
2

IN n

IN n

OUT
1

IN 1

IN 1

IN 2

IN n

p aux
1

OUT
1

t aux
1

IN 1
IN 2
OUT
1

OUT 1

IN n

IN
1

OUT
T
%R

Rese
t

Time
IN 1

OUT
T

Time

D. Employed Software and Hardware


The control algorithm in LD was developed in Proficy
Machine Edition and the PNLD in Cimplicity HMI, and PLC
series 90-30, all brand GEFanuc.

Address
%I1

TABLE IV. ADDRESS RELATIONSHIP PN-LD


Tag
Place Description
PB_ZUNCHO
I1
Pushbutton opening

MXICO, D.F., MXICO, NOVIEMBRE 2012

zuncho
Zuncho sensor
Bottom cover sensor scale one
Bottom cover sensor scale two
Pushbutton unloading scale one
Automatic selection of scale two
Automatic selection of scale one
Selector operation of scale one
Weight wide sensor of scale one
Weight fine sensor of scale one
Pushbutton unloading scale two
Selector operation of scale two
Weight wide sensor of scale two
Weight fine sensor of scale two
Belt in operation
Energy on
Valve of the zuncho
Valve of bottom cover scale one
Valve piston weight wide scale
one
Valve piston weight fine scale
one
Valve piston high performance
scale one
Valve of bottom cover scale two
Valve piston weight fine scale
two
Valve piston weight wide scale
two
Valve piston high performance
scale two
Filling light scale two
Filling light scale one
System permissive
Zuncho permissive
Automatic system
Scale one permissive
Scale two permissive
Opening scale one permissive
Complete weight scale one
Opening scale two permissive
Latch fine piston of scale two
Complete weight scale two
Latch wide piston of scale two
Latch fine piston of scale one
Latch wide piston of scale one
Opening time of the zuncho
Opening time bottom cover
scale one
Opening time piston high
performance scale one
Opening time bottom cover
scale two
Opening time piston high
performance scale two

A. Ladder diagram of packaging systems


The LD of packaging system is shown in Fig. 3 and 4. Its
control algorithm involves general protections and the
possibility of working the packaging system with a single
scale, by turning off the corresponding operating selector. It is
also possible to download manually the scales, existing crosscontacts used in the sequence to determine that the scale to

manual

ARTCULO NO.
ARTCULO

XIII CONGRESO NACIONAL DE INGENIERA


ELECTROMECNICA Y DE SISTEMAS (XIII CNIES)

download is the first having gotten its corresponding weight.


Timers are used for the time that the zuncho must be closed,
while some scale is being downloaded; that is to say, the time
that the gate bottom must be open, and the time to give
mechanical stability to each scale.

Fig. 2. Packaging system.


With the selectors in working position the operating
sequence of the overall system is as follows: both scales are
beginning to fill, if weight wide sensor is activated then the
valve piston weight wide is actuated, reducing the flow of
product which is filling corresponding scale. If weight fine
sensor is activated then the valve piston weight fine is
activated, obstructing the flow of product into the
corresponding scale. If the system is in automatic and there is
bag in the discharge duct activating zuncho sensor when is
activated the valve of bottom cover, discharged the scale
which was first filled, and so on until the system conditions
change.

Fig. 4. LD packaging system, part two.


B. Simulation PNLD
The following considerations are for the analysis of PNLD
packaging system, based on the principle of operation of the
PLC and the initial conditions (electrical signals) for control
and system operation.

Fig. 3. LD packaging system, part one.


MXICO, D.F., MXICO, NOVIEMBRE 2012

ARTCULO NO.
ARTCULO

XIII CONGRESO NACIONAL DE INGENIERA


ELECTROMECNICA Y DE SISTEMAS (XIII CNIES)

1. In each PLC scan cycle it is generated an snapshot of the


input signals conditions, wherewith control algorithm is
evaluated on PLC and on PN, in order to prevent the
accumulation of markings when tested with the created image.

Later, making a snapshot of the conditions that keep the output


signals (coils) and transferring them to the corresponding
output modules.

Fig. 5. PNLD of packaging systems


MXICO, D.F., MXICO, NOVIEMBRE 2012

ARTCULO NO.
ARTCULO

XIII CONGRESO NACIONAL DE INGENIERA


ELECTROMECNICA Y DE SISTEMAS (XIII CNIES)

[11] Jos Mendes, Jos Creissac, Filomena Soares, Celina Pinto, Jaime
Ferreira, Simulation and Formal Verification of Industrial Systems
Controllers, ABCM Symposium Series in Mechatronics, Vol. 3, pp.
461-470, 2008.
[12] Murata, Petri Nets: Properties, Analysis and Applications, Proceedings
of the IEEE, 1989.

2. Whereas the system is physically sequential, ie;


a. Automatic systems and both scales in operation (I6, I7,
I8, I12, I15, I16),
b. Bottom cover sensor scale's (I3, I4),
c. Valve of bottom cover scale's (Q2, Q6),
d. Weight wide sensor's (I9, I13),
e. Valve piston weight wide scale's (Q3, Q8),
f. Weight fine sensor's (I10, I14),
g. Valve piston weight fine scale's (Q4, Q7),
h. Zuncho sensor (I2),
i. Valve zuncho (Q1),
j. Valve piston high performance scale's (Q5, Q9

VII. BIOGRAPHIES

Jos Carlos Quezada Quezada received the M. S.


degree in Mechatronics Engineering from
Tecnolgico de Estudios Superiores de Ecatepec,
Estado de Mxico, Mexico, in 2008 and his title of
Electronic Engineering at the Technological Institute
of Lzaro Crdenas, Michoacn , Mexico, in 1992.
He has worked in Fertilizantes Mexicanos S.A. de
C.V., CFE, SICARTSA and Fertinal. He is currently
Research Professor of the high school of Tizayuca, Hgo. where its main
interest is on process automation by means of PLC, PAC and HMI.

V. CONCLUSIONS
The PNLD allows transforming control algorithms
developed on LD, including basic Boolean functions and selfloops to PN, for modeling and simulation of the control
system, allowing detecting errors in the control or excessive
repetition of physical signals in the control algorithm.
Petri nets allow the analysis of systems by reducing
complexity sections. For the packaging system may be when
the systems working with a single scale.
Future work considers the application of mathematical tools
for optimization and simulation of dynamical behavior with
human machine interface of the PNLD to reduce code and
streamline the packaging system.

Joselito Medina-Marin. He received the M.S. and


Ph.D. degrees in electrical engineering from the
Research and Advanced Studies Center of the
National Polytechnic Institute at Mexico, in 2002
and 2005, respectively. Currently, he is a Professor
of the Advanced Research in Industrial Engineering
Center at the Autonomous University of Hidalgo
State at Pachuca, Hidalgo, Mxico. His current
research interests include Petri net theory and its applications, active
databases, simulation, and programming languages.

VI. REFERENCES
[1]

Sammy Korotkin, Guy Zaidner, Benny Cohen, Amir Ellenbogen, Meir


Arad and Yosef Cohen, A Petri Net Formal Design Methodology for
Discrete-Event Control of Industrial Automated Systems, IEEE 26-th
Convention of Electrical and Electronics Engineers in Israel, 2010.
[2] Karl-Heinz John, Micahel Tiegelkamp, IEC 61131-3: Programming
Industrial Automation Systems, Second Edition, Springer, 2010.
[3] Marius Kloetzer, Cristian Mahulea, Calin Belta, and Manuel Silva, An
Automated Framework for Formal Verification of Timed Continuous
Petri Nets, IEEE Transaction on Industrial Informatics, 2010.
[4] Adamo Castelnuovo, Luca Ferrarini, Senior Member, IEEE, and Luigi
Piroddi, An Incremental Petri Net-Based Approach to the Modeling of
Production Sequences in Manufacturing Systems, IEEE Transactions on
Automation Science and Engineering, 2007.
[5] Bani Younis, M., Frey, G., Formalization of existing PLC Programs: A
Survey. Proceedings of CESA 2003.
[6] W. Bolton, Programmable Logic Controller, 4th Edition, Elsevier Ltd.,
2009.
[7] International Electrotechnical Commission, Programmable Controller Part 3: Programming Languages, Edition 2.0, 2003.
[8] J. Lee and J.S. Lee, Conversion of Ladder Diagram to Petri Net Using
Module Synthesis Technique, International Journal of Modeling and
Simulation, Vol. 29, No. 1, 2009.
[9] J.S. Lee and P.L. Hsu, An improved evaluation of ladder logic and Petri
nets for the sequence controller design in manufacturing systems,
International Journal Advance Manufacture Technologic, pp. 279-287
2004.
[10] T. Suesut, P. Inban, P. Nilas, P. Rerngreun and S. Gulphanich,
Interpretation Petri Net Model to IEC 1131-3: LD for Programmable
Logic Controller, Proceedings of the 2004 IEEE Conference on Robotic,
Automation and Mechatronics, December 2004.

MXICO, D.F., MXICO, NOVIEMBRE 2012

Ernesto Flores obtained his MSc and PhD in


Automatic Control specialty from the CINVESTAVIPN of Mxico City, Mxico. He received his
Engineer degree in Aeronautics from the IPN of
Mxico. Dr. Flores has worked as a university
researcher professor in areas such as Control Theory
and Mathematics, mainly. His research interests
include Electromechanical Systems Control,
Servomechanisms, Robotics, among others.

You might also like