0% found this document useful (0 votes)
55 views47 pages

Petri Nets. An: Javier Campos Universidad de Zaragoza

The document introduces Petri nets, which are a formal, graphical, and executable technique for modeling concurrent systems. Petri nets represent systems as bipartite graphs with two types of nodes: places representing states or conditions, and transitions representing events or actions. The state of a system is represented by the marking of tokens across different places. Petri nets allow formally analyzing system properties and verifying requirements.

Uploaded by

tete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views47 pages

Petri Nets. An: Javier Campos Universidad de Zaragoza

The document introduces Petri nets, which are a formal, graphical, and executable technique for modeling concurrent systems. Petri nets represent systems as bipartite graphs with two types of nodes: places representing states or conditions, and transitions representing events or actions. The state of a system is represented by the marking of tokens across different places. Petri nets allow formally analyzing system properties and verifying requirements.

Uploaded by

tete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Petri nets.

An introduction

Javier Campos
Universidad de Zaragoza
[Link]
Outline

Basic concepts
Definitions
Functional properties and analysis

Javier Campos. Petri nets 2


Basic concepts
 Global versus local models
A system has three identical components. Each of these
components is repairable and fails with the same probability.

 In a Markov Chain, the circles or states represent all the


components in that model.

Each state represents the entire system in a particular combination


of conditions (global model).
Each node in the graph represents a state = poor abstract level.

Javier Campos. Petri nets 3


Basic concepts
 Global versus local models
For the same application…

 The equivalent Petri Net…

Each component is represented with one or several “state nodes”


(called places).
The state is distributed. The marking of all the places represents
the state (local model) = higher level of abstracion.

Javier Campos. Petri nets 4


Basic concepts
 Global versus local models
For the same application…

 The equivalent Petri Net…

Each component is represented with one or several “state nodes”


(called places).
The state is distributed. The marking of all the places represents
the state (local model) = higher level of abstracion.

Javier Campos. Petri nets 5


Basic concepts
 Global versus local models
For the same application…

 The equivalent Petri Net…

1 2

Each component is represented with one or several “state nodes”


(called places).
The state is distributed. The marking of all the places represents
the state (local model) = higher level of abstracion.

Javier Campos. Petri nets 6


Basic concepts
 Global versus local models
For the same application…

 The equivalent Petri Net…

0 3

Each component is represented with one or several “state nodes”


(called places).
The state is distributed. The marking of all the places represents
the state (local model) = higher level of abstracion.

Javier Campos. Petri nets 7


Basic concepts

Petri nets:

A formal, graphical, executable technique


for the specification and analysis of
concurrent, discrete-event dynamic
systems; a technique undergoing
standardisation.

[Link]

Javier Campos. Petri nets 8


Basic concepts

Formal:

The technique is mathematically defined.


Many static and dynamic properties of a
PN (and hence a system specified using the
technique) may be mathematically proven.

Javier Campos. Petri nets 9


Basic concepts
 Graphical:
The technique belongs to a branch of mathematics
called graph theory.

A PN may be represented graphically as well as


mathematically.

The ability to visualise structure and behaviour of


a PN promotes understanding of the modelled
system.

Software tools exist which support graphical


construction and visualisation.

Javier Campos. Petri nets 10


Basic concepts
 Executable:

A PN may be executed and the dynamic behaviour


observed graphically.

PN practitioners regard this as a key strength of


the PN technique, both as a rich feedback
mechanism during model construction and as an aid
in communicating the behaviour of the model to
other practioners and lay-persons.

Software tools exist which automate execution.

Javier Campos. Petri nets 11


Basic concepts

Specification:

System requirements expressed and


verified (by formal analysis) using the
technique constitute a formal system
specification.

Javier Campos. Petri nets 12


Basic concepts
 Analysis:
A specification in the form of a PN model may be formally
analysed, to verify that static and dynamic system
requirements are met.

Methods available are based on Occurrence graphs (state


spaces), Invariants and Timed PN. The inclusion of timing
enables performance analysis.

Modelling is an iterative process. At each iteration analysis


may uncover errors in the model or shortcomings in the
specification. In response the PN is modified and re-
analysed. Eventually a mathematically correct and consistent
model and specification is achieved.

Software tools exist which support and automate analysis.

Javier Campos. Petri nets 13


Basic concepts

Concurrent:

The representation of multiple independent


dynamic entities within a system is
supported naturally by the technique,
making it highly suitable for capturing
systems which exhibit concurrency, e.g.,
multi-agent systems, distributed
databases, client-server networks and
modern telecommunications systems.

Javier Campos. Petri nets 14


