Post on 13-Dec-2015
Maria Pia FANTI
Dipartimento di Elettrotecnica ed Elettronica
Modelling by Petri netsModelling by Petri nets
Polytechnic of Bari, ITALY
OutlineOutline
What are Petri Nets?
Definitions and basic concepts
Modelling with Petri Nets: main structures
Timed Petri nets
Conclusions
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.
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.
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.
DefinitionsDefinitions
A 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).
DefinitionsDefinitions
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
DefinitionsDefinitions
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 arrive from the transition
Example of a PNExample of a PN
p1 – resource idle
p2 – resource busy
t1 – task arrives
t2 – task completes
p1
t2
p2
t1t1
DefinitionsDefinitionsMore formally, a 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×TN is the pre incidence matrix, that specifies the arcs directed from places to transitionsPost: P×TN is the post incidence matrix, that specifies the arcs directed from transitions to places
Example of Petri netExample of Petri net
Incidence MatrixIncidence Matrix
Tokens are dots (or integers) associated with places; a place containing tokens indicates that the corresponding condition holdsMarking is a function M: PN 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
M0 is the initial marking
A net system <PN, M0 > is a dynamical system
PN DefinitionsPN Definitions
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 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
Example of a PNExample of a PN
p1 – resource idle
p2 – resource busy p3 – user
t1 – task starts
t2 – task completes
p1
t2
p2
t1p3
Transition t2 is enabled at M0 because M0 Pre(.,t2).An enabled transition may fire (event happens) removing one token from each input place and depositing one token in each of its output place.
Enabling conditionEnabling condition
Firing
Firing
Introducing the firing vector
0
1
0
0
0
u
It holds: M=M0+ C u
SequenceSequence
Modelling by Petri nets: main structuresModelling by Petri nets: main structures
Concurrency (or Parallelism)Concurrency (or Parallelism)
Choice (non determinism)Choice (non determinism)
Modelling by Petri nets: main structuresModelling by Petri nets: main structures
SynchronizationSynchronization
Modelling by Petri nets: main structuresModelling by Petri nets: main structures
Limited ResourcesLimited Resources
Modelling by Petri nets: main structuresModelling by Petri nets: main structures
Producer/consumerProducer/consumer
Modelling by Petri netsModelling by Petri nets
Transmitter/receiver processTransmitter/receiver process
Modelling by Petri netsModelling by Petri nets
Mutual exclusion or choiceMutual exclusion or choice
Modelling by Petri nets: main structuresModelling by Petri nets: main structures
A marking M’ is reachable from M if there exists a firing sequence s=t1t2..tn starting from M that results in the new marking M’
Hence: M’=M+Cu where u is the firing vector associated to s.
The reachability set of a PN system <PN,M0> is the set of all markings that are reachable from its initial marking
Reachability Analysis
Reachability AnalysisReachability 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 marking-to-marking 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
7ab15e
Reachability AnalysisReachability Analysis
If the reachability set is infinite then the nodes of the reachability graph are infinite in number: it is necessary to build a coverability graph.
Several analysis are based on the reachability graph: behavioral analysis.
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: terminal (dead) nodes: no transition is enabled; duplicate nodes: already generated; infinitely reproducible nodes.
Reachability graphReachability graph
Structural properties Structural properties
The structural properties are the properties that depend on the structure of the net and on the initial marking.
Reachability
Bundness
Liveness
Conservativeness
Deadlock
Analysis may be based on the rechability graph or on the state equation
Main advantage of the Petri net modeling: Main advantage of the Petri net modeling: linear algebraic structurelinear algebraic structure
While the state of a DES is non numerical the state of a Petri net is a vectorThe model of an machine that may fails:
For performance and dependability analysis it is necessary to introduce the duration of the events associated to PN transitions.
Hence Petri nets are extended by associating time with the firing of transitions, resulting in timed Petri nets.
Deterministic timed transitions are typically represented by black boxes
Powerful modeling tools:Powerful modeling tools:timed Petri Netstimed Petri Nets
t1 t2
2 s