modelling by petri nets - roma tre university

24
Maria Pia FANTI Dipartimento di Elettrotecnica ed Elettronica Modelling by Petri nets Modelling by Petri nets Polytechnic of Bari, ITALY

Upload: others

Post on 05-Nov-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modelling by Petri nets - Roma Tre University

Maria Pia FANTI

Dipartimento di Elettrotecnica ed Elettronica

Modelling by Petri netsModelling by Petri nets

Polytechnic of Bari, ITALY

Page 2: Modelling by Petri nets - Roma Tre University

OutlineOutline

What are Petri Nets?

Definitions and basic concepts

Modelling with Petri Nets: main structures

Timed Petri nets

Conclusions

Page 3: Modelling by Petri nets - Roma Tre University

Petri NetsPetri Nets (PN) offer advantages because of their twofold representation: graphical and mathematical.

It is a graphical and mathematical tool for the formal description of the logical interactions and the dynamics of complex systems.

PN are particularly suited to model:Concurrency;Conflict;Sequencing;Synchronization;Sharing of limited resources;Mutual exclusion.

Page 4: Modelling by Petri nets - Roma Tre University

Petri NetsPetri 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 8,500 items can be found.

http://www.daimi.au.dk/PetriNets/

The main International Conference:

⇒ ATPN - Application and Theory of PN

Other conferences:

⇒Int. IFAC conference, IEEE SMC conference, IEEE CASE, WODES, etc.

Page 5: Modelling by Petri nets - Roma Tre University

Main references about definitions and properties of ordinary Petri nets

Murata T., (1989), “Petri nets: properties, analysis and applications”, IEEE Proceedings, Vol. 77, no. 4, 541-580.

Peterson, J.L., (1981), Petri Net Theory and the Modeling of Systems, Prentice Hall, Englewood Cliffs, NJ, USA.

Page 6: Modelling by Petri nets - Roma Tre University

DefinitionsDefinitionsA Petri net is a bipartite directed graph consisting of two kinds of nodes: places and transitions

– Places typically represent conditions within the system being modeled. They are represented by circles.

– Transitions represent events occurring in the system that may cause change in the condition of the system. They are represented by bars.

– 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).

Page 7: Modelling by Petri nets - Roma Tre University

DefinitionsDefinitionsA Petri net is described by the four-tuple PN=(P, T, Pre, Post) where:P P is the set of places and |P|=m

T is the set of transitions and |T|=n

Pre: P×T→N is the pre incidence matrix, that specifies the arcs directed from places to transitionsPost: P×T→N is the post incidence matrix, that specifies the arcs directed from transitions to places

Page 8: Modelling by Petri nets - Roma Tre University

Example of Petri netExample of Petri net

Page 9: Modelling by Petri nets - Roma Tre University

Incidence MatrixIncidence Matrix

Page 10: Modelling by Petri nets - Roma Tre University

Tokens are dots (or integers) associated with places; a place containing tokens indicates that the corresponding condition holdsMarking is a function M: P→N that associates to each place a non negative number. It is a vector listing the number of tokens in each place of the net

PN DefinitionsPN Definitions

Page 11: Modelling by Petri nets - Roma Tre University

M0 is the initial marking

A net system <PN, M0 > is a dynamical system

PN DefinitionsPN Definitions

Page 12: Modelling by Petri nets - Roma Tre University

When input places of a transition have the required number of tokens, the transition is enabled.

An enabled transition may fire (event happens) removingone or more tokens from each input place and depositing one or more tokens in each of its output place.

PN dynamicsPN dynamics

2

p1p1

p1

p2

p2

t1

t1

3

3

2

Page 13: Modelling by Petri nets - Roma Tre University

SequenceSequence

Modelling by Petri nets: main structuresModelling by Petri nets: main structures

Concurrency (or Parallelism)Concurrency (or Parallelism)

Page 14: Modelling by Petri nets - Roma Tre University

Choice (non determinism)Choice (non determinism)

Modelling by Petri nets: main structuresModelling by Petri nets: main structures

