Professional Documents
Culture Documents
Petri Nets: (Modeling and Analysis of System Behavior)
Petri Nets: (Modeling and Analysis of System Behavior)
Practical session 1
Petri Nets
Introduction:
- Petri nets were introduced in 1962 by Dr. Carl Adam Petri
- A powerful modeling formalism in computer science
- Petri nets combine:
- Mathematical theory (modeling and analysis of system behavior)
- Graphical representation of the dynamic behavior of systems
(state changes)
- good for modelling:
- Concurrency
- Synchronization
Definition:
- Petri net is a particular kind of bipartite (2-nodes) directed graphs with
three types of objects.
- its simplest form , a transition together with an input place and an output
place , may be used for example to represent a data processing event in a
data processing system (modeled system)
- study the dynamic behavior of a Petri net modeled system in terms of its
states and state changes , each place may potentially hold either none or a
positive number of tokens.
- Tokens can represent : resource availability , jobs to perform , fulfillment
of the condition,….
Petri net structure:
- A Petri net is composed of 5 parts, PN(P,T,I,O,M0):
1
Modelling and Simulation / 4th year
Practical session 1
.
Transition Firing:
2
Modelling and Simulation / 4th year
Practical session 1
Examples:
Enabling Rule :
(a) Enabled
(b) Disabled
(a) (b)
Firing Rule:
3
Modelling and Simulation / 4th year
Practical session 1
Behavioural properties:
1) Reachability
Can we reach one
particular state from
intial state?
When studying the dynamics of Petri nets, it is often desirable to know if the given
marking M1 can be reached from the initial marking M0 or if an undesirable
marking M2 can be avoided.
Therefore, it is necessary to know if there is a firing sequence that can bring the net to
a new marking.
The firing of an enabled transition will change the token distribution (marking)
in a net
A marking M is said to be reachable from M0 (initial marking) if there exists a
sequence of firings of transitions σ that transforms M0 to M .
A firing sequence is denoted by σ=t1 t2 t3 ….tn .
4
Modelling and Simulation / 4th year
Practical session 1
It is often desirable to know whether Petri net model is bounded. The bounded
property is especially useful when we want to define the size of the system or to
reveal some design errors.
5
Modelling and Simulation / 4th year
Practical session 1
A place in a Petri net is safe if the number of tokens in that place never exceeds
one (The number of tokens in that place is either 0 or 1) .
Note
The concept of safe and bounded nets is independent of the firing sequences. It
should be noticed that bounded indicates the finiteness of reachability space.
Places in a Petri net are often used to represent buffers and registers for
storing intermediate data. By verifying that the net is bounded or safe, it is
guaranteed that there will be no overflows in the buffers or registers, no matter
what firing sequence is taken.
6
Modelling and Simulation / 4th year
Practical session 1
3) Live
Will the system die in
a particular state ?
It’s easier to prove if a petri net is alive by proving that it’s not dead because there are
only two cases in which a petri net is said to be dead:
1. There is a transition that is impossible to get enabled, which can be
represented in a reachability graph by the absence of that impossible
transition.
2. After some firing sequence, there is no enabled transition, which can be
represented in a reachability graph by the existence of a leaf marking.
7
Modelling and Simulation / 4th year
Practical session 1
4) Reversibility
A Petri net is said to be reversible if for each marking M , M0 is reachable from M .
Thus, in reversible net one can always get back to the initial marking or state.
Existence of the reversibility ensures that the system can always recover the normal
behavior and is important for systems subject to failures.
5) Persistence
A PN is persistent if, for any two enabled transitions, the firing of one of them will
not disable the other. Then, once a transition is enabled, it remains enabled until it’s
fired. Persistency means conflict-free nets.
In other words, we can say: no action can disable another one.
The notion of persistence is useful in the context of parallel program.
Examples:
Explain behavioral properties (Bounded – Live- Reversibility- persistence) for
the following nets:
8
Modelling and Simulation / 4th year
Practical session 1
Bounded, not live , not reversible, not Unbounded, live , reversible, persistent
persistent
How Petri net handles real life modeling situations, thus revealing the
modeling power and ease of representation of Petri net
9
Modelling and Simulation / 4th year
Practical session 1
10