System Modeling with Petri Nets
I I T Kanpur, November 2002
Andrea Bobbio and Kishor Trivedi
Dipartimento di Informatica
Università del Piemonte Orientale, 15100 Alessandria (Italy)
bobbio@unipmn.it  URL: www.mfn.unipmn.it/~bobbio
Center for Advanced Computing and Communication (CACC)
Department of Electrical and Computer Engineering
Duke University, Durham, NC 277080291(USA)
kst@ee.duke.edu  URL: www.ee.duke.edu/~kst
2
Outline
CWhat are Petri Nets;
CDefinitions and basic concepts;
C Examples;
C Stochastic Petri Net (SPN);
CGeneralized SPN and Stochastic Reward Net (SRN).
A Monograph on this subject is:
http://www.mfn.unipmn.it/~bobbio/BIBLIO/PAPERS/ANNO90/k
luwerpetrinet.pdf
3
Petri Nets
Petri Nets (PN) are a graphical tool for the formal
description of the logical interactions among parts or of
the flow of activities in complex systems.
PN are particularly suited to model:
O Concurrency and Conflict;
O Sequentiality and Synchronization;
O Boundedness of resources and Mutual exclusion.
4
Petri Nets
Petri Nets (PN) originated from the Phd thesis of Carl
Adam Petri in 1962.
A web service on PN is managed at the University of
Aarhus in Denmark, where a bibliography with more
that 7,800 items can be found.
http://www.daimi.au.dk/PetriNets/
Regular International Conferences:
¬ ATPN  Application and Theory of PN
¬ PNPM – PN and Performance Models
5
Timed model were subsequently extensively explored,
following two main lines:
O Random durations : Stochastic PN (SPN)
O Deterministic or interval: Timed PN (TPN)
Petri Nets
The original PN did not convey any notion of time.
For performance and dependability analysis it is
necessary to introduce the duration of the events
associated to PN transitions.
6
Definitions
• A Petri net (PN) is a bipartite directed graph consisting of
two kinds of nodes: places and transitions
– Places typically represent conditions within the system being
modeled
– Transitions represent events occurring in the system that may
cause change in the condition of the system
– Arcs connect places to transitions and transitions to places (never
an arc from a place to a place or from a transition to a transition)
7
Example of a PN
p1 – resource idle
p2 – resource busy
t1 – task arrives
t2 – task completes
p1
t2
p2
t1
8
Example of a PN
p1 – resource idle
p2 – resource busy p3 – user
t1 – task arrives
t2 – task completes
p1
t2
p2
t1
p3
9
Definition of PN
A PN is a ntuple (P,T,I,O,M)
P set of places
T set of transitions
I input arcs
O output arcs
M marking
10
PN Definitions
• Input arcs are directed arcs drawn from places to
transitions, representing the conditions that need
to be satisfied for the event to be activated
• Output arcs are directed arcs drawn from
transitions to places, representing the conditions
resulting from the occurrence of the event
11
PN Definitions
• Input places of a transition are the set of places that
are connected to the transition through input arcs
• Output places of a transition are the set of places to
which output arcs exist from the transition
12
• Tokens are dots (or integers) associated with places; a
place containing tokens indicates that the corresponding
condition holds
• Marking of a Petri net is a vector listing the number of
tokens in each place of the net
PN Definitions
m
(m
1
m
2
… m
P
) ; P = # of Places
13
• When input places of a transition have the required number
of tokens, the transition is enabled.
• An enabled transition may fire (event happens) removing
one token from each input place and depositing one token
in each of its output place.
PN Definitions
14
Basic Components of PN
transition
output place
input place
token
input arc output arc
15
The firing rules of a PN
m ¬ t
k
¬ m'
16
Enabling & Firing of Transitions
up
t_repair t_repair t_repair
up up
down down down
t_fail t_fail t_fail
“t_fail” fires “t_fail” fires
“t_repair” fires “t_repair” fires
A 2processor failure/repair model
17
Example of PN
18
Concurrency (or Parallelism)
19
Synchronization
20
Limited Resources
21
Producer/consumer
22
Producer/consumer with buffer
23
Mutual exclusion
24
• A marking is reachable from another marking if
there exists a sequence of transition firings
starting from the original marking that results in
the new marking
• The reachability set of a PN is the set of all
markings that are reachable from its initial
marking
Reachability Analysis
25
Reachability Analysis
• A reachability graph is a directed graph whose
nodes are the markings in the reachability set,
with directed arcs between the markings
representing the markingtomarking transitions
• The directed arcs are labeled with the
corresponding transition whose firing results in a
change of the marking from the original marking
to the new marking
26
Generation of the reachability graph
27
Generation of the reachability graph
By properly identifying the frontier nodes, the generation
of the reachability graph involves a finite number of
steps, even if the PN is unbounded.
Three type of frontier nodes:
Oterminal (dead) nodes: no transition is enabled;
Oduplicate nodes: already generated;
Oinfinitely reproducible nodes.
28
Generation of the
reachability graph
29
Infinitely reproducible nodes
A marking M´´ is an infinitely reproducible node if:
M´´ ¯ M´
m
i
´´ ¯ m
i
´ (i= 1,2 …., n
place
)
where M´ is a marking already generated.
In fact, the sequence M´ 4 M´´ is firable from M´´
and then is infinitely reproducible.
An arbitrarily large number of tokens is represented
by a special symbol º
30
Generation of an unbounded RG
Producer/consumer
31
Extensions of PN models
= arc multiplicity
Cinhibitor arcs
Cpriority levels
Cenabling functions (guards)
Note: The last three extensions destroy the
infinitely reproducible property.
32
Petri Net: Arc Multiplicity
• An arc cardinality (or multiplicity) may be associated with input
and output arcs, whereby the enabling and firing rules are
changed as follows:
– Each input place must contain at least as many tokens as the cardinality
of the corresponding input arc.
– When the transition fires, it removes as many tokens from each input
place as the cardinality of the corresponding input arc, and deposits as
many tokens in each output places as the cardinality of the corresponding
output arc.
m p
33
Inhibitor arcs are represented with a circleheaded arc.
Petri Net : Inhibitor Arc
tk
pi
pj
The transition can fire iff the inhibitor place does not
contain tokens.
34
Petri Net : Inhibitor Arc
35
• An inhibitor arc drawn from place to a transition means that
the transition cannot fire if the corresponding inhibitor place
contains at least as many tokens as the cardinality of the
corresponding inhibitor arc
• Inhibitor arcs are represented graphically as an arc ending in
a small circle at the transition instead of an arrowhead
Petri Net : Multiple Inhibitor Arc
n
m p
36
An Example: Before
or cardinality of the output arc
37
or cardinality of the output arc
An Example: After
38
Priority levels
A priority level can be attached to each PN transition.
The standard execution rules are modified in the sense
that, among all the transitions enabled in a given
marking, only those with associated highest priority
level are allowed to fire.
39
Enabling Functions
An enabling function (or guard) is a boolean expression
composed with the PN primitives (places, trans, tokens).
The enabling rule is modified in the sense that beside the
standard conditions, the enabling function must evaluate
to true.
tk
pi
pj
¯(tk) = #P1<2 & #P2=0
40
High Level (colored) Petri Nets
In standard PN tokens are indistinguishable entities.
The semantics of the model does not allow to follow
the behavior of an individual token through the PN.
High Level PN overcome this limitation by assigning to
each individual token an attribute (color).
Places, arcs and transitions can have functions and
guards depending on the colors.
41
Colored Petri Nets
C is a set of colors of cardinality C and x is an element
of the set.
Place p can contain tokens of any color x)C;
Transition t can fires tokens of any color x)C.
x)C
x)C
<x>
<x>
p t
42
• Petri nets are extended by associating time with the
firing of transitions, resulting in timed Petri nets.
• A special case of timed Petri nets is stochastic Petri
net (SPN) where the firing times are considered
random variables.
Stochastic Petri Nets (SPN)
43
• A special case of stochastic Petri net (SPN) is
where the firing times are exponentially distributed.
• The marking process is mapped into a continuous
time Markov chain (CTMC) with state space
isomorphic to the reachability graph of the PN.
Stochastic Petri Nets (SPN)
44
SPN: A Simple Example
ì
.
µ
10 01
ì
.
µ
ì
Reachability
graph
CTMC
Server Failure/Repair
p1
t1
t2 t2
10 01
ì
µ
t1
t2
t1
p2 p1 p2
45
From SPN to CTMC: A Simple
Example
46
From SPN to CTMC:
An Example
47
0 1 2
.......
SPN: Poisson Process
ì ì ì
ì
SPN model
PP with rate
RG = CTMC
ì
48
0 1 2
.......
SPN: M/M/1 Queue
ì ì ì
µ µ µ
ì
µ
SPN model
M/M/1
RG = CTMC
ì
µ
49
0 1 2
.......
n
SPN: M/M/1/n Queue (1)
ì ì ì
µ µ µ
n
ì
µ
SPN model
M/M/1/n
RG = CTMC
n
ì
µ
50
0 1 2
.......
n
SPN: M/M/1/n Queue (2)
ì ì ì
µ µ µ
n
ì
µ
SPN model
M/M/1/n
RG = CTMC
n
ì µ
51
• A firing rate is associated with each timed transition.
• Firing rate of a transition may be marking
dependent.
Marking dependent firing rate
#
n
T
Rate of T = nì
ì
52
Marking dependent firing rate
The mutual exclusion problem can be folded
¤(t1) = #P1
¤
53
SPN: M/M/n/n Queue
n
ì
µ
SPN model
M/M/n/n
n
µ
µ
#
ì
µ
The use of markingdependent rate
54
SPN: M/M/m/n Queue (1)
n
m
n
m
O(t3) = #P4 O
¤(t1) = ¤
immediate trans.
t1 ¬ arrival
t2 ¬ service
55
SPN: M/M/m/n Queue (2)
K parallel repairable components
b) 1 repairman
M/M/1/n
¤(t1) = #P1 ¤
O (t2) = O
c) 2 repairmen
M/M/2/n
¤(t1) = #P1 ¤
O (t2)
=
#P2 O if #P2<2
2O otherwise
56
GSPN: M/M/i/n Queue
#
µ
ì
T
arrival
P
queue
t
quick
P
server
P
service
T
service
ni
i
immediate trans.
57
ERG for M/M/i/n Queue
0,0,0
1,0,0
i=0:
1,0,0 2,0,0 n,0,0
ì ì ì ì
.......
i>0 (ERG):
0,0,i 0,1,i1 1,i1,1 0,i,0
1,i,0 ni,i1,1 ni,i,0 1,i1,1
...
.......
µ
i>0 (CTMC):
0,0,i 0,1,i1 0,i,0 ... 1,i,0 ... ni,i,0
ì ì ì ì ì
2µ iµ iµ iµ iµ
T
arrival t
quick
T
arrival
t
quick
T
service
T
service
T
arrival
t
quick
T
service
T
service
t
quick
t
quick
58
Generalized SPN
• Sometimes when some events take extremely small time to
occur, it is useful to model them as instantaneous activities
• SPN models were extended to allow for such modeling by
allowing some transitions, called immediate transitions, to
have zero firing times
• The remaining transitions, called timed transitions, have
exponentially distributed firing times
¤
59
• The enabling rules are modified: if both an immediate
and a timed transition are enabled in a marking,
immediate transition has higher priority.
• If more than one immediate transition is enabled in a
marking, then the conflict is resolved by assigning firing
probabilities to the immediate transitions.
Generalized SPN
T
t
Immediate transition t is
enabled!
t2
Transition t1 & t2 will fire
with p
1
and p
2
.
t1
p
1
p
2
60
GSPN Properties
Markings (states) enabling immediate transitions are
passed through in 0 time and are called vanishing.
Markings (states) enabling timed transitions only, are
called tangible.
Since the process spends zero time in vanishing
markings they do not contribute to the time behavior
of the system and must be eliminated
61
GSPN Properties
The resulting reachability graph, referred to as the
Extended Reachability Graph (ERG), contains
vanishing marking, and is no longer a CTMC!
Need to eliminate the vanishing markings to
obtain the underlying CTMC.
62
Elimination of vanishing markings
Situation 1
Only timed transitions are enabled.
63
Elimination of vanishing markings
Situation 2
One immediate and timed transitions are enabled.
CTMC ERG
64
Elimination of vanishing markings
Situation 3
Several immediate transitions are enabled.
ERG CTMC
65
Elimination of vanishing markings
Example
t1 = #P1 ¤
t2 immed.
t3 = O
M
2
M
3
66
Step 3b: Or, build a system of linear, firstorder,
ordinary differential equations
(Transient solution)
Traditional Methodology
dt(t) /dt = t(t) Q
given t(0) = t
0
t(t): state probability vector
Q: infinitesimal generator matrix
67
Step 3a: Build a system of linear equations
(Steadystate solution)
Traditional Methodology
t Q = 0
t1 = 1
t: steadystate probability vector
Q: infinitesimal generator matrix
68
Measures of Reliability &
Performance
Solving the model means evaluating the (transient /
steady state) probability vector over the state space
(markings).
However, the modeler wants to interact only at the PN:
the analytical procedure must be completely transparent
to the analyst.
There is a need to define the output measures at the PN
level, in term of the PN primitives.
69
Measures of Reliability &
Performance
Output measures defined at the PN level.
× Probability of a given condition on the PN;
× Time spent in a marking;
× Mean (first) passage time;
× Distribution of tokens in a place;
× Expected number of firing of a PN trans (throughput).
All these measures can be reformulated in terms of
reward functions (MRM)
70
Solving models with SPN
The use of SPN requires only the topology of the PN,
the firing rates of the transitions and the specification of
the output measures.
All the subsequent steps, which consist in:
× generation of the reachability graph
× generation of the associated Markov chain;
× transient and s.s. solution of the Markov chain;
× evaluation of the relevant process measures.
must be completely automatized by a computer program,
thus making transparent to the user the associated
mathematics.
71
Probability of a given condition on the PN
Define a condition by a logical function (e.g #Pf = 0) and
find the subset of states S where the condition holds true.
In terms of reward rate rs =
1 s ) S
0 otherwise
72
Expected time spent in a marking
Define a condition by a logical function (e.g #Pf = 0) and
find the subset of states S where the condition holds true.
In terms of reward rate rs =
1 s ) S
0 otherwise
73
Mean first passage time
If the subset of states S is absorbing, Qs(t) is the
probability of first visit to S.
The mean first passage time is:
The above formula requires the transient analysis
to be extended over long intervals (other more direct
techniques are available).
74
Distribution of tokens in a place
The density mass of having k (k = 0, 1, 2, … ) tokens in a
place pi is f
i
(k,t).
f
i
(k,t) can be evaluated by summing the probability of all
the markings containing k (k = 0, 1, 2, … ) tokens in pi.
f
i
(k,t) = q
s
(t)
s ) #pi =
k
75
Expected number of tokens in a place
Given the density mass of having k (k = 0, 1, 2, … )
tokens in a place pi, the expected number of tokens in
place pi can be evaluated by:
In terms of reward rate rs = k
76
Expected number of firings
Given an interval (0,t) this quantity indicates how many
times, on the average, an event modeled by a PN
transition has occurred (throughput).
Let S be the subset of markings enabling tk.
In terms of reward rate rs = ¤
k
(s)
77
Example:
Multiprocessor with failure
• Number of processors: n
• Single repair facility is shared by all
processors
• A reconfiguration is needed after a covered
fault
• A reboot is required after an uncovered fault
78
Assumptions:
• The failure rate of each processor is ¸
• The repair times are exponentially
distributed with mean 1/t
• A processor fault is covered with
probability c
• The reconfiguration times and the reboot
times are exponentially distributed with
parameter o and , respectively
¸
79
GSPN Model for Multiprocessor
GSPN Model of a Multiprocessor
80
ERG for Multiprocessor Model
(n=2)
2,0,0,0,0 1,1,0,0,0
1,0,0,1,0
1,0,1,0,0
1,0,0,0,1
0,0,0,0,2
0,1,0,0,1
2,0,0,0,0
1,0,0,1,0
1,0,1,0,0
1,0,0,0,1 0,0,0,0,2
Extended Reachability Graph for Multiprocessor model
Reduced ERG for Multiprocessor model
T
fail
t
cov
T
uncov
T
recon
T
rep
T
reboot
T
rep
T
fail
t
quick
¸c
¸(1c)

