petri nets 2000
TRANSCRIPT
-
8/3/2019 Petri Nets 2000
1/270
Petri Nets 2000
21st International Conference onApplication and Theory of Petri Nets
Aarhus, Denmark, June 26-30, 200
Introductory Tutorial
Petri Nets
Organised by
Gianfranco BalboJ org DeselKurt JensenWolfgang ReisigGrzegorz RozenbergManuel Silva
-
8/3/2019 Petri Nets 2000
2/270
-
8/3/2019 Petri Nets 2000
3/270
Table of Contents
Wolfgang Reisig An Informal Introduction to Petri Nets . . . . . . . . . . . . . . . .
Grzegorz Rozenberg Elementary Net Systems . . . . . . . . . . . . . . . . . . . . . . .
J org Desel Place/Transition Nets I . . . . . . . . . . . . . . . . . . . . . . . .
Kurt Jensen Coloured Petri Nets . . . . . . . . . . . . . . . . . . . . . . . . .
Grzegorz Rozenberg Behaviour of Elementary Net Systems . . . . . . . . . . . . . . . .
Manuel Silva Place/Transition Nets II . . . . . . . . . . . . . . . . . . . . . . . .
Gianfranco BalboAn Introduction to Generalised Stochastic Petri Nets . . . . . . . . .
-
8/3/2019 Petri Nets 2000
4/270
-
8/3/2019 Petri Nets 2000
5/2701
-
8/3/2019 Petri Nets 2000
6/2702
-
8/3/2019 Petri Nets 2000
7/2703
-
8/3/2019 Petri Nets 2000
8/270
4
-
8/3/2019 Petri Nets 2000
9/270
5
-
8/3/2019 Petri Nets 2000
10/270
6
-
8/3/2019 Petri Nets 2000
11/270
7
-
8/3/2019 Petri Nets 2000
12/270
8
-
8/3/2019 Petri Nets 2000
13/270
9
-
8/3/2019 Petri Nets 2000
14/270
10
-
8/3/2019 Petri Nets 2000
15/270
11
-
8/3/2019 Petri Nets 2000
16/270
12
-
8/3/2019 Petri Nets 2000
17/270
13
-
8/3/2019 Petri Nets 2000
18/270
14
-
8/3/2019 Petri Nets 2000
19/270
15
-
8/3/2019 Petri Nets 2000
20/270
16
-
8/3/2019 Petri Nets 2000
21/270
17
-
8/3/2019 Petri Nets 2000
22/270
18
-
8/3/2019 Petri Nets 2000
23/270
19
-
8/3/2019 Petri Nets 2000
24/270
20
-
8/3/2019 Petri Nets 2000
25/270
21
-
8/3/2019 Petri Nets 2000
26/270
22
-
8/3/2019 Petri Nets 2000
27/270
23
-
8/3/2019 Petri Nets 2000
28/270
24
-
8/3/2019 Petri Nets 2000
29/270
25
-
8/3/2019 Petri Nets 2000
30/270
26
-
8/3/2019 Petri Nets 2000
31/270
27
-
8/3/2019 Petri Nets 2000
32/270
28
-
8/3/2019 Petri Nets 2000
33/270
29
-
8/3/2019 Petri Nets 2000
34/270
30
-
8/3/2019 Petri Nets 2000
35/270
31
-
8/3/2019 Petri Nets 2000
36/270
32
-
8/3/2019 Petri Nets 2000
37/270
-
8/3/2019 Petri Nets 2000
38/270
34
-
8/3/2019 Petri Nets 2000
39/270
35
-
8/3/2019 Petri Nets 2000
40/270
36
-
8/3/2019 Petri Nets 2000
41/270
37
-
8/3/2019 Petri Nets 2000
42/270
38
-
8/3/2019 Petri Nets 2000
43/270
39
-
8/3/2019 Petri Nets 2000
44/270
40
-
8/3/2019 Petri Nets 2000
45/270
41
-
8/3/2019 Petri Nets 2000
46/270
42
-
8/3/2019 Petri Nets 2000
47/270
43
-
8/3/2019 Petri Nets 2000
48/270
44
-
8/3/2019 Petri Nets 2000
49/270
45
-
8/3/2019 Petri Nets 2000
50/270
46
-
8/3/2019 Petri Nets 2000
51/270
47
-
8/3/2019 Petri Nets 2000
52/270
48
-
8/3/2019 Petri Nets 2000
53/270
49
-
8/3/2019 Petri Nets 2000
54/270
50
-
8/3/2019 Petri Nets 2000
55/270
51
-
8/3/2019 Petri Nets 2000
56/270
52
-
8/3/2019 Petri Nets 2000
57/270
53
-
8/3/2019 Petri Nets 2000
58/270
54
-
8/3/2019 Petri Nets 2000
59/270
55
-
8/3/2019 Petri Nets 2000
60/270
56
-
8/3/2019 Petri Nets 2000
61/270
57
-
8/3/2019 Petri Nets 2000
62/270
58
-
8/3/2019 Petri Nets 2000
63/270
59
-
8/3/2019 Petri Nets 2000
64/270
60
-
8/3/2019 Petri Nets 2000
65/270
61
-
8/3/2019 Petri Nets 2000
66/270
62
-
8/3/2019 Petri Nets 2000
67/270
63
-
8/3/2019 Petri Nets 2000
68/270
64
-
8/3/2019 Petri Nets 2000
69/270
65
-
8/3/2019 Petri Nets 2000
70/270
66
-
8/3/2019 Petri Nets 2000
71/270
67
-
8/3/2019 Petri Nets 2000
72/270
68
-
8/3/2019 Petri Nets 2000
73/270
69
-
8/3/2019 Petri Nets 2000
74/270
70
-
8/3/2019 Petri Nets 2000
75/270
71
-
8/3/2019 Petri Nets 2000
76/270
72
-
8/3/2019 Petri Nets 2000
77/270
73
-
8/3/2019 Petri Nets 2000
78/270
74
-
8/3/2019 Petri Nets 2000
79/270
75
-
8/3/2019 Petri Nets 2000
80/270
76
-
8/3/2019 Petri Nets 2000
81/270
77
-
8/3/2019 Petri Nets 2000
82/270
78
-
8/3/2019 Petri Nets 2000
83/270
79
-
8/3/2019 Petri Nets 2000
84/270
80
-
8/3/2019 Petri Nets 2000
85/270
81
-
8/3/2019 Petri Nets 2000
86/270
82
-
8/3/2019 Petri Nets 2000
87/270
83
-
8/3/2019 Petri Nets 2000
88/270
84
Introductory Tutorial
Place/Transition-Nets I
-
8/3/2019 Petri Nets 2000
89/270
J org Desel, Catholic University in Eichst att
I. Introduction to place/transition-nets
II. Basic analysis techniques
I. Introduction to An exampleplace/transition nets Different features of place/tr
Place/transition-nets vs en-sy
Formal denitions
Place/transition-nets
Occurrence sequences and r
An example: a vending machine
Control structure of a vending machine
-
8/3/2019 Petri Nets 2000
90/270
eady for insertion
holdingcoin
dispenseitem
nsert coin
ccept coin
reject coin
ready to dispense
eady for insertion
ispenseitem
nser
ccep
rejec
eady to dispense
an en-system its behaviour
item storage ready for insertion
holding coin
refilldispense
item
insert coin
reject coin
Adding concurrency: a vending machine with capacity 1 ...
tem storage eady for insertion
holding coin
efillispense
item
nsert coin
reject coin
Adding bounded storages: a vending machine with capacity 4 ...
-
8/3/2019 Petri Nets 2000
91/270
equest for refill
efill item
accept coineady to dispense
ic
rc
ic ic ic ic
rc rc rc rc
refill refill refill
refillrefillrefillrefill
refill
ac ac ac acac
di di di di
refill refill refill refill
... and its behaviour
ready for insertion
holding coindispense
item
insert coin
reject coin
coins in machine
Adding unbounded counters: the control part with a counter ...
tem storage eady for insertion
holding coin
efillispense
item
nsert coin
reject coin
Adding arc weights: the vending machine selling pairs ...
-
8/3/2019 Petri Nets 2000
92/270
equest for refill accept coineady to dispense
tem storage
equest for refill
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
reject coin
eady to dispense
... or storing pairs
tem storage eady for insertion
holding coin
efillispense
item
nsert coin
reject coin
Adding limited capacities: replacing the place request for rell ...
Marked place/transition-nets generalize en-systems
Each contact-free en-system is a 1-safe marked place/transition-net
Terminology:
-
8/3/2019 Petri Nets 2000
93/270
Terminology:
en-system marked p/t-net
condition ; ! place
event ; ! transition
case / state ; ! marking
c conditions m : places ! f 0 1 g
sequential case graph ; ! marking graph
(reachability graph, state graph
Formal denition of marked place/transition-nets
A marked place/transition-net (p/t-net) is a tuple ( S T F
(S T F ) is a net with
S set of places (Stellen), nonempty, nite (often P
T set of transitions , nonempty, nite
The occurrence rule
A transition t is enabled at a marking m if
every place s 2 t satises m (s ) w (s t ) and
every place s 2 t satises m (s ) + w (t s ) k (s )
-
8/3/2019 Petri Nets 2000
94/270
2
2
32
2
3 k=4
The occurrence of t leads to the successor marking m 0 , den
m 0 (s ) =
8
>
>
>
>
>
<
>
>
>
>
>
:
m (s ) if s =2 t and s =2 t
m (s ) ; w (s t ) if s 2 t and s =2 t
m (s ) + w (t s ) if s =2 t and s 2 t
m (s ) ; w (s t ) + w (t s ) if s 2 t and s 2 t
Notation: m t
; ! m 0 (m [t i m 0 )
Occurrence sequences and reachability
A nite sequence = t 1 t 2 . . . t n of transitions is a
nite occurrence sequence leading from m 0 to m n if
m 0
t 1
; ! m 1
t 2
; ! t n
; ! m n
A m rking is re ch ble (from ) if
Marking graphs
The marking graph of a marked p/t-net is an edge-labeled graph wi
initial vertex initial marking m 0 (denoted ! )
vertices set of reachable markings [ m 0 i
-
8/3/2019 Petri Nets 2000
95/270
(1,1,0)t1 t2
s1
s2
s3 (0,2,0)
t2 (1,0,1)
t1
t2 (0,1,1)
t1
t2
t3
2t3
vertices set of reachable markings [labeled edges set of triples ( m t m 0 ) such that m ;
Example:
Lemma Each occurrence sequence corresponds to the
labels of a directed path of the marking graphstarting with the initial vertex,
and vice versa.
Behavioral properties of marked p/t-nets
A marked p/t-net is
terminating if there is no innite occurrence seque
deadlock-free if each reachable marking enables a tralive if each reachable marking enables
an occurrence sequence containing all
t1t2
t2
t1
t4
t3
A marked p/t-net which is not deadlock-free and its marking graph
-
8/3/2019 Petri Nets 2000
96/270
t3
t4
t4 t2
Proposition A marked p/t-net is deadlock-free if and only if
its marking graph has no vertex without successor
Proposition No deadlock-free marked p/t-net is terminating
(but the converse does not necessarily hold)
t2 t4
t1 t5
t3t2
t1
t3t4
t5
A deadlock-free marked p/t-net which is not live
Proposition Every live marked p/t-net is deadlock-free
Proposition A marked p/t-net is bounded if and only if
its set of reachable markings is nite
(its marking graph is nite)
Proof
-
8/3/2019 Petri Nets 2000
97/270
(( ) The maximal number of tokens on a place can be taken as its b
() ) If a place s is bounded by b (s ) then it can be in at most b (
m (s ) = 0 m (s ) = 1 . . . m (s ) = b (s ):
So the number of reachable markings does not exceed
(b (s 1 ) + 1) (b (s 2 ) + 1) (b (s n ) + 1)
where f s 1 s 2 . . . s n g is the (nite !) set of places
Corollary A 1safe marked p/t-net with n places has
at most 2 n reachable markings
t2 t4
t1 t5
t3
t2
t1
t3
Proposition A marked p/t-net is reversible if and only if
its marking graph is strongly connected
Example a 1safe non-live marked p/t-net which is not reversible
tem storage
eady for insertion
holding coin
efill ispenseitem
nsert coin
= 4
Substituting capacities ...
-
8/3/2019 Petri Nets 2000
98/270
accept coin
eject coin
eady to dispense
tem storage
equest for refill
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
reject coin
eady to dispense
... by complement places
Weak capacities. . . guarantee bounds of places
weak enabling condition:
a transitiont
is enabled at a markingm
ifevery place s 2 t satises m (s ) w (s t ) and
every place s 2 t n t satises m (s ) + w (t s) k (s ) an
Strong capacities
. . . generalize contact of en-systems
strong enabling condition:
a transition t is enabled at a marking m if
l ti ( ) ( ) d
-
8/3/2019 Petri Nets 2000
99/270
= 3
every place s 2 t satises m (s ) w (s t ) and
every place s 2 t satises m (s ) + w (t s ) k (s )
Proposition each en-system is equivalent to a
marked p/t-net without arc weights andwith the strong capacity restriction k (s ) = 1 for eve
Replacing a strong capacity restrictiction by a strong complem
Inhibitor arcs for null tests
inhibitor enabling condition: If (s t ) is an inhibitor arc then
t is only enabled at a marking
II. Basic Linear-algebraic techniquesanalysis The marking equationtechniques Place invariants
Transition invariants
Structural techniques
-
8/3/2019 Petri Nets 2000
100/270
Structural techniques
Siphons
Traps
The siphon/trap property
Restricted net classes
State machines
Marked graphs
Free-choice nets
Causal Semantics
Occurrence nets
Process nets
1
s2
s3
s4t1 t2
3
4
t5
5
Linear-algebraic representation of markings and transitions
1 s3
s4t1 t2
3
t5
Matrix representation of a net
-
8/3/2019 Petri Nets 2000
101/270
s2 45
incidence matrix of the net:
N
;
=
~ t 1
~ t 2
~ t 3
~ t 4
~ t 5
~ s 1 1 ; 1 0 0 0
~ s 2 ; 1 1 0 0 0
~ s 3 0 1 ; 1 0 1
~ s 4 0 0 1 ; 1 ; 1
~ s 5 0 ; 1 0 1 0
The marking equation
m 0
t 2 t 3 t 5 t 1 t 3
; ; ; ! m ) ~ m 0 + ~ t 2 + ~ t 3 + ~ t 5 + ~ t 1 + ~ t 3 = ~ m
~ m 0 + (1 ~ t 1 ) + (1 ~ t 2 ) + (2 ~ t 3 ) + (0 ~ t 4 ) +
~ m 0
+
N ;
(1 1 2 0 1)| { z } Parikh vector of t 2 t 3 t 5 t 1 t 3
=~ m
t1
2
3
t4
1
2
3
4
5
5
Example: a live and 1safe marked p/t-net
-
8/3/2019 Petri Nets 2000
102/270
2 t43 5
reachable markings solutions to the marking equation
(1 0 0 0 0) (0 0 0 0 0) (1 0 1 0 1)
(0 1 0 0 1) (1 0 0 0 0) . . .
(0 0 1 1 0) (0 1 0 0 0) . . .
(0 0 0 1 1) (1 0 1 0 0) (0 1 0 1 0) .
non-reachable marking solutions to the marking equation
(0 1 1 0 0) (1 1 0 0 1 ) . . .
Consequence: solubility of the marking equation is not sufcient for r
s1 s2s3
t1
s4
t3
s5
process 1 process 2
Place invariants
Example: mutual exclusion
Place invariants
Three equivalent denitions:
A place invariant of a net N is a vector ~ i satisfying
(1)X
~ i s =
X
~ i s for every transition t of N
-
8/3/2019 Petri Nets 2000
103/270
s 2
t s 2 t
(2) ~ i ~ t = 0 for every transition t of N
(3) ~ i
N ;
= (0 0 . . . 0)
The token conservation law for a place invariant ~ i :
If m is reachable from m 0 then ~ i ~ m 0 = ~ i ~ m
Proof: m 0
; ! m ) ~ m 0 +
N ;
P [ ] = ~ m
) ~ i ~ m
0 + ~ i
N ;
| { z }
= ( 0 . . . 0 )
P [ ] = ~ i ~ m
) ~ i ~ m
0 = ~ i ~ m
s1 s2s3
t1
t2
s4
t3
t4
s5
process 1 process 2
Proving stability
s1
s2
s3
t1
s4
t3
s5
process 1 process 2
Further place invariants
-
8/3/2019 Petri Nets 2000
104/270
t2 t4
(0 1 1 1 0) mutual exclusion
(0 1 1 0 ; 1) m (s 2 ) + m (s 3 ) = m (s 5 )
if s 2 is marked then s 5 is marked
(1 1 0 0 0) m (s 1 ) + m (s 2 ) = 1
m (s 1 ) m (s 2 ) 1, the places s 1 and s 2 are bou
A necessary condition for liveness
Proposition: In a live marked p/t-net without isolated places,
each place invariant ~ i without negative entries and
with some positive entry ~ i s satises ~ i ~ m 0 > 0.
Proof: otherwise transitions in s s are dead.
A sufcient condition for boundedness:
Proposition: Each marked p/t-net with a place invariant ~ i satis~ i
s > 0 for each place s is bounded.
Proof: m is reachable ) ~ i ~ m = ~ i ~ m 0 .~ ~ ~
-
8/3/2019 Petri Nets 2000
105/270
1 23
4
1
2
t3
t4
s5
) ~ i
s ~ m
s ~ i ~ m = ~ i ~ m 0 .
) m (s ) = ~ m s ~ i ~ m
0
~ i s
Example: place invariant (1 2 1 2 1)
3
s1
Place invariants and the marking equation
Proposition There is a place invariant ~ i satisfying ~ i ~ m 0 6= ~ i ~m
~ m 0 +
N ;
~x = ~ m has no rational-valued solution for
Example:
1 t3
Transition invariantsA transition invariant of a net N is a vector ~ j satisfying
N ;
~ j = (0 0 . . . 0)
Example:
-
8/3/2019 Petri Nets 2000
106/270
1 23
4
2 t4
s5
Transition invariants: (1 1 0 0), (0 0 1 1), (2 2 1 1)
Proposition Let m 0
; ! m be an occurrence sequence.
m 0 = m if and only if P [ ] is a transition invariant
Proof: follows immediately from ~ m 0 +
N ;
P [ ] = ~ m
A necessary condition for liveness and boundedness
Proposition: Each live and bounded marked p/t-net
has a transition invariant ~ j satisfying~ j (t ) > 0 for each transition t .
Proof: By liveness, there exist occurrence sequences
Structural Techniques
A siphon is a set of places which, once unmarked, never gains a token
S is a siphon if S S , i.e. if t \ S 6= implies t \ S 6= .
A trap is a set of places which, once marked, never looses all tokens
-
8/3/2019 Petri Nets 2000
107/270
a siphon{s1,s2}
a trap{s3, s4}
s1 s2 s3 s4
S is a trap if S S , i.e. if t \ S 6= implies t \ S 6= .
If a marking m satises m (s 1 ) = m (s 2 ) = 0 then so do all follower
If a marking m satises m (s 3 ) + m (s 4 ) > 0 then so do all follower
1
2
3
t4
1
2
3
s4
5
t5
Example for the use of a trap
Siphons and traps, liveness and deadlock-freedom
Proposition: In a live marked p/t-net without isolated places,
each nonempty siphon contains an initially marked pl
Proof: otherwise, for each place s of the siphon, all trans
-
8/3/2019 Petri Nets 2000
108/270
Proposition: Assume a marked p/t-net with some transition,
without capacity restrictions and arc weights.If each nonempty siphon includes an initially marked
then the marked p/t-net is deadlock-free
Proof: the set of unmarked places at a dead marking is a no
This siphon contains no marked trap.) It contains no initially marked trap.
Restricted net classes
State machines are marked p/t-nets without branched transitions,
i.e. j t j = j t j = 1 for each transition,
without arc weights andwithout capacity restrictions.
Marked graphs are marked p/t-nets without branched places,
i.e. j s j = j s j = 1 for each place,
without arc weights and
without capacity restrictions.
Example
-
8/3/2019 Petri Nets 2000
109/270
Proposition A marked graph is live if and only if
each cycle carries a token initially.
Proposition It is moreover 1safe if and only if
each place belongs to a cycle with exactly one token.
Free-choice nets are marked p/t-netswithout arc weights and capacity restrictions sati
(s t ) 2 F ) t s F for each place s
If then
produce send receive consume
produced
full
consumed
Causal semantics of marked p/t-nets
Example: a producer / consumer system
-
8/3/2019 Petri Nets 2000
110/270
sent received
ent
onsumed
end
roduce
roduced ent
ull ullroduce
roduced send sent
eceive
eceived
consume
onsumed
receive
eceived
a causal run of the producer /consumer system
Causal runsA causal run of a marked p/t-net is given by a labeled Petri net (
Interpretation of causal runs
net element name symbol interpretation
Occurrence netsAn occurrence net is a net ( B E K ) with the following properti
it has no cycles (i.e. K + is a partial order )
it has no branched places, i.e.
j
b j j b
j 1 for each condition b
-
8/3/2019 Petri Nets 2000
111/270
events have nite fan-in and fan-out, i.e.
e and e are nite sets for each event e
it has neither input nor output-events, i.e.j
e j j e
j 1 for each event e
no node has innitely many predecessors, i.e.
the set f x 2 (B E ) j x y g is nite for each node y
Process nets of marked p/t-nets represent causal runsAssume a marked p/t-net ( S T F k w m 0 ) without capacity restr
An occurrence net ( B E K ) together with
labels : (B E ) ! (S T ) is a process net of N if
sorts of nodes are respected by , i.e.
(B ) S and (E ) T
Occurrence sequences versus process nets
occurrence provide total orders of events that respect causality
sequences but add arbitrary interleavings of independent events.
Information about causal relationships can get lost.
process nets provide partial orders reecting causality.
-
8/3/2019 Petri Nets 2000
112/270
d a
e b
f
g
c h
d a
e b
f
g
c
f
d a
e b
f
g
cf
Example:
a b c
b a c
a c b
b c a
maximal occurrence sequences maximal process nets
s1 s3 s4
s2 s6
s5
t1 t2
t3
t5
t4
b4 b10s4 s4 b1s4
Two process nets corresponding to t 1 t 3 t 5 t 2 t 3 t 5 t 2
s1 s3 s4
s2 s6
s5
t1 t2
t3
t5
t4
b4 b104 s4 b14
Two process nets without a common occurrence sequence
-
8/3/2019 Petri Nets 2000
113/270
b8
b3
b1 e1
b4
b5 e2 b6
e3
b2
e4
b14
b7
b9
e5
b10
b11 e6 b12
e7
b13s3 t3
s4
s5 t5 s6 t2
s1
s3 t3
s4
s5 t5 s6 t2 s3
s2s2 t1
s1
s2
e8
b1
b16t3
s4
s5
b2
b8
b1
b3
e1
b4
b5 e2 b6
e3
b7
s3 t3
s4
s5 t5 s6 t2 s3
s2
s1
s2
e4
b9
b10 e6 b11
t3
s4
s5 t4 s3
b12e5t1 s1
e7
b13
b14 e8 b15
t3
s4
s5 t5 s6
-
8/3/2019 Petri Nets 2000
114/270
-
8/3/2019 Petri Nets 2000
115/270
C o l o u r e d P e t r i N e t s 4
f e n a b l e d b i n d i n g
B P
2 2 ` ( p
, 0 )
T 2 C P
B P
2 2 ` ( p
, 0 )
T 2 C P
B P
1 1 ` ( p
, 0 )
T 2 C P
1 1 ` ( p
, 0 )
( x , i )
( x , i ) 1
1 ` ( p
, 0 )
( x , i ) 1
1 ` ( p
, 0 )
( x , i )
( x , i )
( x , i )
-
8/3/2019 Petri Nets 2000
116/270
C o l o u r e d P e t r i N e t s
3
R e s o u r c e a l l o c a t i o n e x a m p l e
A
P
3 ` ( q
, 0 )
B
P
2 ` ( p
, 0 )
C
P
D
P
E
P T 1
[ x = q
]
T 2 T 3 T 4 T 5
R E
1 ` e D e c
l a r a
t i o n s :
t y p e
U = w
i t h p
| q ;
t y p e
I = i n t ;
t y p e
P = p r o d u c
t U * I ;
t y p e
E = w
i t h e ;
v a r x : U ;
v a r
i : I ;
S E
3 ` e
T E
2 ` e
( x , i )
( x , i )
( x , i )
( x , i )
( x , i )
( x , i )
( x , i )
( x , i )
( x , i )
i f x = q
t h e n
1 ` ( x , i +
1 )
e l s e e m p
t y
e i f x = q
t h e n
1 ` e
e l s e e m p t y
c a s e x o
f
p = >
2 ` e
| q = >
1 ` e
2 ` e
e
i f x = p
t h e n
1 ` e
e l s e e m p t y e
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
i f x = p
t h e n
1 ` ( x , i +
1 )
e l s e e m p
t y
O c c u r r e n c e o f
S
E
3 3 ` e
S
E
3 3 ` e
B i n d i n g :
< x = p , i
= 0 >
S
E
1 1 ` e
N e w
M a r
k i n g
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
2
2 ` e
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
112
C o l o u r e d P e t r i N e t s 6
p l e x e x a m p l e
B
P
3
1 ` ( p
, 2 ) + 1 ` ( p
, 4 ) + 1 ` ( q
, 3 )
T 2 C
P
B
P
3
1 ` ( p
, 2 ) + 1 ` ( p
, 4 ) + 1 ` ( q
, 3 )
T 2 C
P
B
P
3
1 ` ( p
, 2 ) + 1 ` ( p
, 4 ) + 1 ` ( q
, 3 )
T 2 C
P ( x , i )
( x , i )
1 1 ` ( p
, 2 )
( x , i )
1 1 ` ( p
, 2 )
( x , i )
1 1 ` ( q
, 3 )
( x , i )
1 1 ` ( q
, 3 )
( x , i )
-
8/3/2019 Petri Nets 2000
117/270
C o l o u r e d P e t r i N e t s
5
B i n d i n g w h i c h i s n o t e n a b l e d
S
E
3 3 ` e
B
P
2 2 ` ( p
, 0 )
T 2 C
P
S
E
3 3 ` e
B
P
2 2 ` ( p
, 0 )
T 2 C
P
B i n d i n g :
< x = q , i
= 2 >
( x , i )
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
( x , i )
1 1 ` ( q
, 2 )
( x , i )
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
1
1 ` e
1 1 ` ( q
, 2 )
( x , i )
B i n d i n g c a n n o
t o c c u r
A m o r e c o m p
S
E
3 3 ` e
S
E
3 3 ` e
B i n d i n g :
< x = p ,
i = 2 >
S
E
3 3 ` e
B i n d i n g :
< x = q ,
i = 3 >
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
2
2 ` e
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
1
1 ` e
113
C o l o u r e d P e t r i N e t s 8
B
P
3
1 ` ( p
, 2 ) + 1 ` ( p
, 4 ) + 1 ` ( q
, 3 )
T 2 C
P
B
P
3
1 ` ( p
, 2 ) + 1 ` ( p
, 4 ) + 1 ` ( q
, 3 )
T 2 C
P
1 1 ` ( p
, 2 )
( x , i )
1 1 ` ( p
, 2 )
( x , i )
1 1 ` ( p
, 4 )
( x , i )
1 1 ` ( p
, 4 )
( x , i )
g s c a n n o t o c c u r c o n c u r r e n t l y .
tt h e y n e e d
t h e s a m e t o k e n s .
-
8/3/2019 Petri Nets 2000
118/270
C o l o u r e d P e t r i N e t s
7
C o n c u r r e n c y
S
E
3 3 ` e
B P
3 1 ` ( p
, 2 ) + 1 ` ( p
, 4 ) + 1 ` ( q
, 3 )
T 2 C P
B i n d i n g :
< x = p , i
= 2 >
S
E
B P
1 1 ` ( p
, 4 )
T 2 C P
2 1 ` ( p
, 2 ) + 1 ` ( q
, 3 )
B i n d i n g :
< x = q , i
= 3 >
2 1 ` ( p
, 2 ) + 1 ` ( q
, 3 )
( x , i )
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
3
3 ` e
2 1 ` ( p
, 2 ) + 1 ` ( q
, 3 )
( x , i )
( x , i )
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
( x , i )
T h e t w o
b i n d
i n g s m a y o c c u r c o n c u r r e n t l y .
T h i s i s p o s s i
b l e
b e c a u s e
t h e y u s e d i f f e r e n t
t o k e n s .
C o n f l i c t
S
E
3 3 ` e
B i n d i n g :
< x = p ,
i = 2 >
S
E
3 3 ` e
B i n d i n g :
< x = p ,
i = 4 >
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
2
2 ` e
c a s e x o f
p = >
2 ` e
| q = >
1 ` e
2
2 ` e
T h e s e
t w o
b i n d
i n g
T h e r e a s o n
i s t h a t
t
114
C o l o u r e d P e t r i N e t s
1 0
tr i N e t s
o p e r a t i o n s a n
d v a r i a b l e s .
f o l l o w
i n g i n s c r i p
t i o n s :
fic a t
i o n ) .
ify i n g
t h e t y p e o f
t o k e n s w
h i c h
p l a c e ) .
u l t i - s e
t o f t o k e n c o
l o u r s ) .
t h e
f o l l o w i n g
i n s c r i p
t i o n s :
fic a t
i o n ) .
x p r e s s
i o n c o n t a i n i n g s o m e o f
l l o w
i n g i n s c r i p
t i o n s :
o n t a i n i n g s o m e o f
t h e v a r i a
b l e s ) .
r e s s
i o n i s e v a l u a
t e d i t y i e l
d s a
c o l o u r s .
-
8/3/2019 Petri Nets 2000
119/270
C o l o u r e d P e t r i N
e t s
9
R e s o u r c e a l l o c a t i o n s y s t e m
T w o
k i n d s o
f p r o c e s s e s :
T h r e e c y c l
i c q - p r o c e s s e s ( s t a t e s
A , B , C , D
a n d E )
.
T w o c y c l
i c p - p r o c e s s e s
( s t a t e s B , C , D
a n d E ) .
T h r e e
k i n d s o
f r e s o u r c e s :
R e p r e s e n t e d
b y t h e p l a c e s
R , S
a n d T .
D u r i n g a c y c l e a p r o c e s s r e s e r v e s s o m e r e s o u r c e s
a n d r e l e a s e s
t h e m a g a i n :
T o k e n s a r e r e m o v e d
f r o m a n
d a d d e d t o t h e
r e s o u r c e p l a c e s
R , S
a n d T .
A c y c l e c o u n t e r
i s i n c r e a s e d e a c h
t i m e a p r o c e s s
c o m p l e t e s a
f u l l c y c l e .
I t i s r a
t h e r s t r a
i g h t f o r w a r
d t o p r o v e
t h a t
t h e
r e s o u r c e a l
l o c a
t i o n s y s t e m
c a n n o t d e a d l o c k .
W h a t h a p p e n s
i f w e a d d
a n a d
d i t i o n a
l t o k e n t o
p l a c e
S
i . e . ,
i f w e s t a r
t w i t h f o u r
S - r e s o u r c e s
i n s t e a
d o f
t h r e e ?
C o l o u r e d P e t r
D e c l a r a t i o n s :
T y p e s , f u n c t i o n s , op
E a c h p l a c e
h a s t
h e f
N a m e
( f o r
i d e n
t i f i c
C o l o u r s e t
( s p e c i
f y
m a y r e s
i d e o n
t h ep
I n i t i a l m a r k i n g
( m
E a c h t r a n s i t i o n
h a s t
N a m e
( f o r
i d e n
t i f i c
G u a r d ( b o o
l e a n e x
t h e v a r i a
b l e s
) .
E a c h a r c
h a s t
h e f o l
A r c e x p r e s s i o n
( c o
W h e n t h e a r c e x p r
m u l t i - s e t o f
t o k e n
115
C o l o u r e d P e t r i N e t s
1 2
t e r i s t i c s o f C P - n e t s
t a n d g r a p h i c s .
e t i n s c r i p t i o n s a r e s p e c
i f i e d
b y
la n g u a g e , e . g . , a p r o g r a m m i n g
o p e r a t
i o n s , v a r i a
b l e s a n
d
is t s o f p l a c e s , t
r a n s
i t i o n s a n d
p a r t i
t e g r a p h
) .
t r e a d a b l e i t i s i m p o r t a n t
t o
h i c a
l l a y o u
t .
o u t h a s n o f o r m a l m e a n i n g .
am e
k i n d o
f c o n c u r r e n c y
/ T r a n s
i t i o n
N e t s .
-
8/3/2019 Petri Nets 2000
120/270
C o l o u r e d P e t r i N e t s
1 1
E n a b l i n g a n d o c c u r r e n c e
A b i n d i n g a s s i g n s a c o l o u r
( i . e . , a
v a l u e )
t o e a c
h
v a r i a b l e o f a
t r a n s
i t i o n .
A b i n d i n g e l e m e n t i s a p a
i r ( t , b ) w
h e r e
t i s a
t r a n s i t i o n w
h i l e b i s a b i n d i n g
f o r t
h e v a r i a
b l e s
o f t . E
x a m p l e :
( T 2 , < x = p ,
i = 2 > ) .
A b i n d i n g e l e m e n
t i s e n a b l e d
i f a n
d o n
l y i f :
T h e r e a r e e n o u g h t o k e n s
( o f t h e c o r r e c
t c o l o u r s o n
e a c
h i n p u
t - p l a c e
) .
T h e g u a r d e v a l u a
t e s t o
t r u e .
W h e n a
b i n d
i n g e l e m e n t
i s e n a b
l e d i t m a y o c c u r :
A m u l
t i - s e
t o f t o k e n s i s r e m o v e d
f r o m e a c h
i n p u
t - p l a c e .
A m u l
t i - s e
t o f t o k e n s i s a d d e d t o e a c h
o u t p u
t - p l a c e .
A b i n d i n g e l e m e n
t m a y o c c u r c o n c u r r e n t l y t o o t h e r
b i n d i n g e l e m e n
t s
i f f t h e r e a r e s o m a n y
t o k e n s
t h a t e a c
h b i n d
i n g e l e m e n
t c a n g e
t i t s " o w n s h a r e " .
M a i n c h a r a c t
C o m
b i n a t
i o n o f t e x t
D e c l a r a t i o n s a n
d n e
m e a n s o f a
f o r m a l
l a
l a n g u a g e .
T y p e s ,
f u n c
t i o n s ,
e x p r e s s
i o n s .
N e t s t r u c t u r e c o n s
i s
a r c s
( f o r m
i n g a
b i - p
T o m a k e a
C P - n e
t
m a k e a n i c e g r a p
h
T h e g r a p h
i c a l
l a y o
C P - n e t s h a v e
t h e s a m
p r o p e r t i e s a s
P l a c e /
116
C o l o u r e d P e t r i N e t s
1 4
n i t i o n o f b e h a v i o u r
m u l t i - s e t o f b i n d i n g e l e m e n t s
.
a m a r
k i n g
M i f f t h e
f o l l o w
i n g p r o p e r
t y i s
b > M ( p ) .
d i n a m a r
k i n g
M 1
i t m a y o c c u r , c h a n g i n g
e r m a r
k i n g
M 2 ,
d e f i n e d
b y :
( p )
( t , b )
Y E (
p , t ) < b > ) +
( t , b )
Y E
( t , p )
< b > .
t h e r e m o v e d
t o k e n s w
h i l e t h e s e c o n d
i s
s . M o r e o v e r w e s a y
t h a t
M 2
i s d i r e c
t l y
h e o c c u r r e n c e o f
t h e s t e p
Y , w
h i c h w e a l s o
e i s a s e q u e n c e o f m a r
k i n g s a n d s t e p s :
M
n [ Y
n M
n + 1
f o r a l
l i 1 . . n
. W e
t h e n s a y
t h a t
M n + 1 i s
e u s e [ M t o d e n o t e t h e s e t o f m a r k i n g s
M .
-
8/3/2019 Petri Nets 2000
121/270
C o l o u r e d P e t r i N e t s
1 3
F o r m a l d e f i n i t i o n
o f C P - n e t s
D e f i n i
t i o n : A C o l o u r e d P e t r i N e t i s a t u p l e C P N = (
, P , T ,
A , N ,
C , G
, E , I
) s a
t i s f y i n g
t h e
f o l l o w i n g r e q u
i r e m e n
t s :
( i )
i s a
f i n i t e s e
t o f n o n - e m p
t y t y p e s , c a
l l e d c o
l o u r s e
t s .
( i i )
P i s a
f i n i t e s e
t o f p l a c e s .
( i i i )
T i s a
f i n i t e s e
t o f t r a n s i t i o n s .
( i v )
A i s a f i n i t e s e t o f a r c s s u c h t h a t :
P T =
P A =
T A =
.
( v )
N i s a n o
d e f u n c
t i o n .
I t i s d e f i n e d
f r o m
A i n t o P T
T
P .
( v i )
C i s a c o
l o u r
f u n c
t i o n .
I t i s d e f i n e d
f r o m
P i n t o
.
( v i i ) G i s a g u a r
d f u n c t i o n . I t i s d e f i n e d f r o m T i n t o e x p r e s s i o n s
s u c h
t h a t :
t T : [ T y p e (
G ( t ) ) = B o o
l
T y p e
( V a r
( G ( t ) ) )
] .
( v i i i ) E i s a n a r c e x p r e s s i o n
f u n c
t i o n .
I t i s d e f i n e d
f r o m
A
i n t o
e x p r e s s i o n s s u c
h t h a t :
a
A : [
T y p e
( E ( a ) ) = C
( p ( a ) )
M S
T y p e
( V a r
( E ( a ) ) )
]
w h e r e p ( a )
i s t h e p l a c e o f N
( a ) .
( i x )
I i s a n
i n i t i a l i z a
t i o n
f u n c t
i o n .
I t i s d e f i n e
d f r o m
P
i n t o
c l o s e d e x p r e s s i o n s s u c
h t h a t :
p
P : [ T y p e (
I ( p )
) = C ( p ) M
S ] .
F o r m a l d e f i n
D e f
i n i t i o n : A s t e p i s a m
A s t e p
Y i s e n a b
l e d i n a
s a t i s f i e d : p
P :
( t , b )
Y E
( p , t )
< b
W h e n a s t e p
Y i s e n a b
l e d
t h e m a r k
i n g
M 1
t o a n o t
h e
p
P : M
2 ( p ) =
( M 1 (
T h e
f i r s t
s u m
i s c a
l l e d t
c a l l e d t h e a d
d e d
t o k e n s
r e a c
h a b l e f r o m
M 1
b y t h
d e n o
t e : M
1 [ Y M
2 .
A n o c c u r r e n c e s e q u e n c e
M 1 [
Y 1
M 2
[ Y 2
M 3
s u c h
t h a t M i [
Y i M i + 1
f
r e a c
h a b l e f r o m M
1 . W e
w h i c h a r e r e a c
h a b l e
f r o m
117
C o l o u r e d P e t r i N e t s
1 6
o n t r a l o w - l e v e l n e t s
e t w e e n
C P - n e t s a n d
e t s (
P T - n e
t s ) i s a n a l o g o u s
t o
t w e e n
h i g h - l e v e
l p r o g r a m m
i n g
e m b l y c o d e .
o l e v e
l s h a v e e x a c
t l y t h e s a m e
o w e r .
l e v e
l l a n g u a g e s h a v e m u c
h
p o w e r b e c a u s e
t h e y
h a v e
g f a c i
l i t i e s , e . g . , t
y p e s a n
d
n e q u i v a l e n t P T - n e
t a n
d v i c e
i s u s e d
t o d e r i v e
t h e
d e f i n i t i o n
ie s a n
d t o e s t a b
l i s h t h e
ho d s
.e v
e r t r a n s l a t e a
C P - n e
t i n t o a
v e r s a .
u l a t
i o n a n d v e r i f
i c a t
i o n a r e
d o n e
o f C P - n e t s .
-
8/3/2019 Petri Nets 2000
122/270
C o l o u r e d P e t r i N e t s
1 5
F o r m a l d e f i n i t i o n
T h e e x
i s t e n c e o f a f o r m a l d e f i n i t i o n
i s v e r y
i m p o r
t a n t :
I t i s t h e
b a s i s f o r s i m u l a t i o n ,
i . e . ,
e x e c u t
i o n o
f t h e
C P - n e
t .
I t i s a l s o
t h e
b a s i s f o r t h e f o r m a l v e r i f i c a t i o n
m e t
h o d s ( e
. g . ,
s t a t e s p a c e s a n d p l a c e
i n v a r i a n
t s ) .
W i t h o u
t t h e f o r m a l
d e f i n i t i o n , i
t w o u
l d h a v e
b e e n
i m p o s s
i b l e t o o b t a
i n a s o u n d n e
t c l a s s .
I t i s n o t n e c e s s a r y
f o r a u s e r
t o k n o w
t h e
f o r m a
l
d e f i n i t i o n o f
C P - n e
t s :
T h e c o r r e c
t s y n t a x
i s c h e c
k e d b y t h e
C P N e d i
t o r ,
i . e . , t
h e c o m p u
t e r t o o l b y w
h i c h
C P - n e
t s a r e
c o n s t r u c t e d .
T h e c o r r e c
t u s e o f
t h e s e m a n t i c s
( i . e . , t
h e
e n a
b l i n g r u
l e a n
d t h e o c c u r r e n c e r u
l e ) i s
g u a r a n t e e
d b y t h e
C P N s i m u l a t o r a n
d t h e
C P N t o o l s f o r
f o r m a l v e r
i f i c a
t i o n .
H i g h - l e v e l c o
T h e r e l a t
i o n s
h i p
b e
P l a c e / T r a n s
i t i o n
N e
t h e r e l a
t i o n s
h i p
b e t
l a n g u a g e s a n
d a s s e
I n t h e o r y ,
t h e
t w o
c o m p u t a t i o n a l p o
I n p r a c t
i c e ,
h i g h -
m o r e m o d e l l i n g p
b e t t e r s t r u c t u r
i n g
m o d u
l e s .
E a c h C
P - n e
t h a s a n
v e r s a .
T h i s e q u i v a
l e n c e
o f b a s i c p r o p e r t i e
v e r i f i c a t i o n m e t h o
I n p r a c t
i c e , w e n e
P T - n e t o r v i c e v
D e s c r i p
t i o n , s i m u
d i r e c t l y i n t e r m s o
118
C o l o u r e d P e t r i N e t s 1 8
to c o l
T r a n s m
i t
P a c
k e t
R e c e i v e
P a c
k e t
T r a n s m
i t
A c k n o w .
R e c e i v e
d
D A T A
" "
N e x
t R e c
I N T
1
B
I N T x D A T A
C I N T
R P
8
I n t_ 0_ 1 0
R A
I n t_ 0_ 1 0 8
N e
t w o r k
R e c e
i v e r
T =
i n t ;
O O L =
b o o l ;
A T A = s t r i n g ;
T x D A T A = p r o d u c t
I N T * D A T A ;
: I N T ;
tr : D
A T A ;
= " # # # # # # # # " ;
t 0_ 1 0 =
i n t w i t h 0 .
. 1 0 ;
t 1_ 1 0 =
i n t w i t h 1 .
. 1 0 ;
In t_ 0_ 1 0 ;
In t_ 1_ 1 0 ;
(s : I n t
_ 0_ 1
0 , r :
I n t_ 1_ 1
0 ) =
( r s ) ;
p )
i f O k ( s , r )
t h e n
1 ` ( n
, p )
e l s e e m p t y
( n , p
)
i f n =
k
a n d a l s o
p < > s
t o p
t h e n s t r ^ p
e l s e s t r
i f n =
k
t h e n
k + 1
e l s e
k
n
k i f n =
k
t h e n
k + 1
e l s e
k
( s , r
)1 `
ne m
p t y
s t r
s s
-
8/3/2019 Petri Nets 2000
123/270
C o l o u r e d P e t r i N e t s
1 7
O t h e r k i n d s o f h i g h - l e v e l n e t s
C P - n e t s h a v e
b e e n
d e v e l o p e
d f r o m
P r e d i c a
t e / T r a n s
i t i o n
N e t s .
H a r t m a n n G e n r i c h & K u r t L a u t e n b a c h .
W i t h r e s p e c
t t o d e s c r i p t i o n a n
d s i m u l a t i o n t h e
t w
o m o d e l s a r e n e a r
l y i d e n t
i c a l .
W i t h r e s p e c
t t o f o r m a l v e r i f i c a t i o n
t h e r e a r e
s o m e
d i f f e r e n c e s .
S e v e r a l o t
h e r k
i n d s o f
h i g h - l e v e
l P e t r i
N e t s e x i s t .
T h e y a l
l b u i
l d u p o n
t h e s a m e b a s i c i d e a s ,
b u t u s e
d i f f e r e n t l a n g u a g e s
f o r d e c l a r a t
i o n s a n
d
i n s c r i p
t i o n s .
A
d e t a i l e d c o m p a r i s o n
i s o u
t s i d e
t h e s c o p e o f
t h i s t a l k
.
S i m p l e p r o t o
S e n
d
P a c
k e t
R e c e i v e
A c k n o w .
S e n
d
I N T x D A T A
1 ` ( 1
, " M o d e l
l i n " ) +
1 ` ( 2
, " g a n
d A n "
) +
1 ` ( 3
, " a l y s
i s b " ) +
1 ` ( 4
, " y
M e a n s
" ) +
1 ` ( 5
, " o f
C o l o u
" ) +
1 ` ( 6
, " r e
d P e t r "
) +
1 ` ( 7
, " i N e t s #
# " ) +
1 ` ( 8
, " # # # # # # # # " )
N e x
t S e n
d
I N T 1
D I N T A
I N T x D A T A
S e n
d e r
t y p e
I N T
t y p e
B O
t y p e
D A
t y p e
I N T
v a r n , k
v a r p , s
t r
v a l s t o p
t y p e
I n t_
t y p e
I n t_
v a r s : I n
v a r r : I n
f u n
O k ( s
( n , p
)
( n , p)
( n , p
)
i f O k (
t h e n
1
e l s e e
n
k
n n
119
C o l o u r e d P e t r i N e t s 2 0
c k e t
r a n s m
i t
P a c
k e t
R P
1 1 ` 8
B
I N T x D A T A
i f O k ( s
, r )
t h e n
1 ` ( n , p )
e l s e e m p t y
s
e n a b l e d b i n d i n g s :
th e
f o r m
"M o d e l
l i n " , s =
8 , r =
> .
a n t a k e 1 0 d i f f e r e n t v a l u e s ,
e o f r i s d e f
i n e d
t o c o n t a i n
t h e
s, r ) c h e c k s w
h e t h e r r s .
s, r ) = t r u e .
T h i s m e a n s
t h a t
t h e
f r o m
A t o B
, i . e . ,
t h a t
t h e p a c k e t
i s
n s m i t t e d o v e r
t h e n e
t w o r
k .
k( s , r ) = f a l s e . T
h i s m e a n s
t h a t n o
o B
, i . e . , t h
a t t h e p a c k e t
i s l o s t .
la t o r m a k e r a n d o m c h o i c e s
d b i n d
i n g s .
H e n c e
t h e r e
i s 8 0 %
e s s f u l t r a n s f e r .
-
8/3/2019 Petri Nets 2000
124/270
C o l o u r e d P e t r i N e t s
1 9
S e n d p a c k e t
S e n
d
I N T x D A T A
8 1 ` ( 1
, " M o d e l
l i n " )
+ 1 ` ( 2
, " g a n
d A n "
)
+ 1 ` ( 3
, " a l y s
i s b " )
+ 1 ` ( 4
, " y
M e a n s
" )
+ 1 ` ( 5
, " o f
C o l o u "
)
+ 1 ` ( 6
, " r e
d P e t r " )
+ 1 ` ( 7
, " i N e t s #
# " )
+ 1 ` ( 8
, " # # # # # # # # " )
S e n
d
P a c
k e t
A I N T x D A T A
N e x
t S e n
d
I N T
1
1 1 ` 1 ( n
, p )
( n , p
) n
O n l y t h e
b i n d
i n g
< n = 1 , p
= " M o d e l
l i n " > i s e n a b l e d .
W
h e n
t h e
b i n d
i n g o c c u r s
i t a d
d s a
t o k e n
t o
p l a c e
A . T
h e t o k e n r e p r e s e n t s t
h a t t h e p a c k e t
( 1 , " M o d e l
l i n " ) i s s e n t t o
t h e n e
t w o r
k .
T h e p a c k e t
i s n o t r e m o v e
d f r o m p l a c e S e n d a n d
t h e N e x t S e n d c o u n
t e r i s n o t c h a n g e d .
T r a n s m i t p a c
A
I N T x D A T A
1 1 ` ( 1
, " M o d e l
l i n " )
T r P 8
I n t_ 0_ 1 0
( n , p
)
T h e r e a r e n o w 1 0 e
T h e y a r e a l
l o f t h
< n = 1 , p
= " M
T h e v a r
i a b l e r c a
b e c a u s e
t h e
t y p e
i n t e g e r s 1 . . 1
0 .
T h e f u n c t i o n
O k ( s ,
F o r r
1 . . 8 , O
k ( s ,
t o k e n i s m o v e d
f
s u c c e s s f u l l y t r a n
F o r r
9 . . 1
0 , O k (
t o k e n i s a d
d e d t o
T h e C
P N s i m u l a
b e t w e e n e n a b
l e d
c h a n c e
f o r s u c c e
120
C o l o u r e d P e t r i N e t s 2 2
k e t n u m b e r
) R e c e i v e
P a c
k e t
R e c e i v e
d
1 1 ` " M o d e l
l i n g a n
d A n "
p )
i f n =
k
a n d a l s o
p < > s t o p
t h e n s
t r ^ p
e l s e s
t r
1 1 ` " M o d e l
l i n g a n
d A n a
l y s i s
b "
i f n =
k
t h e n
k + 1
e l s e
k
1 1 ` 4
s t r 1
n d A n "
p a c k e t
i s c o n c a t e n a t e d
t o t h e
d a t a
d . u n t e r
i s i n c r e a s e d
b y o n e .
e m e n t m e s s a g e
i s s e n t . I
t c o n
t a i n s
h e n e x t p a c
k e t w h i c h
t h e r e c e
i v e r
-
8/3/2019 Petri Nets 2000
125/270
C o l o u r e d P e t r i N e t s
2 1
R e c e i v e p a c k e t
B
I N T x D A T A
1
1 ` ( 1
, " M o
d e
l l i n
" ) R e c e
i v e
P a c
k e t
N e x t
R e c
I N T
1
1
1 ` 1
R e c e
i v e
d
D A T A
" "
1
1 ` " "
C I N T
( n , p
)
i f n =
k
a n
d a
l s o
p < > s t o p
t h e n s t r ^ p
e l s e s
t r
i f n =
k
t h e n
k + 1
e l s e
k
k i f n =
k
t h e n
k + 1
e l s e
k
s t r
I t i s c
h e c k e d w
h e t h e r
t h e n u m
b e r o
f t h e i n c o m i n g
p a c k e t n m a t c h e s
t h e n u m
b e r o
f t h e e x p e c t e d
p a c k e t k
.
C o r r e c t p a c k
B
1 1 ` ( 3
, " a l y s
i s b " )
N e x
t R e c
1
1 ` 3
C
( n , p)
1
1 ` ( 3
, " a l y s
i s b " )
k
1 1 ` 3
i f n =
k
t h e n
k + 1
e l s e
k 1
1 ` 4
1 ` " M o d e l
l i n g a n
T h e d a t a
i n t h e p
a l r e a
d y r e c e
i v e d
T h e N e x t R e c c o u
A n a c k n o w l e d g e
t h e n u m
b e r o
f t h
w a n t s t o g e
t .
121
C o l o u r e d P e t r i N e t s 2 4
c k n o w l e d g e m e n t
C I N T
1
1 ` 2
r a n s m
i t
c k n o w .
R A
1
1 ` 8
n
s
o r k s i n a s i m
i l a r w a y a s
la c e R A d e t e r m
i n e s
t h e s u c c e s s
is s i o n o f a c k n o w
l e d g e m e n
t s .
i n s a
t o k e n w
i t h v a
l u e
8 , t h e
8 0 % .
i n s a
t o k e n w
i t h v a
l u e
1 0 , n o
e n t s a r e
l o s t .
i n s a
t o k e n w
i t h v a
l u e
0 , a l l
e n t s a r e
l o s t .
-
8/3/2019 Petri Nets 2000
126/270
C o l o u r e d P e t r i N e t s
2 3
W r o n g p a c k e t n u m b e r
B
1
1 ` ( 2
, " g a n
d A n
" ) R e c e
i v e
P a c k e
t
N e x t
R e c
1
1
1 ` 3
R e c e
i v e
d
1
1 ` " M o
d e
l l i n g a n
d A n
"
C
( n , p
)
1
1 ` ( 2
, " g a n
d A n
" )
i f n =
k
a n
d a
l s o
p < > s
t o p
t h e n s t r ^ p
e l s e s t r
1 1 ` " M o
d e
l l i n g a n
d A n
"
i f n =
k
t h e n
k +
1
e l s e
k
1 1 ` 3
k
1
1 ` 3
i f n =
k
t h e n
k + 1
e l s e
k
1
1 ` 3
s t r 1
1 ` " M o
d e
l l i n g a n
d A n
"
T h e d a t a i n t h e p a c k e t
i s i g n o r e d .
T h e N e x t R e c c o u n
t e r i s u n c h a n g e
d .
A n a c k n o w l e d g e m e n t m e s s a g e
i s s e n t . I
t c o n
t a i n s
t h e n u m
b e r o
f t h e n e x t p a c k e t w
h i c h
t h e r e c e
i v e r
w a n
t s t o g e
t .
T r a n s m i t a c T
r A c
D I N T
I n t_ 0_ 1 0
8
i f O k ( s , r )
t h e n
1 ` n
e l s e e m p
t y
T h i s t r a n s i
t i o n w o
T r a n s m i t P a c k e t .
T h e t o k e n o n p l a
r a t e f o r
t r a n s m
i s
W h e n R A c o n t a i
s u c c e s s r a
t e i s 80
W h e n R A c o n t a i
a c k n o w
l e d g e m e
W h e n R A c o n t a i
a c k n o w
l e d g e m e
122
C o l o u r e d P e t r i N e t s 2
6
te s t a t e T r a n
s m i t
P a c
k e t
R e c e i v e
P a c
k e t
T r a n s m
i t
A c k n o w .
) n " )
" ) s " ) " ) r"
)# "
)# #
" )
R e c e i v e
d
D A T A
" "
1
1 ` " M o d e l
l i n g a n
d
A n a
l y s i s
b y M e a n s
o f C o l o u
" N e x
t R e c
I N T
1
1 1 ` 6
B
I N T x D A T A
1 1 ` ( 5
, " o f C o l o u
" )
C I N T
1 1 ` 6
N e
t w o r
k
R e c e
i v e r
R P
8
I n t_ 0_ 1 0
1 1 ` 8
R A
I n t_ 0_ 1 0
8
1 1 ` 8
(n , p
)
i f O k ( s , r )
t h e n
1 ` ( n
, p )
e l s e e m p t y
( n , p
)
i f n =
k
a n d a l s o
p < > s
t o p
t h e n s t r ^ p
e l s e s t r
i f n =
k
t h e n
k + 1
e l s e
k
n
k i f n =
k
t h e n
k + 1
e l s e
k
O k ( s , r )
he n
1 ` n
ls e e m p t y
s t r
s s
s e x p e c
t i n g p a c
k a g e n o . 6 . T
h i s
a s s u c c e s s f u
l l y r e c e
i v e d
t h e
f i r s t 5
st i l l s e n d
i n g p a c k e t n o . 5 . I
n a
lr e c e i v e a n a c k n o w
l e d g e m e n
t
q u e s
t f o r p a c k e t n o . 6 .
o w l e d g e m e n
t i s r e c e i v e
d t h e
t e r i s u p d a t e
d a n
d t h e S e n d e r w i l l
a c k e t n o .
6 .
-
8/3/2019 Petri Nets 2000
127/270
C o l o u r e d P e t r i N e t s
2 5
R e c e i v e a c k n o w l e d g e m e n t
R e c e i v e
A c k n o w .
N e x
t S e n
d
I N T 1
1 1 ` 1
D I N T 1 1 ` 2
n
k
n
W h e n a n a c
k n o w
l e d g e m e n
t a r r i v e s
t o t h e S e n d e r
i t
i s u s e
d t o u p
d a t e t h e N e x t S e n d c o u n
t e r .
I n
t h i s c a s e
t h e c o u n
t e r v a
l u e
b e c o m e s
2 , a n d
h e n c e
t h e S e n d e r w
i l l b e g
i n t o s e n d p a c k e t
n u m
b e r 2 .
I n t e r m e d i a t e
S e n
d
P a c
k e t
R e c e i v e
A c k n o w .
S e n
d
I N T x D A T A
8 1 ` ( 1
, " M o d e l
l i n " )
+ 1 ` ( 2
, " g a n
d A n
+ 1 ` ( 3
, " a l y s
i s b
)
+ 1 ` ( 4
, " y
M e a n s
+ 1 ` ( 5
, " o f
C o l o u
+ 1 ` ( 6
, " r e
d P e t r
+ 1 ` ( 7
, " i N e t s #
#
+ 1 ` ( 8
, " # # # # # # #
N e x
t S e n
d
I N T 1
1 1 ` 5
D I N T
1 1 ` 6
A
I N T x D A T A
S e n
d e r
( n , p
)
( n
( n , p
)
i f O
t h e
e l s
n
k
n
n
T h e R e c e i v e r
i s
m e a n s t
h a t i t h a
p a c k e t s .
T h e S e n d e r
i s s t
m o m e n
t i t w i l l r
c o n t a
i n i n g a r e q
W h e n
t h e a c
k n o
N e x t S e n d c o u n
t
s t a r t s e n d
i n g p a
123
-
8/3/2019 Petri Nets 2000
128/270
C o l o u r e d P e t r i N e t s 3
0
b e u s e d m
o r e t h a n o n c e
R e c e
i v e
d
D A T A
" "
B 1
I N T x D A T A
C 1
I N T
e t w o r k
t w o r k
R e c N o
1
H S
R e c e
i v e r
B 1 - >
B
C 1 - >
C
B 2
I N T x D A T A
C 2
I N T
R e c N o
2
H S R
e c e
i v e r
B 2 - >
B
C 2 - >
C
R e c e
i v e
d
D A T A
" "
R e c e
i v e r s
T r a n s m
i t
P a c k e
t
R P
8
I n t_ 0_ 1 0
R A 1
I n t_ 0_ 1 0
8 T r a n s m
i t
A c k n o w .
T
C 1
I N T B
2
I N T x D A T A
A T A
B 1
I N T x D A T A
R A 2
I n t_ 0_ 1 0 8
T r a n s m
i t
A c k n o w .
C 2
I N T
N e x t
R e c
I N T
1
R e c e
i v e
P a c k e
t
C I N T
R e c e
i v e
d
D A T A
" "
B
I N T x D A T A
R e c e i v e r
tw o r k
O u
t
O u
t
O u
t I n
t
I n
I n
I / O
s s
( n , p
)
i f O k ( s
, r 2 )
t h e n
1 ` ( n , p
)
e l s e e m p
t y n
i f O k ( s , r )
t h e n
1 ` ( n , 1
)
e l s e e m p
t y
i f O k ( s
, r 1 )
t h e n
1 ` ( n , p
)
e l s e e m p
t y
s
n
i f O k ( s
, r )
t h e n
1 ` ( n , 2
)
e l s e e m p
t y
k i f n =
k
t h e n
k + 1
e l s e
k
( n , p
)
i f n =
k
a n
d a
l s o
p < > s t o p
t h e n s
t r ^ p
e l s e s
t r
i f n =
k
t h e n
k + 1
e l s e
k
s t r
if f e r e n
t i n s t a n c e s o f
t h e R e c e i v e r
n c e
h a s i
t s o w n m a r k i n g .
-
8/3/2019 Petri Nets 2000
129/270
C o l o u r e d P e t r i N e t s
2 9
S u b s t i t u t i o n t r a n s i t i o n s
A p a g e m a y c o n t a i n o n e o r e m o r e s u b s t i t u t i o n
t r a n s i t i o n s .
E a c
h s u
b s t i t u t
i o n
t r a n s
i t i o n
i s r e
l a t e d t o a p a g e ,
i . e . ,
a s u b n e t p r o v i
d i n g a m o r e d e t a i l e d
d e s c r i p t i o n
t h a n
t h e t r a n s
i t i o n
i t s e l
f .
T h e p a g e
i s a s u b p a g e o f
t h e s u
b s t i t u t
i o n
t r a n s
i t i o n .
T h e r e
i s a w e l l - d e f i n e d i n t e r f a c e
b e t w e e n a
s u b s t
i t u t i o n
t r a n s
i t i o n a n
d i t s s u
b p a g e :
T h e p l a c e s s u r r o u n d
i n g
t h e s u
b s t i t u t
i o n
t r a n s
i t i o n
a r e s o c k e t p l a c e s .
T h e s u
b p a g e c o n t a i n s a n u m
b e r o
f p o r t p l a c e s .
S o c
k e t p l a c e s a r e r e l a t e d
t o p o r t p l a c e s
i n a
s i m i l a r w a y a s a c
t u a l p a r a m e t e r s a r e r e
l a t e d t o
f o r m a l p a r a m e t e r s i n a p r o c e d u r e c a
l l .
A
s o c k e t p l a c e
h a s a
l w a y s t
h e s a m e m a r k i n g a s
t h e r e
l a t e d p o r t p l a c e . T
h e t w o p l a c e s a r e
j u s t
d i f f e r e n t v i e w s o f
t h e s a m e p l a c e .
S u b s t i t u t i o n t r a n s i t i o n s w o r
k i n a s i m
i l a r w a y a s
t h e r e
f i n e m e n
t p r i m
i t i v e s
f o u n
d i n m a n y s y s t e m
d e s c r i p
t i o n
l a n g u a g e s e . g . ,
S A D T d i a g r a m s .
P a g e s c a n b
D
I N T x I N T
A
I N T x D A T A
S e n
d e r
H S
S e n
d e r
N H S
N e
S i m p
l e P r o
t o c o
l w
i t h 2 R
S e n
d
P a c k e
t
N e x t
S e n d
I N T
1
R e c e
i v e
A c k n o w .
S e n
d
I N T x D A T A
D I N T x I N T
A
I N T x D A T A
D
I N T x I N T
A
I N T x D A
S e n
d e r
N e
t w
O u
t I n
I n O u
( n , p
) k
m i n ( n
1 , n
2 )
n
( n , p
)
1 ` ( n
1 , 1
) +
1 ` ( n
2 , 2
)
T h e r e a r e t w o
d i f
p a g e . E a c
h i n s t a n
125
C o l o u r e d P e t r i N e t s 3
2
f i n i t i o n o f h i e r a r c h i c a l
s e m a n t i c s o f
h i e r a r c h
i c a l
C P - n e
t s
fin i t i o n s s i m
i l a r t o
t h e
d e f i n i t i o n s
hi c a
l C P - n e t s
a l C P - n e
t h a s a n e q u i v a l e n t
l C P - n e
t a n
d v i c e v e r s a .
o f n e
t s h a v e
t h e s a m e
l p o w e r
b u t h i e r a r c h
i c a l
C P - n e
t s
o r e m o d e l l i n g p o w e r .
c e i s u s e d
f o r t h e o r e t i c a l p u r p o s e s .
e n e v e r
t r a n s
l a t e a
h i e r a r c h
i c a l
n o n -
h i e r a r c h
i c a l
C P - n e
t o r v i c e
-
8/3/2019 Petri Nets 2000
130/270
C o l o u r e d P e t r i N e t s
3 1
R i n g n e t w o r k
4 t o 1
P A C K
1 t o 2
P A C K
S i t e 1
H S
S i t e
4 t o 1 - >
I n c o m
i n g
1 t o 2 - >
O u t g o
i n g
2 t o 3
P A C K
S i t e 2
H S
S i t e
1 t o 2 - >
I n c o m
i n g
2 t o 3 - >
O u t g o
i n g
3 t o 4
P A C K
S i t e 3
H S
S i t e
2 t o 3 - >
I n c o m
i n g
3 t o 4 - >
O u t g o
i n g
S i t e 4
H S
S i t e
3 t o 4 - >
I n c o m
i n g
4 t o 1 - >
O u t g o
i n g
R i n g
N e
t w o r k
N e w
P a c k
P a c
k N o
I N T
1
P a c k a g e
P A C K
S e n d
O u
t g o
i n g P
A C K O
u t
I n c o m
i n g
P A C K
I n
R e c e
i v e
S i t e
R e c e
i v e
d
P A C K
n +
1
n
{ s e =
t h i s ( )
, r e = r , n o = n
}
p
i f # r e p < >
t h i s ( )
t h e n
1 ` p
e l s e e m p
t y
p
i f # r e p < >
t h i s ( )