Petri Nets 200021st International Conference onApplication and Theory of Petri Nets
Aarhus, Denmark, June 26-30, 2000
Introductory TutorialPetri Nets
Organised by
Gianfranco Balbo
Jorg DeselKurt Jensen
Wolfgang ReisigGrzegorz Rozenberg
Manuel Silva
June 2000
DEPARTMENT OF COMPUTER SCIENCEUNIVERSITY OF AARHUS
Ny Munkegade, Bldg. 540DK-8000 Aarhus C, Denmark
Table of Contents
Wolfgang ReisigAn Informal Introduction to Petri Nets . . . . . . . . . . . . . . . . . . . . . . . . . 1
Grzegorz RozenbergElementary Net Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Jorg DeselPlace/Transition Nets I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Kurt JensenColoured Petri Nets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Grzegorz RozenbergBehaviour of Elementary Net Systems . . . . . . . . . . . . . . . . . . . . . . . . . 161
Manuel SilvaPlace/Transition Nets II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Gianfranco BalboAn Introduction to Generalised Stochastic Petri Nets . . . . . . . . . . . . . . . . . 217
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
1Introductory Tutorial
Place/Transition-Nets I
Jorg Desel, Catholic University in Eichstatt
I. Introduction to place/transition-nets
II. Basic analysis techniques
2I. Introduction to An example
place/transition nets Different features of place/transition-nets
Place/transition-nets vs en-systems
Formal definitions
Place/transition-nets
Occurrence sequences and reachability
Marking graphs
Behavioral properties
Deadlock-freedom and liveness
Boundedness and 1–safety
Reversibility
Capacities and complements
Weak and strong capacities
Weak and strong complements
Inhibitor arcs85
eady for insertion
holding coin
dispense item
nsert coin
ccept coin
reject coin
ready to dispense
eady for insertion
holding coin
ispenseitem
nsert coin
ccept coin
reject coin
eady to dispense
3An example: a vending machine
Control structure of a vending machine
an en-system its behaviour
item storage
request for refill
ready for insertion
holding coin
refilldispense item
insert coin
accept coin
reject coin
ready to dispense
ispenseitem
insert coin
accept coin
reject coin
insert coin
accept coin
reject coin
refill
refill
refill
4Adding concurrency: a vending machine with capacity 1 ...
... and its behaviour
86
tem storage
equest for refill
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
reject coin
eady 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
5Adding bounded storages: a vending machine with capacity 4 ...
... and its behaviour
ready for insertion
holding coindispense item
insert coin
accept coin
reject coin
ready to dispense
coins in machine
dispense item
insert coin
accept coin
reject coin
insert coin
accept coin
reject coin
dispense item
0 coins in machine 1 coin in machine 2 coins in machine
6Adding unbounded counters: the control part with a counter ...
... and its behaviour
87
tem storage
equest for refill
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
reject 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
7Adding arc weights: the vending machine selling pairs ...
... or storing pairs
tem storage
equest for refill
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
reject coin
eady to dispense
tem storage
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
eject coin
eady to dispense
= 4
8Adding limited capacities: replacing the place ”request for refill” ...
... by a capacity restriction
88
9Marked place/transition-nets generalize en-systems
Each contact-free en-system is a 1-safe marked place/transition-net
Terminology:
en-system marked p/t-net
condition �! place
event �! transition
case / state �! marking
c � conditions m: places ! f0; 1gsequential case graph �! marking graph
(reachability graph, state graph)
10Formal definition of marked place/transition-nets
A marked place/transition-net (p/t-net) is a tuple (S; T; F; k; w;m0) where
(S; T; F ) is a net with
S – set of places (Stellen), nonempty, finite (often P is used)
T – set of transitions , nonempty, finite
F � (S � T ) [ (T � S) – flow relation
k :S ! f1; 2; 3; . . .g [ f1g – partial capacity restriction (default: 1)
w :F ! f1; 2; 3; . . .g – weight function (default: 1)
m0:S ! f0; 1; 2; . . .g – a marking satisfying
8s 2 S : k(s) = 1 _ m0(s) � k(s)
(initial marking )
89
2
2
32
2
3 k=4
11The occurrence rule
A transition t is enabled at a marking m if
every place s 2 �t satisfies m(s) � w(s; t) and
every place s 2 t� satisfies m(s) + w(t; s) � k(s)
The occurrence of t leads to the successor marking m0, defined by
m0(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: mt�! m0 (m[tim0)
12Occurrence sequences and reachability
A finite sequence � = t1 t2 . . . tn of transitions is a
finite occurrence sequence leading from m0 to mn if
m0t1�! m1
t2�! � � � tn�! mn
A marking m is reachable (from m0) if
there is an occurrence sequence leading from m0 to m
Notation: [m0i is the set of all reachable markings
An infinite sequence � = t1 t2 t3 . . . is an
infinite occurrence sequence enabled at m0 if
m0t1�! m1
t2�! m2t3�! � � �
90
(1,1,0)t1 t2
s1
s2
s3 (0,2,0)
t2 (1,0,1)
t1
t2 (0,1,1)
t1
(0,0,2)
t2
t3
2 t3
13Marking graphs
The marking graph of a marked p/t-net is an edge-labeled graph with initial vertex
initial vertex – initial marking m0 (denoted !�)
vertices – set of reachable markings [m0ilabeled edges – set of triples (m; t;m0) such that m
t�! m0
Example:
Lemma Each occurrence sequence corresponds to the
labels of a directed path of the marking graph
starting with the initial vertex,
and vice versa.
14Behavioral properties of marked p/t-nets
A marked p/t-net is
terminating – if there is no infinite occurrence sequence
deadlock-free – if each reachable marking enables a transition
live – if each reachable marking enables
an occurrence sequence containing all transitions
bounded – if, for each place s, there is a bound b(s)
such that m(s) � b(s) for every reachable marking m
1–safe – if b(s) = 1 is a bound for each place s
reversible – if m0 is reachable from each other reachable marking
Example The vending machines are deadlock-free and live.
Some are 1–safe, some are bounded, some are unbounded.
The bounded vending machines are reversible.91
t1t2
t2
t3
t4
t1
t4
t3
t4 t2
15A marked p/t-net which is not deadlock-free and its marking graph
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
t3
t4
t5
4
t5
2 t4
1 5
3
16A deadlock-free marked p/t-net which is not live
Proposition Every live marked p/t-net is deadlock-free
(this does not hold for nets without transitions)
Proposition A marked p/t-net is live if and only if
at no reachable marking a transition is dead
(cannot become enabled again)
Example Some transitions are dead at a reachable marking
92
17Proposition A marked p/t-net is bounded if and only if
its set of reachable markings is finite
(its marking graph is finite)
Proof
(() The maximal number of tokens on a place can be taken as its bound.
()) If a place s is bounded by b(s) then it can be in at most b(s) + 1 different states, vic.
m(s) = 0;m(s) = 1; . . . ;m(s) = b(s):
So the number of reachable markings does not exceed
(b(s1) + 1) � (b(s2) + 1) � � � (b(sn) + 1)
where fs1; s2; . . . ; sng is the (finite !) set of places
Corollary A 1–safe marked p/t-net with n places has
at most 2n reachable markings
t2 t4
t1 t5
t3t2
t1
t3
t4
t5
t1
t2
t3
t4
t5
t3
t3t4
t4t5
t2
t1
18Proposition A marked p/t-net is reversible if and only if
its marking graph is strongly connected
Example a 1–safe non-live marked p/t-net which is not reversible
Example an unbounded marked p/t-net which is not reversible
Example a live and 1–safe marked p/t-net which is not reversible
93
tem storage
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
eject coin
eady to dispense
= 4
tem storage
equest for refill
eady for insertion
holding coin
efillispense
item
nsert coin
accept coin
reject coin
eady to dispense
19Substituting capacities ...
... by complement places
k = 3
20Weak capacities
. . . guarantee bounds of places
weak enabling condition:
a transition t is enabled at a marking m if
every place s 2 �t satisfies m(s) � w(s; t) and
every place s 2 t� n �t satisfies m(s) + w(t; s) � k(s) and
every place s 2 t� \ �t satisfies m(s)� w(s; t) + w(t; s) � k(s)
Proposition If k(s) is finite then s is k(s)-bounded
Replacing a weak capacity restrictiction by a weak complement
94
= 3
21Strong capacities
. . . generalize contact of en-systems
strong enabling condition:
a transition t is enabled at a marking m if
every place s 2 �t satisfies m(s) � w(s; t) and
every place s 2 t� satisfies m(s) + w(t; s) � k(s)
Proposition each en-system is equivalent to a
marked p/t-net without arc weights and
with the strong capacity restriction k(s) = 1 for every place s
Replacing a strong capacity restrictiction by a strong complement
k = 3 3 3
22Inhibitor arcs for null tests
inhibitor enabling condition: If (s; t) is an inhibitor arc then
t is only enabled at a marking m if m(s) = 0
Replacing an inhibitor arc at a bounded place by a weak complement
95
23II. Basic Linear-algebraic techniques
analysis The marking equation
techniques Place invariants
Transition invariants
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
24Linear-algebraic representation of markings and transitions
vector representation of the marking m0: ~m0 = (4; 0; 0; 0; 1)
vector representation of the transition t2: ~t2 = (�1; 1; 1; 0;�1)
m0t2�! m1 ) ~m0 + ~t2 = ~m1 = (3; 1; 1; 0; 0)
96
1
s2
s3
s4t1 t2
3
4
t5
5
25Matrix representation of a net
incidence matrix of the net:
��N ��=
~t1 ~t2 ~t3 ~t4 ~t5
~s1 1 �1 0 0 0
~s2 �1 1 0 0 0
~s3 0 1 �1 0 1
~s4 0 0 1 �1 �1
~s5 0 �1 0 1 0
26The marking equation
m0
t2 t3 t5 t1 t3���! m ) ~m0 + ~t2 + ~t3 + ~t5 + ~t1 + ~t3 = ~m
~m0 + (1 � ~t1) + (1 � ~t2) + (2 � ~t3) + (0 � ~t4) + (1 � ~t5) = ~m
~m0 +��N ��� (1; 1; 2; 0; 1)| {z }
Parikh vector of t2t3t5t1t3
= ~m
The Marking Equation If m0��! m and
P(�) denotes the Parikh vector of � then
~m0 +��N ��� P(�) = ~m
. . . yields a necessary condition for reachability of a marking:
A marking m is only reachable from m0 if
~m0 +��N ��� ~x = ~m has a solution for ~x in IN
�.
97
t1
2
3
t4
1
2
3
4
5
5
27Example: a live and 1–safe marked p/t-net
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; 1; 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 sufficient for reachability
s1 s2
s3
t1
t2
s4
t3
t4
s5
process 1 process 2
28Place invariants
Example: mutual exclusion
Every reachable marking m satisfies m(s2) + m(s4) � 1
1) m(s2) + m(s3) + m(s4) = 1 holds initially
2) m(s2) + m(s3) + m(s4) = 1 is stable ! will be shown by a place invariant
3) m(s2) + m(s3) + m(s4) = 1 ) m(s2) + m(s4) � 198
29Place invariants
Three equivalent definitions:
A place invariant of a net N is a vector~i satisfying
(1)Xs2�t
~is =Xs2t�
~is for every transition t of N
(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 m0 then~i � ~m0 =~i � ~m
Proof: m0��! m ) ~m0 +
��N ��� P [�] = ~m
) ~i � ~m0 + ~i � ��N ��| {z }=(0;...;0)
�P [�] =~i � ~m
) ~i � ~m0 =~i � ~m
s1 s2
s3
t1
t2
s4
t3
t4
s5
process 1 process 2
30Proving stability
The number of tokens on fs2; s3; s4g is not changed
by transition occurrences.
)~i = (0; 1; 1; 1; 0) is a place invariant.
~i � ~m0 = 1 implies~i � ~m = 1 for each reachable marking M .
) m(s2) + m(s3) + m(s4) = 1 is stable.
99
s1 s2
s3
t1
t2
s4
t3
t4
s5
process 1 process 2
31Further place invariants
(0; 1; 1; 1; 0) mutual exclusion
(0; 1; 1; 0;�1) m(s2) + m(s3) = m(s5)
if s2 is marked then s5 is marked
(1; 1; 0; 0; 0) m(s1) + m(s2) = 1
m(s1);m(s2) � 1, the places s1 and s2 are bounded
1 2
3
4
1
2
t3
t4
s5
32A 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~is satisfies~i � ~m0 > 0.
Proof: otherwise transitions in �s [ s� are dead.
Examples: place invariants (1; 1; 0; 0; 0), (0; 0; 0; 1; 1), (0; 1; 1; 1; 0)
100
1 2
3
4
1
2
t3
t4
s5
33A sufficient condition for boundedness:
Proposition: Each marked p/t-net with a place invariant~i satisfying
~is > 0 for each place s is bounded.
Proof: m is reachable ) ~i � ~m =~i � ~m0.
) ~is � ~ms �~i � ~m =~i � ~m0.
) m(s) = ~ms �~i � ~m0
~is
Example: place invariant (1; 2; 1; 2; 1)
t1 t2t3
t4 t5
s1
s2
s3
s4
s5
s6
s7
s8
34Place invariants and the marking equation
Proposition There is a place invariant~i satisfying~i � ~m0 6=~i � ~m if and only if
~m0 +��N ��� ~x = ~m has no rational-valued solution for ~x.
Example:
~m0 +��N ��� (1; 0; 1; 12 ;
12 ) = ~m = (1; 0; 1; 0; 1; 1; 0; 0)
) no place invariant proves the non-reachability of m.
But the marking equation has no solution in IN�
! modulo place invariants101
1 2
3
4
1
2
t3
t4
s5
35Transition invariants
A transition invariant of a net N is a vector ~j satisfying��N ���~j = (0; 0; . . . ; 0)
Example:
Transition invariants: (1; 1; 0; 0), (0; 0; 1; 1), (2; 2; 1; 1)
Proposition Let m0��! m be an occurrence sequence.
m0 = m if and only if P [�] is a transition invariant
Proof: follows immediately from ~m0 +��N ��� P [�] = ~m
36A 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
m0�1�! m1
�2�! m2�3�! � � �
such that all transitions occur in every �i.
By boundedness, mi = mj for some i < j.
) mi�i+1�! � � � �j�! mj = mi.
) ~j = P [�i+1 � � ��j ] is a suitable transition invariant.
102
a siphon {s1,s2}
a trap{s3, s4}
s1 s2 s3 s4
37Structural Techniques
A siphon is a set of places which, once unmarked, never gains a token again
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
S is a trap if S� � �S, i.e. if �t \ S 6= ; implies t� \ S 6= ;.
If a marking m satisfies m(s1) = m(s2) = 0 then so do all follower markings.
If a marking m satisfies m(s3) + m(s4) > 0 then so do all follower markings.
1
2
3
t4
1
2
3
s4
5
t5
38Example for the use of a trap
fs1; s4; s5g is an initially marked trap
) the marking (0; 1; 1; 0; 0) is not reachable.
103
39Siphons and traps, liveness and deadlock-freedom
Proposition: In a live marked p/t-net without isolated places,
each nonempty siphon contains an initially marked place
Proof: otherwise, for each place s of the siphon, all transitions in �s [ s� are dead.
Proposition: Assume a marked p/t-net with some transition,
without capacity restrictions and arc weights.
If each nonempty siphon includes an initially marked trap
then the marked p/t-net is deadlock-free
Proof: the set of unmarked places at a dead marking is a nonempty siphon.
This siphon contains no marked trap.
) It contains no initially marked trap.
40Restricted net classes
State machines are marked p/t-nets without branched transitions,
i.e. j�tj = jt�j = 1 for each transition,
without arc weights and
without capacity restrictions.
Example
Proposition Each marked state machine is bounded.
Proposition A marked state machine is live if and only if
it is strongly connected and some place is initially marked.
104
41Marked graphs are marked p/t-nets without branched places,
i.e. j�sj = js�j = 1 for each place,
without arc weights and
without capacity restrictions.
Example
Proposition A marked graph is live if and only if
each cycle carries a token initially.
Proposition It is moreover 1–safe if and only if
each place belongs to a cycle with exactly one token.
s1
s2
s3
s4
s5
42Free-choice nets are marked p/t-nets
without arc weights and capacity restrictions satisfying
(s; t) 2 F ) �t� s
� � F for each place s and transition t
If then
Proposition A free-choice net without isolated places is live if and only if
each nonempty siphon includes an initially marked trap.
Example
fs1; s2; s5g is a siphon which includes no nonempty trap
) this free-choice net is not live.105
produce send receive consume
produced
sent
full
consumed
received
ent
onsumed
end
roduce
roduced ent
ull ullroduce
roduced send sent
eceive
eceived
consume
onsumed
receive
eceived
43Causal semantics of marked p/t-nets
Example: a producer / consumer system
a causal run of the producer /consumer system
44Causal runs
A causal run of a marked p/t-net is given by a labeled Petri net (B;E;K)
Interpretation of causal runs
net element name symbol interpretation
places conditions B tokens on system places
transitions events E system transition occurrences
arcs causal relation K flow of tokens
106
45Occurrence nets
An occurrence net is a net (B;E;K) with the following properties
it has no cycles (i.e. K+ is a partial order � )
it has no branched places, i.e.
j�bj; jb�j � 1 for each condition b
events have finite fan-in and fan-out, i.e.�e and e� are finite sets for each event e
it has neither input nor output-events, i.e.
j�ej; je�j � 1 for each event e
no node has infinitely many predecessors, i.e.
the set fx 2 (B [ E) j x � yg is finite for each node y
46Process nets of marked p/t-nets represent causal runs
Assume a marked p/t-net (S; T; F; k; w;m0) without capacity restrictions
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
m0 agrees with min(B), i.e.
m0(s) = jfb 2 B j �b = ; and �(b) = sgj for every place s 2 S
transition vicinities are preserved, i.e.
�(�e) = �(�(e)), jfb 2 �e j �(b) = sgj = w(s; �(e)) for each event e
�(e�) = (�(e))�, jfb 2 e� j �(b) = sgj = w(�(e); s) for each event e
107
d a
e b
f
g
c h
d a
e b
f
g
c h
f
d a
e b
f
g
c hf
47Occurrence 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 reflecting causality.
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
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
b15
b16 e9 b17t3
s4
s5 t4 s3
b8b3
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
b15
b16 e9 b17t3
s4
s5 t4 s3
48Two process nets corresponding to t1 t3 t5 t2 t3 t5 t2 t3 t4
108
s1 s3 s4
s2 s6
s5
t1 t2
t3
t5
t4
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
b15
b16 e9 b17t3
s4
s5 t4 s3
b2
b8
b1
b3
e1
b4
b5 e2 b6
e3
b7s3 t3
s4
s5 t5 s6 t2 s3
s2
s1
s2
e4
b9
b10 e6 b11t3
s4
s5 t4 s3
b12e5t1 s1
b17
e7
b13
b14 e8 b15
e9
b16t3
s4
s5 t5 s6 t2 s3
s2
49Two process nets without a common occurrence sequence
109
110
Col
oure
d P
etri
Net
s
Kur
t Jen
sen
Com
pute
r S
cien
ce D
epar
tmen
tU
nive
rsity
of A
arhu
s
Ny
Mun
kega
de, B
uild
ing
540
DK
-800
0 A
arhu
s C
, Den
mar
k
Pho
ne:
+45
89
42 3
2 34
Tel
efax
:+
45 8
9 42
32
55E
-mai
l: kj
ense
n@da
imi.a
u.dk
UR
L: h
ttp://
ww
w.d
aim
i.au.
dk/~
kjen
sen
TO
OL
S •
edi
ting
• s
imul
atio
n •
veri
fica
tion
TH
EO
RY
• m
odel
s•
basi
c co
ncep
ts•
veri
fica
tion
met
hods
PR
AC
TIC
AL
USE
• s
peci
fica
tion
• in
vest
igat
ion
• v
erif
icat
ion
•im
plem
enta
tion
Col
oure
d P
etri
Net
s 2
Par
t 1: I
ntro
duct
ion
to C
P-n
ets
An
ordi
nary
Pet
ri ne
t (P
T-n
et)
has no
typ
es a
nd no
mo
du
les:
•O
nly
one
kind
of t
oken
s an
d th
e ne
t is
flat.
With
Col
oure
d P
etri
Net
s (C
P-n
ets)
it is
pos
sibl
e to
use d
ata
typ
es a
nd c
ompl
ex da
ta m
an
ipu
latio
n:
•E
ach
toke
n ha
s at
tach
ed a
dat
a va
lue
calle
d th
eto
ken
co
lou
r.
•T
he to
ken
colo
urs
can
be
inve
stig
ate
d and
mo
difi
ed b
y th
e oc
curr
ing
tran
sitio
ns.
With
CP
-net
s it
is p
ossi
ble
to m
ake hie
rarc
hic
al
desc
riptio
ns:
•A
larg
e m
odel
can
be
obta
ined
by
com
bin
ing a
set o
f su
bm
od
els
.
•W
ell-d
efin
ed in
terf
ace
s bet
wee
n th
e su
bmod
els.
•W
ell-d
efin
ed se
ma
ntic
s of t
he c
ombi
ned
mod
el.
•S
ub
mo
de
ls can
be
reus
ed.
111
Col
oure
d P
etri
Net
s 3
Res
ourc
e al
loca
tion
exam
ple
AP
3`(q
,0)
BP
2`(p
,0)
CP
DP
EPT
1[x
=q]
T2
T3
T4
T5
R E
1`eD
ecla
ratio
ns:
type
U =
with
p |
q;
type
I =
int;
type
P =
pro
duct
U *
I;ty
pe E
= w
ith e
;va
r x
: U;
var
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)
if x=
qth
en 1
`(x,
i+1)
else
em
pty
e
if x=
q th
en 1
`eel
se e
mpt
y
case
x o
f p
=>
2`e
| q =
> 1
`e
2`e
e
if x=
p th
en 1
`eel
se e
mpt
y e
case
x o
f p
=>
2`e
| q =
> 1
`e
if x=
pth
en 1
`(x,
i+1)
else
em
pty
Col
oure
d P
etri
Net
s 4
Occ
urre
nce
of e
nabl
ed b
indi
ng
SE
33`
e
BP
22`
(p,0
)
T2
CP
SE
33`
e
BP
22`
(p,0
)
T2
CP
Bin
ding
:<
x=p,
i=0>
SE
11`
e
BP
11`
(p,0
)
T2
CP
11`
(p,0
)
New
Mar
king
(x,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
(x,i)
11`
(p,0
)(x
,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
22`
e
11`
(p,0
)(x
,i)
(x,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
(x,i)
112
Col
oure
d P
etri
Net
s 5
Bin
ding
whi
ch is
not
ena
bled
SE
33`
e
BP
22`
(p,0
)
T2
CP
SE
33`
e
BP
22`
(p,0
)
T2
CP
Bin
ding
:<
x=q,
i=2>
(x,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
(x,i)
11`
(q,2
)(x
,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
11`
e
11`
(q,2
)(x
,i)
Bin
ding
can
not o
ccur
Col
oure
d P
etri
Net
s 6
A m
ore
com
plex
exa
mpl
e
SE
33`
e
BP
31`
(p,2
)+1`
(p,4
)+1`
(q,3
)
T2
CP
SE
33`
e
BP
31`
(p,2
)+1`
(p,4
)+1`
(q,3
)
T2
CP
Bin
ding
:<
x=p,
i=2>
SE
33`
e
BP
31`
(p,2
)+1`
(p,4
)+1`
(q,3
)
T2
CP
Bin
ding
:<
x=q,
i=3>
(x,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
(x,i)
11`
(p,2
)(x
,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
22`
e
11`
(p,2
)(x
,i)
11`
(q,3
)(x
,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
11`
e
11`
(q,3
)(x
,i)
113
Col
oure
d P
etri
Net
s 7
Con
curr
ency
SE
33`
e
BP
31`
(p,2
)+1`
(p,4
)+1`
(q,3
)
T2
CP
Bin
ding
:<
x=p,
i=2>
SE
BP
11`
(p,4
)
T2
CP
21`
(p,2
)+1`
(q,3
)
Bin
ding
:<
x=q,
i=3>
21`
(p,2
)+1`
(q,3
)(x
,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
33`
e
21`
(p,2
)+1`
(q,3
)(x
,i)
(x,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
(x,i)
•T
he tw
o bi
ndin
gs m
ay o
ccur
co
ncu
rre
ntly
.
•T
his
is p
ossi
ble
beca
use
they
use
d
iffe
ren
tto
ken
s.
Col
oure
d P
etri
Net
s 8
Con
flict
SE
33`
e
BP
31`
(p,2
)+1`
(p,4
)+1`
(q,3
)
T2
CP
Bin
ding
:<
x=p,
i=2>
SE
33`
e
BP
31`
(p,2
)+1`
(p,4
)+1`
(q,3
)
T2
CP
Bin
ding
:<
x=p,
i=4>
11`
(p,2
)(x
,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
22`
e
11`
(p,2
)(x
,i)
11`
(p,4
)(x
,i)
case
x o
f p
=>
2`e
| q =
> 1
`e
22`
e
11`
(p,4
)(x
,i)
•T
hese
two
bind
ings
can
not o
ccur
co
ncu
rre
ntly
.
•T
he r
easo
n is
that
they
nee
d th
e sa
me
to
ken
s.
114
Col
oure
d P
etri
Net
s 9
Res
ourc
e al
loca
tion
syst
emT
wo
kind
s of
pro
cess
es:
•T
hree
cyc
lic q
-pro
cess
es (
stat
es A
,B,C
,D a
nd E
).
•T
wo
cycl
ic p
-pro
cess
es (
stat
es B
,C,D
and
E).
Thr
ee k
inds
of re
sou
rce
s:
•R
epre
sent
ed b
y th
e pl
aces
R, S
and
T.
Dur
ing
a cy
cle
a pr
oces
s rese
rve
s som
e re
sour
ces
and
rele
ase
s the
m a
gain
:
•T
oken
s ar
e rem
ove
d fro
m a
nd ad
de
d to
the
reso
urce
pla
ces
R, S
and
T.
A c
ycle
co
un
ter is
incr
ease
d ea
ch ti
me
a pr
oces
sco
mpl
etes
a fu
ll cy
cle.
It is
rat
her
stra
ight
forw
ard
to p
rove
that
the
reso
urce
allo
catio
n sy
stem
ca
nn
ot
de
ad
lock
.
•W
hat h
appe
ns if
we
add
an a
dditi
onal
toke
n to
plac
e S
– i.
e., i
f we
star
t with
four
S-r
esou
rces
inst
ead
of th
ree?
Col
oure
d P
etri
Net
s 10
Col
oure
d P
etri
Net
sD
ecl
ara
tion
s:
•T
ype
s, f
un
ctio
ns, o
pe
ratio
ns a
nd v
aria
ble
s.
Eac
h pla
ce h
as th
e fo
llow
ing
insc
riptio
ns:
•N
am
e (fo
r id
entif
icat
ion)
.
•C
olo
ur
set (sp
ecify
ing
the
type
of t
oken
s w
hich
may
res
ide
on th
e pl
ace)
.
•In
itia
l ma
rkin
g (m
ulti-
set o
f tok
en c
olou
rs).
Eac
h tra
nsi
tion
has
the
follo
win
g in
scrip
tions
:
•N
am
e (fo
r id
entif
icat
ion)
.
•G
ua
rd (
bool
ean
expr
essi
on c
onta
inin
g so
me
ofth
e va
riabl
es).
Eac
h arc
has
the
follo
win
g in
scrip
tions
:
•A
rc e
xpre
ssio
n (co
ntai
ning
som
e of
the
varia
bles
).W
hen
the
arc
expr
essi
on is
eva
luat
ed it
yie
lds
am
ulti-
set o
f tok
en c
olou
rs.
115
Col
oure
d P
etri
Net
s 11
Ena
blin
g an
d oc
curr
ence
A b
ind
ing
assi
gns
a co
lou
r (i.e
., a
valu
e) to
eac
hva
ria
ble
of a
tran
sitio
n.
A b
ind
ing
ele
me
nt is
a p
air
(t,b
) w
here
t is
atr
an
sitio
n w
hile
b is
a bi
nd
ing
for
the
varia
bles
of t.
Exa
mpl
e: (
T2,
<x=
p, i=
2>).
A b
indi
ng e
lem
ent i
s en
ab
led i
f and
onl
y if:
•T
here
are
enou
gh to
kens (
of th
e co
rrec
t col
ours
on
each
inpu
t-pl
ace)
.
•T
he g
ua
rd e
valu
ates
to tr
ue.
Whe
n a
bind
ing
elem
ent i
s en
able
d it
may
o
ccu
r:
•A
mul
ti-se
t of t
oken
s is
rem
ove
d fro
m e
ach
inpu
t-pl
ace.
•A
mul
ti-se
t of t
oken
s is
add
ed t
o ea
chou
tput
-pla
ce.
A b
indi
ng e
lem
ent m
ay o
ccur
co
ncu
rre
ntly
to o
ther
bind
ing
elem
ents
– if
f the
re a
re s
o m
any
toke
nsth
at e
ach
bind
ing
elem
ent c
an g
et it
s "o
wn
shar
e".
Col
oure
d P
etri
Net
s 12
Mai
n ch
arac
teris
tics
of C
P-n
ets
Com
bina
tion
of te
xt a
nd g
rap
hic
s.
De
cla
ratio
ns a
nd ne
t in
scrip
tion
s are
spe
cifie
d by
mea
ns o
f a fo
rmal
lang
uage
, e.g
., a
pro
gra
mm
ing
lan
gu
ag
e.
•T
ypes
, fun
ctio
ns, o
pera
tions
, var
iabl
es a
ndex
pres
sion
s.
Ne
t st
ruct
ure
cons
ists
of p
lace
s, tr
ansi
tions
and
arcs
(fo
rmin
g a
bi-p
artit
e gr
aph)
.
•T
o m
ake
a C
P-n
et
rea
da
ble
it is
impo
rtan
t to
mak
e a
nice
gra
phic
al la
yout
.
•T
he g
raph
ical
layo
ut h
as
no
fo
rma
l me
an
ing
.
CP
-net
s ha
ve th
e sa
me
kind
of
con
curr
en
cyp
rop
ert
ies a
s P
lace
/Tra
nsiti
on N
ets.
116
Col
oure
d P
etri
Net
s 13
For
mal
def
initi
on o
f CP
-net
s
Def
initi
on:
A C
olo
ure
d P
etr
i Ne
t is
a t
up
le C
PN
= (
Σ, P
, T
, A
, N
,C
, G, E
, I)
sat
isfy
ing
the
follo
win
g re
quire
men
ts:
(i)Σ
is a
fini
te s
et o
f non
-em
pty
type
s, c
alle
d co
lour
set
s.
(ii)
P is
a fi
nite
set
of pl
aces
.
(iii)
T is
a fi
nite
set
of tr
ansi
tions
.
(iv)
A is
a fi
nite
set
of a
rcs
such
that
:
•P
∩ T
= P
∩ A
= T
∩ A
= Ø
.
(v)
N is
a n
ode
func
tion.
It is
def
ined
from
A in
to P ×
T ∪
T ×
P.
(vi)
C is
a co
lour
func
tion.
It is
def
ined
from
P in
to Σ.
(vii)
G is
a g
uard
fu
nct
ion
. It
is d
efin
ed
fro
m T
into
exp
ress
ion
ssu
ch th
at:
•∀
t ∈T
: [T
ype(
G(t
)) =
Boo
l ∧ T
ype(
Var
(G(t
))) ⊆
Σ].
(viii)
E i
s a
n a
rc e
xpre
ssio
n fu
nct
ion
. It
is
de
fine
d f
rom
A i
nto
expr
essi
ons
such
that
:•
∀a ∈
A: [
Typ
e(E
(a))
= C
(p(a
)) MS ∧
Typ
e(V
ar(E
(a))
) ⊆ Σ
]w
here
p(a
) is
the
plac
e of
N(a
).
(ix)
I is
an
initi
aliz
atio
n
fun
ctio
n.
It i
s d
efin
ed
fro
m P
in
tocl
osed
exp
ress
ions
suc
h th
at:
•∀
p ∈P
: [T
ype(
I(p)
) =
C(p
) MS].
Col
oure
d P
etri
Net
s 14
For
mal
def
initi
on o
f beh
avio
ur
Def
initi
on:
A s
tep
is a
mul
ti-se
t of b
indi
ng e
lem
ents
.
A s
tep
Y is
en
ab
led
in a
ma
rkin
g M
iff
th
e f
ollo
win
g p
rop
ert
y is
satis
fied:
∀p
∈P
:∑
(t,b
) ∈Y E
(p,t)
<b>
≤ M
(p).
Wh
en
a s
tep
Y is
en
ab
led
in a
ma
rkin
g M
1 it
ma
y oc
cur,
cha
ng
ing
the
mar
king
M1
to a
noth
er m
arki
ng M 2
, def
ined
by:
∀p
∈P
: M
2(p)
= (
M1(
p) –
∑(t
,b) ∈
Y E
(p,t)
<b>
) +
∑(t
,b) ∈
Y E
(t,p
)<b>
.
Th
e f
irst
su
m i
s ca
lled
th
e
rem
oved
to
ken
s w
hile
th
e s
eco
nd
is
calle
d t
he
ad
de
d to
ken
s. M
ore
ove
r w
e s
ay
tha
t M
2 is
dir
ect
lyre
acha
ble
from
M1
by t
he o
ccur
renc
e of
the
ste
p Y
, w
hich
we
also
deno
te: M
1 [Y› M
2.
An
occu
rren
ce s
eque
nce is
a s
eque
nce
of m
arki
ngs
and
step
s:
M1 [Y
1› M
2 [Y
2› M
3 …
Mn [Y
n› M
n+1
such
th
at
Mi [
Yi› M
i+1
fo
r a
ll i ∈
1. . n
. W
e t
he
n s
ay
tha
t M n+
1 is
reac
habl
e fr
om
M1.
We
use
[M ›
to
de
no
te t
he
se
t o
f m
ark
ing
sw
hich
are
rea
chab
le fr
om M
.
117
Col
oure
d P
etri
Net
s 15
For
mal
def
initi
onT
he e
xist
ence
of a
fo
rma
l de
finiti
on i
s ve
ryim
port
ant:
•It
is th
e ba
sis
for si
mu
latio
n, i.e
., ex
ecut
ion
of th
eC
P-n
et.
•It
is a
lso
the
basi
s fo
r th
e form
al v
erific
atio
nm
etho
ds (
e.g.
, sta
te s
pace
s an
d pl
ace
inva
riant
s).
•W
ithou
t the
form
al d
efin
ition
, it w
ould
hav
ebe
en im
poss
ible
to o
btai
n a so
un
d net
cla
ss.
It is
no
t n
ece
ssa
ry for
a u
ser t
o kn
ow th
e fo
rmal
defin
ition
of C
P-n
ets:
•T
he c
orre
ct sy
nta
x is
chec
ked
by th
e C
PN
edi
tor,
i.e.,
the
com
pute
r to
ol b
y w
hich
CP
-net
s ar
eco
nstr
ucte
d.
•T
he c
orre
ct u
se o
f the
se
ma
ntic
s (i.e
., th
een
ablin
g ru
le a
nd th
e oc
curr
ence
rul
e) is
guar
ante
ed b
y th
e C
PN
sim
ulat
or a
nd th
eC
PN
tool
s fo
r fo
rmal
ver
ifica
tion.
Col
oure
d P
etri
Net
s 16
Hig
h-le
vel c
ontr
a lo
w-le
vel n
ets
The
rel
atio
nshi
p be
twee
n C
P-n
ets
and
Pla
ce/T
rans
ition
Net
s (P
T-n
ets)
is
an
alo
go
us t
oth
e re
latio
nshi
p be
twee
n hi
gh-le
vel p
rogr
amm
ing
lang
uage
s an
d as
sem
bly
code
.
•In
theo
ry, t
he tw
o le
vels
hav
e ex
actly
the
sam
eco
mp
uta
tion
al p
ow
er.
•In
pra
ctic
e, h
igh-
leve
l lan
guag
es h
ave
muc
hm
ore
mo
de
llin
g p
ow
er –
bec
ause
they
hav
ebe
tter
stru
ctur
ing
faci
litie
s, e
.g.,
type
s an
dm
odul
es.
Eac
h C
P-n
et h
as a
n equ
iva
len
t PT
-net
– a
nd v
ice
vers
a.
•T
his
equi
vale
nce
is u
sed
to d
eriv
e th
e de
finiti
onof
ba
sic
pro
pe
rtie
s and
to e
stab
lish
the
verific
atio
n m
eth
od
s.
•In
pra
ctic
e, w
e ne
ver t
rans
late
a C
P-n
et in
to a
PT
-net
– o
r vi
ce v
ersa
.
•D
escr
iptio
n, s
imul
atio
n an
d ve
rific
atio
n ar
e do
ned
ire
ctly
in te
rms
of C
P-n
ets.
118
Col
oure
d P
etri
Net
s 17
Oth
er k
inds
of h
igh-
leve
l net
sC
P-n
ets
have
bee
n de
velo
ped
from
Pre
dica
te/T
rans
ition
Net
s.
•H
art
ma
nn
Ge
nrich
& K
urt
La
ute
nb
ach.
•W
ith r
espe
ct to
desc
rip
tion
and
sim
ula
tion t
hetw
o m
odel
s ar
e ne
arly
iden
tical
.
•W
ith r
espe
ct to
form
al v
erific
atio
n the
re a
reso
me
diffe
renc
es.
Sev
eral
oth
er k
inds
of h
igh-
leve
l Pet
ri N
ets
exis
t.
•T
hey
all b
uild
upo
n th
e sa
me ba
sic
ide
as, b
ut u
sed
iffe
ren
t la
ng
ua
ge
s for
decl
arat
ions
and
insc
riptio
ns.
•A
det
aile
d co
mpa
rison
is o
utsi
de th
e sc
ope
ofth
is ta
lk.
Col
oure
d P
etri
Net
s 18
Sim
ple
prot
ocol
Sen
dP
acke
tT
rans
mit
Pac
ket
Rec
eive
Pac
ket
Rec
eive
Ack
now
.T
rans
mit
Ack
now
.
Sen
d
INT
xDA
TA
1`(1
,"M
odel
lin")
+1`
(2,"
g an
d A
n")+
1`(3
,"al
ysis
b")
+1`
(4,"
y M
eans
")+
1`(5
,"of
Col
ou")
+1`
(6,"
red
Pet
r")+
1`(7
,"i N
ets#
#")+
1`(8
,"##
####
##")
Nex
tSen
dIN
T
1
DIN
TA
INT
xDA
TA
Rec
eive
dD
AT
A
""
Nex
tRec
INT
1
B
INT
xDA
TA
CIN
T
RP
8
Int_
0_10
RA
Int_
0_108
Sen
der
Net
wo
rkR
ecei
ver
type
INT
= in
t;ty
pe B
OO
L =
boo
l;ty
pe D
AT
A =
str
ing;
ty
pe IN
TxD
AT
A =
pro
duct
INT
* D
AT
A;
var
n, k
: IN
T;
var
p,st
r : D
AT
A;
val s
top
= "
####
####
";
type
Int_
0_10
= in
t with
0..1
0;ty
pe In
t_1_
10 =
int w
ith 1
..10;
var
s : I
nt_0
_10;
var
r : I
nt_1
_10;
fun
Ok(
s : I
nt_0
_10,
r :
Int_
1_10
) =
(r≤
s);
(n,p
)(n
,p)
if O
k(s,
r)th
en 1
`(n,
p)el
se e
mpt
y
(n,p
)
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
kn
k
if n=
kth
en k
+1
else
k
if O
k(s,
r)th
en 1
`nel
se e
mpt
y
n
kn
str
ssn
119
Col
oure
d P
etri
Net
s 19
Sen
d pa
cket
Sen
d
INT
xDA
TA
8
1`(1
,"M
odel
lin")
+ 1
`(2,
"g a
nd A
n")
+ 1
`(3,
"aly
sis
b")
+ 1
`(4,
"y M
eans
")
+ 1
`(5,
"of C
olou
")+
1`(
6,"r
ed P
etr"
)+
1`(
7,"i
Net
s##"
)+
1`(
8,"#
####
###"
)
Sen
dP
acke
tA
INT
xDA
TA
Nex
tSen
dIN
T
1
11`
1(n,p
)
(n,p
) n
Onl
y th
e bi
ndin
g <
n=1,
p= "M
odel
lin">
is e
na
ble
d.
•W
hen
the
bind
ing o
ccu
rs it
add
s a
toke
n to
plac
e A
. The
toke
n re
pres
ents
that
the
pack
et(1
,"M
odel
lin")
is s
ent t
o th
e ne
twor
k.
•T
he p
acke
t is n
ot r
emov
ed fr
om p
lace
S
en
d and
the
Ne
xtS
en
d cou
nter
is no
t cha
nged
.
Col
oure
d P
etri
Net
s 20
Tra
nsm
it pa
cket
A
INT
xDA
TA
11`
(1,"
Mod
ellin
")
Tra
nsm
itP
acke
t
RP
8
Int_
0_10
11`
8
B
INT
xDA
TA
(n,p
)
if O
k(s,
r)th
en 1
`(n,
p)el
se e
mpt
y
s
The
re a
re n
ow 10
en
ab
led
bin
din
gs:
•T
hey
are
all o
f the
form
<n=
1, p
= "M
odel
lin",
s=
8, r
=…
>.
•T
he v
aria
ble
r ca
n ta
ke
10
diff
ere
nt
valu
es,
beca
use
the
type
of r
is d
efin
ed to
con
tain
the
inte
gers
1. .1
0.
The
fun
ctio
n O
k(s,
r) c
heck
s w
heth
er r
≤
s.
•F
or r
∈1.
.8, O
k(s,
r) =
tru
e. T
his
mea
ns th
at th
eto
ken
is m
oved
from
A to
B, i
.e.,
that
the
pack
et is
succ
ess
fully
tra
nsm
itte
d ove
r th
e ne
twor
k.
•F
or r
∈9.
.10,
Ok(
s,r)
= f
als
e. T
his
mea
ns th
at n
oto
ken
is a
dded
to B
, i.e
., th
at th
e pa
cket
is
lost
.
•T
he C
PN
sim
ulat
or m
ake ra
nd
om
cho
ices
betw
een
enab
led
bind
ings
. Hen
ce th
ere
is
80
%ch
ance
for s
ucc
ess
ful t
ran
sfe
r.
120
Col
oure
d P
etri
Net
s 21
Rec
eive
pac
ket
B
INT
xDA
TA
11`
(1,"
Mod
ellin
")
Rec
eive
Pac
ket
Nex
tRec
INT1
11`
1
Rec
eive
dD
AT
A
""1
1`""
CIN
T
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
k
k
if n=
kth
en k
+1
else
k
str
It is
che
cked
whe
ther
the
num
ber
of th
e in
com
ing
pack
et n
ma
tch
es t
he n
umbe
r of
the
expe
cted
pack
et k
.
Col
oure
d P
etri
Net
s 22
Cor
rect
pac
ket n
umbe
r
B
11`
(3,"
alys
is b
")
Rec
eive
Pac
ket
Nex
tRec
11`
3
Rec
eive
d1
1`"M
odel
ling
and
An"
C
(n,p
)1
1`(3
,"al
ysis
b")
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
11`
"Mod
ellin
g an
d A
naly
sis
b"
if n=
kth
en k
+1
else
k
11`
4
k
11`
3
if n=
kth
en k
+1
else
k
11`
4
str1
1`"M
odel
ling
and
An"
•T
he d
ata
in th
e pa
cket
is
con
cate
na
ted to
the
data
alre
ady
rece
ived
.
•T
he N
ext
Re
c cou
nter
is in
crea
sed
by o
ne.
•A
n a
ckn
ow
led
ge
me
nt
me
ssa
ge
is s
ent.
It co
ntai
nsth
e nu
mbe
r of
the
next
pac
ket w
hich
the
rece
iver
wan
ts to
get
.
121
Col
oure
d P
etri
Net
s 23
Wro
ng p
acke
t num
ber
B
11`
(2,"
g an
d A
n") R
ecei
veP
acke
tN
extR
ec1
11`
3
Rec
eive
d1
1`"M
odel
ling
and
An"
C
(n,p
)1
1`(2
,"g
and
An"
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
11`
"Mod
ellin
g an
d A
n"
if n=
kth
en k
+1
else
k
11`
3
k
11`
3
if n=
kth
en k
+1
else
k
11`
3
str1
1`"M
odel
ling
and
An"
•T
he d
ata
in th
e pa
cket
is
ign
ore
d.
•T
he N
ext
Re
c cou
nter
is u
ncha
nged
.
•A
n a
ckn
ow
led
ge
me
nt
me
ssa
ge
is s
ent.
It co
ntai
nsth
e nu
mbe
r of
the
next
pac
ket w
hich
the
rece
iver
wan
ts to
get
.
Col
oure
d P
etri
Net
s 24
Tra
nsm
it ac
know
ledg
emen
t
CIN
T
11`
2
Tra
nsm
itA
ckno
w.
DIN
T
RA
Int_
0_10
81
1`8
nif
Ok(
s,r)
then
1`n
else
em
pty
s
Thi
s tr
ansi
tion
wor
ks in
a s
imila
r w
ay a
sT
ran
smit
Pa
cke
t.
•T
he to
ken
on p
lace
R
A de
term
ines
the
succ
ess
rate
for
tran
smis
sion
of a
ckno
wle
dgem
ents
.
•W
hen
RA
cont
ains
a to
ken
with
val
ue 8
, the
succ
ess
rate
is
80
%.
•W
hen
RA
cont
ains
a to
ken
with
val
ue 1
0,
no
ackn
owle
dgem
ents
are
lost
.
•W
hen
RA
cont
ains
a to
ken
with
val
ue 0
, a
llac
know
ledg
emen
ts a
re lo
st.
122
Col
oure
d P
etri
Net
s 25
Rec
eive
ack
now
ledg
emen
t
Rec
eive
Ack
now
.
Nex
tSen
dIN
T
1
11`
1
DIN
T
11`
2
n
kn
Whe
n an
ack
now
ledg
emen
t a
rriv
es
to th
e Se
nd
er it
is u
sed
to u
pdat
e th
e Ne
xtS
en
d cou
nter
.
•In
this
cas
e th
e co
unte
r va
lue
beco
mes
2, a
ndhe
nce
the S
en
de
r will
beg
in to
sen
d pa
cket
num
ber
2.
Col
oure
d P
etri
Net
s 26
Inte
rmed
iate
sta
te
Sen
dP
acke
tT
rans
mit
Pac
ket
Rec
eive
Pac
ket
Rec
eive
Ack
now
.T
rans
mit
Ack
now
.
Sen
d
INT
xDA
TA
8
1`(1
,"M
odel
lin")
+ 1
`(2,
"g a
nd A
n")
+ 1
`(3,
"aly
sis
b")
+ 1
`(4,
"y M
eans
")
+ 1
`(5,
"of C
olou
")+
1`(
6,"r
ed P
etr"
)+
1`(
7,"i
Net
s##"
)+
1`(
8,"#
####
###"
)
Nex
tSen
dIN
T
1
11`
5
DIN
T
11`
6
A
INT
xDA
TA
Rec
eive
dD
AT
A
""1
1`"M
odel
ling
and
Ana
lysi
s by
Mea
ns
of C
olou
"
Nex
tRec
INT
1
11`
6
B
INT
xDA
TA
11`
(5,"
of C
olou
")
CIN
T
11`
6
Sen
der
Net
wo
rkR
ecei
ver
RP
8
Int_
0_10
11`
8
RA
Int_
0_10
81
1`8
(n,p
)(n
,p)
if O
k(s,
r)th
en 1
`(n,
p)el
se e
mpt
y
(n,p
)
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
k
n
k
if n=
kth
en k
+1
else
k
if O
k(s,
r)th
en 1
`nel
se e
mpt
y
n
kn
n
str
ss
•T
he R
ece
ive
r is e
xpec
ting
pack
age
no. 6
. Thi
sm
eans
that
it h
as s
ucce
ssfu
lly r
ecei
ved
the
first
5pa
cket
s.
•T
he S
en
de
r is s
till s
endi
ng p
acke
t no.
5. I
n a
mom
ent i
t will
rec
eive
an
ackn
owle
dgem
ent
cont
aini
ng a
req
uest
for
pack
et n
o. 6
.
•W
hen
the
ackn
owle
dgem
ent i
s re
ceiv
ed th
eN
ext
Se
nd c
ount
er is
upd
ated
and
the
Se
nd
er w
illst
art s
endi
ng p
acke
t no.
6.
123
Col
oure
d P
etri
Net
s 27
Fin
al s
tate
Sen
dP
acke
tT
rans
mit
Pac
ket
Rec
eive
Pac
ket
Rec
eive
Ack
now
.T
rans
mit
Ack
now
.
Sen
d
INT
xDA
TA
8
1`(1
,"M
odel
lin")
+ 1
`(2,
"g a
nd A
n")
+ 1
`(3,
"aly
sis
b")
+ 1
`(4,
"y M
eans
")
+ 1
`(5,
"of C
olou
")+
1`(
6,"r
ed P
etr"
)+
1`(
7,"i
Net
s##"
)+
1`(
8,"#
####
###"
)
Nex
tSen
dIN
T
1
11`
9
DIN
TA
INT
xDA
TA
Rec
eive
dD
AT
A
""1
1`"M
odel
ling
and
Ana
lysi
s by
Mea
ns
of C
olou
red
Pet
ri N
ets#
#" Nex
tRec
INT
1
11`
9
B
INT
xDA
TA
CIN
T
Sen
der
Net
wo
rkR
ecei
ver
RP
8
Int_
0_10
11`
8
RA
Int_
0_10
81
1`8
(n,p
)(n
,p)
if O
k(s,
r)th
en 1
`(n,
p)el
se e
mpt
y
(n,p
)
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
k
n
k
if n=
kth
en k
+1
else
k
if O
k(s,
r)th
en 1
`nel
se e
mpt
y
n
kn
n
str
ss
•W
hen
the
last
pac
ket,
i.e.,
pack
et n
o. 8
rea
ches
the
Re
ceiv
er a
n ac
know
ledg
emen
t with
val
ue 9
isse
nt.
•W
hen
this
ack
now
ledg
emen
t rea
ches
the
Se
nd
er
the
Ne
xtS
en
d cou
nter
is u
pdat
ed to
9.
•T
his
mea
ns th
at th
e Se
nd
Pa
cke
t tran
sitio
n no
long
er c
an o
ccur
, and
hen
ce th
e tr
ansm
issi
onst
ops.
Col
oure
d P
etri
Net
s 28
Par
t 2: H
iera
rchi
cal C
P-n
ets
A h
iera
rchi
cal C
P-n
et c
onta
ins
a nu
mbe
r of
inte
rre
late
d s
ub
ne
ts– ca
lled p
ag
es.
D
INT
xIN
T
A
INT
xDA
TA
Rec
eive
dD
AT
A
""
B
INT
xDA
TA
CIN
T
Sen
der
HS
Sen
der
Net
wor
k
HS
Net
wor
k
Rec
eive
r
HS
Rec
eive
r
Sim
ple
Pro
toco
l
Sen
dP
acke
t
Nex
tSen
dIN
T
1
Rec
eive
Ack
now
.
Sen
d
INT
xDA
TA
DIN
TA
INT
xDA
TA
Tra
nsm
itP
acke
t
RP
8
Int_
0_10
RA
Int_
0_10
8 Tra
nsm
itA
ckno
w.
DIN
T
CIN
T
A
INT
xDA
TA
B
INT
xDA
TA
Nex
tRec
INT
1R
ecei
veP
acke
t
CIN
T
Rec
eive
dD
AT
A
""
B
INT
xDA
TA
Sen
der
Rec
eive
r N
etw
ork
Out
Out
Out
In
In
InO
ut
In
I/O
(n,p
)
kn
n
(n,p
)
n
s
s
(n,p
)
n
if O
k(s,
r)th
en 1
`nel
se e
mpt
y
if O
k(s,
r)th
en 1
`(n,
p)el
se e
mpt
y
k if n=
kth
en k
+1
else
k
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
k
str
124
Col
oure
d P
etri
Net
s 29
Sub
stitu
tion
tran
sitio
nsA
pag
e m
ay c
onta
in o
ne o
re m
ore
sub
stitu
tion
tra
nsi
tion
s.
•E
ach
subs
titut
ion
tran
sitio
n is
rel
ated
to a
p
ag
e,i.e
., a s
ub
ne
t pro
vidi
ng a
mo
re d
eta
iled
de
scrip
tion t
han
the
tran
sitio
n its
elf.
•T
he p
age
is a
sub
pa
ge o
f the
sub
stitu
tion
tran
sitio
n.
The
re is
a we
ll-d
efin
ed
inte
rfa
ce be
twee
n a
subs
titut
ion
tran
sitio
n an
d its
sub
page
:
•T
he p
lace
s su
rrou
ndin
g th
e su
bstit
utio
n tr
ansi
tion
are
sock
et
pla
ces.
•T
he s
ubpa
ge c
onta
ins
a nu
mbe
r of
p
ort
pla
ces.
•S
ocke
t pla
ces
are re
late
d to
por
t pla
ces
– in
asi
mila
r w
ay a
s ac
tual
par
amet
ers
are
rela
ted
tofo
rmal
par
amet
ers
in a
pro
cedu
re c
all.
•A
soc
ket p
lace
has
alw
ays
the
sam
e m
ark
ing a
sth
e re
late
d po
rt p
lace
. The
two
plac
es a
re ju
std
iffe
ren
t vi
ew
s of t
he s
ame
plac
e.
Su
bst
itutio
n t
ran
sitio
ns w
ork
in a
sim
ilar
way
as
the
refin
emen
t prim
itive
s fo
und
in m
any
syst
emde
scrip
tion
lang
uage
s –
e.g.
, SA
DT
dia
gram
s.
Col
oure
d P
etri
Net
s 30
Pag
es c
an b
e us
ed m
ore
than
onc
e
D
INT
xIN
T
A
INT
xDA
TA
Rec
eive
dD
AT
A
""
B1
INT
xDA
TA
C1
INT
Sen
der
HS
Sen
der
Net
wor
k
HS
Net
wor
k
Rec
No1
HS
Rec
eive
rB
1->
BC
1->
C
B2
INT
xDA
TA
C2
INT
Rec
No2
HS Rec
eive
rB
2->
BC
2->
C
Rec
eive
dD
AT
A
""
Sim
ple
Pro
toco
l wit
h 2
Rec
eive
rs
Sen
dP
acke
t
Nex
tSen
dIN
T
1
Rec
eive
Ack
now
.
Sen
d
INT
xDA
TA
DIN
TxI
NT
A
INT
xDA
TA
Tra
nsm
itP
acke
t
RP
8
Int_
0_10
RA
1In
t_0_
10
8 Tra
nsm
itA
ckno
w.
DIN
TxI
NT
C1
INTB2
INT
xDA
TA
A
INT
xDA
TA
B1
INT
xDA
TA
RA
2In
t_0_
108Tra
nsm
itA
ckno
w.
C2
INT
Nex
tRec
INT
1R
ecei
veP
acke
t
CIN
T
Rec
eive
dD
AT
A
""
B
INT
xDA
TA
Sen
der
Rec
eive
r N
etw
ork
Out
Out
Out
Out
In
In
In
Out
In
In
I/O
(n,p
)
km
in(n
1,n2
)
n
(n,p
)
1`(n
1,1)
+1`
(n2,
2)
ss
(n,p
)
if O
k(s,
r2)
then
1`(
n,p)
else
em
pty n
if O
k(s,
r)th
en 1
`(n,
1)el
se e
mpt
y
if O
k(s,
r1)
then
1`(
n,p)
else
em
pty
s
nif
Ok(
s,r)
then
1`(
n,2)
else
em
pty
k if n=
kth
en k
+1
else
k
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
k
str
The
re a
re tw
o di
ffere
nt in
sta
nce
s of t
he R
ece
ive
rpa
ge. E
ach
inst
ance
has
its
ow
n m
ark
ing
.
125
Col
oure
d P
etri
Net
s 31
Rin
g ne
twor
k
4to1
PA
CK
1to2
PA
CK
Site
1
HS
Site
4to1
->In
com
ing
1to2
->O
utgo
ing
2to3
PA
CK
Site
2
HS
Site
1to2
->In
com
ing
2to3
->O
utgo
ing
3to4
PA
CK
Site
3H
S
Site
2to3
->In
com
ing
3to4
->O
utgo
ing
Site
4H
S
Site
3to4
->In
com
ing
4to1
->O
utgo
ing
Rin
g N
etw
ork
New
Pac
k
Pac
kNo
INT
1
Pac
kage
PA
CK
Sen
d
Out
goin
gPA
CK O
ut
Inco
min
gP
AC
KIn
Rec
eive
Sit
e
Rec
eive
d
PA
CK
n+1
n
{se=
this
(), r
e=r,
no=
n}
p
if #r
e p
<>
this
()th
en 1
`pel
se e
mpt
y
p
if #r
e p
<>
this
()th
en 1
`pel
se e
mpt
y
if #r
e p
= th
is()
then
1`p
else
em
pty
if #r
e p
= th
is()
then
1`p
else
em
pty
Col
oure
d P
etri
Net
s 32
For
mal
def
initi
on o
f hie
rarc
hica
lC
P-n
ets
The
syn
tax a
nd se
ma
ntic
s of h
iera
rchi
cal C
P-n
ets
have
form
al d
efin
itio
ns –
sim
ilar
to th
e de
finiti
ons
for
non-
hier
arch
ical
CP
-net
s
Eac
h hi
erar
chic
al C
P-n
et h
as a
n e
qu
iva
len
tno
n-hi
erar
chic
al C
P-n
et –
and
vic
e ve
rsa.
•T
he tw
o ki
nds
of n
ets
have
the
sam
eco
mp
uta
tion
al p
ow
er – b
ut h
iera
rchi
cal C
P-n
ets
have
muc
h m
ore m
od
elli
ng
po
we
r.
•T
he e
qu
iva
len
ce is
use
d fo
r the
ore
tica
l pu
rpo
ses.
•In
pra
ctic
e, w
e ne
ver t
rans
late
a h
iera
rchi
cal
CP
-net
into
a n
on-h
iera
rchi
cal C
P-n
et –
or
vice
vers
a.
126
Col
oure
d P
etri
Net
s 33
CP
-net
s m
ay b
e la
rge
A ty
pica
l in
du
stria
l ap
plic
atio
n of C
P-n
ets
cont
ains
:
•10
-200
pag
es.
•50
-100
0 pla
ces
an
d t
ran
sitio
ns.
•10
-200
colo
ur
sets
.
Thi
s co
rres
pond
s to
th
ou
san
ds/
mill
ion
s o
f n
od
es
ina
Pla
ce/T
rans
ition
Net
.
Mos
t of t
he in
dust
rial a
pplic
atio
ns w
ould
be
tota
llyim
po
ssib
le w
ithou
t:
•C
olou
rs.
•H
iera
rchi
es.
•C
ompu
ter
tool
s.
Col
oure
d P
etri
Net
s 34
Pro
toco
l for
tele
phon
e ne
twor
kT
rans
port
laye
r of
a p
roto
col f
or
dig
ital t
ele
ph
on
eco
mm
un
ica
tion.
ISD
N#
1
US
ER
_T
OP
#2
NU
LL
#3
DE
CL
AR
E#
4
CA
LL
_R
EC
#1
1
CO
NN
EC
T#
12
INC
OM
ING
#1
3
HIE
RA
RC
HY
#1
00
10
CA
LL
_IN
I#6
OV
ER
LA
P#
9
OU
TG
OIN
G#15
CA
LL
_D
EL
#1
6
NU
LL
_S
ET
#5
AC
TIV
E#
7
DIS
CO
NN
E#
8
RE
LE
AS
E#
17
DIS
C_
IND
#1
8
NE
T_
TO
P#
19
NU
LL
#2
0U
_S
ET
UP
#2
1
N_
SE
TU
P#
22
RO
UT
ING
#2
4
OU
TG
OIN
G#26 N
_E
_P
AR
T#
27
CA
LL
_D
EL
#2
8
OV
ER
LA
P#
29
CO
NN
EC
T#
30
N_
D_
PA
RT
#3
1
CA
LL
_R
EC
#3
2
DIS
CO
NN
E#
33
DIS
CO
NN
E#
34
RE
LE
AS
E#
35
AC
TIV
E#
36
INC
OM
ING
#3
7
CA
LL
_P
RE
#3
8
UR
EQ
_G
EN
#3
9
U_
DIS
C#
23
U_
RE
L#
25
U_
RE
L_
CO
#4
0
U_
PR
OG
#4
1
U_
INF
O#
42
N_
HO
LD
#4
4
U_
HO
LD
#4
5
Fig
. 7
.1
{
Use
rs
U1
U7
U8
U9
U0
U2
U3
U4
U1
0
U1
1
U1
9
U1
2
N0
N3
N4
N2
N8
N7
N1
1
N1
2
N1
9
N1
0
N9
N6
Ne
two
rks
Ove
rvie
w o
f the
hie
rarc
hy s
truc
ture
:
•E
ach n
od
e re
pres
ents
a
pa
ge,
i.e.
, a s
ubne
t.
•E
ach a
rc r
epre
sent
s a tr
an
sitio
n s
ub
stitu
tion
.
127
Col
oure
d P
etri
Net
s 35
Tw
o of
the
mos
t abs
trac
t pag
es
Use
rToN
etw
orkM
essa
ge
Net
wor
kToU
ser Mes
sage
Use
rsN
etw
orks
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
----
Net
wor
kToU
ser
Mes
sage
Use
rToN
etw
ork
Mes
sage
IntU
serR
eqUIn
tReq
U1
U2
U3
U4
U7
U8
U9
U10
U11
U12
U19
U0
UR
EQ
In
Out
Col
oure
d P
etri
Net
s 36
Typ
ical
pag
e fo
r th
e us
er s
ite
(u,{
mt=
DIS
C,
cr=
cref
,ai
=nu
ll})
(u,{
mt =
RE
L_C
OM
,cr
= c
ref,
ai =
nul
l})
(u, {
mt=
ST
AT
US
,cr
=cr
ef,
ai=
Sta
tus
8})(u
,m)
(u,m
)
(u,c
ref,b
,s)
(u,c
ref,b
,s)
(u,c
ref,b
,s)
(u,0
,non
e,s)
(u,{
mt=
CLE
AR
_RE
Q,
ai=
Cal
lref c
ref}
)
U8
Use
rSta
te
Net
wor
kToU
ser
Mes
sage
In
[#m
t m =
ST
AT
US
_EN
Q,
cref
= #
cr m
]
[#m
t m =
RE
L_C
OM
,cr
ef=
#cr
m]
[#m
t m =
DIS
C,
cref
= #
cr m
]
[#m
t m =
CO
NN
_AC
K,
cref
= #
cr m
]
Use
rToN
etw
ork
Mes
sage
Out
U11
U10
U12
U0
[#m
t m =
RE
L,cr
ef=
#cr
m]
CLE
AR
_RE
Q
Inte
rnal
Use
rReq U
IntR
eq
In(u
,cre
f,b,s
)
Thi
s pa
ge d
escr
ibes
the po
ssib
le a
ctio
ns th
at c
anha
ppen
whe
n th
e us
er s
ite is
in s
tate
U
8:
•F
rom
the n
etw
ork fi
ve d
iffer
ent k
inds
of
mes
sage
s m
ay b
e re
ceiv
ed.
•In
add
ition
ther
e is
one
kin
d of
in
tern
al u
ser
req
ue
st.
•In
thre
e of
the
case
s a ne
w m
ess
ag
e is s
ent t
o th
en
etw
ork
site
.
128
Col
oure
d P
etri
Net
s 37
Typ
ical
tran
sitio
n
(u, {
mt=
ST
AT
US
,cr
=cr
ef,
ai=
Sta
tus
8})
(u,m
)
(u,c
ref,b
,s)
Net
wor
kToU
ser
Mes
sage
[#m
t m =
ST
AT
US
_EN
Q,
cref
= #
cr m
]
Use
rToN
etw
ork M
essa
ge
U8
Use
rSta
te
type
Use
rSta
te =
prod
uct U
ser
* C
allR
ef
*
BC
hanN
ame
* H
oldS
tatu
s;
type
Mes
sage
Rec
=
r
ecor
d m
t : M
essa
geT
ype
* c
r : C
allR
efer
ence
* a
i : M
essa
geD
ata;
type
Mes
sage
=
p
rodu
ct U
ser
* M
essa
geR
ec;
Thi
s tr
ansi
tion
desc
ribes
the ac
tion
s tha
t are
take
nw
hen
a Sta
tus
En
qu
iry m
essa
ge is
rec
eive
d in
sta
teU
8:
•T
he g
uard
che
cks
that
the
mes
sage
is a
S
tatu
sE
nq
uiry
mes
sage
. It a
lso
chec
ks th
at th
e C
all
Re
fere
nce
is c
orre
ct (
i.e.,
mat
ches
the
one
in th
eU
ser
Sta
te to
ken
at p
lace
U8)
.
•A
Sta
tus
me
ssa
ge is s
ent t
o th
e ne
two
rk s
ite. It
tells
that
the
user
site
is in
sta
te U
8.
Col
oure
d P
etri
Net
s 38
SD
L de
scrip
tion
of u
ser
page
CO
NN
AC
KD
ISC
RE
LR
EL
CO
MS
TA
TU
SE
NQ
AN
YO
TH
ER
ME
SS
AG
E
CLE
AR
RE
QU
ES
T
8 C
ON
NE
CT
RE
QU
ES
T
DIS
C
11
CO
NN
EC
TB
-CH
AN
NE
LT
O U
SE
R
10
12R
ELE
AS
EC
RV
RE
LEA
SE
CR
V
RE
LC
OM 0
0
FO
RM
CA
US
EC
ALL
ST
AT
E(U
8 O
R U
10)
ST
AT
US
8
OP
TIO
N
Eac
h ve
rtic
al s
trin
g o
f S
DL
sym
bo
ls des
crib
es a
sequ
ence
of a
ctio
ns –
whi
ch is
tran
slat
ed in
to a
sin
gle
CP
N t
ran
sitio
n.
•T
he tr
an
sla
tion
from
SD
L to
CP
N w
as d
one
ma
nu
ally
.
•T
he tr
ansl
atio
n is
str
aigh
tforw
ard
and
it co
uld
easi
ly b
e au
tom
ate
d.
The
gra
phic
al s
hape
of a
nod
e ha
s a
we
ll-d
efin
ed
mea
ning
in S
DL.
•In
the
CP
-net
the
shap
e is
ret
aine
d –
to im
prov
eth
e re
ad
ab
ility
. It h
as n
o fo
rmal
mea
ning
.
129
Col
oure
d P
etri
Net
s 39
Typ
ical
pag
e fo
r th
e ne
twor
k si
te
N6
Net
Sta
te
Net
Fro
mN
et
NIn
tReq
Use
rToN
etw
ork
Mes
sage
"E"
[#m
t m
= A
LE
RT
, c
ref=
#cr
m]
Net
ToN
et NIn
tReq N
etw
orkT
oUse
r
Mes
sage
"D"
FIR
ST
TIM
EO
UT
T
303
T30
3
NT
imer
Cou
nt
NB
CB
Cha
n
N0
Net
Sta
teN
7N
etS
tate
[#m
t m
=
CA
LL
_PR
OC
,cr
ef=
#cr
m]
[#m
t m
=
RE
L_C
OM
, c
ref=
#cr
m]
T31
0
NT
imer
N9
Net
Sta
te
Tim
eOut
Ena
b
SE
CO
ND
TIM
EO
UT
T
303
NB
C
BC
han
In
In
Out
Out
[cou
nt=
first
]%(n
,{m
t=N
_ALE
RT
,ai
=nn
ull},
nnr)
(n,{
mt=
N_P
RO
G,
ai=
nnul
l},nn
r)
(n,c
ref,f
irst)
(n,c
ref,c
ount
)
(n,u
,cre
f,b,
nnr)
(n
,no,
0, n
one,
0)(n
,u,c
ref,
b,n
nr)
(n,u
,cre
f,b,n
nr)
(u,m
)
(n,c
ref,c
ount
)
(n,c
ref)
(u,m
)
(n,b
, 0
,free
)(u
,{m
t=S
ET
UP
,cr
=cr
ef,
ai=
null}
)
(n,c
ref,s
econ
d)
(n,b
,cre
f,in
_use
)
(n,{
mt=
N_P
RO
G,
ai=
nnul
l},nn
r)
e
(n,{
mt=
N_P
RO
G,
ai=
nnul
l},nn
r)
(n,b
, 0
,free
)
(n,c
ref,s
econ
d)
(n,u
,cre
f,b,n
nr)
(n,b
,cre
f,in
_use
)
Sim
ilar
stru
ctur
e as
for
the
user
pag
e –
but s
light
lym
ore
com
plex
.
Col
oure
d P
etri
Net
s 40
SD
L de
scrip
tion
of n
etw
ork
page
CA
LLP
RO
CA
LER
TR
EL
CO
MP
T3
03
EXPI
RES
DE
6 C
ALL
PR
ES
EN
T
ST
OP
T30
3
ST
AR
TT
310
PT
.M
ULT
.
RE
TA
IN C
AU
SE
FR
OM
FIR
ST
RE
L C
OM
P
SE
ND
PR
OG
WIT
H S
IG =
AU
D.
RIN
G A
ND
RE
TA
INE
D C
ALL
S T
O
CA
LLIN
G U
SE
R
ST
OP
T30
3
RE
LEA
SE
B-C
HA
NN
EL
AN
D C
RV
0N
ULL
RE
CO
RD
IND
ICA
TE
DT
ER
MIN
AL
ST
OP
T30
3
FIR
ST
ALE
RT
SE
ND
CA
LLIN
GU
SE
R A
LER
T
7 C
ALL
RE
CE
IVE
D6
CA
LLP
RE
SE
NT
SE
ND
PR
OG
TO
CA
LLIN
G U
SE
RW
ITH
CA
US
E =
NO
US
ER
RE
SP
ON
DIN
G
SE
ND
PR
OG
TO
CA
LLIN
G U
SE
RW
ITH
SIG
= A
UD
.R
ING
AN
D IN
-BA
ND
AU
DIB
LE R
ING
9 IN
CO
MIN
GC
ALL
PR
OC
EE
DIN
G
NO
YES
FIR
ST
TIM
EO
UT
RE
LEA
SE
B-C
HA
NN
EL
AN
D C
RV
SE
TUP
ST
AR
TT
303
0N
ULLN
O
NO
YES
YES
Sim
ilar
stru
ctur
e as
for
the
user
pag
e –
but s
light
lym
ore
com
plex
.
It is
eas
y to
see
that
ther
e is
a v
ery
stra
ight
forw
ard
rela
tions
hip
betw
een
the SD
L p
ag
e and
the
corr
espo
ndin
g CP
N p
ag
e.
130
Col
oure
d P
etri
Net
s 41
Som
e pa
ges
are
used
man
y tim
esIS
DN
#1
US
ER
_T
OP
#2
NU
LL
#3
DE
CL
AR
E#
4
CA
LL
_R
EC
#1
1
CO
NN
EC
T#
12
INC
OM
ING
#1
3
HIE
RA
RC
HY
#1
00
10
CA
LL
_IN
I#6
OV
ER
LA
P#
9
OU
TG
OIN
G#15
CA
LL
_D
EL
#1
6
NU
LL
_S
ET
#5
AC
TIV
E#
7
DIS
CO
NN
E#
8
RE
LE
AS
E#
17
DIS
C_
IND
#1
8
NE
T_
TO
P#
19
NU
LL
#2
0U
_S
ET
UP
#2
1
N_
SE
TU
P#
22
RO
UT
ING
#2
4
OU
TG
OIN
G#26 N
_E
_P
AR
T#
27
CA
LL
_D
EL
#2
8
OV
ER
LA
P#
29
CO
NN
EC
T#
30
N_
D_
PA
RT
#3
1
CA
LL
_R
EC
#3
2
DIS
CO
NN
E#
33
DIS
CO
NN
E#
34
RE
LE
AS
E#
35
AC
TIV
E#
36
INC
OM
ING
#3
7
CA
LL
_P
RE
#3
8
UR
EQ
_G
EN
#3
9
U_
DIS
C#
23
U_
RE
L#
25
U_
RE
L_
CO
#4
0
U_
PR
OG
#4
1
U_
INF
O#
42
N_
HO
LD
#4
4
U_
HO
LD
#4
5
Fig
. 7
.1
{
Use
rs
U1
U7
U8
U9
U0
U2
U3
U4
U1
0
U1
1
U1
9
U1
2
N0
N3
N4
N2
N8
N7
N1
1
N1
2
N1
9
N1
0
N9
N6
Ne
two
rks
•43
pag
es w
ith m
ore
than
100
pag
e in
stan
ces.
•T
he e
ntire
mod
ellin
g of
this
– fa
irly
com
plex
prot
ocol
– w
as m
ade
in o
nly 3
we
eks
(by
a si
ngle
pers
on).
•A
ccor
ding
to e
ngin
eers
at t
he p
artic
ipat
ing
tele
com
mun
icat
ions
com
pany
, the
CP
N m
odel
was
the m
ost
de
taile
d beh
avio
ural
mod
el th
atth
ey h
ad e
ver
seen
for
such
pro
toco
ls.
Col
oure
d P
etri
Net
s 42
Pra
ctic
al u
se o
f CP
-net
sC
P-n
ets
are
used
in
ma
ny
diff
ere
nt
are
as. A
few
sele
cted
exa
mpl
es a
re:
•C
omm
unic
atio
n pr
otoc
ols
(B
RI,
DQ
DB
, AT
M).
•V
LSI c
hips
(cl
ocke
d an
d se
lf-tim
ed).
•B
anki
ng p
roce
dure
s (c
heck
pro
cess
ing
and
fund
str
ansf
er).
•C
orre
ctne
ss o
f AD
A p
rogr
ams
(ren
dezv
ous
stru
ctur
e).
•T
eles
hopp
ing
syst
ems.
•M
ilita
ry s
yste
ms
(rad
ar c
ontr
ol p
ost a
nd n
aval
vess
el).
•S
ecur
ity s
yste
ms
(intr
usio
n al
arm
s, e
tc.)
.
•F
lexi
ble
man
ufac
turin
g.
131
Col
oure
d P
etri
Net
s 43
Sum
mar
y of
pra
ctic
al e
xper
ienc
esG
rap
hic
al r
ep
rese
nta
tion a
nd e
xecu
tab
ility
are
extr
emel
y im
port
ant.
Mos
t pra
ctic
al m
odel
s ar
e larg
e.
•T
hey
cann
ot b
e co
nstr
ucte
d w
ithou
t the
hie
rarc
hy
con
cep
ts.
•N
eith
er c
an th
ey b
e co
nstr
ucte
d or
ver
ified
with
out t
he co
mp
ute
r to
ols
.
CP
-net
s ar
e of
ten
used
to
ge
the
r with
oth
ergr
aphi
cal d
escr
iptio
n la
ngua
ges,
suc
h as
SA
DT
,S
DL
and
bloc
k di
agra
ms.
•T
his
mea
ns th
at th
e us
er d
oes
not h
ave
to le
arn
aco
mpl
etel
y ne
w la
ng
ua
ge
.
CP
-net
s ar
e w
ell-s
uite
d fo
r verific
atio
n of
exi
stin
gde
sign
s –
in p
artic
ular
con
curr
ent s
yste
ms.
•C
P-n
ets
can
also
be
used
to
de
sig
n new
sys
tem
s.
•T
hen
it is
pos
sibl
e to
use
the insi
gh
t gai
ned
thro
ugh
the
mod
ellin
g, s
imul
atio
n an
dve
rific
atio
n ac
tiviti
es –
to im
pro
ve th
e de
sign
itsel
f.
Col
oure
d P
etri
Net
s 44
Par
t 3:
Con
stru
ctio
n an
dS
imul
atio
n of
CP
-net
sC
P-n
ets
have
an in
teg
rate
d set
of r
ob
ust c
ompu
ter
tool
s w
ith re
liab
le s
up
po
rt:
•C
on
stru
ctio
n and
mo
difi
catio
n of C
PN
mod
els.
•S
ynta
x ch
eck
ing (e.
g., t
ypes
and
mod
ule
inte
rfac
es).
•In
tera
ctiv
e s
imu
latio
n, e.g
., to
gai
n ad
ditio
nal
unde
rsta
ndin
g of
the
mod
elle
d sy
stem
. Can
als
obe
use
d fo
r de
bu
gg
ing.
•A
uto
ma
tic s
imu
latio
ns, e
.g.,
to o
btai
n pe
rfor
man
cem
easu
res.
Can
als
o be
use
d fo
r p
roto
typ
ing.
•V
erific
atio
n to
pro
ve b
ehav
iour
al p
rope
rtie
s.
–S
tate
sp
ace
s (al
so c
alle
d re
acha
bilit
y gr
aphs
and
occu
rren
ce g
raph
s).
–P
lace
inva
ria
nts.
The
com
pute
r to
ols
are
avai
labl
e on
:
•S
un S
parc
with
Sol
aris
.
•H
P w
ith H
PU
X
•In
tel P
Cs
with
Lin
ux.
•M
acin
tosh
with
Mac
OS
.
132
Col
oure
d P
etri
Net
s 45
CP
N e
dito
r
Eac
h pa
ge
is s
how
n in
its
own w
ind
ow
.
The
use
r pe
rfor
ms
an o
pera
tion
by s
elec
ting
ano
bje
ct a
nd a
com
ma
nd f
or it
, e.g
.:
•S
elec
t a tra
nsi
tion
(by
poin
ting
with
the
mou
se).
•S
elec
t the
des
ired co
mm
an
d (by
poi
ntin
g in
the
corr
espo
ndin
g dr
op-d
own
men
u).
Com
man
ds c
an b
e pe
rfor
med
on
a se
t o
f o
bje
cts.
Col
oure
d P
etri
Net
s 46
Edi
tor
know
s sy
ntax
of C
P-n
ets
Som
e ki
nds
of e
rror
s ar
e imp
oss
ible,
e.g
.:
•A
n ar
c be
twee
n two
pla
ces o
r tw
o t
ran
sitio
ns.
•A
pla
ce w
ith tw
o c
olo
ur
sets o
r an
arc
with
two
arc
exp
ress
ion
s.
•A
tran
sitio
n w
ith a
colo
ur
set.
•P
ort a
ssig
nmen
t inv
olvi
ng a
pla
ce w
hich
is a
no
n-s
ock
et or
a n
on
-po
rt.
•A
cyc
lic s
et o
f su
bst
itutio
n t
ran
sitio
ns.
The
edi
tor
beha
ves in
telli
ge
ntly
:
AU
BU
Tra
ns[x
<>
y]
AU
BU
Tra
ns[x
<>
y]
AU
BU
Tra
ns[x
<>
y]
AU
BU
(x,y
)
f(x,
y)
(x,y
)
f(x,
y)
(x,y
)
f(x,
y)
•W
hen
a no
de is
rep
osi
tion
ed o
r re
size
d the
surr
ound
ing
arcs
and
insc
riptio
ns a
rea
uto
ma
tica
lly a
dju
ste
d.
•W
hen
a no
de is
dele
ted t
he s
urro
undi
ng a
rcs
are
au
tom
atic
ally
de
lete
d.
133
Col
oure
d P
etri
Net
s 47
Attr
ibut
esE
ach
grap
hica
l obj
ect h
as it
s ow
n a
ttrib
ute
s.
The
y de
term
ine
how
the
obje
ct a
ppea
rs o
n th
esc
reen
/prin
t-ou
ts:
Tra
nsiti
on
TTTT Trrrr raaaa annnn nssss siiii itttt tiiii ioooo onnnn n
Tra
nsi
tio
n
• T
ext a
ttrib
utes
• G
raph
ical
attr
ibut
es
• Sh
ape
attr
ibut
es
Eac
h kin
d o
f o
bje
cts h
as it
s ow
n de
fau
lts:
Plac
e N
ame
Col
our
Set
Initi
al M
arki
ng
Tra
nsi
tio
nN
ame
[Gua
rd]
Arc
Exp
ress
ion
Def
aults
can
be c
ha
ng
ed a
nd th
ey c
an b
eo
verw
ritt
en
(for
indi
vidu
al o
bjec
ts).
Col
oure
d P
etri
Net
s 48
Eas
y to
exp
erim
ent
[not
(lock
ed(r
))]
C
Get
Rec
ord
Lock
@+
CP
Ulo
ck()
TR
AN
SP
7O
ut
TR
AN
S_R
EQ
P1
In
LOC
K_D
B
Lock
Tab
le
FG
TR
AN
S_R
EQ
P2
[i>1]
Res
erve
Pag
e
C @+
CP
Ure
serv
e()
AP
P_R
EQ
P4
AP
P_R
EQ
P6
Rea
d D
ata
Fro
m B
uffe
r @+
CP
Ure
ad()
C
[buf
fere
d(r)
]
Byp
ass
Dis
k A
cces
s
C
@+
CP
Uby
pass
()
Rec
ord
Rea
d
HS
Dis
kAcc
ess
AP
P_R
EQ
P5
C@
+C
PU
upda
te()
Upd
ate
Buf
fer
BU
FF
ER
_DBBuf
fer
Tab
le
FG
TR
AN
S_R
EQ
_QU
EU
E
( [ ]
, [ ]
)P
3
[nee
d_di
sk_r
ead(
r),
page
_cle
an_p
roc(
)]
Que
ue R
eque
st
C
In L
ine
Cle
anin
g
HS
Pag
eCle
anin
g
(t,r
)
(t,r
)
ldb
(TA
PP
t,dr
)
(TA
PP
t,D
iskR
eqO
fRec
(r))
(t,r
)
(TA
PP
t,D
iskR
eqO
fRec
(r))
t
i
(ap,
dr)
(ap,
dr)
i
tq
((t,r
)::tr
l1,tr
l2)
(t,r
)
tq(trl1
,trl2
)
i
i
i
i -1
Can
we
impr
ove
the la
you
t of t
his
page
?
134
Col
oure
d P
etri
Net
s 49
Impr
oved
layo
ut [not
(lock
ed(r
))]
C
Get
Rec
ord
Lock
@+
CP
Ulo
ck()
TR
AN
SP
7O
ut
TR
AN
S_R
EQ
P1
In
LOC
K_D
B
Lock
Tab
le
FG
TR
AN
S_R
EQ
P2
[i>1]
Res
erve
Pag
e
C@
+C
PU
rese
rve(
)
AP
P_R
EQ
P4
AP
P_R
EQ
P6
Rea
d D
ata
Fro
m B
uffe
r@
+C
PU
read
()C
[buf
fere
d(r)
]
Byp
ass
Dis
k A
cces
s
C
@+
CP
Uby
pass
()
Rec
ord
Rea
d
HS
Dis
kAcc
ess
AP
P_R
EQ
P5
C@
+C
PU
upda
te()
Upd
ate
Buf
fer
BU
FF
ER
_DB
Buf
fer
Tab
le
FG
TR
AN
S_R
EQ
_QU
EU
E
( [ ]
, [ ]
)P
3
[nee
d_di
sk_r
ead(
r),
page
_cle
an_p
roc(
)]
Que
ue R
eque
st
C
In L
ine
Cle
anin
g
HS
Pag
eCle
anin
g
(t,r
)
(t,r
)
ldb
(TA
PP
t,dr
)
(TA
PP
t,D
iskR
eqO
fRec
(r))
(t,r
)
(TA
PP
t,D
iskR
eqO
fRec
(r))
t
i
(ap,
dr)
(ap,
dr)
i
tq
((t,r
)::tr
l1,tr
l2)
(t,r
)
tq(trl1
,trl2
)
i
i
i
i -1
Col
oure
d P
etri
Net
s 50
How
to m
ake
a ne
w s
ubpa
ge
Rec
eive
all
Ack
now
ledg
-m
ents
Upd
ate
and
Sen
d M
essa
ges
Sen
d an
Ack
now
ledg
-m
ent
Rec
eive
aM
essa
ge
Per
form
ing
DB
M
Inac
tive
DB
M
DB
M
Wai
ting
DB
M
Unu
sed
ME
S
ME
S
Sen
t
ME
S
Rec
eive
d ME
S
Ack
now
ledg
ed
ME
S
Act
ive
E
Pas
sive
Ee
Dat
aBas
e#1
Mes
(s)
(s,r
)
(s,r
)
(s,r
)
(s,r
)M
es(s
)
Mes
(s)
Mes
(s)
ss s
s
rr r
r
e eee
We
wan
t to m
ove
the
four
sel
ecte
d no
des
to a
n
ew
pa
ge
– an
d re
plac
e th
em b
y a su
bst
itutio
ntr
an
sitio
n:
•T
his
is d
one
by a
sin
gle
com
man
d –
calle
d M
ove
to S
ub
pa
ge.
135
Col
oure
d P
etri
Net
s 51
Res
ult o
f Mov
e to
Sub
page
Rec
eive
all
Ack
now
ledg
-m
ents
Upd
ate
and
Sen
d M
essa
ges
Inac
tive
DB
M
DB
MW
aitin
g
DB
M
Unu
sed
ME
S
ME
S
Sen
t
ME
S
Ack
now
ledg
ed
ME
S
Act
ive
E
Pas
sive
Ee
HS
New
#2
Dat
aBas
e#1
Rec
eive
aM
essa
ge
Rec
eive
d ME
S
Sen
d an
Ack
now
ledg
-m
ent
Per
form
ing
DB
M
Inac
tive
DB
M
DB
M
I/O
Ack
now
ledg
ed
ME
S
Ou
t
Sen
t
ME
S
In
New
#2
Mes
(s)
(s,r
)
(s,r
)
Mes
(s)
Mes
(s)
Mes
(s)
ss s
s
r r
e eee
(s,r
)
(s,r
)
r r
(s,r
)
(s,r
)
r r
Col
oure
d P
etri
Net
s 52
Mov
e to
Sub
page
is c
ompl
exT
he M
ove
to
Su
bp
ag
e com
man
d is
com
ple
x. T
heco
mm
and:
•C
heck
s th
e leg
alit
y o
f th
e s
ele
ctio
n (al
l bor
der
node
s m
ust b
e tr
ansi
tions
).
•C
reat
es th
e ne
w p
ag
e.
•M
ove
s th
e s
ub
ne
t to
the
new
pag
e.
•P
rom
pts
th
e u
ser to
cre
ate
a ne
w tr
ansi
tion
whi
chbe
com
es th
e su
pern
ode
for
the
new
sub
page
.
•C
reat
es th
e po
rt p
lace
s by
copy
ing
thos
e pl
aces
whi
ch w
ere
next
to th
e se
lect
ed s
ubne
t.
•C
alcu
late
s th
e po
rt t
ype
s (in
, out
or
in/o
ut).
•C
reat
es th
e co
rres
pond
ing po
rt in
scrip
tion
s.
•C
onst
ruct
s th
e ne
cess
ary
arc
s be
twee
n th
e po
rtno
des
and
the
sele
cted
sub
net.
•D
raw
s th
e arc
s su
rrou
ndin
g th
e ne
w tr
ansi
tion.
•C
reat
es a
hie
rarc
hy
insc
rip
tion f
or th
e ne
wtr
ansi
tion.
•U
pdat
es th
e hie
rarc
hy
pa
ge
.
All
thes
e th
ings
are
don
e in
a
few
se
con
ds.
136
Col
oure
d P
etri
Net
s 53
Top
-dow
n an
d bo
ttom
-up
Mo
ve t
o S
ub
pa
ge sup
port
s top
-do
wn d
evel
opm
ent.
How
ever
, it i
s al
so p
ossi
ble
to w
ork bo
tto
m-u
p – o
rus
e a m
ixtu
re o
f top
-dow
n an
d bo
ttom
-up.
The
Su
bst
itutio
n T
ran
sitio
n com
man
d is
use
d to
rela
te a
sub
stitu
tion
tran
sitio
n to
an
exi
stin
g p
ag
e.
The
com
man
d:
•M
akes
the h
iera
rch
y p
ag
e a
ctiv
e.
•P
rom
pts
th
e u
ser to
sel
ect t
he d
esire
d su
bpag
e;w
hen
the
mou
se is
mov
ed o
ver
a pa
ge n
ode
itbl
inks
, unl
ess
it is
ille
gal (
beca
use
sele
ctin
g it
wou
ld m
ake
the
page
hie
rarc
hy c
yclic
).
•W
aits
unt
il a
blin
king
pa
ge
no
de h
as b
een
sele
cted
.
•T
ries
to d
educ
e th
e port
ass
ign
me
nt by
mea
ns o
fa
set o
f rul
es w
hich
look
s at
the
port
/soc
ket
nam
es a
nd th
e po
rt/s
ocke
t typ
es.
•C
reat
es th
e hie
rarc
hy
insc
rip
tion w
ith th
e na
me
and
num
ber
of th
e su
bpag
e an
d w
ith th
ose
part
sof
the
port
ass
ignm
ent w
hich
cou
ld b
eau
tom
atic
ally
ded
uced
.
•U
pdat
es th
e hie
rarc
hy
pa
ge
.
Col
oure
d P
etri
Net
s 54
Syn
tax
chec
king
Whe
n a
CP
N d
iagr
am h
as b
een
cons
truc
ted
it ca
nbe
syn
tax
che
cke
d.
The
mos
t com
mon
err
ors
are:
•S
ynta
x er
rors
in th
e de
cla
ratio
ns.
•S
ynta
x er
rors
in arc
exp
ress
ion
s o
r g
ua
rds.
•T
ype
mis
ma
tch b
etw
een
arc
expr
essi
ons
and
colo
ur s
ets.
Syn
tax
chec
king
is incr
em
en
tal:
•W
hen
a co
lour
set
, gua
rd o
r an
arc
exp
ress
ion
isch
ange
d, it
is su
ffic
ien
t to r
eche
ck th
e ne
are
stsu
rro
un
din
gs.
•A
nalo
gous
ly, i
f an a
rc is
add
ed o
r re
mov
ed.
All
CP
N d
iagr
ams
in th
is s
et o
f lec
ture
not
es a
rem
ade
by m
eans
of t
he C
PN
edi
tor.
137
Col
oure
d P
etri
Net
s 55
CP
N s
imul
ator
Whe
n a s
ynta
ctic
al c
orr
ect C
PN
dia
gram
has
bee
nco
nstr
ucte
d, th
e C
PN
tool
gen
erat
es th
e ne
cess
ary
cod
e t
o p
erf
orm
sim
ula
tion
s.
The
sim
ulat
ion
code
:
•C
alcu
late
s w
heth
er th
e in
divi
dual
tran
sitio
ns a
ndbi
ndin
gs a
re en
ab
led
.
•C
alcu
late
s th
e eff
ect
of
occ
urr
ing
tra
nsi
tion
s an
db
ind
ing
s.
The
cod
e ge
nera
tion
is
incr
em
en
tal. H
ence
it is
fast
to m
ake
smal
l cha
nges
to th
e C
PN
dia
gram
.
We
dist
ingu
ish
betw
een
two
kind
s of
sim
ulat
ions
:
•In
an
inte
ract
ive
sim
ulat
ion
the
user
is in
con
trol
,bu
t mos
t of t
he w
ork
is d
one
by th
e sy
stem
.
•In
an
au
tom
atic
sim
ulat
ion
the
syst
em d
oes
all
the
wor
k.
Col
oure
d P
etri
Net
s 56
Inte
ract
ive
sim
ulat
ion
Sen
dP
acke
tT
rans
mit
Pac
ket
Rec
eive
Pac
ket
Rec
eive
Ack
now
.T
rans
mit
Ack
now
.
Sen
d
INT
xDA
TA
8
1`(1
,"M
odel
lin")
+ 1
`(2,
"g a
nd A
n")
+ 1
`(3,
"aly
sis
b")
+ 1
`(4,
"y M
eans
")
+ 1
`(5,
"of C
olou
")+
1`(
6,"r
ed P
etr"
)+
1`(
7,"i
Net
s##"
)+
1`(
8,"#
####
###"
)
Nex
tSen
dIN
T
1
11`
5
DIN
T
11`
6
A
INT
xDA
TA
Rec
eive
dD
AT
A
""1
1`"M
odel
ling
and
Ana
lysi
s by
Mea
ns
of C
olou
"
Nex
tRec
INT
1
11`
6
B
INT
xDA
TA
11`
(5,"
of C
olou
")
CIN
T
11`
6
Sen
der
Net
wo
rkR
ecei
ver
RP
8
Int_
0_10
11`
8
RA
Int_
0_10
81
1`8
(n,p
)(n
,p)
if O
k(s,
r)th
en 1
`(n,
p)el
se e
mpt
y
(n,p
)
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
k
n
k
if n=
kth
en k
+1
else
k
if O
k(s,
r)th
en 1
`nel
se e
mpt
y
n
kn
n
str
ss
Sim
ula
tion
re
sults
are
show
n di
rect
ly o
n th
e C
P-n
et:
•T
he u
ser
can
see
the en
ab
led
tra
nsi
tion
s and
the
ma
rkin
gs o
f the
indi
vidu
al p
lace
s.
To
exe
cute
a s
tep, the
use
r:
•S
ele
cts o
ne o
f the
ena
bled
tran
sitio
ns.
•T
hen
he ei
the
r ent
ers
a bi
ndin
g or
ask
s th
esi
mul
ator
to c
alcu
late
all
the
enab
led
bind
ings
, so
that
he
can
sele
ct o
ne.
138
Col
oure
d P
etri
Net
s 57
Exe
cutio
n of
a s
tep
The
sim
ulat
or:
•C
heck
s th
e leg
alit
y a
nd
en
ab
ling o
f the
bin
ding
.
•C
alcu
late
s th
e resu
lt o
f th
e e
xecu
tion
.
The
use
r de
term
ine
s whe
ther
the
sim
ulat
ordi
spla
ys th
e to
kens
whi
ch a
re a
dded
/rem
oved
:
B
11`
(3,"
alys
is b
")
Rec
eive
Pac
ket
Nex
tRec
11`
3
Rec
eive
d1
1`"M
odel
ling
and
An"
C
(n,p
)1
1`(3
,"al
ysis
b")
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
11`
"Mod
ellin
g an
d A
naly
sis
b"
if n=
kth
en k
+1
else
k
11`
4
k
11`
3
if n=
kth
en k
+1
else
k
11`
4
str1
1`"M
odel
ling
and
An"
Col
oure
d P
etri
Net
s 58
Inte
ract
ive
sim
ulat
ion
with
rand
om s
elec
tion
of s
teps
The
sim
ulat
or ch
oo
ses b
etw
een
conf
lictin
gtr
ansi
tions
and
bin
ding
s (b
y m
eans
of a
ra
nd
om
nu
mb
er
ge
ne
rato
r).
•T
he u
ser
can o
bse
rve a
ll de
tails
, e.g
., th
e m
arki
ngs
the
enab
ling
and
the
adde
d/re
mov
ed to
kens
.
•T
he s
imul
ator
sho
ws
the
pa
ge on
whi
ch e
ach
step
is e
xecu
ted
– by
mov
ing
the
corr
espo
ndin
gw
indo
w to
the
top
of th
e sc
reen
.
•T
he u
ser
can
set bre
akp
oin
ts so
that
he
has
the
nece
ssar
y tim
e to
insp
ect m
arki
ngs,
ena
blin
gs,
etc.
A s
imul
atio
n w
ith th
is a
mou
nt o
f gra
phic
al fe
edba
ckis
slo
w (
typi
cally
a fe
w tr
ansi
tions
per
min
ute)
:
•It
take
s a
lot o
f tim
e to
upd
ate
the
grap
hics
.
•A
use
r ha
s no
cha
nce
to fo
llow
a fa
st s
imul
atio
n.
It is
pos
sibl
e to
turn
off
sele
cted
par
ts o
f the
gra
ph
ica
l fe
ed
ba
ck, e
.g.:
•A
dded
and
rem
oved
to
ken
s.
•O
bser
vatio
n of
unin
tere
stin
g p
ag
es.
139
Col
oure
d P
etri
Net
s 59
Aut
omat
ic s
imul
atio
nT
he s
imul
ator
cho
ose
s bet
wee
n co
nflic
ting
tran
sitio
ns a
nd b
indi
ngs
(by
mea
ns o
f a
ran
do
mn
um
be
r g
en
era
tor).
The
use
r do
es
no
t int
end
to fo
llow
the
sim
ulat
ion:
•T
he s
imul
atio
n ca
n be
ve
ry f
ast
– se
vera
lhu
ndre
d st
eps
per
seco
nd.
•T
he u
ser
spec
ifies
som
e sto
p c
rite
ria,
whi
chde
term
ine
the
dura
tion
of th
e si
mul
atio
n.
•W
hen
the
sim
ulat
ion
stop
s th
e gr
aphi
cs o
f the
CP
-net
is up
da
ted
.
•T
hen
the
user
can
insp
ect a
ll de
tails
of t
hegr
aphi
cs, e
.g.,
the en
ab
ling a
nd th
e ma
rkin
g.
•A
utom
atic
sim
ulat
ions
can
be mix
ed w
ithin
tera
ctiv
e si
mul
atio
ns.
To
find
out w
hat h
appe
ns d
urin
g an
a
uto
ma
ticsi
mu
latio
n the
use
r ha
s a
num
ber
of c
hoic
es.
Col
oure
d P
etri
Net
s 60
Sim
ulat
ion
repo
rt1
Sen
dPac
k@(1
:Top
#1)
{n =
1, p
= "
Mod
ellin
"}2
Tra
nPac
k@(1
:Top
#1)
{n =
1, p
= "
Mod
ellin
", r
= 6
, s =
8}
3S
endP
ack@
(1:T
op#1
){n
= 1
, p =
"M
odel
lin"}
4T
ranP
ack@
(1:T
op#1
){n
= 1
, p =
"M
odel
lin",
r =
3, s
= 8
}5
Rec
Pac
k@(1
:Top
#1)
{k =
1, n
= 1
, p =
"M
odel
lin",
str
= "
"}6
Sen
dPac
k@(1
:Top
#1)
{n =
1, p
= "
Mod
ellin
"}7
Sen
dPac
k@(1
:Top
#1)
{n =
1, p
= "
Mod
ellin
"}8
Tra
nAck
@(1
:Top
#1)
{n =
2, r
= 2
, s =
8}
9T
ranP
ack@
(1:T
op#1
){n
= 1
, p =
"M
odel
lin",
r =
7, s
= 8
}10
Rec
Pac
k@(1
:Top
#1)
{k =
2, n
= 1
, p =
"M
odel
lin",
str
= "
Mod
ellin
"}11
Rec
Ack
@(1
:Top
#1)
{k =
1, n
= 2
}12
Rec
Pac
k@(1
:Top
#1)
{k =
2, n
= 1
, p =
"M
odel
lin",
str
= "
Mod
ellin
"}13
Tra
nAck
@(1
:Top
#1)
{n =
2, r
= 7
, s =
8}
14T
ranP
ack@
(1:T
op#1
){n
= 1
, p =
"M
odel
lin",
r =
6, s
= 8
}15
Rec
Ack
@(1
:Top
#1)
{k =
2, n
= 2
}16
Sen
dPac
k@(1
:Top
#1)
{n =
2, p
= "
g an
d A
n"}
17T
ranA
ck@
(1:T
op#1
){n
= 2
, r =
6, s
= 8
}18
Rec
Pac
k@(1
:Top
#1)
{k =
2, n
= 1
, p =
"M
odel
lin",
str
= "
Mod
ellin
"}19
Rec
Ack
@(1
:Top
#1)
{k =
2, n
= 2
}20
Sen
dPac
k@(1
:Top
#1)
{n =
2, p
= "
g an
d A
n"}
The
sim
ula
tion
re
po
rt sho
ws
the tr
an
sitio
ns w
hich
have
occ
urre
d. T
he u
ser
dete
rmin
es w
heth
er h
eal
so w
ants
to s
ee th
e bin
din
gs.
140
Col
oure
d P
etri
Net
s 61
Cha
rts
Pac
kets
Rec
eive
d
Step
No.
020
4060
8010
012
014
016
018
020
0
Pack
et N
o
012345678910
Pac
kets
pack
1
pack
2
pack
3
pack
4
pack
5
pack
6
pack
7
pack
8
5 5 7 5 4
01
23
45
67
89
10
01
23
45
67
89
10
Suc
cess
es
Fai
lure
s
Los
t
Enr
oute
The
se c
hart
s ar
e us
ed to
sho
w th
e p
rog
ress
of a
sim
ulat
ion
of th
e si
mpl
e pr
otoc
ol:
•T
he u
pper
cha
rt is
upd
ated
eac
h tim
e a
new
pack
et is
succ
ess
fully
re
ceiv
ed
.
•T
he lo
wer
cha
rt is
upd
ated
for
ea
ch 5
0 s
tep
s.
Col
oure
d P
etri
Net
s 62
Oth
er k
inds
of g
raph
ics
u(1)
Sho
rt
u(3)
Sho
rt
u(4)
Inac
u(6)
Rin
g
u(10
)
NoT
o
u(9)
Inac
u(8)
Con
n
u(7)
Con
n
u(5)
Sho
rt
u(2)
Long
Thi
s gr
aphi
c is
use
d to
dis
play
the
stat
e of
a
sim
ple
tele
ph
on
e s
yste
m.
The
gra
phic
s is
upd
ated
eac
htim
e on
e of
the
tele
phon
es c
hang
es to
a n
ew s
tate
:
•T
elep
hone
s u(
7) a
nd u
(8)
are
con
ne
cte
d.
•T
elep
hone
u(2
) is
cal
ling
u(6)
whi
ch is
rin
gin
g.
•T
elep
hone
u(1
0) is
cal
ling
u(2)
. Thi
s ca
ll w
ill
no
tsu
cce
ed b
ecau
se u
(2)
alre
ady
is e
ngag
ed.
141
Col
oure
d P
etri
Net
s 63
Cod
e se
gmen
tsE
ach
tran
sitio
n m
ay h
ave
a co
de s
egm
ent,
i.e.,
ase
quen
ce o
f pro
gra
m in
stru
ctio
ns w
hich
are
exec
uted
eac
h tim
e th
e tr
ansi
tion
occu
rs.
NoT
one
U
Long
U
Fre
eC
input (x,y);
action
UpdateState(x,Long);
UpdateState(y,Ringing);
UpdateConn(x,y,Call);
Rin
ging
U
Req
uest
UxU
Cal
lU
xU
Eng
aged
U
Inac
tive
U
xx
y
(x,y
)
(x,y
)
y
y
•T
he in
stru
ctio
ns in
cod
e se
gmen
t are
use
d to
up
da
te c
ha
rts
an
d g
rap
hic
s.
•T
his
is d
one
by c
allin
g a
num
ber
of
libra
ryfu
nct
ion
s.
•U
sual
ly, t
he c
ode
segm
ent d
oes
no
t inf
luen
ce th
eb
eh
avi
ou
r of t
he C
P-n
et (
i.e.,
the
enab
ling
and
occu
rren
ce).
•H
owev
er, a
cod
e se
gmen
t may
re
ad
an
d w
rite
from
file
s.
•In
this
way
it is
pos
sibl
e to
in
pu
t va
lue
s to
beus
ed d
urin
g th
e si
mul
atio
n, o
r to
o
utp
ut
sim
ula
tion
re
sults
.
Col
oure
d P
etri
Net
s 64
Sta
ndar
d M
LD
ecla
ratio
ns, n
et in
scrip
tions
and
cod
e se
gmen
tsar
e sp
ecifi
ed in
a pro
gra
mm
ing
lan
gu
ag
e cal
led
Sta
nd
ard
ML.
•S
tro
ng
ly t
ype
d, fu
nct
ion
al la
ngua
ge.
•D
ata
typ
es c
an b
e:–
Ato
mic
(inte
gers
, rea
ls, s
trin
gs, b
oole
ans
and
enum
erat
ions
).–
Str
uct
ure
d (pr
oduc
ts, r
ecor
ds, u
nion
s, li
sts
and
subs
ets)
.
•A
rbitr
ary
com
plex
fun
ctio
ns a
nd o
pe
ratio
ns c
anbe
def
ined
(po
lym
orph
ism
and
ove
rload
ing)
.
•C
ompu
tatio
nal p
ower
of e
xpre
ssio
ns a
reeq
uiva
lent
to la
mb
da
ca
lcu
lus (an
d he
nce
toT
urin
g m
achi
nes)
.
•D
evel
oped
at E
din
bu
rgh
Un
ive
rsity
by R
obin
Miln
er a
nd h
is g
roup
.
•S
tand
ard
ML
is w
ell-k
now
n, w
ell-t
este
d an
dve
ry g
ener
al. S
ever
al
text
bo
oks
are
avai
labl
e.
142
Col
oure
d P
etri
Net
s 65
Tim
e an
alys
isC
P-n
ets
can
be e
xten
ded
with
a
time
co
nce
pt.
Thi
s m
eans
that
the sa
me
lan
gu
ag
e can
be
used
toin
vest
igat
e:
•L
og
ica
l co
rre
ctn
ess
.D
esire
d fu
nctio
nalit
y, a
bsen
ce o
f dea
dloc
ks, e
tc.
•P
erf
orm
an
ce.
Rem
ove
bottl
enec
ks. P
redi
ct m
ean
wai
ting
times
and
aver
age
thro
ughp
ut. C
ompa
re d
iffer
ent
stra
tegi
es.
In a
tim
ed C
P-n
et e
ach
toke
n ca
rrie
s a
colo
ur (
data
valu
e) a
nd a
time
sta
mp (
telli
ng w
hen
it ca
n be
used
).
Tim
e st
amps
are
spe
cifie
d by
exp
ress
ions
:
•T
ime
stam
ps c
an d
epen
d up
on
colo
ur
valu
es.
•T
ime
stam
ps c
an b
e sp
ecifi
ed b
y p
rob
ab
ility
dis
trib
utio
ns.
•T
his
mea
ns th
at w
e, e
.g.,
can
spec
ify
fixe
dde
lays
, inte
rva
l del
ays
and e
xpo
ne
ntia
l del
ays.
Col
oure
d P
etri
Net
s 66
A ti
med
CP
-net
for
prot
ocol
Sen
dP
acke
t @+
9
Tra
nsm
itP
acke
t @+
Del
ay()
Rec
eive
Pac
ket
@+
17
Rec
eive
Ack
now
.
@+
7
Tra
nsm
itA
ckno
w.
@+
Del
ay()
Sen
d
INT
xDA
TA
Nex
tSen
dIN
T
1
DIN
TA
INT
xDA
TA
Rec
eive
dD
AT
A
""
Nex
tRec
INT
1
B
INT
xDA
TA
CIN
T
Sen
der
Net
wo
rkR
ecei
ver
RP
8
Int_
0_10
RA
Int_
0_10
8
Wai
t
TIM
E
100
(n,p
)(n
,p)
if O
K(s
,r)
then
1`(
n,p)
else
em
pty
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
kn
k
if n=
kth
en k
+1
else
k
if O
K(s
,r)
then
1`n
else
em
pty
n
kn
n
str
(n,p
)(n
,p)@
+w
ait
ss
wai
t
•F
or th
e th
ree S
en
d and
Re
ceiv
e ope
ratio
ns w
esp
ecify
a fix
ed
de
lay.
•F
or th
e ne
two
rk w
e sp
ecify
an in
terv
al d
ela
y, i.e
.,ra
ndom
del
ay b
etw
een
25 a
nd 7
5 tim
e un
its.
•T
he to
ken
colo
ur o
n pl
ace W
ait
spec
ifies
the
dela
y be
twee
n tw
o retr
an
smis
sio
ns o
f the
sam
epa
cket
.
The
com
pute
r to
ols
for
CP
-net
s al
so s
uppo
rtsi
mul
atio
n of
time
d C
P-n
ets.
143
Col
oure
d P
etri
Net
s 67
Tim
ed s
imul
atio
n of
pro
toco
lT
ime:
570
Sen
dP
acke
t @+
9
Tra
nsm
itP
acke
t @+
Del
ay()
Rec
eive
Pac
ket
@+
17
Rec
eive
Ack
now
.
@+
7
Tra
nsm
itA
ckno
w.
@+
Del
ay()
Sen
d
INT
xDA
TA
81`
(1,"
Mod
ellin
")@
[218
]+
1`(2
,"g
and
An"
)@[6
70]+
1`
(3,"
alys
is b
")@
[0]+
1`
(4,"
y M
eans
")@
[0]+
1`
(5,"
of C
olou
")@
[0]+
1`
(6,"
red
Pet
r")@
[0]+
1`
(7,"
i Net
s##"
)@[0
]+
1`(8
,"##
####
##")
@[0
]
Nex
tSen
dIN
T
1
11`
2@[5
70] D
INT
11`
3@[5
93]
A
INT
xDA
TA
1
1`(2
,"g
and
An"
) @
[570
]
Rec
eive
dD
AT
A
11`
"Mod
ellin
g an
d A
n"
""
Nex
tRec
INT
1
11`
3@[5
48]B
INT
xDA
TA
CIN
T
Sen
der
Net
wo
rkR
ecei
ver
RP
8
Int_
0_10
11`
8
RA
Int_
0_10
11`
88
Wai
tT
IME
11`
100
(n,p
)(n
,p)
if O
K(s
,r)
then
1`(
n,p)
else
em
pty
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
kn
k
if n=
kth
en k
+1
else
k
if O
K(s
,r)
then
1`n
else
em
pty
n
kn
n
str
(n,p
)(n
,p)@
+w
ait
ss
wai
t
•M
odel
tim
e is
now
570
.
•S
en
d P
ack
et has
sen
t a c
opy
of p
acke
t no.
2 a
ttim
e 5
70
.
•If
no a
ckno
wle
dgem
ent a
rriv
es
an
oth
er
cop
y of
pack
et n
o. 2
will
be
sent
at tim
e 6
70
.
•T
he o
nly
tran
sitio
n w
hich
is e
nabl
ed a
t tim
e 57
0is
Tra
nsm
it P
ack
et.
Col
oure
d P
etri
Net
s 68
Tim
ed s
imul
atio
nsT
ime
d s
imu
latio
ns h
ave
the s
am
e f
aci
litie
s as
untim
ed s
imul
atio
ns, e
.g.:
•W
e ca
n sw
itch
betw
een in
tera
ctiv
e an
da
uto
ma
tic s
imul
atio
n.
•S
imu
latio
n r
ep
ort
s tell
the
time
at w
hich
the
indi
vidu
al tr
ansi
tions
occ
urre
d.
•W
e ca
n us
e ch
art
s and
oth
er k
inds
of re
po
rtin
gfa
cilit
ies.
It is
eas
y to
switc
h be
twee
n a ti
me
d an
d an
untim
ed
sim
ula
tion
.
144
Col
oure
d P
etri
Net
s 69
Cha
rts
for
a tim
ed s
imul
atio
n
Tim
e
Tim
e0
50
01
00
01500
2000
25
00
3000
3500
40
00
Ru
n N
o.
123456789
Ste
p
Ste
p0
20
40
60
80
100
12
0140
16
0
Run
No.
123456789
25 :
1080
100 :
1576
200 :
2014
25 :
119
100 :
78
200 :
53
•S
ho
rt in
terv
al b
etw
een
retr
ansm
isio
ns im
plie
sfa
st t
ran
smis
sio
n with
he
avy
use
of
the
ne
two
rk.
•L
on
g in
terv
al b
etw
een
retr
ansm
isio
ns im
plie
ssl
ow
tra
nsm
issi
on w
ith le
ss u
se o
f th
e n
etw
ork
.
•T
o ge
t re
liab
le r
esu
lts it
is n
eces
sary
to m
ake
ala
rge
nu
mb
er o
f le
ng
thy s
imul
atio
n ru
ns.
Col
oure
d P
etri
Net
s 70
Par
t 4: V
erifi
catio
n o
f CP
-net
sIn
this
par
t of t
he ta
lk w
e de
scrib
e th
e tw
o m
ost
impo
rtan
t met
hods
for ve
rific
atio
n of
CP
-net
s:
•S
tate
sp
ace
s (al
so c
alle
d re
acha
bilit
y gr
aphs
and
occu
rren
ce g
raph
s).
•P
lace
inva
ria
nts.
We
also
des
crib
e ho
w th
e ve
rific
atio
n m
etho
ds a
resu
ppor
ted
by co
mp
ute
r to
ols.
145
Col
oure
d P
etri
Net
s 71
Sta
te s
pace
ana
lysi
s
AU3`q
BU2`p
CU
DU
EUT
1
T2
T3
T4
T5
R E
1`etype
U =
with
p |
q;
type
E =
with
e;
var
x : U
;
S E
3`e
T E
2`e
x x x x x x x x x
if x=
qth
en 1
`qel
se e
mpt
y
e
if x=
q th
en 1
`eel
se e
mpt
y
case
x o
f p
=>
2`e
| q =
> 1
`e
2`e
e
if x=
p th
en 1
`eel
se e
mpt
y
e
case
x o
f p
=>
2`e
| q =
> 1
`e
if x=
pth
en 1
`pel
se e
mpt
y
To
obta
in a
finite
sta
te s
pace
we
rem
ove
the
cycl
eco
unte
rs. O
ther
wis
e th
ere
wou
ld b
e an
in
finite
num
ber
of r
each
able
mar
king
s.
Col
oure
d P
etri
Net
s 72
Sta
te s
pace
for
reso
urce
allo
catio
n
0 2 2
PP
Q – – –
#5
1 3 2
QP
P – – –
#1
1 1 2
QP P – –
#2
0 1 2
PP Q – –
#9 1 1 2
PP – Q –
#10
1 1 1
PP – – Q
#12
1 1 1
QP – P –
#3
1 1 0
QP – – P
#4
0 0 2
PQ P – –
#6
0 0 1
PQ – P –
#7
0 0 0
PQ – – P
#8
0 0 2
QP
PQ – Q –
#11
0 0 1
QP
PQ – – Q
#13
(T1,
Q)
(T2,
P)
(T2,
Q) (T
3,Q
)
(T4,
Q)
(T5,
Q)
(T3,
P)
(T4,
P)
(T1,
Q)
(T2,
P)
(T3,
P)
(T5,
P)
(T1,
Q)
(T1,
Q)
(T4,
P)
(T5,
P)
(T1,
Q)
(T4,
Q)
(T1,
Q)
(T5,
Q)
Dire
cte
d g
rap
h with
:
•A
no
de f
or e
ach r
ea
cha
ble
ma
rkin
g (i.e
., st
ate)
.
•A
n a
rc fo
r ea
ch oc
curr
ing
bin
din
g e
lem
en
t.
146
Col
oure
d P
etri
Net
s 73
Som
e qu
estio
ns th
at c
an b
ean
swer
ed fr
om s
tate
spa
ces
Bo
un
de
dn
ess p
rope
rtie
s:
•W
hat i
s th
e ma
xim
al n
um
be
r of t
oken
s on
the
diffe
rent
pla
ces?
•W
hat i
s th
e min
ima
l nu
mb
er o
f tok
ens
on th
edi
ffere
nt p
lace
s?
•W
hat a
re th
e po
ssib
le t
oke
n c
olo
urs?
Ho
me p
rope
rtie
s:
•Is
it a
lwa
ys p
ossi
ble
to re
turn
to th
e in
itial
mar
king
?
Liv
en
ess
prop
ertie
s:
•A
re a
ll tr
ansi
tions
live
, i.e
., ca
n th
ey
alw
ays
beco
me
enab
led ag
ain
?
Col
oure
d P
etri
Net
s 74
Sta
te s
pace
rep
ort f
or r
esou
rce
allo
catio
n sy
stem
Sta
tistic
sO
ccur
renc
e G
raph
Nod
es:
13A
rcs:
20S
ecs:
1S
tatu
s:F
ull
Scc
Gra
phN
odes
:1
Arc
s:0
Sec
s:1
Bou
nded
ness
Pro
pert
ies
Upp
er In
tege
r B
ound
sA
:3
B:
3C
:1
D:
1E
:1
R:
1S
:3
T:
2
Upp
er M
ulti-
set B
ound
sA
:3`
qB
:2`
p+ 1
`qC
:1`
p+ 1
`qD
:1`
p+ 1
`qE
:1`
p+ 1
`qR
:1`
eS
:3`
eT
:2`
e
Low
er In
tege
r B
ound
sA
:1
B:
1C
:0
D:
0E
:0
R:
0S
:0
T:
0
Low
er M
ulti-
set B
ound
sA
:1`
qB
:1`
pC
:em
pty
D:
empt
yE
:em
pty
R:
empt
yS
:em
pty
T:
empt
y
147
Col
oure
d P
etri
Net
s 75
Sta
te s
pace
rep
ort (
cont
inue
d)H
ome
Pro
pert
ies
Hom
e M
arki
ngs:
All
Live
ness
Pro
pert
ies
Dea
d M
arki
ngs:
Non
e
Live
Tra
nsiti
ons:
All
Fai
rnes
s P
rope
rtie
s
T1:
No
Fai
rnes
sT
2:Im
part
ial
T3:
Impa
rtia
lT
4:Im
part
ial
T5:
Impa
rtia
l
Gen
erat
ion
of th
e st
ate
spac
e re
port
take
s on
ly a
few
se
con
ds.
•T
he r
epor
t con
tain
s a
lot o
f use
ful i
nfo
rma
tion
abou
t the
beh
avi
ou
r of t
he C
P-n
et.
•T
he r
epor
t is
exce
llent
for loca
ting
err
ors
or to
incr
ea
se o
ur
con
fide
nce i
n th
e co
rrec
tnes
s of
the
syst
em.
Col
oure
d P
etri
Net
s 76
Str
ongl
y co
nnec
ted
com
pone
nts
•S
ubgr
aph
whe
re all n
od
es
are
re
ach
ab
le f
rom
ea
ch o
the
r.
•M
axi
ma
l sub
grap
h w
ith th
is p
rope
rty.
148
Col
oure
d P
etri
Net
s 77
Str
ongl
y co
nnec
ted
com
pone
nts
are
very
use
ful
The
re a
re o
ften m
uch
fe
we
r str
ongl
y co
nnec
ted
com
pone
nts
than
nod
es:
•A
cyc
lic s
yste
m has
onl
y on
e st
rong
ly c
onne
cted
com
pone
nt.
•T
his
is, e
.g.,
the
case
for
the
reso
urce
allo
catio
nsy
stem
.
•T
he s
tro
ng
ly c
on
ne
cte
d c
om
po
ne
nts
can
be
dete
rmin
ed in
line
ar
time,
e.g
., by
Tar
jan’
sal
gorit
hm.
Str
ongl
y co
nnec
ted
com
pone
nts
can
be u
sed
toan
swer
que
stio
ns a
bout
h
om
e p
rop
ert
ies a
ndliv
en
ess
pro
pe
rtie
s.
Col
oure
d P
etri
Net
s 78
Sta
te s
pace
for
sim
ple
prot
ocol
Sen
dP
acke
tT
rans
mit
Pac
ket
Rec
eive
Pac
ket
Rec
eive
Ack
now
.T
rans
mit
Ack
now
.
Sen
d
INT
xDA
TA
1`(1
,"C
olou
red"
)+1`
(2,"
Pet
ri N
")+
1`(3
,"et
s###
##")
+1`
(4,"
####
####
")
Nex
tSen
dIN
T
1
DIN
TA
INT
xDA
TA
Rec
eive
dD
AT
A
""
Nex
tRec
INT
1
B
INT
xDA
TA
CIN
T
Sen
der
Net
wo
rkR
ecei
ver
RP
1
Int_
0_2
RA
Int_
0_21
Max
2 t
oke
ns
Max
1 t
oke
nM
ax 2
to
ken
s
Max
1 t
oke
n
(n,p
)(n
,p)
if O
k(s,
r)th
en 1
`(n,
p)el
se e
mpt
y
(n,p
)
(n,p
)
if n=
kan
dals
op<
>st
opth
en s
tr^p
else
str
if n=
kth
en k
+1
else
k
n
k
if n=
kth
en k
+1
else
k
if O
k(s,
r)th
en 1
`nel
se e
mpt
y
n
kn
n
str
ss
To
obta
in a
finite
sta
te s
pace
we
limit
the
num
ber
of to
kens
on
the
“buf
fer”
pla
ces
A, B
, C a
nd D
.O
ther
wis
e th
ere
wou
ld b
e an
in
finite
num
ber
ofre
acha
ble
mar
king
s.
Mor
eove
r, w
e no
w o
nly
have
4
pa
cke
ts and
ab
ina
ry c
ho
ice b
etw
een
succ
ess
and
failu
re.
149
Col
oure
d P
etri
Net
s 79
Sta
te s
pace
rep
ort f
or p
roto
col
Sta
tistic
sO
ccur
renc
e G
raph
Nod
es:
4298
Arc
s:15
887
Sec
s:53
Sta
tus:
Ful
l
Scc
Gra
phN
odes
:24
06A
rcs:
1167
7S
ecs:
17
Bou
nded
ness
Pro
pert
ies
Upp
er In
tege
r B
ound
sA
:1
B:
2C
:1
D:
2N
extR
ec:
1N
extS
end:
1R
A:
1R
P:
1R
ecei
ved:
1S
end:
4
Low
er In
tege
r B
ound
sA
:0
B:
0C
:0
D:
0N
extR
ec:
1N
extS
end:
1R
A:
1R
P:
1R
ecei
ved:
1S
end:
4
Col
oure
d P
etri
Net
s 80
Sta
te s
pace
rep
ort (
cont
inue
d)U
pper
Mul
ti-se
t Bou
nds
A:
1`(1
,"C
olou
red"
)+ 1
`(2,
" P
etri
N")
+1`
(3,"
ets#
####
")+
1`(
4,"#
####
###"
)B
:2`
(1,"
Col
oure
d")+
2`(
2,"
Pet
ri N
")+
2`(3
,"et
s###
##")
+ 2
`(4,
"###
####
#")
C:
1`2+
1`3
+ 1
`4+
1`5
D:
2`2+
2`3
+ 2
`4+
2`5
Nex
tRec
:1`
1+1`
2+1`
3+1`
4+1`
5N
extS
end:
1`1+
1`2+
1`3+
1`4+
1`5
RA
:1`
1R
P:
1`1
Rec
eive
d:1`
""+
1`"
Col
oure
d"+
1`"
Col
oure
d P
etri
N"+
1`"C
olou
red
Pet
ri N
ets#
####
"S
end:
1`(1
,"C
olou
red"
)+ 1
`(2,
" P
etri
N")
+1`
(3,"
ets#
####
")+
1`(
4,"#
####
###"
)
Low
er M
ulti-
set B
ound
sA
:em
pty
B:
empt
yC
:em
pty
D:
empt
yN
extR
ec:
empt
yN
extS
end:
empt
yR
A:
1`1
RP
:1`
1R
ecei
ved:
empt
yS
end:
1`(1
,"C
olou
red"
)+ 1
`(2,
" P
etri
N")
+1`
(3,"
ets#
####
")+
1`(
4,"#
####
###"
)
150
Col
oure
d P
etri
Net
s 81
Sta
te s
pace
rep
ort (
cont
inue
d)H
ome
Pro
pert
ies
Hom
e M
arki
ngs:
1[4
52]
Live
ness
Pro
pert
ies
Dea
d M
arki
ngs:
1[4
52]
Live
Tra
nsiti
ons:
Non
e
Fai
rnes
s P
rope
rtie
s
Sen
d P
acke
t:Im
part
ial
Tra
nsm
it P
acke
t:Im
part
ial
Rec
eive
Pac
ket:
No
Fai
rnes
sT
rans
mit
Ack
now
:N
o F
airn
ess
Rec
eive
Ack
now
:N
o F
airn
ess
Gen
erat
ion
of th
e st
ate
spac
e re
port
take
s on
ly a
few
se
con
ds.
•T
he r
epor
t con
tain
s a
lot o
f use
ful i
nfo
rma
tion
abou
t the
beh
avi
ou
r of t
he C
P-n
et.
•T
he r
epor
t is
exce
llent
for loca
ting
err
ors
or to
incr
ea
se o
ur
con
fide
nce i
n th
e co
rrec
tnes
s of
the
syst
em.
Col
oure
d P
etri
Net
s 82
Inve
stig
atio
n of
dea
d m
arki
ngW
e as
k th
e sy
stem
to d
ispl
ay m
arki
ng n
umbe
r 45
2.
45
2
8:0
452
NextSend = 5
NextRec = 5
Received = "Coloured Petri Nets#####"
Mar
king
no.
452
is th
e de
sire
d f
ina
l ma
rkin
g (al
lpa
cket
s ha
s be
en r
ecei
ved
in th
e co
rrec
t ord
er)
Mar
king
452
is de
ad
:
•T
his
impl
ies
that
the
prot
ocol
is
pa
rtia
lly c
orr
ect
(if e
xecu
tion
stop
s it
stop
s in
the
desi
red
final
mar
king
).
Mar
king
452
is a
hom
e m
ark
ing
:
•T
his
impl
ies
that
we a
lwa
ys h
ave
a c
ha
nce
to
finis
h c
orr
ect
ly (it
is im
poss
ible
to r
each
a s
tate
from
whi
ch w
e ca
nnot
rea
ch th
e de
sire
d fin
alm
arki
ng).
151
Col
oure
d P
etri
Net
s 83
Inve
stig
atio
n of
sho
rtes
t pat
hW
e as
k th
e sy
stem
to c
alcu
late
one
of t
he
sho
rte
stp
ath
s fro
m th
e in
itial
mar
king
to th
e de
ad m
arki
ng:
val path =
NodesInPath(1,452);
> val path =
[1,2,3,5,8,11,15,20,27,38,50,
64,80,102,133,164,199,243,
301,375,452] : Node list
Length(path);
> 20 : int
The
cal
cula
ted
path
con
tain
s 2
0 t
ran
sitio
ns.
•T
his
is a
s ex
pect
ed b
ecau
se th
ere
are
4 p
ack
ets
whi
ch e
ach
need
s 5 tr
an
sitio
ns t
o oc
cur.
Col
oure
d P
etri
Net
s 84
Dra
win
g of
sho
rtes
t pat
hW
e as
k th
e sy
stem
to d
raw
the
first
six
no
de
s in th
eca
lcul
ated
sho
rtes
t pat
h:
DisplayNodePath; [1,2,3,5,8,11];
> () : unit
1 1:1
1 NextSend = 1
NextRec = 1
Received = ""
2 1:2
2 NextSend = 1
NextRec = 1
Received = ""
A = 1`(1,"Coloured")
3 2:2
3 NextSend = 1`1
NextRec = 1`1
Received = ""
B = 1`(1,"Coloured")
5 3:3
5 NextSend = 1
NextRec = 2
Received = "Coloured"
C = 1`2
8 3:2
8 NextSend = 1
NextRec = 2
Received = "Coloured"
D = 1`2
11
5:1
11
NextSend = 2
NextRec = 2
Received = "Coloured"
1->2
SendPack
{p="Coloured",n=1}
2->3
TranPack
{s=1,r=1,p="Coloured",n=1}
3->5
RecPack
{str="",p="Coloured",n=1,k=1}
5->8
TranAck
{s=1,r=1,n=2}
8->11
RecAck
{n=2,k=1}
152
Col
oure
d P
etri
Net
s 85
Dra
w s
ubgr
aph
1 1:1
NextSend = 1
NextRec = 1
Received = ""
2 1:2
NextSend = 1
NextRec = 1
Received = ""
A = 1`(1,"Coloured")
3 2:2
NextSend = 1
NextRec = 1
Received = ""
B = 1`(1,"Coloured")
4 1:3
5 3:3
NextSend = 1
NextRec = 2
Received = "Coloured"
C = 1`2
9 2:2
6 3:4
7 2:1
8 3:2
NextSend = 1
NextRec = 2
Received = "Coloured"
D = 1`2
14
1:2
NextSend = 1
NextRec = 1
Received = ""
A = 1`(1,"Coloured")
B = 2`(1,"Coloured")
13
4:3
12
2:2
10
3:3
NextSend = 1
NextRec = 2
Received = "Coloured"
A = 1`(1,"Coloured")
D = 1`2
11
5:1
SendPack
LoosePack
TranPack
SendPack
RecPack
LoosePack
TranPack
RecPack
LooseAck
TranAck
SendPack RecPack
LoosePack
SendPack
TranPack
LooseAck
TranAck
SendPack
SendPack
RecAck
Col
oure
d P
etri
Net
s 86
Non
-sta
ndar
d qu
estio
nsW
e as
k th
e sy
stem
to s
earc
h a
ll a
rcs
in th
e e
ntir
eg
rap
h an
d re
turn
the fi
rst
10
arc
s whe
re N
ext
Se
nd
has
a la
rge
r val
ue in
the s
ou
rce
ma
rkin
g than
it h
asin
the
de
stin
atio
n m
ark
ing
.
PredArcs
(EntireGraph,
fn a => ((ms_to_col(Mark.NextSend 1
(SourceNode a))) >
(ms_to_col(Mark.NextSend 1
(DestNode a)))),
10)
end;
>[10179,10167,10165,10159,10055,10052,10035,
10031,10019,10007] : Arc list
28
06
1
:4
NextSend = 4
NextRec = 5
Received = "Coloured Petri
Nets#####"
A = 1`(4,"########")
B = 2`(4,"########")
C = 1`5
D = 1`2+ 1`5
30
75
1
:4
NextSend = 2
NextRec = 5
Received = "Coloured
Petri Nets#####"
A = 1`(4,"########")
B = 2`(4,"########")
C = 1`5
D = 1`5
10179:2806->3075
RecAck = {n=2,k=4}
153
Col
oure
d P
etri
Net
s 87
Tem
pora
l log
icIt
is a
lso
poss
ible
to m
ake
ques
tions
by
mea
ns o
f aC
TL-
like
tem
po
ral l
og
ic.
Usu
ally
CT
L fo
cuse
s on
que
ries
abou
t st
ate
pro
pe
rtie
s, e.
g.:
•In
v(P
os(M
))ch
ecks
whe
ther
M is
a
ho
me
ma
rkin
g.
•E
v(de
ad)
chec
ks w
heth
er th
ere
are
any
infin
ite o
ccur
renc
ese
quen
ces.
Our
ver
sion
of C
TL
also
allo
ws
quer
ies
abou
ttr
an
sitio
ns a
nd b
ind
ing
ele
me
nts
.
•In
v(P
os(t
in A
rc))
chec
ks w
heth
er tr
ansi
tion
t is live.
Tim
ed C
P-n
ets
The
com
pute
r to
ols
for
CP
-net
s al
so s
uppo
rt s
tate
spac
e an
alys
is o
f time
d C
P-n
ets.
Col
oure
d P
etri
Net
s 88
Sta
te s
pace
s –
pro/
cont
raS
tate
spa
ces
are po
we
rfu
l and
easy
to u
se.
•T
he m
ain
draw
back
is th
e sta
te e
xplo
sio
n,
i.e.,
the
siz
e o
f th
e s
tate
sp
ace.
•T
he p
rese
nt v
ersi
on o
f our
tool
han
dles
gra
phs
with
250
,000
nod
es a
nd 1
,000
,000
arc
s. F
orm
any
syst
ems
this
is
no
t su
ffic
ien
t.
For
tuna
tely
, it i
s so
met
imes
pos
sibl
e to
con
stru
ctm
uch
mor
e co
mp
act
stat
e sp
aces
–
with
ou
t lo
osi
ng
info
rma
tion
.
•T
his
is d
one
by e
xplo
iting
the
inhe
rent
sym
me
trie
s of t
he m
odel
led
syst
em.
•W
e de
fine
two e
qu
iva
len
ce r
ela
tion
s (on
e fo
rm
arki
ngs
and
one
for
bind
ing
elem
ents
).
•T
he c
onde
nsed
sta
te s
pace
s ar
e of
ten
mu
chsm
alle
r (po
lyno
mia
l siz
e in
stea
d of
exp
onen
tial).
•T
he c
onde
nsed
sta
te s
pace
s co
ntai
n th
e sa
me
info
rma
tion
as th
e fu
ll st
ate
spac
es.
154
Col
oure
d P
etri
Net
s 89
Pla
ce in
varia
nts
anal
ysis
The
bas
ic id
ea is
sim
ilar
to th
e us
e of
in
varia
nts in
pro
gra
m v
erific
atio
n.
•A
pla
ce in
varia
nt is
an e
xpre
ssio
n whi
ch is
satis
fied
for
all r
each
able
mar
king
s.
•T
he e
xpre
ssio
n cou
nts
the
toke
ns o
f the
mar
king
– us
ing
a sp
ecifi
ed s
et o
f wei
ghts
.
We
first
co
nst
ruct
a se
t of p
lace
inva
riant
s.
The
n w
e ch
eck
whe
ther
they
are
fu
lfille
d.
•T
his
is d
one
by s
how
ing
that
eac
h oc
curr
ing
bind
ing
elem
ent re
spe
cts th
e in
varia
nts.
•T
he re
mo
ved s
et o
f tok
ens
mus
t be
iden
tical
toth
e a
dd
ed s
et o
f tok
ens
– w
hen
the
wei
ghts
are
take
n in
to a
ccou
nt.
Fin
ally
, we
use
the
plac
e in
varia
nts
to
pro
vebe
havi
oura
l pro
pert
ies
of th
e C
P-n
et.
•T
his
is d
one
by a
ma
the
ma
tica
l pro
of.
Col
oure
d P
etri
Net
s 90
Exa
mpl
e of
pla
ce in
varia
nts
(x,i)
(x,i)
(x,i)
(x,i)
(x,i)
(x,i)
(x,i)
(x,i)
(x,i)
e
if x=
q th
en 1
`eel
se e
mpt
y
case
x o
f p
=>
2`e
| q =
> 1`
e
2`e
e
if x=
p th
en 1
`eel
se e
mpt
y
e
case
x o
f p
=>
2`e
| q =
> 1`
e
AP
3`(q
,0)
BP
2`(p
,0)
CP
DP
EPT
1
T2
T3
T4
T5
R E1`e S E3`e T E2`e
INV
1: P
R1
INV
1: P
R1
2: Q
3: 2
*P+
2*Q
INV
1: P
R1
3: 2
*P+
2*Q
4: P
INV
1: P
R1
3: 2
*P+
2*Q
4: 2
*P+
Q
INV
2: ID
INV
3: ID
INV
4: ID
INV
AR
IAN
TS
1: 2
`p+
3`q
: U2:
1`e
: E
3: 3
`e :
E4:
2`e
: E
INV
1: P
R1
2: Q
3: Q
155
Col
oure
d P
etri
Net
s 91
Pla
ce in
varia
nts
for
reso
urce
allo
catio
n sy
stem
To
spec
ify th
e w
eigh
ts w
e us
e thre
e f
un
ctio
ns:
•P
R 1 is
a p
roje
ctio
n fu
nctio
n: (
x,i)
-->
x.
•P
is a
n in
dic
ato
r fun
ctio
n: (
p,i)
-->
1`e
; (q,
i) --
>Ø
.
•Q
is a
n in
dic
ato
r fun
ctio
n: (
p,i)
-->
Ø; (
q,i)
-->
1`e.
•P
and
Q “
coun
ts”
the
num
ber
of p
and
q to
kens
.
PR 1
(M(A
)+M
(B)+
M(C
)+M
(D)+
M(E
)) =
2`p
+3`
q
M(R
) +
Q(M
(B)+
M(C
)) =
1`e
M(S
) +
Q(M
(B))
+(2
*P+
2*Q
)(M
(C)+
M(D
)+M
(E))
= 3
`e
M(T
) +
P(M
(D))
+ (
2*P
+Q
)(M
(E))
= 2
`e
Col
oure
d P
etri
Net
s 92
A m
ore
read
able
ver
sion
of t
hepl
ace
inva
riant
s
PR 1
(A+
B+
C+
D+
E)
= 2
`p+
3`q
R +
Q(B
+C
) =
1`e
S +
Q(B
) +
(2*
P+
2*Q
)(C
+D
+E
) =
3`e
T +
P(D
) +
(2*
P+
Q)(
E)
= 2
`e
The
pla
ce in
varia
nts
can
be u
sed
to
pro
vepr
oper
ties
of th
e re
sour
ce a
lloca
tion
syst
em, e
.g.,
that
it is
imp
oss
ible
to
re
ach
a d
ea
d m
ark
ing
.
156
Col
oure
d P
etri
Net
s 93
Too
l sup
port
for
plac
e in
varia
nts
Ch
eck
of p
lace
inva
ritan
s:
•T
he u
ser p
ropo
ses
a se
t of w
eigh
ts.
•T
he to
ol c
heck
s w
heth
er th
e w
eigh
ts c
onst
itute
apl
ace
inva
riant
.
Au
tom
atic
ca
lcu
latio
n of a
ll pl
ace
inva
riant
s:
•T
his
is p
ossi
ble,
but
it is
a v
ery co
mp
lex t
ask.
•M
oreo
ver,
it is
diff
icul
t to
repr
esen
t the
res
ults
on a
use
ful f
orm
, i.e
., a
form
whi
ch c
an b
e us
edby
the
syst
em d
esig
ner.
Inte
ract
ive
ca
lcu
latio
n of p
lace
inva
ritan
s:
•T
he u
ser p
ropo
ses
som
e of
the
wei
ghts
.
•T
he to
ol c
alcu
late
s th
e rem
ain
ing
we
igh
ts–
if po
ssib
le.
Inte
ract
ive
calc
ulat
ion
of p
lace
inva
riant
s is
m
uch
ea
sie
r tha
n a
fully
aut
omat
ic c
alcu
latio
n.
Col
oure
d P
etri
Net
s 94
How
to u
se p
lace
inva
riant
sIn
varia
nts
in o
rdin
ary p
rog
ram
min
g la
ng
ua
ge
s:
•N
o on
e w
ould
con
stru
ct a
larg
e pr
ogra
m–
and
then
exp
ect afte
rwa
rds t
o be
abl
e to
calc
ulat
e in
varia
nts.
•In
stea
d in
varia
nts
are
cons
truc
ted
tog
eth
er w
ithth
e pr
ogra
m.
For
CP
-ne
ts w
e sh
ould
do
the
sam
e:
•D
urin
g th
e sy
stem
spe
cific
atio
n an
d m
odel
ling
the
desi
gner
get
s a
lot o
f kn
ow
led
ge a
bout
the
syst
em.
•S
ome
of th
is k
now
ledg
e ca
n ea
sily
be
form
ulat
edas
pla
ce in
varia
nts
.
•T
he in
varia
nts
can
be
che
cke
d and
in th
is w
ay it
is p
ossi
ble
to fi
nd erro
rs.
•It
can
be s
een w
he
re th
e er
rors
are
.
Som
e pro
toty
pe
s of c
ompu
ter
tool
s fo
r in
varia
nts
anal
ysis
do
exis
t. H
owev
er, n
one
of th
em a
re a
t ast
ate
whe
re th
ey c
an b
e w
idel
y us
ed.
157
Col
oure
d P
etri
Net
s 95
Pla
ce in
varia
nts
– pr
o/co
ntra
Fro
m p
lace
inva
riant
s it
is p
ossi
ble
to p
rove
man
yki
nds
of b
eh
avi
ou
ral p
rop
ert
ies.
•In
varia
nts
can
be u
sed
to m
ake
mo
du
lar
verific
atio
n –
beca
use
it is
pos
sibl
e to
com
bine
inva
riant
s of
the
indi
vidu
al p
ages
.
•In
varia
nts
can
be u
sed
to v
erify
la
rge
sys
tem
s – w
ithou
t com
puta
tiona
l pro
blem
s.
•T
he u
ser
need
s so
me
inge
nuity
to
con
stru
ctin
varia
nts.
Thi
s ca
n be
sup
port
ed b
y co
mp
ute
rto
ols
– in
tera
ctiv
e pr
oces
s.
•T
he u
ser
also
nee
ds s
ome
inge
nuity
to
use
inva
riant
s. T
his
can
also
be
supp
orte
d by
com
pu
ter
too
ls – in
tera
ctiv
e pr
oces
s.
•In
varia
nts
can
be u
sed
to v
erify
a s
yste
m –
with
out f
ixin
g th
e sys
tem
pa
ram
ete
rs (su
ch a
sth
e nu
mbe
r of
site
s in
the
data
bas
e sy
stem
).
Col
oure
d P
etri
Net
s 96
Con
clus
ion
One
of t
he m
ain
reas
ons
for
the
succ
ess
of C
P-n
ets
is th
e fa
ct th
at w
e – si
mu
ltan
eo
usl
y – h
ave
wor
ked
with
:
TO
OL
S •
edi
ting
• s
imul
atio
n •
veri
fica
tion
TH
EO
RY
• m
odel
s•
basi
c co
ncep
ts•
veri
fica
tion
met
hods
PR
AC
TIC
AL
USE
• s
peci
fica
tion
• in
vest
igat
ion
• v
erif
icat
ion
•im
plem
enta
tion
158
Col
oure
d P
etri
Net
s 97
Mor
e in
form
atio
n on
CP
-net
sT
he fo
llow
ing
WW
W p
ages
con
tain
a lo
t of i
n-fo
rmat
ion
abou
t CP
-net
s an
d th
eir
com
pute
r to
ols:
http
://w
ww
.dai
mi.a
u.dk
/CP
nets
/
A d
etai
led
intr
oduc
tion
to C
P-n
ets
can
be fo
und
inth
e fo
llow
ing
pape
rs/b
ooks
:L
.M.
Kri
ste
nse
n,
S.
Ch
rist
en
sen
an
d K
. Je
nse
n:
Th
e P
ract
itio
ne
r’s
Gu
ide
to
Co
lou
red
Pe
tri
Ne
ts.
In
t. J
ou
rna
l o
n S
oft
wa
re T
oo
ls f
or
Tec
hnol
ogy
Tra
nsfe
r, 2
(19
98),
Spr
inge
r V
erla
g, 9
5-19
1
K.
Jen
sen
: An
In
tro
du
ctio
n t
o t
he
Th
eo
retic
al
Asp
ect
s o
f C
olo
ure
dP
etr
i N
ets
. In
: J.
W.
de
Ba
kke
r, W
.-P
. d
e R
oe
ver,
G.
Roz
enbe
rg(e
ds.
): A
De
cad
e o
f C
on
curr
en
cy,
Le
ctu
re N
ote
s in
Co
mp
ute
rS
cien
ce v
ol. 8
03, S
prin
ger-
Ver
lag
1994
, 230
-272
.
K.
Jen
sen
: An
In
tro
du
ctio
n t
o t
he
Pra
ctic
al
Use
of
Co
lou
red
Pe
tri
Ne
ts. I
n:
W.
Re
isig
an
d G
. R
oze
nb
erg
(e
ds.
): L
ect
ure
s o
n P
etr
i Ne
tsII
: A
pp
lica
tion
s, L
ect
ure
No
tes
in C
om
pu
te S
cie
nce
Vo
l. 1
49
2,
Spr
inge
r-V
erla
g 19
98, 2
37-2
92.
K.
Jen
sen
: Co
lou
red
Pe
tri
Ne
ts.
Ba
sic
Co
nce
pts
, A
na
lysi
s M
eth
od
sa
nd
Pra
ctic
al
Use
. Mo
no
gra
ph
s in
Th
eo
retic
al
Co
mp
ute
r S
cie
nce
,S
prin
ger-
Ver
lag.
•V
ol. 1
: Bas
ic C
once
pts,
199
2, IS
BN
: 3-5
40-6
0943
-1.
•V
ol. 2
: Ana
lysi
s M
etho
ds, 1
994,
ISB
N: 3
-540
-582
76-2
.•
Vol
. 3: P
ract
ical
Use
, 199
7, IS
BN
: 3-5
40-6
2867
-3.
Col
oure
d P
etri
Net
s 98
Som
e of
the
mos
t im
port
ant p
aper
s on
hig
h-le
vel
nets
, the
ir ve
rific
atio
n m
etho
ds a
nd a
pplic
atio
nsha
ve b
een
repr
inte
d in
:K
. Je
nse
n,
G.
Ro
zen
be
rg (
ed
s.):
H
igh-
leve
l P
etr
i N
ets
. T
he
ory
an
dA
pp
lica
tion
. Spr
inge
r-V
erla
g, 1
991,
ISB
N: 3
-540
-541
25-X
.
A li
st o
f pap
ers
that
des
crib
e in
dust
rial u
se o
fC
P-n
ets
and
thei
r to
ols
can
be fo
und
on:
http
://w
ww
.dai
mi.a
u.dk
/CP
nets
/intr
o/ex
ampl
e_in
du.h
tml
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
ANINTRODUCTIONTO
GENERALIZEDSTOCHASTICPETRINETS
GianfrancoBalbo
DipartimentodiInformatica
UniversitadiTorino
1
Outline
•TIMEDPETRINETS
–Timedplaces,tokens,arcs,transitions
–Raceandpreselection
–Memory
–Singleandmultipleserversemantics
•STOCHASTICPETRINETS
–Theexponentialdistribution
–Markovchains
–IsomorphismbetweenSPNsandMCs
–Example
•GENERALIZEDSPNs
–Immediatetransitionsandpriority
–GSPNdefinition
–Extendedconflictsets
–IsomorphismbetweenGSPNsandMCs
–Performanceindices
–Example
•ANAPPLICATIONOFGSPNS
•CONCLUSIONS
2
217
Prerequisites
•ThebasicdefinitionsofPetrinettheory
–places,transitions,arcs,tokens
–marking
–enabling,firing,reachability
–(enablingdegree)
–conflict,confusion
–(invariants)
•Someelementarynotionsofprobabilitytheory
–randomvariable
–stochasticprocess
–pdf,PDF
–statespace
–averages
–sojourntimes
–(ergodicity)
–(Little’sformula)
Itemsinparenthesesareoptional.
3
TIMEDPETRINETS
4
218
Timingspecifications
TimeisintroducedinPetrinetstomodeltheinteraction
amongseveralactivitiesconsideringtheirstartingand
completiontimes
Theintroductionoftimespecificationscorrespondsto
aninterpretationofthemodelbymeansof
•observationoftheautonomous(untimed)model
•definitionofanon-autonomousmodel
Timespecificationsshouldprovide
•consistencyamongautonomousandnon-autonomous
models
•non-determinismreductiononthebasisoftimecon-
siderations
•supportforthecomputationofperformanceindices
5
Timedplaces
Severalapproachesarepossiblefortheintroductionof
temporalspecificationsinPNmodels:
•timemaybeassociatedwithplaces(TPPN):
–tokensgeneratedinanoutputplacebecomeavail-
abletofireatransitiononlyafteradelayhas
elapsed;thedelayisanattributeoftheplace
6
219
Timedtokens
•timemaybeassociatedwithtokens:
–tokenscarryatimestampthatindicateswhen
theyareavailabletofireatransition;thistime
stampcanbeincrementedateachtransitionfir-
ing.
7
Timedarcs
•timemaybeassociatedwitharcs:
–atravellingdelayisassociatedwitheacharc;to-
kensareavailableforfiringonlywhentheyreach
atransition
8
220
Timedtransitions
•timemaybeassociatedwithtransitions(TTPN);
transitionsrepresentactivities
–activitystartcorrespondstotransitionenabling,
–activityendcorrespondstotransitionfiring
Differentfiringpoliciesmaybeassumed:
–three-phasefiring
1.tokensareconsumedfrominputplaceswhen
thetransitionisenabled
2.thedelayelapses
3.tokensaregeneratedinoutputplaces
–atomicfiring
tokensremainininputplacesforthetransition
delay;theyareconsumedfrominputplacesand
generatedinoutputplaceswhenthetransition
fires
9
Atomicfiring
WeshallconsiderTTPNwithatomicfiring.
TTPNwithatomicfiringcanpreservethebasicbe-
haviouroftheunderlyinguntimedmodel.
ItisthuspossibletoqualitativelystudyTTPNwith
atomicfiringexploitingthetheorydevelopedforun-
timed(autonomous)PN(reachabilityset,invariants,etc.).
Timingspecificationsmayaffectthequalitativebehaviour
ofthePNwhentheydescribe
const
antand
inte
rvalfir-
ingdelays.
10
221
Internaltimer
Wecanexplainthebehaviourofonetimedtransition
withatomicfiringbyassumingthatitincorporatesa
timer.
•Whenthetransitionisenabled,itstimerissettothe
currentdelayvalue
•Then,thetimerisdecrementedatconstantspeed,
untilitreachesthevaluezero
•Atthispointthetransitionfires
11
Conflicts
Whenmorethanonetimedtransitionwithatomicfiring
isenabled,thebehaviourissimilar,butaproblemarises:
Whic
hone
ofth
eenabled
transi
tions
isgoin
gto
fire
?
12
222
Selectionrules
Twoalternativeselectionrules:
•preselection:
theenabledtransitionthatwillfireischosenwhen
themarkingisentered,accordingtosomemetric
(priority,probability,...)
•race:
theenabledtransitionthatwillfireistheonewhose
firingdelayisminimum
13
Memorypolicies
Whenatimedtransitionisdisabledbyaconflictingtran-
sition,aproblemarises:
How
isth
etr
ansi
tion
tim
er
setwhen
the
transi
tion
will
again
beco
me
enabled?
How
does
the
transi
tion
kee
pmemory
of
its
past
en-
abling
tim
e?
14
223
Basicmechanisms
Twobasicmechanismscanbedefined:
•Continue:
thetimerassociatedwiththetransitionholdsthe
presentvalueandwillco
ntinuelateronthecount-
down
•Restart:
thetimerassociatedwiththetransitionis
rest
arte
d,
i.e.,itspresentvalueisdiscardedandanewvalue
willbegeneratedwhenneeded
15
Transitionmemorypolicies
Fromthetwobasicmechanismsitispossibletocon-
structseveraltransitionmemorypolicies;theusualones
are: •Resampling:
–Ateachandeverytransitionfiring,thetimersof
alltimedtransitionsinthetimedPNsystemare
discarded(restartmechanism).
–Nomemoryofthepastisrecorded.
–Afterdiscardingalltimers,newvaluesofthetimers
aresetforthetransitionsthatareenabledinthe
newmarking.
16
224
•Enablingmemory:
–Ateachtransitionfiring,thetimersofalltimed
transitionsthatbecomedisabledarerestarted,
whereasthetimersofalltimedtransitionsthat
remainenabledholdtheirpresentvalue(continue
mechanism).
–Thememoryofthepastisrecordedwithan
en-
abling
mem
ory
vari
ableassociatedwitheachtran-
sition.
–Theenablingmemoryvariableaccountsforthe
workperformedbytheactivityassociatedwith
thetransitionsincethelastinstantoftimewhen
itstimerwasset.
Theenablingmemoryvariablemeasurestheen-
ablingtimeofthetransitionsincethelastinstant
oftimeitbecameenabled.
17
•Agememory:
–Ateachtransitionfiring,thetimersofalltimed
transitionsholdtheirpresentvalues(continuemech-
anism).
–Thememoryofthepastisrecordedwithan
age
mem
ory
vari
ableassociatedwitheachtimedtran-
sition.
Theagememoryvariableaccountsforthework
performedbytheactivityassociatedwiththetran-
sitionsincethetimeofitslastfiring.
–Theagememoryvariablemeasuresthe
cum
ula
-
tiveenablingtimeofthetransitionsincethelast
instantoftimewhenitfired.
18
225
Transitionenabling
The
enabling
deg
reeofatransitionisthenumberof
timesthetransitioncouldfireinthegivenmarkingbe-
forebecomingdisabled.
Whentheenablingdegreeofatransitionis>1,attention
mustbepaidtothetimingsemantics.
19
Serversemantics
Threecasesarecommon:
•Single-serversemantics
•Infinite-serversemantics
•Multiple-serversemantics
20
226
Sin
gle-s
erv
er
sem
antics:
Afiringdelayissetwhenthetransitionisfirstenabled,
andnewdelaysaregeneratedupontransitionfiringif
thetransitionisstillenabledinthenewmarking.
Enablingsetsoftokensareprocessed
seria
llyandthe
temporalspecificationassociatedwiththetransitionis
independentoftheenablingdegree;
21
Infinite-s
erv
er
sem
antics:
Everyenablingsetoftokensisprocessedassoonasit
formsintheinputplacesofthetimedtransition.
Itscorrespondingfiringdelayisgeneratedatthistime,
andthetimersassociatedwithalltheseenablingsets
rundowntozeroconcurrently.
Multipleenablingsetsoftokensarethusprocessed
in
para
llel.
Theoveralltemporalspecificationsoftransitionswith
thissemanticsdependdirectlyontheirenablingdegrees
22
227
Multip
le-s
erv
er
sem
antics:
Enablingsetsoftokensareprocessedassoonasthey
formintheinputplacesofthetransitionuptoamaxi-
mumdegreeofparallelism(sayK).
Forlargervaluesoftheenablingdegree,thetimersasso-
ciatedwithnewenablingsetsoftokensaresetonlywhen
thenumberofconcurrentlyrunningtimersdecreasesbe-
lowthevalueK.
Theoveralltemporalspecificationsoftransitionswith
thissemanticsdependdirectlyontheirenablingdegrees
uptoathresholdvalueK
23
Exampleofserversemantics
Consideratimedtransitionwithenablingdegreeequal
to3.
Thethreeenablingsareassociatedwithfiringdelays
equalto3,2,and4timeunits.
t3
24
0t
32
0
t0
59
3
6
24
228
Queueingpolicies
Uponfiringofatransition,inputtokensareremovedat
random
Specificqueueingpoliciesmustbeexplicitlyrepresented
atmodellevel
25
Firingandselectionrules
WeconsiderTTPNwithatomicfiringandraceselection
rule.
TransitionswithinoneTTPNcanuse
•Resampling
•Enablingmemory
•Agememory
and •Single-serversemantics
•Infinite-serversemantics
•Multiple-serversemantics
inanycombination
26
229
STOCHASTICPETRINETS
27
Probabilisticinterpretation
TimedTransitionPNwithatomicfiringinwhichall
transitiondelaysare
random
varia
ble
swithnegativeex-
ponentialdistributionsarecalled
Sto
chast
icPN
(SPN
).
ThedynamicbehaviourofaSPNisdescribedthrough
ast
ochast
icpro
cess.
28
230
Definitions
Ara
ndom
varia
bleisarealfunctiondefinedoveraprob-
abilityspace.
Sto
chast
icpro
cess
esaremathematicalmodelsusefulfor
thedescriptionofphenomenaofaprobabilisticnatureas
afunctionofaparameterthatusuallyhasthemeaning
oftime.
Astochasticprocess
{X(t),t∈T}isafamilyofrandom
variablesdefinedoverthesameprobabilityspace,in-
dexedbytheparametertandtakingvaluesinthestate
spaceS.
29
Stochasticprocesses
Asa
mple
path(orrealization)ofastochasticprocessisa
functionoftime.
Con
tinuo
us ti
me
Dis
cret
e tim
e
X(t
)X
n
tn
05
1015
20
30
231
TheprobabilisticdescriptionofarandomvariableXis
givenbyits
pro
babi
lity
den
sity
funct
ion(pdf)
f X(x)=d dxP{X
≤x}
−∞<x<
∞
Theprobabilisticdescriptionofarandomprocessisgiven
bythejointpdfofanysetofrandomvariablesextracted
fromtheprocess.
P{X
(t1)≤x
1,X(t
2)≤x
2,...,X(tn)≤xn}
Inthegeneralcasethecompleteprobabilisticdescription
ofarandomprocessisnotfeasible.
MA
RK
OV
IAN
pro
cess
esareonespecialclassofstochas-
ticprocessesforwhichtheprobabilisticdescriptionis
simplerandofparticularrelevance.
31
AprocessthatsatisfiestheMarkovproperty:
P{X
(t)≤x|X(tn)=xn,X(tn−1)=xn−1,···
X(t
0)=x
0}=
P{X
(t)≤x|X(tn)=xn}
witht>t n>t n
−1>
···>t 0iscalleda
Mark
ovi
an
pro
cess.
Ifthestatespaceisdenumerable,theprocessisaM
arkov
chain.
Iftheparametertiscontinuous,theprocessisaco
ntinuous-
tim
eMarkovchain(CTMC). 32
232
Acontinuous-timeMarkovchain(CTMC)isastochastic
processwhere
•sojourntimesinstatesareexponentiallydistributed
randomvariables
•thefutureevolutiondependsonlyonthepresent
state,notonthepasthistory
33
Exponentialdistributions
Theexponentialpdf
f X(x)=λe−λx
(x≥0)
istheonlycontinuouspdfforwhichthememoryless
propertyholds:
P{X
>x+α|X>α}=
P{X
>x}
X
x0
a
�-
x
e�
nor
mal
izat
ion
34
233
Theexponentialpdf
f X(x)=λe−λx
(x≥0)
isdefinedonlybyits
rateλ,whichistheinverseofits
averagevalue:
E[X]=1 λ
35
GiventworandomvariablesXandYwithexponential
f X(x)=λe−λx
(x≥0)
f Y(y)=µe−µy
(y≥0)
thenewrandomvariableZ=min(X,Y)alsohasanex-
ponentialpdf f Z(z)=(λ+µ)e
−(λ+µ)z
(z≥0)
Infact,
FZ(z)=
1−Pr{Z>z}
=1
−Pr{X>z,Y>z}
=1
−e−λze−µz=1
−e−
(λ+µ)z
(z≥0)
36
234
Markovchains
TheresidualsojourntimeinastateofaMarkovchain
isarandomvariablewiththesamedistributionasthe
wholesojourntime.
37
ACTMCcanbedescribedthrougha
state
transi
tion
rate
dia
gram,orequivalentlywitha
state
transi
tion
rate
matr
ix,
alsocalled
infinites
imalge
ner
ato
r,denotedby
Q.
Q=
−λ
λ
µ−µ
38
235
ThesolutionofaCTMCattimetistheprobability
distributionoverthesetofstates:
π(t)=(π
1(t),π
2(t),π
3(t),···)
with
πi(t)=P{X
(t)=i}
Itcanbeproventhat dπ(τ)
dτ
=π(τ)Q
whosesolutioncanbeformallywrittenas
π(t)=
π(0)H
(t)
with
H(t)=eQ
t
Thisisaveryelegantsolutionthatishoweverusually
veryexpensivetocomputesincethematrixexponenti-
ationisdefinedbythefollowinginfinitesum
eQτ=
∞ ∑ k=
0
(Qτ)k
k!
39
ThesolutionofaCTMCatsteady-stateistheprobabil-
itydistributionoverthesetofstates.
Thesteady-statedistributionexistsfor
ergo
dicCTMCs.
Thesteady-statedistribution
π=(π
1,π
2,π
3,···)
with
πi=lim
t→∞P{X
(t)=i}
iscomputedasthesolutionofthelinearsystemofequa-
tions
πQ=0
withthenormalizingcondition
∑ iπi=1
40
236
DefinitionofstochasticPetrinets
Formally,anSPNisdefinedthroughan8-tuple:
SPN=(P,T,I(.),O(.),H(.),W(.),M
0)
where
•PN
=(P,T,I(.),O(.),H(.),M
0)isthemarkedPN
underlyingtheSPN
•W(.)isafunctiondefinedonthesetoftransitions
thatassociatesaratewitheachtransition.Thisrate
istheinverseoftheaveragefiringtimeofthetran-
sition
41
SPNscanbeprovedtobeisomorphictoCTMCs:the
reachabilitygraphoftheSPNcorrespondstothestate
transitionratediagramoftheMC.
Thiscanbeeasilyseeninthecaseofsimplesubclassesof
Petrinetssuchas:
Fin
ite
Sta
teM
achin
esand
Mark
ed
Gra
phs
42
237
SPNswithoutchoicesand
synchronizations
•ThenethasthestructureofbothaFiniteStateMa-
chine(notransitionhasmorethanoneinputandone
outputplace)andofaMarkedGraph(noplacehas
morethanoneinputandoneoutputtransition);
•theinitialmarkingcontainsonlyonetoken
Eachplaceofthenetunivocallyidentifiesastateofthe
net.
Eachplaceofthenetmapsintoastateofthecorre-
spondingprobabilisticmodel.
Thetimespentbythetokenineachofitsplacesis
completelydeterminedbythecharacteristicsoftheonly
transitionthatcanwithdrawitfromthatplace.
43
Theprobabilisticmodelthatrepresentsthebehaviour
ofthenet(M
ark
ing
Pro
cess)isaCTMC
p 1p 2
p 3T
3T
2T
1
γµ
λ
1 0
00
1 0
0 0
1
λµ
γ 44
238
SPNswithchoices
•ThenethasthestructureofaFiniteStateMachine
(notransitionhasmorethanoneinputandoneout-
putplace);
•theinitialmarkingcontainsonlyonetoken
Conflictsarisewhenseveraltransitionsshareacommon
inputplace
Aracestartsamongthesimultaneouslyenabledtransi-
tions.
Theraceiswonbyoneofthetransitionsandtheway
ofdealingwiththepartiallycompletedactivitiesofthe
transitionsthatwereinterruptedbecomesanissue(in
general).
45
Whenthefiringtimesofthetransitionsofthenethave
negativeexponentialdistributions,theirmemorylessprop-
ertymakesthedistinctionamong
•resampling
•enablingmemory
•agememory
irre
levantandtheCTMCcorrespondingtotheSPNis
obtainedfromthenetinastraightforwardmanner.
p 2
p 1p 3 p 4
T5
T3
T4
T1
T2
σγ
δ
λ
µ
1 0
0 0
0 1
0 0
0 0
1 0
0 0
0 1
λµ γ
δ σ 46
239
Morecomplexsituationsarisealreadywhenseveralto-
kensareallowedintheinitialmarkingsofthesesimple
models.
•Servicesemanticsadoptedwhentheinputplaceofa
transitioncontainsseveraltokens;
•Queueingpolicyassumedwithrespecttothetokens
residingintheinputplaceofatransition.
47
Asimpleexample
p 2p 1
T1
T2
λµ
IS(onbothtransitions)
0 2
1 1
2 0
λ
µµ 2
λ 2
SS(onbothtransitions)
0 2
1 1
2 0
λ
µλ
µ 48
240
Queuein
gpolicy
Itispossibletoshowthatwhenthefiringtimesareex-
ponentiallydistributedandtheperformancefiguresof
interestareonlyrelatedtothemomentsofthenumber
oftokensintheinputplaceofatransitionmanyqueue-
ingpoliciesyieldthesameresultsandthusthe
random
ord
er(thatisthemostnaturalinthePetrinetcontext)
canbeassumed.
49
Ingeneral,theCTMCassociatedwithagivenSPNsys-
temisobtainedbyapplyingthefollowingsimplerules:
1.TheCTMCstatespaceS=
{si}correspondstothe
reachabilitysetRS(m
0)ofthePNassociatedwiththe
SPN(m
i↔s i).
2.Thetransitionratefromstates i(correspondingto
marking
mi)tostates j(m
j)isobtainedasthesum
ofthefiringratesofthetransitionsthatareenabled
inmiandwhosefiringsgeneratemarking
mj.
Assumingthatallthetransitionsofthenetoperate
withasingle-serversemanticsandmarking-independent
speeds,anddenotingwith
•Qthe
infinitesi
malgenera
tor,
•wkthefiringrateofTk,
•e
j(m
i)=
{h:Th∈
e(m
i)∧
mi[Th〉m
j}thesetoftransi-
tionsthatbringthenetfrom
mito
mj,
thecomponentsofQare:
q ij=
∑T
k∈e
j(m
i)wk
−qi
i�=j
i=j
where
q i=
∑
Tk∈e
(mi)wk
50
241
Performanceindices
Thesteady-statedistribution
πisthebasisforaquanti-
tativeevaluationofthebehaviouroftheSPNexpressed
intermsofperformanceindices.
Theseresultscanbecomputedusingaunifyingapproach
inwhichproperindexfunctions(alsocalled
reward
func-
tions)aredefinedoverthemarkingsoftheSPNandan
averagerewardisderivedusingthesteady-stateproba-
bilitydistributionoftheSPN.
Assumingthatr(
m)representsoneofsuchrewardfunc-
tions,theaveragerewardcanbecomputedusingthe
followingweightedsum:
R=
∑
mi∈RS
(m0)r(
mi)πi
51
Pro
bability
ofa
particula
rco
nditio
nΥ(m
)ofth
eSPN
.
Definethefollowingrewardfunction:
r(m)=
1 0
Υ(m
)=true
otherwise
Thedesiredprobabilityiscomputedusingthefollowing
expression:
P{Υ
}=
∑
mi∈RS
(m0)r(
mi)πi=
∑
mi∈Aπi
whereA
={m
i∈RS(m
0):Υ(m
i)=true}.
52
242
Expec
ted
valu
eofth
enum
berofto
kensin
agiv
en
pla
ce.
Inthiscasetherewardfunctionis:
r(m)=niff
m(pj)=n
Theexpectedvalueofthenumberoftokensinp jisgiven
by: e[m(pj)]=
∑
mi∈RS
(m0)r(
mi)πi==
∑ n>
0[nP{A(j,n)}]
whereA(j,n)=
{mi∈RS(m
0):
mi(p j)=n}andthe
sumisobviouslylimitedtovaluesofn≤k;
iftheplaceisk-bounded.
53
Mea
nnum
ber
of
firi
ngs
per
unit
of
tim
eof
agiv
en
transi
tion.
Atransitionmayfireonlywhenitisenabled,thusthe
rewardfunctionassumesthefollowingform:
r(m)=
wj 0
Tj∈
e(m
)
otherwise
ThemeannumberoffiringsofTjperunitoftimeisthen
givenby: f j=
∑
mi∈RS
(m0)r(
mi)πi==
∑
Mi∈A
j
wjπi
whereAj=
{mi∈RS(m
0):Tj∈
e(m
i)}.
54
243
Theaveragesteady-statedelayspentintraversingasub-
networkcanbecomputedfromLittle’sformla
E[T]=E[N]
E[S]
whereE[N]istheaveragenumberof(equivalent)tokens
inthesubnet,andE[S]istheaverageinputrateintothe
subnet.
Delaydistributionsareingeneraldifficulttocompute.
55
Example
TheSPNdescriptionofasimpleparallelsystem
P1
P2
Tnewdata
Tpar1
P3
P5
Tstart
Tpar2
P4
P6
Tcheck
P9
Tsyn
TKO
P7
TI/O
P8
TOK
56
244
P1 P2
P3+
P4
P5+
P6
P7
P9P8
P4+
P5P3
+P6
W(T
new
data
)
star
tW
(T)
chec
kW
(T)
syn
W(T
)
par1
W(T
)pa
r2W
(T)
I/O
W(T
)
µ 2µ 1 K
Oλ
OK
λ
StatespaceforM(P1)=1
57
Com
puta
tion
ofµ
1,µ
2:
•TotalrateoutofP3+P4is:
W(Tpar1)+W(Tpar2)
•WithwhatprobabilityTpar1isthefirsttofire?
W(Tpar1)
W(Tpar1)+W(Tpar2)
•Therefore:
µ1=(W
(Tpar1)+W(Tpar2))
W(Tpar1)
W(Tpar1)+W(Tpar2)
=W(Tpar1)
58
245
Com
puta
tion
ofλOK,λKO:
samecomputationasbefore:
λOK=W(TOK)
λKO=W(TKO)
but... whatisthemeaningofW(TOK)andW(TKO)?
→checkactivity:0.0001
→rateof10,000
→probabilityofOK/KOis99%vs.1%
→W(TOK)=9,900andW(TKO)=100
59
Para
mete
rsp
ecifi
cations:
transitionratevalue
semantics
Tnewdata
λ1
infinite-server
Tstart
τ1000single-server
Tpar1
µ1
10
single-server
Tpar2
µ2
5single-server
Tsyn
σ2500single-server
TOK
α9900single-server
TKO
β100
single-server
TI/O
ν25
single-server
Tcheck
θ0.5
single-server
Theconsistencycheckoperationhasanaverageduration
0.0001timeunits,andresultsinasuccess99%ofthe
times,andinafailure1%ofthetimes.
60
246
Perf
orm
ance
indic
es:
•ThroughputoftransitionTI/O:
–1.504success/timeunits
•Averagenumberofitemsundertest:
–0.031
•Averageproductiontime:
–0.33timeunits
61
GENERALIZEDSTOCHASTIC
PETRINETS
62
247
TwoclassesoftransitionsexistinGSPNs:
•tim
edtransitions,whosedelaysareexponentiallydis-
tributedrandomvariables(likeinSPNs)
•im
med
iatetransitions,whosedelaysaredeterminis-
ticallyzero
Immediatetransitionshavebeenintroducedinthemodel
•toaccountforinstantaneousactions(e.g.choiceamong
classesofclients);
•toimplementspecificmodellingfeatures(e.g.to
emptyaplace);
•toaccountfortimescaledifferences(e.g.busarbi-
trationandI/Oaccesses).
63
Immediatetransitionshavepriorityovertimedtransi-
tions.
Severalprioritylevelsforimmediatetransitionscanbe
defined.Immediatetransitionsatprioritylevelnare
calledn-immediate.
TheautonomousmodelassociatedwithaGSPNisa
Petr
inetwith
pri
ori
ties.
Atransitiontissaidtohave
conce
ssio
ninmarkingM
iffM
≥I(t)
∧M<H(t).
Atransitiont jisdefinedtobeenabledinmarkijgMiff
ithasconcessioninMand
∀tk∈Tthathaveconcession
inM,πj≥πk.
64
248
Effectsinducedbythepresenceofpri-
orities
Σ⇐⇒
Σπ
•Properties
→safety(invariant):mustholdinallstates
→eventuality(progress):mustholdinsomestate
•RS(Σ)⊇RS(Σπ)
→safetypropertiesaremaintained(absenceofdead-
locks,boundedness,mutualexclusion,...)
→eventualitypropertiesarenotnecessarilymain-
tained(reachability,liveness,...)
65
Effectsinducedbythepresenceofpri-
orities
Σ⇐⇒
Σπ
•Reachability
→M
∈RS(Σ)�⇒M
∈RS(Σπ)
but
→M
∈RS(Σπ)⇒M
∈RS(Σ)
•Boundedness
→Σbounded⇒Σπbounded
but
→Σnotbounded�⇒Σπnotbounded
t1p1
t2
t3p2
t4
•Liveness-homestates
→prioritycanintroduceorremoveliveness
66
249
Somefinepoints:
1.Needforpriority
p1
2.Irrelevanceofdistinctionbetweenresampling-en-
abling-ageduetothememorylesspropertyofex-
ponentialdistributions
3.Impossibilityoftwotimerstoexpireatthesametime
probabilityofextractingaspecificsam-
plexisequaltozero
67
Markingsthatenabletimedtransitionsonlyaresaidto
be
tangib
le,whereasmarkingsthatenablen-immediate
transitionsaresaidtobe
vanishin
g.
p1
p2
p3p4
T1
T2
T3
t1t2
αβ
µ
λ 1λ 2
p2p1
p3p4
T3
T1
t1t2
T2
p1
p3p4
λ 1λ 2
µα+
βαµ
α+ββ
68
250
Definitionof
generalizedstochasticPetrinets
Formally,aGSPNisan8-tuple:
GSPN=(P,T,Π(.),I(.),O(.),H(.),W(.),M
0)
where
•PNπ=
(P,T,Π(.),I(.),O(.),H(.),M
0)isthemarked
PNwithpriorityunderlyingtheGSPN
•W(.)isafunctiondefinedonthesetoftransitions
Thesubnetsformedbyn-immediatetransitionsmustbe
confusion-free.
69
ThefunctionW(.)allowsthedefinitionofthestochastic
componentofaGSPNmodel.Inparticular,itmaps
transitionsintorealpositivenumbers.
ThequantityW(tk)=wkiscalled
•the“rate”oftransitiont kift kistimed
•the“weight”oftransitiont kift kisn-immediate
RatesareusedlikeinSPNs.
Weightsareusedfortheprobabilisticresolutionofcon-
flictsofimmediatetransitions.
70
251
Whenatangiblemarkingisentered,thetimedtransi-
tionsthatbecomeenabledforthefirsttimesincetheir
lastfiring,sampleafiringdelayinstanceandsettheir
timertothesampledvalue.
Then,alltimersoftheenabled(timed)transitionsare
decrementedatequalspeed,untiloneofthemreaches
thevaluezero.
Atthispointthetransitionwhosetimerreachedzero
fires.
Allthetransitionsthatdidnotfirekeeptheirtimerread-
ings,andtheirtimerswillbeagaindecrementedinthe
nextmarkinginwhichthetransitionisenabled.
(Enabling
mem
ory
was
use
din
the
desc
ription,but
is
irre
levant)
71
Whenavanishingmarkingisentered,theweightsofthe
enabledn-immediatetransitionsareusedtoprobabilis-
ticallyselectthe(n-immediate)transition(s)tofire.The
timespentinanyvanishingmarkingisdeterministically
equaltozero.
72
252
p2+
p4p3
p1+
p4
W(t
1)W
(t1)
+W(t
2)
p1
p2p3
p4
p5
p6
t1t2
t3
W(t
2)W
(t1)
+W(t
2)
W(t
1)=10
W(t
2)=20
W(t
3)=44
note:
•Theweightoft 2withrespecttot 1isal-
waysthesame,regardlessofwhethert 3
isenabledornot.
•Extensionstomarkingdependentrates
havebeendefined. 73
Thedefinitionofweightsrequirestheidentificationof
thesetsofimmediatetransitionsthatcanbesimultane-
ouslyenabledinconflict.
SuchsetsoftransitionsarecalledExtendedConflictSets
(ECSs).
WhenalltheECSsinaGSPNareknown,theassocia-
tionofweightstotransitionsiseasy,providedthatno
confu
sionexists.
Thestructuralandbehaviouralanalysisofthemarked
PNwithpriorityunderlyingtheGSPNallowsthequal-
itativestudyoftheGSPNbehaviour,andinparticular
theidentificationof
•ECS
•confusion
74
253
Confusiondestroysthelocalityofconflicts
p 0p 1
p 3 p 4p 2
p a
p 0p 1
p 3 p 4p 2
(b)
(a)
t 0
t 2t 1
t 2t 1
t at 0
w0
αβ
αβ
wa
w0
75
Confusionproducesdifferenttransitionprobabilities
p0+
p2
p0+
p4p1
+p2
p1+
p4p2
+p3
t2t0
t2t0
t1
1
αα+
ω0
ω0
α+ω0
α α+β
β α+β
p0+
p2
t2t0
t2t1
αα+
ω0
ω0
α+ω0
α α+β
β α+βp1
+p2
p0+
p4pa
+p2
p2+
p3p1
+p4
pa+
p4
1 1
t0 ta
t2ta
αα+
ω0
ω0
α+ω0
76
254
Inthecaseofvanishingmarkings,theweightsoftheen-
abledn-immediatetransitionscanbeusedtodetermine
whichonewillactuallyfireinamarkingMthatenables
morethanoneconflictingn-immediatetransitions.
WhenseveraltransitionsbelongingtothesameECSare
theonlyonesenabledinagivenmarking,oneofthem,
saytransitiont i,isselectedasacandidatetofirewith
probability:
P{t i|M
}=
wi
WI(M
)
whereWI(M
)istheweightofECS(ti)inmarkingM,and
isdefinedasfollows:
WI(M
)=
∑
k:t k∈ECS
(ti)∩E
(M)wk
77
ItmayhoweverhappenthatseveralECSscomprising
transitionsofthesameprioritylevelaresimultaneously
enabledinavanishingmarking.
Thecharacteristicofthesubnetsofn-immediatetransi-
tionsofbeingconfusion-freeguaranteesthatthewayin
whichthischoiceisperformedis
irre
levantwithrespect
totheresultingstochasticmodel.
78
255
GSPNscanbeprovedtobeisomorphictoSemi-Markov
processes.
TheanalysisofaGSPNcanbeperformedbystudying
aCTMC.
ThestatetransitionratediagramoftheMCcorresponds
tothe
tangib
lereachabilitygraphoftheGSPN.
Thememorylesspropertyoftheexponentialdistribution
makesthedistinctionamong
•resampling
•enablingmemory
•agememory
irrelevant.
79
Thesojourntimeinatangiblemarkingisexponentially
distributedwithaparameterthatisthesumoftherates
ofallenabledtimedtransitions,sothattheaveragetime
spentinmarkingMisgivenby:
E[SJ(M
)]=
∑
t∈E
(M)W(t) −1
80
256
NumericalsolutionofGSPNmodels
AnembeddedMarkovchain(EMC)canberecognized
disregardingtheconceptoftimeandfocusingtheatten-
tiononthesetofstatesofthesemi-Markovprocess.
ThespecificationsofaGSPNsystemaresufficientfor
thecomputationofthetransitionprobabilitiesofsucha
chain.
Severaltechniqueshavebeendevisedforrestrictingthe
computationtoreducedmodelsaccountingforthetan-
giblemarkingsonly.
81
Threedifferentapproachescanbeused:
•IdentifyareducedEmbeddedMarkovChaindefined
overthesetoftangiblemarkingsonly;
•Computethetransitionprobabilitiesamongtangible
markingsdirectlybyapplying(on-the-fly)adepth-
firstalgorithmthatexploresallcompletevanishing
pathsemanatingfromeachtangiblestate.
Themethodassumesthatnoloopsamongvanish-
ingstatesexistandmemorysavingistraded-offwith
(possible)repeatedcomputations;
•ReducetheGSPNtoanequivalentSPNobtained
byfusingimmediatetransitionswithprecedingtimed
transitionsusinganalgorithmthatinthesimplecases
producesthefollowingreductions
p 1p 3
p 2p ap a
p 3p 2
p 1
p a
T1
T2
T3
Ta
t 3t 2
t 1
82
257
Computationalconsiderations
Themathematicallyelegantsolutionofthemodelus-
ingtheREMCsuffersinpracticeofthedifficultiesde-
rivingfromthesizeoftheCTMCandfromtime-scale
differencesthatmayexistamongthefiringratesofthe
transitionsofamodel.
Approachesthatcanbeusedtoovercomethesedifficul-
tiesarethefollowing:
•Transientsolution
–Uniformizationmethod
•Steadystatesolution
–Timescaledecomposition
–Tensoralgebrasandcompositionality
–Symmetriesandexactlumping
•Simulation
83
Performanceindices
Fromthesteady-stateprobabilitydistributionofmark-
ingsitispossibletoobtainseveralperformanceindices
thatarethebasisforaquantitativeevaluationofthe
behaviouroftheGSPN.
AsinthecaseofSPNs,theseresultscanbecomputed
usingtheunifyingapproachbasedonthedefinitionof
rewardfunctions.
84
258
Tools
Theapplicabilityofthe[(G)S]PNapproachtoanything
butthesmallesttoyexamplesrestsontheavailabilityof
efficienttoolsforthe
•modelconstruction(top-d
own,bo
ttom
-up,co
mposi
-
tionality)
•modeldebugging(s
tructu
ralanaly
sis)
•definitionofperformanceindices
•modelsolution(a
naly
sis
and/or
sim
ula
tion)
•computationofaggregateresults
•displayofresults
Goodsoftwaretoolsareamust.
Theuser-friendlinessandthegraphicalcapabilitiesof
thetoolareofparamountimportance.
85
Example
TheGSPNdescriptionofasimpleparallelsystem
P1
P2
Tnewdata
Tpar1
P3
P5
t start
Tpar2
P4
P6
Tcheck
P9
t syn
t KO
P7
TI/O
P8
t OK
86
259
transitionratevalue
semantics
Tnewdata
λ1
infinite-server
Tpar1
µ1
10
single-server
Tpar2
µ2
5single-server
TI/O
ν25
single-server
Tcheck
θ0.5
single-server
transitionweightpriorityECS
t start
11
1
t syn
11
2
t OK
99
13
t KO
11
3
Theconsistencycheckoperationresultsinasuccess99%
ofthetimes,andinafailure1%ofthetimes.
87
TheGSPNmodelgenerates
•20tangiblemarkings
•18vanishingmarkings
Asanexample,withthenumericalvalueschosenforthe
modelparameters,theprobabilityofatleastoneprocess
waitingforsynchronizationiscomputedtobe0.238.
88
260
Acasestudy
akanbansystem
CA
RD
CE
LL
CE
LL
i -
1 i
+ 1
PA
RT
PA
RT
CA
RD
MA
CH
INE
INP
UT
BU
FF
ER
BU
FF
ER
OU
TP
UT
JOIN BO
AR
DB
UL
LE
TIN
CE
LL
i
Akanbancellandthepartsandcardsthatflowintoand
outofit
89
Thebasicmodel
idleM
i
OB
ibusyM
iIB
i
BB
i
outM
iexitCell i
inM
ienterCell i
Ki
GSPNmodelofasingleKanbancell
90
261
n-cellsequentialKanban
BB
n−1
IB
n
BB
3
OB
2
IB
2
OB
1
IB
1
idleM
1
BB
1
busyM
1
idleM
2busyM
2
BB
2
BB
n
busyM
nidleM
n
OB
n
outM
n
outM
1
outM
2
exitCell n
inM
1
enterCell 1
enterCell 2
inM
2
enterCell 3
inM
n
enterCell n
K1
K2
K3
Kn−1
Kn
91
Qualitativeanalysis
An-cellKanbanmodelhas2nminimalP-semiflows,whose
associatedP-invariantsare:
∀i,1
≤i≤n:
M(BBi)
+M(IBi)
+M(busyMi)+M(OBi)=Ki
M(idleMi)+M(busyMi)=
1
Itfollowsthat:
•ThenumberofpartsincelliisatmostKi,thenum-
berofcardsinthecell;
•Eachmachinecanprocessonlyonepartatatime;
•PlacesidleMiandbusyMiaremutuallyexclusive.
92
262
AlltransitionsoftheGSPNmodelarecoveredbya
sin-
gleminimalT-semiflow:itrepresentsthedeterministic
flowoftheuniquetypeofpartsprocessedbythesystem.
Thenetbehaviourisdeterministic:nostructuralcon-
flictsexist,henceneithereffectiveconflictsnorconfusion
caneverarise.
93
Quantitativeanalysis
WeconsiderKcardsandn=5cellsofequalmachine
time(therateoftransitionsoutM
iis4.0)
Firstcase:Inputandoutputinventoryinthecells
Inputbufferinventory
Outputbufferinventory
Cell1Card
2Cards3Cards1Card
2Cards3Cards
10.486
1.041
1.474
0.514
0.958
1.526
20.486
1.040
1.470
0.383
0.713
1.131
30.486
1.047
1.478
0.282
0.524
0.811
40.486
1.056
1.490
0.170
0.316
0.472
50.486
1.073
1.515
0.000
0.000
0.000
Theinputinventoryisfairlyconstant,whiletheoutput
inventorydecreasesasthecellpositionincreases.
94
263
Secondcase:faultfreeversusfailurepronesystems
idleM
i
OB
ibusyM
iIB
i
BB
i
OK
iFAILED
i
repair
i
failure
i
outM
iexitCell i
inM
ienterCell i
Ki
ModelofaKanbancellthatcanfail
95
•Cellscanfailindependently;
•Failurerateis0.02;
•Repairrateis0.4.
1.60
1.80
2.00
2.20
2.40
2.60
2.80
3.00
12
3
Failure
free system
Failure
prone system
Throughput
K
Failurefreevs.“all
cellscanfail”
K
0.03
0
0.03
2
0.03
4
0.03
6
0.03
8
0.04
0
12
34
56
Relative Throughput
Reduction
Failure in
middle cell
Failure in
last cell
0.02
8
Middlecellfailurevs.
finalcellfailure
InaperfectlybalancedKanbansystemthecellperfor-
manceisposition-dependent. 96
264
CONCLUSIONS
97
StochasticPetrinettechniquesareattractivebecause
theyprovideaperformanceevaluationapproachbased
onaformaldescription.
Thisallowstheuseofthesamelanguageforthe
•specification
•validation
•performanceevaluation
•implementation
•documentation
ofasystem.
98
265
Twoarethemaindirectionsoftheresearchbeingpresently
conductedinthefieldofGSPN-basedperformanceeval-
uation.
1.ExtensionsoftheGSPNanalysisapproachtoenvi-
ronmentsinwhichtokenspossessanidentityhasal-
readybeenproposedbyseveralauthors,andmore
workisbeingperformedtoobtainanenvironment
withahighdescriptivepowerinwhichthemodel
specificationissimple.
2.Variousapproachesarebeingpursuedforthereduc-
tionofthecomplexityofthesolutioncomputation
withstochastictechniques,possiblyproducingonly
partialorapproximateresults.
SuccessesinthesetwofieldswouldmakeGSPNapromi-
nentmodelingtechniqueinthewholeareaofdistributed
systems.
99
266