Basic concepts
 Discrete-event dynamic system:

A system which may change state over time, based


on current state and state-transition rules, and
where each state is separated from its neighbour
by a step rather than a continuum of intermediate
infinitesimal states.

Often falling into this classification are


information systems, operating systems,
networking protocols, banking systems, business
processes, telecommunications systems, population
systems, chemical networks, many biological
systems…

Javier Campos. Petri nets 15


Basic concepts
 Standardisation:

 2004-12-02
Achieved Published Standard status:
ISO/IEC 15909-1:2004 Systems and software
engineering - High-level Petri nets - Part 1: Concepts,
definitions and graphical notation. Available from ISO.

 2011-02-14
Achieved Published Standard status:
ISO/IEC 15909-2:2011 Systems and software
engineering - High-level Petri nets - Part 2: Transfer
format. Available from ISO.

Javier Campos. Petri nets 16


Definition
 Graphical representations

Useful to inform about model structure

a picture is better than a thousand words

 Continuous systems:  Discrete event systems:


 Circuits diagrams  State diagrams 
 Block diagrams  Markov chains
 Bond graphs  Algorithmic state machines
…  PERTs
 QNs
 …

Javier Campos. Petri nets 17


Definition

In Petri Nets: two basic concepts


( graphical objects)

states/data (PLACES)
actions/algorithms (TRANSITIONS)
+ weight (labeling) of the arcs

Javier Campos. Petri nets 18


Definitions

Autonomous Petri nets


(place/transition nets or P/T nets)
Petri Nets is a bipartite valued graph
 Places: states/data (P)
 Transitions: actions/algorithms (T)
 Arcs: connecting places and transitions (F)
 Weights: labeling the arcs (W)

N = < P, T, F, W >

inscriptions
in the arcs
PRE POST

Javier Campos. Petri nets 19


Definitions
 Net  Static part 1
 Places : State variables (names)
 Transitions: Changes in the state a f
(conditions)
2 4 6

 Marking  Dynamic part b c e


 Marking : State variables (values)
3 5
 Event/Firing
d
 Enabling: the pre-condition is
verified
 Firing: change in the marking
 the pre-condition “consumes”


tokens 3 3

 the post-condition “produces”


tokens
2 4 2 4

Javier Campos. Petri nets 20


Definitions
 Net  Static part
 Places : State variables (names)
1
 Transitions: Changes in the state
(conditions) a f

 Marking  Dynamic part 2 4 6


 Marking : State variables (values)
b c e

 Event/Firing 3 5
 Enabling: the pre-condition is
verified d
 Firing: change in the marking
 the pre-condition “consumes”
tokens
 the post-condition “produces”
tokens

Javier Campos. Petri nets 21


Definitions
 Net  Static part
 Places : State variables (names)
1
 Transitions: Changes in the state
(conditions) a f

 Marking  Dynamic part 2 4 6


 Marking : State variables (values)
b c e

 Event/Firing 3 5
 Enabling: the pre-condition is
verified d
 Firing: change in the marking
 the pre-condition “consumes”
tokens
 the post-condition “produces”
tokens

Javier Campos. Petri nets 22


Definitions
 Net  Static part
 Places : State variables (names)
1
 Transitions: Changes in the state
(conditions) a f

 Marking  Dynamic part 2 4 6


 Marking : State variables (values)
b c e

 Event/Firing 3 5
 Enabling: the pre-condition is
verified d
 Firing: change in the marking
 the pre-condition “consumes”
tokens
 the post-condition “produces”
tokens

Javier Campos. Petri nets 23


Definitions
 Net  Static part
 Places : State variables (names)
1
 Transitions: Changes in the state
(conditions) a f

 Marking  Dynamic part 2 4 6


 Marking : State variables (values)
b c e

 Event/Firing 3 5
 Enabling: the pre-condition is
verified d
 Firing: change in the marking
 the pre-condition “consumes”
tokens
 the post-condition “produces”
tokens

Javier Campos. Petri nets 24


Definitions
 Net  Static part
 Places : State variables (names)
1
 Transitions: Changes in the state
(conditions) a f

 Marking  Dynamic part 2 4 6


 Marking : State variables (values)
b c e

 Event/Firing 3 5
 Enabling: the pre-condition is
verified d
 Firing: change in the marking
 the pre-condition “consumes”
tokens
 the post-condition “produces”
tokens

Javier Campos. Petri nets 25


Definitions
PN and its algebraic representation based
on state equation
 Linear representation of PNs, the structure:
N  P,T , Pre, Post 
 Pre-incidence matrix