t
o
¸
t
81
Example: Reward Rates for
Multiprocessor Availability
• Reward rate at the net level for steady –state
availability
¹
´
¦
= + >
=
otherwise , 0
0 ) # (# and 1 # , 1
cov cov un up
i
P P P
r
¹
´
¦
=
=
otherwise , 0
) (1,0,0,0,1 ), 0 , 0 , 0 , 0 , 2 ( , 1 i
r
i
• Reward rate at the CTMC level for steady
state availability (n=2)
82
• Introduced by Ciardo, Muppala and Trivedi [1989]
• Structural characteristics
– Extensive Marking dependency allowed for firing rates
and firing probabilities
– Transition Priorities
– Guards (Enabling functions) for Transitions
– Variable cardinality arcs
Stochastic Reward Net (SRN)
83
• Stochastic characteristics
– Allow definition of reward rates in terms of net level
entities
– Automatically generate the reward rates for the
markings
– Enables computation of required measures of interest
Stochastic Reward Net (SRN)
84
Stochastic Reward Nets
Extended Reachability Graphs
Markov Reward Model
Eliminates vanishing markings
Reachability Analysis
Analysis Procedure of SRN
Measures of Interest
Solve MRM (transient or steadystate)
85
SRN Summary
Place
Timed Transition
Immediate Transition
Input Arc
Output Arc
Inhibit Arc
An SRN
86
Finite Buffer
n
m m
mµ ì
Poisson Arrival
Single Server
mstage Erlang Service time
SRN of M/E
m
/1/n Queue
SRN Analysis: Step1
Abstract the system > SRN Model
Specify in SRN Tools
87
SRN Analysis: Step2
Reachability Analysis: Automatically Generate ERG
Extended
Reachabilty
Graph
SRN
Specification
Vanishing Marking Tangible Marking
88
SRN Analysis: Step3
Reachability Analysis: Automatically Generate RG
Extended
Reachabilty
Graph
CTMC = RG
Eliminate
Vanishing
Marking
89
SRN Analysis: Step4
Solve CTMC
Steadystate Analysis: A System of Linear Equations
GaussSeidel, SOR (Successive overrelaxation)
Power method, etc.
Transient Analysis: A coupled system of ODE
Classical ODE Methods
Randomization (or Uniformization), etc.
90
SRN Analysis: Step5
Compute measures of interest
Measures of interests: Blocking/Dropping Probability,
Throughput, Utilization, Delay etc.
Measures can be defined as reward functions which specify
reward rates on netlevel entities.
Step 15: The SPN Tool does it all!
91
NonMarkovian SPN
Transition Firing Time: not exponentially
distributed
H.Choi,V. Kulkarni, K. Trivedi
Markov regenerative stochastic Petri net (MRSPN)
Performance Evaluation, 20, 337357, 1994
(A special case: At most one general transition can be enabled in
any marking).
A. Bobbio and A. Puliafito and M. Telek and K. Trivedi.
Recent developments in nonMarkovian stochastic Petri nets.
Journal of Systems Circuits and Computers, 8:1, 119158, 1998.
92
Fluid Petri Net
Fluid stochastic Petri net (FSPN)
Introduced by K. Trivedi and V. Kulkarni (1993)
Allow both discrete and continuous places
Useful in fluid approximation of discrete
queueing system
Powerful formalism of stochastic fluid queueing
networks
Boundary conditions complicated. Solution
techniques under investigation.
93
The Fluid Petri Net Model
FPN's are an extension of PN able to model the
coexistence of discrete and continuous variables.
The primitives of FPN (places, transitions and arcs) are
partitioned in two groups:
discrete primitives that handle discrete tokens (as in
standard PN);
continuous (or fluid) primitives that handle
continuous (fluid) quantities.
fluid arcs are assigned instantaneous flow rates.
94
Fluid Petri Nets
95
References
• http://www.ee.duke.edu/~kst/
then click on Stochastic Petri Nets
• K. Trivedi, Probability and Statistics with
Reliability, Queuing, and Computer Science
Applications, 2
nd
Ed., John Wiley and Sons, New
York, 2001
96
Conclusion
97
Outline
What are Petri Nets; Definitions and basic concepts; Examples; Stochastic Petri Net (SPN); Generalized SPN and Stochastic Reward Net (SRN).
A Monograph on this subject is: http://www.mfn.unipmn.it/~bobbio/BIBLIO/PAPERS/ANNO90/k luwerpetrinet.pdf
2
Petri Nets
Petri Nets (PN) are a graphical tool for the formal description of the logical interactions among parts or of the flow of activities in complex systems. PN are particularly suited to model: Concurrency and Conflict; Sequentiality and Synchronization;
Boundedness of resources and Mutual exclusion.
3
dk/PetriNets/ Regular International Conferences: ATPN .daimi.Petri Nets Petri Nets (PN) originated from the Phd thesis of Carl Adam Petri in 1962. http://www. A web service on PN is managed at the University of Aarhus in Denmark.au. where a bibliography with more that 7.800 items can be found.Application and Theory of PN PNPM – PN and Performance Models 4 .
For performance and dependability analysis it is necessary to introduce the duration of the events associated to PN transitions.Petri Nets The original PN did not convey any notion of time. Timed model were subsequently extensively explored. following two main lines: Random durations : Stochastic PN (SPN) Deterministic or interval: Timed PN (TPN) 5 .
Definitions • A Petri net (PN) is a bipartite directed graph consisting of two kinds of nodes: places and transitions – Places typically represent conditions within the system being modeled – Transitions represent events occurring in the system that may cause change in the condition of the system – Arcs connect places to transitions and transitions to places (never an arc from a place to a place or from a transition to a transition) 6 .
Example of a PN t1 p1 t2 p2 p1 – resource idle p2 – resource busy t1 – task arrives t2 – task completes 7 .
Example of a PN p3 t1 p1 t2 p2 p1 – resource idle p2 – resource busy t1 – task arrives t2 – task completes p3 – user 8 .
I.T.M) P T I O M set of places set of transitions input arcs output arcs marking 9 .Definition of PN A PN is a ntuple (P.O.
representing the conditions resulting from the occurrence of the event 10 .PN Definitions • Input arcs are directed arcs drawn from places to transitions. representing the conditions that need to be satisfied for the event to be activated • Output arcs are directed arcs drawn from transitions to places.
PN Definitions • Input places of a transition are the set of places that are connected to the transition through input arcs • Output places of a transition are the set of places to which output arcs exist from the transition 11 .
P = # of Places 12 .PN Definitions • Tokens are dots (or integers) associated with places. a place containing tokens indicates that the corresponding condition holds m • Marking of a Petri net is a vector listing the number of tokens in each place of the net (m1 m2 … mP) .
• An enabled transition may fire (event happens) removing one token from each input place and depositing one token in each of its output place.PN Definitions • When input places of a transition have the required number of tokens. the transition is enabled. 13 .
Basic Components of PN input place transition output place token input arc output arc 14 .
The firing rules of a PN m t k m' 15 .
Enabling & Firing of Transitions up “t_fail” fires up “t_fail” fires up t_repair t_fail t_repair t_fail t_repair t_fail “t_repair” fires down down “t_repair” fires down 16 A 2processor failure/repair model .
Example of PN 17 .
Concurrency (or Parallelism) 18 .
Synchronization 19 .
Limited Resources 20 .
Producer/consumer 21 .
Producer/consumer with buffer 22 .
Mutual exclusion 23 .
Reachability Analysis • A marking is reachable from another marking if there exists a sequence of transition firings starting from the original marking that results in the new marking • The reachability set of a PN is the set of all markings that are reachable from its initial marking 24 .
with directed arcs between the markings representing the markingtomarking transitions • The directed arcs are labeled with the corresponding transition whose firing results in a change of the marking from the original marking to the new marking 25 .Reachability Analysis • A reachability graph is a directed graph whose nodes are the markings in the reachability set.
Generation of the reachability graph 26 .
even if the PN is unbounded. duplicate nodes: already generated.Generation of the reachability graph By properly identifying the frontier nodes. infinitely reproducible nodes. Three type of frontier nodes: terminal (dead) nodes: no transition is enabled. 27 . the generation of the reachability graph involves a finite number of steps.
Generation of the reachability graph 28 .
Infinitely reproducible nodes A marking M´´ is an infinitely reproducible node if: M´´ M´ m i´´ m i´ (i= 1. An arbitrarily large number of tokens is represented by a special symbol 29 .. the sequence M´ M´´ is firable from M´´ and then is infinitely reproducible. In fact. nplace) where M´ is a marking already generated.2 ….
Generation of an unbounded RG Producer/consumer 30 .
31 .Extensions of PN models arc multiplicity inhibitor arcs priority levels enabling functions (guards) Note: The last three extensions destroy the infinitely reproducible property.
whereby the enabling and firing rules are changed as follows: – Each input place must contain at least as many tokens as the cardinality of the corresponding input arc. it removes as many tokens from each input place as the cardinality of the corresponding input arc.Petri Net: Arc Multiplicity • An arc cardinality (or multiplicity) may be associated with input and output arcs. and deposits as many tokens in each output places as the cardinality of the corresponding output arc. m p – When the transition fires. 32 .
Petri Net : Inhibitor Arc pi tk pj Inhibitor arcs are represented with a circleheaded arc. The transition can fire iff the inhibitor place does not contain tokens. 33 .
Petri Net : Inhibitor Arc 34 .
Petri Net : Multiple Inhibitor Arc • An inhibitor arc drawn from place to a transition means that the transition cannot fire if the corresponding inhibitor place contains at least as many tokens as the cardinality of the corresponding inhibitor arc n m p • Inhibitor arcs are represented graphically as an arc ending in a small circle at the transition instead of an arrowhead 35 .
An Example: Before or cardinality of the output arc 36 .
An Example: After or cardinality of the output arc 37 .
among all the transitions enabled in a given marking. only those with associated highest priority level are allowed to fire. 38 .Priority levels A priority level can be attached to each PN transition. The standard execution rules are modified in the sense that.
Enabling Functions
An enabling function (or guard) is a boolean expression composed with the PN primitives (places, trans, tokens). The enabling rule is modified in the sense that beside the standard conditions, the enabling function must evaluate to true.
pi tk (tk) = #P1<2 & #P2=0
pj
39
High Level (colored) Petri Nets
In standard PN tokens are indistinguishable entities.
The semantics of the model does not allow to follow the behavior of an individual token through the PN.
High Level PN overcome this limitation by assigning to each individual token an attribute (color).
Places, arcs and transitions can have functions and guards depending on the colors.
40
Colored Petri Nets
t xC <x> <x> p xC
C is a set of colors of cardinality C and x is an element of the set. Place p can contain tokens of any color xC; Transition t can fires tokens of any color xC.
41
42 .Stochastic Petri Nets (SPN) • Petri nets are extended by associating time with the firing of transitions. • A special case of timed Petri nets is stochastic Petri net (SPN) where the firing times are considered random variables. resulting in timed Petri nets.
43 .Stochastic Petri Nets (SPN) • A special case of stochastic Petri net (SPN) is where the firing times are exponentially distributed. • The marking process is mapped into a continuous time Markov chain (CTMC) with state space isomorphic to the reachability graph of the PN.
t2 .SPN: A Simple Example Server Failure/Repair t1 p1 p2 p1 t1 . t2 p2 Reachability graph t1 10 t2 01 10 CTMC 01 44 .
From SPN to CTMC: A Simple Example 45 .
From SPN to CTMC: An Example 46 .
.. 0 47 ....SPN: Poisson Process PP with rate SPN model RG = CTMC 1 2 ..
48 0 .....SPN: M/M/1 Queue M/M/1 SPN model RG = CTMC 1 2 ...
.... n 0 49 ...SPN: M/M/1/n Queue (1) M/M/1/n n SPN model n 1 2 RG = CTMC .
.. n 0 50 ..SPN: M/M/1/n Queue (2) M/M/1/n n SPN model n RG = CTMC 1 2 ....
Marking dependent firing rate • A firing rate is associated with each timed transition. T n # Rate of T = n 51 . • Firing rate of a transition may be marking dependent.
Marking dependent firing rate The mutual exclusion problem can be folded (t1) = #P1 52 .
SPN: M/M/n/n Queue M/M/n/n n SPN model n # The use of markingdependent rate 53 .
SPN: M/M/m/n Queue (1) n m (t3) = #P4 (t1) = t1 arrival t2 service immediate trans. 54 n m .
SPN: M/M/m/n Queue (2) K parallel repairable components b) 1 repairman M/M/1/n (t1) = #P1 (t2) = c) 2 repairmen M/M/2/n (t1) = #P1 (t2) = #P2 if #P2<2 55 2 otherwise .
GSPN: M/M/i/n Queue Pserver Tarrival ni tquick Pqueue i Tservice Pservice # immediate trans. 56 .
ERG for M/M/i/n Queue i=0: 0.i1..i1 ...1 tquick 1......0.0 1.i..0 2.i.0.i 0..0 i>0 (ERG): Tarrival 0..0 i ..i. i ni.0 tquick 0.1 Tservice i>0 (CTMC): 0.0 i 1.1..i1 .i1.i.0 57 2 i .i Tservice 1.0.i1.i.0 tquick ni.0 0.0.0.. Tarrival Tservice Tarrival tquick tquick . n.0..0 ....i. 1.0.0 Tservice ni.1.1 1. 0.
have exponentially distributed firing times 58 . called immediate transitions.Generalized SPN • Sometimes when some events take extremely small time to occur. called timed transitions. it is useful to model them as instantaneous activities • SPN models were extended to allow for such modeling by allowing some transitions. to have zero firing times • The remaining transitions.
T t Immediate transition t is enabled! • If more than one immediate transition is enabled in a marking. p1 p2 t1 t2 Transition t1 & t2 will fire with p1 and p2. 59 . immediate transition has higher priority.Generalized SPN • The enabling rules are modified: if both an immediate and a timed transition are enabled in a marking. then the conflict is resolved by assigning firing probabilities to the immediate transitions.
Since the process spends zero time in vanishing markings they do not contribute to the time behavior of the system and must be eliminated 60 . Markings (states) enabling timed transitions only. are called tangible.GSPN Properties Markings (states) enabling immediate transitions are passed through in 0 time and are called vanishing.
contains vanishing marking. referred to as the Extended Reachability Graph (ERG). 61 . and is no longer a CTMC! Need to eliminate the vanishing markings to obtain the underlying CTMC.GSPN Properties The resulting reachability graph.
62 .Elimination of vanishing markings Situation 1 Only timed transitions are enabled.
Elimination of vanishing markings Situation 2 One immediate and timed transitions are enabled. ERG CTMC 63 .
Elimination of vanishing markings Situation 3 Several immediate transitions are enabled. ERG CTMC 64 .
t3 = M2 M3 65 .Elimination of vanishing markings Example t1 = #P1 t2 immed.
Traditional Methodology Step 3b: Or. ordinary differential equations (Transient solution) dp(t) /dt = p(t) Q given p(0) = p0 p(t): state probability vector Q: infinitesimal generator matrix 66 . build a system of linear. firstorder.
Traditional Methodology Step 3a: Build a system of linear equations (Steadystate solution) pQ= 0 p1 = 1 p: steadystate probability vector Q: infinitesimal generator matrix 67 .
There is a need to define the output measures at the PN level.Measures of Reliability & Performance Solving the model means evaluating the (transient / steady state) probability vector over the state space (markings). 68 . in term of the PN primitives. the modeler wants to interact only at the PN: the analytical procedure must be completely transparent to the analyst. However.
Measures of Reliability & Performance Output measures defined at the PN level. Expected number of firing of a PN trans (throughput). Time spent in a marking. All these measures can be reformulated in terms of reward functions (MRM) 69 . Mean (first) passage time. Distribution of tokens in a place. Probability of a given condition on the PN.
which consist in: generation of the reachability graph generation of the associated Markov chain.s. the firing rates of the transitions and the specification of the output measures. 70 . evaluation of the relevant process measures.Solving models with SPN The use of SPN requires only the topology of the PN. thus making transparent to the user the associated mathematics. must be completely automatized by a computer program. All the subsequent steps. transient and s. solution of the Markov chain.
Probability of a given condition on the PN Define a condition by a logical function (e.g #Pf = 0) and find the subset of states S where the condition holds true. In terms of reward rate rs = 1 0 sS otherwise 71 .
Expected time spent in a marking Define a condition by a logical function (e. In terms of reward rate rs = 1 0 sS otherwise 72 .g #Pf = 0) and find the subset of states S where the condition holds true.
The mean first passage time is: The above formula requires the transient analysis to be extended over long intervals (other more direct techniques are available). Qs(t) is the probability of first visit to S.Mean first passage time If the subset of states S is absorbing. 73 .
fi (k. … ) tokens in a place pi is fi (k. 2. 2.t) =s #pi = q s (t) k 74 . 1. 1. … ) tokens in pi.t). fi (k.Distribution of tokens in a place The density mass of having k (k = 0.t) can be evaluated by summing the probability of all the markings containing k (k = 0.
the expected number of tokens in place pi can be evaluated by: In terms of reward rate rs = k 75 . … ) tokens in a place pi.Expected number of tokens in a place Given the density mass of having k (k = 0. 1. 2.
Let S be the subset of markings enabling tk.t) this quantity indicates how many times. In terms of reward rate rs = k (s) 76 . an event modeled by a PN transition has occurred (throughput).Expected number of firings Given an interval (0. on the average.
Example: Multiprocessor with failure • Number of processors: n • Single repair facility is shared by all processors • A reconfiguration is needed after a covered fault • A reboot is required after an uncovered fault 77 .
Assumptions: • The failure rate of each processor is • The repair times are exponentially distributed with mean 1/ • A processor fault is covered with probability c • The reconfiguration times and the reboot times are exponentially distributed with parameter and . respectively 78 .
GSPN Model for Multiprocessor GSPN Model of a Multiprocessor 79 .
0.0.0.0.1.0.0.1.0.1.0.0.0.0.0 1.0 tcov 1.ERG for Multiprocessor Model (n=2) 2.0.0.0.0.0.0 (1c) 1.1 0.0.0.0.0.0.0.0.2 80 Reduced ERG for Multiprocessor model .2 tquick 0.1.0.0.0.1.0 Tfail 1.1.0.0 1.1 T fail 0.1 Extended Reachability Graph for Multiprocessor model 2.0 1.0.0 Trep Trep c Tuncov Treboot Trecon 1.0.0.
0. otherwise 81 .0.0. (1.1 ) ri = 0.Example: Reward Rates for Multiprocessor Availability • Reward rate at the net level for steady –state availability 1.0.0. # Pup 1 and (# Pcov # Pun cov ) = 0 otherwise • Reward rate at the CTMC level for steadystate availability (n=2) 1. ri = 0.0.0). i = (2.
Muppala and Trivedi [1989] • Structural characteristics – Extensive Marking dependency allowed for firing rates and firing probabilities – Transition Priorities – Guards (Enabling functions) for Transitions – Variable cardinality arcs 82 .Stochastic Reward Net (SRN) • Introduced by Ciardo.
Stochastic Reward Net (SRN) • Stochastic characteristics – Allow definition of reward rates in terms of net level entities – Automatically generate the reward rates for the markings – Enables computation of required measures of interest 83 .
Analysis Procedure of SRN Stochastic Reward Nets Reachability Analysis Extended Reachability Graphs Eliminates vanishing markings Markov Reward Model Solve MRM (transient or steadystate) Measures of Interest 84 .
SRN Summary Place Timed Transition Immediate Transition Input Arc An SRN Output Arc Inhibit Arc 85 .
SRN Analysis: Step1 Abstract the system > SRN Model Finite Buffer Specify in SRN Tools n m Poisson Arrival m m Single Server mstage Erlang Service time SRN of M/Em/1/n Queue 86 .
SRN Analysis: Step2 Reachability Analysis: Automatically Generate ERG SRN Specification Extended Reachabilty Graph Vanishing Marking Tangible Marking 87 .
SRN Analysis: Step3 Reachability Analysis: Automatically Generate RG Extended Reachabilty Graph Eliminate Vanishing Marking CTMC = RG 88 .
A System of Linear Equations GaussSeidel. 89 .SRN Analysis: Step4 Solve CTMC Steadystate Analysis: Power method. etc. etc. SOR (Successive overrelaxation) Transient Analysis: Classical ODE Methods A coupled system of ODE Randomization (or Uniformization).
Measures can be defined as reward functions which specify reward rates on netlevel entities. Delay etc.SRN Analysis: Step5 Compute measures of interest Measures of interests: Blocking/Dropping Probability. Throughput. Step 15: The SPN Tool does it all! 90 . Utilization.
1994 (A special case: At most one general transition can be enabled in any marking). 119158. 20. K. Journal of Systems Circuits and Computers.Choi. Bobbio and A. 8:1. Telek and K. A. 91 . 337357. Recent developments in nonMarkovian stochastic Petri nets. Puliafito and M.V. 1998.NonMarkovian SPN Transition Firing Time: not exponentially distributed H. Trivedi Markov regenerative stochastic Petri net (MRSPN) Performance Evaluation. Trivedi. Kulkarni.
92 . Kulkarni (1993) Allow both discrete and continuous places Useful in fluid approximation of discrete queueing system Powerful formalism of stochastic fluid queueing networks Boundary conditions complicated.Fluid Petri Net Fluid stochastic Petri net (FSPN) Introduced by K. Solution techniques under investigation. Trivedi and V.
The Fluid Petri Net Model FPN's are an extension of PN able to model the coexistence of discrete and continuous variables. continuous (or fluid) primitives that handle continuous (fluid) quantities. The primitives of FPN (places. transitions and arcs) are partitioned in two groups: discrete primitives that handle discrete tokens (as in standard PN). fluid arcs are assigned instantaneous flow rates. 93 .
Fluid Petri Nets
94
References
• http://www.ee.duke.edu/~kst/ then click on Stochastic Petri Nets • K. Trivedi, Probability and Statistics with Reliability, Queuing, and Computer Science Applications, 2nd Ed., John Wiley and Sons, New York, 2001
95
Conclusion
96
97 .