You are on page 1of 54

Page1

I ST / DEEC / API
http://users.isr.ist.utl.pt/~jag/courses/api1112/api1112.html
Slides 2010/2011 Prof. Paulo J orge Oliveira
Rev. 2011/2012 Prof. J osGaspar
Discrete Event Systems
Discrete Event Systems
MEEC 2011-2012
Industrial
Industrial
Automation
Automation
(Automa
(Automa

o de Processos Industriais)
o de Processos Industriais)
Page2
I ST / DEEC / API
Chap. 5 CAD/CAM and CNC [1 week]
...
Chap. 6 Discrete Event Systems [2 weeks]
Discrete event systems modeling. Automata.
Petri Nets: state, dynamics, and modeling.
Extended and strict models. Subclasses of Petri nets.

Chap. 7 Analysis of Discrete Event Systems [2 weeks]


Syllabus:
Syllabus:
MEEC 2011-2012
Page3
I ST / DEEC / API
Some pointers to Discrete Event Systems
Some pointers to Discrete Event Systems
History: http://prosys.changwon.ac.kr/docs/petrinet/1.htm
Tutorial: http://vita.bu.edu/cgc/MIDEDS/
http://www.daimi.au.dk/PetriNets/
Analyzers, http://www.ppgia.pucpr.br/~maziero/petri/arp.html (in Portuguese)
and http://wiki.daimi.au.dk:8000/cpntools/cpntools.wiki
Simulators: http://www.informatik.hu-berlin.de/top/pnk/download.html
Bibliography: * Discrete Event Systems - Modeling and Performance Analysis,
Christos G. Cassandras, AksenAssociates, 1993.
* Petri Net Theory and the Modeling of Systems,
J ames L. Petersen, Prentice-Hall,1981.
* Petri Nets and GRAFCET: Tools for Modeling Discrete Event Systems
R. David, H. Alla, Prentice-Hall, 1992
Chap. 6 Discrete Event Systems
Page4
I ST / DEEC / API
Generic characterization of
systems resorting to input /
output relations
State equations:
in continuous time (or in
discrete time)
Examples?