Pre( p,t ): PxT  N 


 Post-incidence matrix
Post ( p,t ): PxT  N 

 Incidence matrix, C = Post – Pre


(marked) Petri Net is finally defined by:   N ,m0

Javier Campos. Petri nets 26


Definitions
a b c d e f
1 p1 1 0 0 0 0 0
p2 0 1 0 0 0 0
a f Pre  p3 0 0 0 1 0 0
 
p4 0 0 1 0 1 0
2 4 6 p5 0 0 0 1 0 0
p6 0
 0 0 0 0 1
b c e
a b c d e f
p1 0 0 0 1 0 0
3 5
p2 1 0 0 0 0 0
Post  p3 0 1 0 0 0 0
d  
p4 1 0 0 0 0 1
p5 0 0 1 0 0 0
p6 0
 0 0 0 1 0

Incidence matrix C (= Post – Pre)  cannot ”see” self loops

Javier Campos. Petri nets 27


Definitions
 State equation definition
m(k  1)  m(k )  C(t ) 
m( k ) [t  m( k  1) 
 m(k )  Post (t )  Pre(t )  0
Integrating in one execution (sequence of firing)

m0 [   m( k )  m( k )  m 0  C  

where  (bold) is the firing counting vector of 

Very important: unfortunately…

m( k )  m0  C      
 m0 [   m ( k )

Javier Campos. Petri nets 28


Definitions
 Design methodologies:
1. Parallel composition by…

synchronization

+ bottom-up methodology
fusion

Javier Campos. Petri nets 29


Definitions
 Design methodologies (cont):
2. Sequential composition by refinement

+ top-down methodology

Javier Campos. Petri nets 30


Definitions
 Design methodologies (cont):
typical synchronization schemes
 
i

S
RV

5. Fork-Joint
6. Sub programa
1. Rendezvous, RV 2. Semáforo, S (p i ,pj están en mutex)

 
 
S

S S 
S

8. Guarda (condición
3. RV/Semáforo simétrico 4. RV/Semáforo asimétrico de lectura)
(master/slave)

7. Recurso compartido (  )
Javier Campos. Petri nets 31
Definitions
 PN syntactic subclasses
 State machines 1
 Subclass of ordinary PN
(arc weights = 1) a f
 Neither synchronizations
nor structural parallelism 4 6
allowed
 Model systems with a c e
finite number of states
5
 Their analysis and
synthesis theory is well-
known d

Javier Campos. Petri nets 32


Definitions
 PN syntactic subclasses (cont.)
 Marked Graphs
1
 Subclass of ordinary PN (arc weights
= 1) a
 Allow synchronizations and
parallelism but not allow decisions 2 4
 No conflicts present
b c
 Allow the modeling of infinite
number of states 3 5
 Their analysis and synthesis theory
is well-known d

Javier Campos. Petri nets 33


Definitions
 PN syntactic subclasses (cont.)
1
 Free-Choice nets
 Subclass of ordinary PN (arc a f
weights = 1)
6
 Allow synchronizations, parallelism 2 4
and choices c e
b
 Choices and synchronizations
cannot be present in the same 3 5
transition
 Their analysis and synthesis d
theory is well-known

 There are other syntactic


subclasses…

Javier Campos. Petri nets 34


Functional properties and analysis
 Functional basic properties
 Boundedness: finiteness of the state space, i.e. the marking of
all places is bounded
p  P  k  N such that m ( p)  k
 Safeness = 1-boundedness (binary marking)
 Mutual Exclusion: two or more places cannot be marked
simultaneously (problem of shared resources)
 Deadlock: situation where there is no transition enabled
 Liveness: infinite potential activity of all transitions

t  T , m reachable, m' , m [σ  m ' such that m ' [t 


 Home state: a marking that can be recovered from every
reachable marking
 Reversibility: recovering of the initial marking
m reachable, σ such that m [  m 0

Javier Campos. Petri nets 35


Functional properties and analysis

Structural basic properties:


N is structurally bounded if for all m0,
<N, m0> is bounded

N is structurally live if there exists a m0 for


which <N, m0> is live

Javier Campos. Petri nets 36


Functional properties and analysis

Analysis techniques (for the computation


of functional properties)
Enumerative: based on reachability graph
Structural: based on the structure of the
model, considering m0 as a parameter
Reduction/transformation: rules that preserve
a given property and simplify the model

Javier Campos. Petri nets 37


Functional properties and analysis

Enumerative analysis: exhaustive sequential


enumeration of reachable states
Problem 1: state explosion problem
Problem 2: lost of information about concurrent
behaviour
1 1(6)
Adding place 6 does not modify
a
a reachability graph but b and c
24(6) cannot fire simultaneously.
2 4
6 b c
b c d
34(6) 25(6)
3 5
c b
reachability graph
d 35(6)

Javier Campos. Petri nets 38


Functional properties and analysis

Enumerative analysis (cont.):


Bounded system  finite reachability graph
1 M0
0100
t2 t3
t1 M1 M2
0010 0011
2 t4 t5
t4 t4
M3 M4 M5
t2 t3
1000 1001 1010

3 4 t1 t1 t5 t1 t4
M6 M7
t5 0101 0110

unbounded system

Javier Campos. Petri nets 39


Functional properties and analysis

Enumerative analysis (cont.):


Deadlock exists  There exists a terminal
node in the RG
1 M0
0100
t2 t3 t1
t1 M1 M2
0010 0011
2 t4 t4 t5
t4
M3 M4 M5
t2 t3
1000 1001 1010
3 4 t5 t4
M6 0110

M3 is a deadlock

Javier Campos. Petri nets 40


Functional properties and analysis
 Enumerative analysis (cont.):
 Live net  in all the strongly connected components of
the RG all transitions can be fired
 Reversible net  there is only one strongly connected
component in the RG
a M0
10103
a M d
p1 1
d 01102
c b
p4 01013
p5 p3 10101
a M2 c
b
10012 live and
non-reversible
01100
a
b
c p2
d
01011
C1 system
c
10010 C2

Javier Campos. Petri nets 41


Functional properties and analysis

Structural analysis:
Based either on convex geometry (linear
algebra and linear programming), or
Based on graph theory
We concentrate on first approach.

 Definitions:
P-semiflow: y  0, yT.C = 0
T-semiflow: x  0, C.x = 0

Javier Campos. Petri nets 42


Functional properties and analysis
 Properties:
1. If y is a P-semiflow, then the next token conservation
law holds (or P-invariant):

for all m  RS(N, m0) and for all m0 


 yT. m = yT. m0.

Proof: if mRS(N, m0) then m = m0 + C., and pre-


multiplying by yT:

yT. m = yT. m0 + yT.C. = yT.m0

P-semiflows  Conservation of tokens

Javier Campos. Petri nets 43


Functional properties and analysis
 Properties (cont.):
2. If m is a reachable marking in N,  a fireable sequence
with  =x, and x a T-semiflow, the next property
follows (or T-invariant):
m [ >m

Proof: if is a T-semiflow, m=m0+C.x=m0

T-semiflows  Repetitivity of the marking

 P and T-semiflows can be computed using


algorithms based in Convex Geometry (linear
algebra and linear programming)

Javier Campos. Petri nets 44


Functional properties and analysis
 Definitions:
 N is conservative  y > 0, yT.C = 0
 N is structurally bounded   y  1, yT.C  0
(computable in polynomial time)

 Properties: pre-multiplying by y the state equation


 N conservative  yT. m = yT. m0
(token conservation)
 N structurally bounded  yT. m  yT. m0
(tokens limitation)

Javier Campos. Petri nets 45


Functional properties and analysis
 Definitions:
 N is consistent   x > 0, C.x = 0
 N is structurally repetitive   x  1, C.x  0
 Properties:
 <N,m0> repetitive  N structurally repetitive
 N structurally live  N structurally repetitive
 N structurally live and structurally bounded 
structurally repetitive and structurally bounded
 consistent and conservative

Javier Campos. Petri nets 46


Reading material
 Untimed Petri nets, by E. Teruel, G. Franceschinis, M. Silva.
In Performance Models for Discrete Event Systems with
Synchronizations: Formalisms and Analysis Techniques, G.
Balbo & M. Silva (ed.), Chapter 2, pp. 27-75, Zaragoza, Spain,
Editorial KRONOS, September 1998.
 Logical properties of P/T systems and their analysis, by J.M.
Colom, E. Teruel, M. Silva. In Performance Models for
Discrete Event Systems with Synchronizations: Formalisms
and Analysis Techniques, G. Balbo & M. Silva (ed.), Chapter 6,
pp. 185-232, Zaragoza, Spain, Editorial KRONOS,
September 1998.
 Linear algebraic and linear programming techniques for the
analysis of net systems, by M. Silva, E. Teruel, J.M.
Colom. Lecture Notes in Computer Science, Lectures in Petri
Nets. I: Basic Models, G. Rozenberg and W. Reisig (ed.), vol.
1491, pp. 309-373, Berlin, Springer-Verlag, 1998.

Javier Campos. Petri nets 47

You might also like