Title: Modeling based on Petri-nets.
1Modeling based on Petri-nets.
Lecture 8
2High-level Petri nets
- The classical Petri net was invented by Carl Adam
Petri in 1962. - A lot of research has been conducted (gt10.000
publications). - Until 1985 it was mainly used by theoreticians.
- Since the 80-ties the practical use is increasing
because of the introduction of high-level Petri
nets and the availability of many tools. - High-level Petri nets are Petri nets extended
with - color (for the modeling of attributes)
- time (for performance analysis)
- hierarchy (for the structuring of models, DFD's)
3The classical Petri net model
- A Petri net is a network composed of places ( )
and transitions ( ).
t2
p2
t1
p1
p4
t3
p3
Connections are directed and between a place and
a transition. Tokens ( ) are the dynamic
objects. The state of a Petri net is determined
by the distribution of tokens over the places.
4p1
p4
t1
p2
p3
- Transition t1 has three input places (p1, p2 and
p3) and two output places (p3 and p4). - Place p3 is both an input and an output place of
t1.
5Enabling condition
- Transitions are the active components and places
and tokens are passive. - A transition is enabled if each of the input
places contains tokens.
Transition t1 is not enabled, transition t2 is
enabled.
6Firing
- An enabled transition may fire.
- Firing corresponds to consuming tokens from the
input places and producing tokens for the output
places.
Firing is atomic.
7Example
8Non-determinism
t1
t2
- Two transitions fight for the same token
conflict. - Even if there are two tokens, there is still a
conflict.
9Modeling
- States of a process are modeled by tokens in
places and state transitions leading from one
state to another are modeled by transitions. - Tokens represent objects (humans, goods,
machines), information, conditions or states of
objects. - Places represent buffers, channels, geographical
locations, conditions or states. - Transitions represent events, transformations or
transportations.
10Example traffic light
11Two traffic lights
12Two safe traffic lights
13Two safe and fair traffic lights
red1
red2
safe2
yr1
yr2
yellow1
yellow2
rg1
rg2
gy1
gy2
safe1
green1
green2
14Example life-cycle of a person
child
puberty
bachelor
marriage
married
divorce
death
dead
15br
black
red
bb
rr
- The number of arcs between two objects specifies
the number of tokens to be produced/consumed. - This can be used to model (dis)assembly processes.
16Some definitions
- current stateThe configuration of tokens over
the places. - reachable stateA state reachable form the
current state by firing a sequence of enabled
transitions. - dead stateA state where no transition is
enabled. -
17- 7 reachable states, 1 dead state.
18Exercise your life-cycle
sleeping
start
stop
active
die
dead
- How many states are reachable?
- Is there a dead state?
19Exercise readers and writers
receive_mail
begin
mail_box
rest
rest
type_mail
read_mail
ready
send_mail
- How many states are reachable?
- Are there any dead states?
- How to model the situation with 2 writers and 3
readers? - How to model a "bounded mailbox" (buffer size 4)?
20High-level Petri nets
- In practice the classical Petri net is not very
useful - The Petri net becomes too large and too complex.
- It takes too much time to model a given
situation. - It is not possible to handle time and data.
- Therefore, we use high-level Petri nets, i.e.
Petri nets extended with - color
- time
- hierarchy
21- To explain the three extensions we use the
following example of a hairdresser's saloon.
hairdresser ready to begin
free
client waiting
start
finish
waiting
busy
ready
Note how easy it is to model the situation with
multiple hairdressers.
22The extension with color
- A token often represents an object having all
kinds of attributes. - Therefore, each token has a value (color) with
refers to specific features of the object modeled
by the token.
name Sally age 28 hairtype BL
name Harry age 28 experience 2
23- Each transition has an (in)formal specification
which specifies - the number of tokens to be produced,
- the values of these tokens,
- and (optionally) a precondition.
- The complexity is divided over the network and
the values of tokens. - This results in a compact, manageable and natural
process description.
24Examples
c ab
b -a
a
b
-
a
b
c
a gt0 b Ö a
a
b
b
sqrt
a
select
c
if agt 0 then b a else ca fi
Exercise calculate Ö ab using these buiding
blocks
25The extension with time
- For performance analysis we need to model
durations, delays, etc. - Therefore, each token has a timestamp and
transitions determine the delay of a produced
token.
26The extension with hierarchy
- A mechanism to structure complex Petri nets
comparable to DFD's. - A subnet is a net composed out of places,
transitions and subnets.
h1
h2
waiting
ready
h3
27Exercise remove hierarchy
h1
h2
waiting
ready
h3
begin
end
pending
begin
end
pending