W3-S1-wfm2_pn

Petri nets
refresher
Prof.dr.ir. Wil van der Aalst
Eindhoven University of Technology, Faculty of Technology Management,
Department of Information and Technology, P.O.Box 513, NL-5600 MB,
Eindhoven, The Netherlands.
/faculteit technologie management
PN-1
p4
place
Elements
t34
(name)
t43
transition
p3
place
t23
(name)
t32
p2
transition
token
arc (directed connection)
t12
token
t21
p1
t01
t10
p0
/faculteit technologie management
PN-2
free
Rules
wait
enter
before
make_picture
after
leave
gone
occupied
•
•
•
•
Connections are directed.
No connections between two places or two transitions.
Places may hold zero or more tokens.
First, we consider the case of at most one arc between
two nodes.
/faculteit technologie management
PN-3
/faculteit technologie management
PN-4
Enabled
• A transition is enabled if each of its input places
contains at least one token.
free
wait
enter
before
make_picture
after
leave
gone
occupied
enabled
/faculteit technologie management
Not
enabled
Not
enabled
PN-5
Firing
• An enabled transition can fire (i.e., it occurs).
• When it fires it consumes a token from each
input place and produces a token for each
output place.
free
fired
wait
enter
before
make_picture
after
leave
gone
occupied
/faculteit technologie management
PN-6
/faculteit technologie management
PN-7
Play “Token Game”
• In the new state, make_picture is enabled. It will fire, etc.
free
wait
enter
before
make_picture
after
leave
gone
occupied
/faculteit technologie management
PN-8
/faculteit technologie management
PN-9
/faculteit technologie management
PN-10
/faculteit technologie management
PN-11
/faculteit technologie management
PN-12
Remarks
• Firing is atomic.
• Multiple transitions may be enabled, but only one
fires at a time, i.e., we assume interleaving
semantics (cf. diamond rule).
• The number of tokens may vary if there are
transitions for which the number of input places is
not equal to the number of output places.
• The network is static.
• The state is represented by the distribution of
tokens over places (also referred to as marking).
/faculteit technologie management
PN-13
p4
Non-determinism
t34
p4
t43
t34
p3
t23
p3
t32
t23
transition t23
fires
p2
t12
t21
t01
t12
t21
p1
t10
p0
t32
p2
p1
Two transitions are
enabled but only
one can fire
t43
t01
t10
p0
/faculteit technologie management
PN-14
/faculteit technologie management
PN-15
Example: Single traffic light
rg
green
red
go
orange
or
/faculteit technologie management
PN-16
/faculteit technologie management
PN-17
Two traffic lights
rg
rg
rg
green
green
red
go
green
red
orange
or
OR
go
red
go
orange
orange
or
or
/faculteit technologie management
PN-18
Problem
/faculteit technologie management
PN-19
Solution
rg1
rg2
g1
r1
go1
How to make
them
alternate?
g2
x
go2
o1
or1
r2
o2
or2
/faculteit technologie management
PN-20
/faculteit technologie management
PN-21
Playing the “Token Game” on the Internet
• Applet to build your own Petri nets and execute
them:
http://is.tm.tue.nl/staff/wvdaalst/workflowcourse/
pn_applet/pn_applet.htm
• FLASH animations: www.workflowcourse.com
/faculteit technologie management
PN-22
Exercise: Train system (1)
• Consider a circular railroad system with 4 (oneway) tracks (1,2,3,4) and 2 trains (A,B). No two
trains should be at the same track at the same
time and we do not care about the identities of
the two trains.
/faculteit technologie management
PN-23
Exercise: Train system (2)
• Consider a railroad system with 4 tracks
(1,2,3,4) and 2 trains (A,B). No two trains should
be at the same track at the same time and we
want to distinguish the two trains.
/faculteit technologie management
PN-24
Exercise: Train system (3)
• Consider a railroad system with 4 tracks
(1,2,3,4) and 2 trains (A,B). No two trains should
be at the same track at the same time.
Moreover the next track should also be free to
allow for a safe distance. (We do not care about
train identities.)
/faculteit technologie management
PN-25
Exercise: Train system (4)
• Consider a railroad system with 4 tracks
(1,2,3,4) and 2 trains. Tracks are free, busy or
claimed. Trains need to claim the next track
before entering.
/faculteit technologie management
PN-26
Modeling problem
/faculteit technologie management
PN-27
Modeling problem (1): Zero testing
• Transition t should fire if place p is empty.
t
?
p
/faculteit technologie management
PN-28
Solution
• Only works if place is N-bounded
t
N input and
output arcs
Initially there
are N tokens
p’
p
/faculteit technologie management
PN-29
Modeling problem (2): Priority
• Transition t1 has priority over t2
t1
?
t2
/faculteit technologie management
Hint: similar to Zero testing!
PN-30
A bit of theory
• Extensions have been proposed to tackle these
problems, e.g., inhibitor arcs.
• These extensions extend the modeling power
(Turing completeness*).
• Without such an extension not Turing complete.
• Still certain questions are difficult/expensive to
answer or even undecidable (e.g., equivalence
of two nets).
* Turing completeness corresponds to the ability to execute any
computation.
/faculteit technologie management
PN-31