Page 15: Modelling by Petri nets - Roma Tre University

SynchronizationSynchronization

Modelling by Petri nets: main structuresModelling by Petri nets: main structures

Page 16: Modelling by Petri nets - Roma Tre University

Limited ResourcesLimited Resources

Modelling by Petri nets: main structuresModelling by Petri nets: main structures

Page 17: Modelling by Petri nets - Roma Tre University

For performance and dependability analysis it is necessary to introduce the duration of the events associated with PN transitions.

The structures to extend the PN by time are different.

Delay times can be associated with places, transitions or arcs.

Typically time is associated with timed transitions.

Powerful Powerful modelingmodeling tools: Timed Petri Nets (TPN)tools: Timed Petri Nets (TPN)

Page 18: Modelling by Petri nets - Roma Tre University

Firing in 3 phases: 1- tokens are removed from the input places, 2- the delay time associated with the transition elapses, 3- tokens are deposed in the output place.

Firing in one phase: tokens arrive in the input place, enable the transition and stay in the place for the delay time associated with the transition. If at the end of the delay time the transition is enabled, then the transition fires.

In this case conflicts are solved.

Powerful modeling tools: Timed Petri Nets (TPN)

Page 19: Modelling by Petri nets - Roma Tre University

Immediate transition : transition fires as soon as it is enabled, the associated delay time is equal to zero.

Deterministic timed transitions: the delay associated with the transition is deterministic and usually constant (black box).

Stochastic timed transition : a stochastic variable is associated to the delay θ with a known distribution function (white box)

If θ has exponential distribution f(θ)=λe-λθ, then the average delay time is 1/λ.

Classification of timed transitions

Page 20: Modelling by Petri nets - Roma Tre University

Infinite server: each transition represents a server that can perform infinite parallel operations.

Single server: each transition represents a server that can perform only one operation at a time.

Server semantic

θθ

3θθ

Multiple server: each transition represents a server that can perform k operations at a time.

Page 21: Modelling by Petri nets - Roma Tre University

Total memory: transition remembers that it has been previously enabled.

Abilitation memory: transition remembers just the actual enabling

Transition memory

θ2

θ1

θ3

θ2<θ1<2θ2

t1

t2 t3

example

Page 22: Modelling by Petri nets - Roma Tre University

Una transizione ti è abilitata da Mj se per ogni p∈P si ha Mj≥Pre(.,ti).

Il grado di abilitazione ai(j) di ti abilitata da Mj è il piùgrande numero intero k tale che Mj ≥kPre(.,ti).

Evoluzione dinamica

Detto oi il più piccolo degli orologi associati a ti, essorappresenta il tempo che deve passare a partiredall’istante attuale, prima del prossimo scatto di ti, se tinon viene disabilitata prima che trascorra il tempo oi.

Ad ogni transizione ti sono associati, all’istante τj, ai(j) orologi, ogni orologio viene inizializzato ogni volta che la transizione viene abilitata, ai valori indicati dallatemporizzazione.

Page 23: Modelling by Petri nets - Roma Tre University

All’istante τj la TPN abbia la marcatura Mj e per ogni ti sianonoti i valori minimi oi degli orologi associati.

•Determinare o*=mini[oi] sia t* la transizione corrispondente

•Il tempo avanza τj+1=τj+o*

•la nuova marcatura è Mj+1=Mj+C(.,t*)

•Gli orologi vengono aggiornati:

•Se ai(j+1)< ai(j) allora sono scartati gli ai(j)-ai(j+1) orologicon i valori più alti, gli altri sono diminuiti di o*

•Se ai(j+1)>ai(j) allora ai(j+1)-ai(j) orologi vengono aggiuntia ti, gli altri sono diminuiti di o*.

Evoluzione dinamica: serventi infiniti, memoria di abilitazione

Page 24: Modelling by Petri nets - Roma Tre University

Maria Pia FANTI

Dipartimento di Elettrotecnica ed Elettronica

Modelling by Petri netsModelling by Petri nets

Polytechnic of Bari, ITALY