=
=
) ), ( ), ( ( ) (
) ), ( ), ( ( ) (
t t u t x g t y
t t u t x f t x

Chap. 6 DiscreteEvent Systems


Page5
I ST / DEEC / API
Open loop vsclosed-loop (the use of feedback)
Advantages of feedback?
(to revisit during SEDssupervision study)
Chap. 6 Discrete Event Systems
Page6
I ST / DEEC / API
Example of closed-loop with feedback
Chap. 6 DiscreteEvent Systems
Page7
I ST / DEEC / API
Discrete Event Systems: Examples
Set of events:
E={N, S, E, W}
Chap. 6 Discrete Event Systems
Page8
I ST / DEEC / API
Queueingsystems
Clients
arrival
Queue Server
Clients
departure
Chap. 6 Discrete Event Systems
Discrete Event Systems: Examples
Page9
I ST / DEEC / API
Computational Systems
Processes
Arrival
CPU
Processes
Departure
CPU
CPU
Chap. 6 Discrete Event Systems
Discrete Event Systems: Examples
Page10
I ST / DEEC / API
Characteristics of systems with continuous variables
1.State space is continuous
2. The state transition mechanism is time-driven
Characteristics of systems with discrete events
1.State space is discrete
2. The state transition mechanism is event-driven
Polling is avoided!
Chap. 6 DiscreteEvent Systems
Page11
I ST / DEEC / API
Taxonomyof Systems
Chap. 6 DiscreteEvent Systems
Page12
I ST / DEEC / API
Levels of abstraction in the study of
Discrete Event Systems
Languages
Timed languages
Stochastic timed languages
Chap. 6 Discrete Event Systems
Page13
I ST / DEEC / API
Systems Theory Objectives
Modeling and Analysis
Designand synthesis
Control / Supervision
Performance assessment and robustness
Optimization
Applications of Discrete
Event Systems
Queueingsystems
Operating systems and computers
Telecommunications networks
Distributed databases
Automation
Chap. 6 Discrete Event Systems
Page14
I ST / DEEC / API
Discrete Event Systems
Typical modeling methodologies
Augmenting
in
modeling
capacity
and
complexity
Automata
GRAFCET
Petri nets
Chap. 6 Discrete Event Systems
Page15
I ST / DEEC / API
Automata Theory and Languages
Genesis of computation theory
Definition: A languageL, defined over the alphabet E is a set of
stringsof finite length with events from E.
Examples: E={, , }
L
1
={, , , }
L
2
={all stringsof length 3}
How to build a machine that talks a given language?
What language talks a system?
or
Chap. 6 Discrete Event Systems
Page16
I ST / DEEC / API
Operations / Properties of languages
Kleene-closure E
*
: set of all strings of finite length
of E, including the null element .
Concatenation:
Prefix-closure:
{ } L st E s L
E t
e - e =
e
*
: :
*
{ }
b b a a b a b a
L s L s s s s E s L L e e = e = , , : :
*
Chap. 6 DiscreteEvent Systems
Page17
I ST / DEEC / API
Operations / Properties of languages
[Cassandras99]
Page18
I ST / DEEC / API
Motivation: An automatonis a device capable of representing
a language according to some rules.
Definition: A deterministic automatonis a 5-tuple
(E, X, f, x
0
,F)
where:
E - finite alphabet (or possible events)
X - finite set of states
f - state transition function f: X x E X
x
0
- initial state x
0
X
F - set of final states or marked states F E
Chap. 6 Discrete Event Systems
Automata Theory and Languages
Page19
I ST / DEEC / API
Example of an automaton
(E, X, f, x
0
,F)
E ={, ,}
X ={x, y, z}
x
0
=x
F ={x, z}
f(x, ) = x f(x, ) = z f(x, ) = z
f(y, ) = x f(y, ) = y f(y, ) = y
f(z, ) = y f(z, ) = z f(z, ) = y
Chap. 6 DiscreteEvent Systems
Page20
I ST / DEEC / API
Example of a stochastic automata
(E, X, f, x
0
,F)
E ={, }
X ={0, 1}
x
0
=0
F ={0}
f(0, ) = {0, 1} f(0, ) = {}
f(1, ) = {} f(1, ) = 0
Chap. 6 DiscreteEvent Systems
Page21
I ST / DEEC / API
the Generated Languageis defined as
L(G) := {s E
-
: f(x
0
,s) is defined}
Note: if f is always defined then L(G)==E*
and the Marked Languageis defined as
L
m
(G) := {s E
-
: f(x
0
,s) F}
Given an automaton
G=(E, X, f, x
0
,F)
Chap. 6 DiscreteEvent Systems
Page22
I ST / DEEC / API
Example: marked language of an automaton
0 1
a
b
b
a
L
m
(G) := {a, aa, ba, aaa, baa, bba, }
Concluding, in this example L
m
(G) means all strings with events aand b, ended by event a.
Chap. 6 DiscreteEvent Systems
L(G) := {, a, b, aa, ab, ba, bb, aaa, aab, baa, }
Page23
I ST / DEEC / API
Automata equivalence:
The automata G
1
e G
2
are equivalent if
L(G
1
) = L(G
2
)
and
L
m
(G
1
) = L
m
(G
2
)
Chap. 6 DiscreteEvent Systems
Page24
I ST / DEEC / API
Example of an automata:
Objective: To validate a sequence of events
Chap. 6 Discrete Event Systems
Page25
I ST / DEEC / API
Deadlocks (inter-blocagem)
Example:
The state 5is a deadlock.
The states 3and 4
constitutes a livelock.
Need methodologies
for the analysis
of
Discrete Event Systems
Howto find
thedeadlocksand
thelivelocks?
0
1
2
3
4
5
a
a
a
g
g
b
b
Chap. 6 DiscreteEvent Systems
Page26
I ST / DEEC / API
Deadlock:
in general the following relations are verified
An automaton G has a deadlock if
and is not blocked when
( ) ( ) G L G L
m
c
( ) ( ) G L G L
m
=
( ) ( ) ( ) G L G L G L
m m
_ _
Chap. 6 DiscreteEvent Systems
Page27
I ST / DEEC / API
Deadlock:
Example:
0
1
2
3
4
5
a
a
a
g
g
b
b
( ) { }
, , ,...
m
L G ab abgab abgabgab =
( )
)
`

=
,... , ,
, , , , , ,
abga aaba abg
aab aa ag ab a
G L
c
( ) ( ) ( ) G L G L
m
c
( ) ( ) G L G L
m
=
Chap. 6 DiscreteEvent Systems
The state 5is a deadlock.
The states 3and 4
constitutes a livelock.
Page28
I ST / DEEC / API
Alternative way to detect deadlocks:
Example:
1
2
0
3
4
0
0

a
5
b
3
a
g
g b
a
0
1
2
3
4
5
a
a
a
g
g
b
b
Chap. 6 DiscreteEvent Systems
The state 5is a deadlock.
The states 3and 4
constitutes a livelock.
Page29
I ST / DEEC / API
Timed Discrete Event Systems
Chap. 6 Discrete Event Systems
1 2
3
4
2
2
Page30
I ST / DEEC / API
Petri nets
Developed by Carl Adam Petri in his PhD thesis in 1962.
Definition: A marked Petri net is a 5-tuple
(P, T, A, w, x
0
)
where:
P - set of places
T - set of transitions
A - set of arcs A (P x T) (T x P)
w - weight function w: A N
x
0
- initial marking x
0
: P N
Chap. 6 Discrete Event Systems
Page31
I ST / DEEC / API
(P, T, A, w, x
0
)
P={p
1
, p
2
, p
3
, p
4
, p
5
}
T={t
1
, t
2
, t
3
, t
4
}
A={(p
1
, t
1
), (t
1
, p
2
), (t
1
, p
3
), (p
2
, t
2
), (p
3
, t
3
),
(t
2
, p
4
), (t
3
, p
5
), (p
4
, t
4
), (p
5
, t
4
), (t
4
, p
1
)}
w(p
1
, t
1
)=1, w(t
1
, p
2
)=1, w(t
1
, p
3
)=1, w(p
2
, t
2
)=1
w(p
3
, t
3
)=2, w(t
2
, p
4
)=1, w(t
3
, p
5
)=1, w(p
4
, t
4
)=3
w(p
5
, t
4
)=1, w(t
4
, p
1
)=1
x
0
={1, 0, 0, 2, 0}
Exampleof a Petri net
Chap. 6 DiscreteEvent Systems
Page32
I ST / DEEC / API
(P, T, A, w, x
0
)
P={p
1
, p
2
, p
3
, p
4
, p
5
}
T={t
1
, t
2
, t
3
, t
4
}
A={(p
1
, t
1
), (t
1
, p
2
), (t
1
, p
3
), (p
2
, t
2
), (p
3
, t
3
),
(t
2
, p
4
), (t
3
, p
5
), (p
4
, t
4
), (p
5
, t
4
), (t
4
, p
1
)}
w(p
1
, t
1
)=1, w(t
1
, p
2
)=1, w(t
1
, p
3
)=1, w(p
2
, t
2
)=1
w(p
3
, t
3
)=2, w(t
2
, p
4
)=1, w(t
3
, p
5
)=1, w(p
4
, t
4
)=3
w(p
5
, t
4
)=1, w(t
4
, p
1
)=1
x
0
={1, 0, 0, 2, 0}
Example of a Petri net
p
1
p
2
p
3
t
1
t
3
t
2
p
4
p
5
t
4
2
3
Petri net graph
Chap. 6 Discrete Event Systems
Page33
I ST / DEEC / API
Petri nets
Rules to follow (mandatory):
Arcs(directed connections)
connect placesto transitionsand
connect transitionsto places
A transitioncan have no placesdirectly as inputs (source) ,
i.e. must exist arcsbetween transitions and places
A transitioncan have no placesdirectly as outputs (sink),
i.e. must exist arcsbetween transitions and places
The same happens with the input and output transitionsfor places
Chap. 6 Discrete Event Systems
Page34
I ST / DEEC / API
Alternative definition of a Petri net
A marked Petri net is a 5-tuple
(P, T, I , O,
0
)
where:
P - set of places
T - set of transitions
I - transition input function I : T P

O - transition output function O : T P

0
- initial marking
0
: P N
Note: P

=bag of places
Chap. 6 DiscreteEvent Systems
Page35
I ST / DEEC / API
Alternative definition
(P, T, I, O,
0
)
P={p
1
, p
2
, p
3
, p
4
, p
5
}
T={t
1
, t
2
, t
3
, t
4
}
I(t
1
)={p
1
} O(t
1
)={p
2
, p
3
}
I(t
2
)={p
2
} O(t
2
)={p
4
}
I(t
3
)={p
3
, p
3
} O(t
3
)={p
5
}
I(t
4
)={p
4
, p
4
, p
4
, p
5
} O(t
4
)={p
1
}

0
={1, 0, 0, 2, 0}
Exampleof a Petri net anditsgraphical representation
p
1
p
2
p
3
t
1
t
3
t
2
p
4
p
5
t
4
2
3
Chap. 6 DiscreteEvent Systems
Page36
I ST / DEEC / API
The stateof a Petri net is
characterized by the marking
of all places.
The set of all possible markings
of a Petri net corresponds to its
state space.
How does the state of a Petri net evolve?
Petri nets
p
1
p
2
p
3
t
1
t
2
3
Chap. 6 Discrete Event Systems
Page37
I ST / DEEC / API
A transition t
j
T is enabledif:
)) ( , ( # ) ( :
j i i i
t I p p P p > e
A transition t
j
e T may firewhenever enabled, resulting in a new
marking given by:
( ) ( ) )) t ( O , p ( # )) t ( I , p ( # p p
j i j i i i
+ =
'

Execution Rules for Petri Nets(Dynamics of Petri nets)
Chap. 6 DiscreteEvent Systems
#(p
i
, I(t
j
)) = multiplicity of the arc from p
i
to t
j
#(p
i
, O(t
j
)) = multiplicity of the arc from t
j
to p
i
Page38
I ST / DEEC / API
Example of evolution of a
Petri net
Initial marking:

0
={1, 0, 1, 2, 0}
p
1
p
2
p
3
t
1
t
3
t
2
p
4
p
5
t
4
2
3
This discrete event system
can not change state.
It is in a deadlock!
.
.
.
.
.
.
.
.
.
.
.
.
.
.. .
..
. . .
.
Chap. 6 DiscreteEvent Systems
Petri nets
Page39
I ST / DEEC / API
Petri nets: Conditions and Events
Conditions:
a) The server is idle.
b) A job arrives and waits to be processed
c) The server is processing the job
d) The job is complete
Events
1) J ob arrival
2) Server starts processing
3) Server finishes processing
4) The job is delivered
Event Pre-conditions Pos-conditions
1 - b
2 a, b c
3 c d, a
4 d -
Chap. 6 Discrete Event Systems
J obs waits
processing
J ob is being
processed
Server is idle
J ob is
complete
J ob arrival
Start of
processing
End of
processing
J ob is
delivered
Example: Machine waits until an order appears and then machines the ordered part and sends it
out for delivery.
Page40
I ST / DEEC / API
Concurrence Conflict
t
1
t
2
t
1
t
2
Chap. 6 Discrete Event Systems
Petri nets: Modeling mechanisms
Page41
I ST / DEEC / API
Mutual Exclusion Producer / Consumer
t
1
t
2
Critical
Section
Critical
Section
m
Chap. 6 Discrete Event Systems
produce
B
consume
B= one element buffer Place m represents the permission to enter
the critical section
Petri nets: Modeling mechanisms
Page42
I ST / DEEC / API
Readers / Writers Producer / Consumer
with finite capacity
Chap. 6 Discrete Event Systems
Petri nets: Modeling mechanisms
produce
B
consume
B'
n
read
write
n
s t
n
n
Page43
I ST / DEEC / API
Discrete Event Systems
Example of a simple automation system modeled using PNs
An automatic soda selling
machine accepts
50c and $1 coins and
sells 2 types of products:
SODA A, that costs $1.50 and
SODA B, that costs $2.00.
Assume that the money return
operation is omitted.
p
1
: machine with $0.00;
t
1
: coin of 50 c introduced;
t
8
: SODA B sold.
Chap. 6 Discrete Event Systems
t
1
t
2
t
3
t
4
t
5
t
6
t
7
t
8
t
9
p
1
p
2
p
3
p
4
p
5
Page44
I ST / DEEC / API
Extensionsto Petri nets
Switches[Baer 1973]
e
f
e
f
e
f
e
f
Possible to be implemented with restricted Petri nets.
Chap. 6 Discrete Event Systems
Page45
I ST / DEEC / API
I nhibitor Arcs
Equivalent to
nets with priorities
Can be implemented with restricted Petri nets?
Zero tests...
Infinity tests...
Chap. 6 Discrete Event Systems
Extensionsto Petri nets
Page46
I ST / DEEC / API
P-Timed nets
Chap. 6 Discrete Event Systems
Extensionsto Petri nets
J obs waits
processing
J ob is beeing
processed
Server is idle
J ob is
complete
J ob arrival Start of
processing
End of
processing
J ob is
delivered
Page47
I ST / DEEC / API
T-Timed nets
Chap. 6 Discrete Event Systems
J obs waits
processing
J ob is being
processed
Server is idle
J ob is
complete
J ob arrival Start of
processing
End of
processing
J ob is
delivered
Extensionsto Petri nets
Page48
I ST / DEEC / API
Stochastic nets
q
0
q
1
q
2
q
0
+q
1
+q
2
=1
Stochastic switches Transitions with stochastic timings
described by a stochastic variable
with known pdf

0
Chap. 6 Discrete Event Systems
Extensionsto Petri nets
Page49
I ST / DEEC / API
Discrete Event Systems
Sub-classes of Petri nets
State Machine:
Petri nets where each transition
has exactly one input arc and one
output arc.
Marked Graphs
Petri nets where each place
has exactly one input arc and one
output arc.
Chap. 6 Discrete Event Systems
Page50
I ST / DEEC / API
Example of DES:
Manufacturing system composed
by 2 machines (M
1
and M
2
) and a
robotic manipulator (R). This takes
the finished parts from machine M
1
and transports them to M
2
.
No buffers available on the machines.
If R arrives near M
1
and the machine is
busy, the part is rejected.
If R arrives near M
2
and the machine is
busy, the manipulator must wait.
Machining time: M
1
=0.5s; M
2
=1.5s; R
M1

M2
=0.2s; R
M2

M1
=0.1s;
M
1
R
M
2
Chap. 6 Discrete Event Systems
Discrete Event Systems
Page51
I ST / DEEC / API
Variables of
M
1
x
1
M
2
x
2
R x
3
Example of arrival of parts:
x
1
={Idle, Busy, Waiting}
x
2
={Idle, Busy}
x
3
={Idle, Carrying, Returning}

=
stamps time other in
in
t a
0
} 5 . 2 , 6 . 1 , 1 . 1 , 7 . 0 , 1 . 0 { 1
) (
M
1
R
M
2
Chap. 6 Discrete Event Systems
Example of DES:
Discrete Event Systems
Page52
I ST / DEEC / API
Definition of events:
a
1
- loads part in M
1
d
1
- ends part processing in M
1
r
1
- loads manipulator
r
2
- unloads manipulator and
loads M
2
d
2
- ends part processing in M
2
r
3
- manipulator at base
M
1
R
M
2
Chap. 6 Discrete Event Systems
Example of DES:
Discrete Event Systems
Page53
I ST / DEEC / API
1 2 3 4
t
a
1
1 2 3 4
t
d
1
1 2 3 4
t
r
1
1 2 3 4
t
r
2
1 2 3 4
t
r
3
1 2 3 4
t
d
2
1 2 3 4
t
x
1
W
B
I
1 2 3 4
t
x
3
R
C
I
1 2 3 4
x
2
t
B
I
Chap. 6 Discrete Event Systems
Discrete Event Systems
Page54
I ST / DEEC / API
M
1
R
M
2
Chap. 6 Discrete Event Systems
Example of DES:
Discrete Event Systems
Events:
a
1
- loads part in M
1
d
1
- ends part processing in M
1
r
1
- loads manipulator
r
2
- unloads manipulator and loads M
2
d
2
- ends part processing in M
2
r
3
- manipulator at base
new
part
reject
part
Idle
Busy
d
1
Waiting
Idle
Carrying
r
1
Idle
Busy
r
2
Returning
d
2
r
3
. . .
M
1
M
2
R

You might also like