Petri Net
In contrast to state machines, state transitions in Petri nets are asynchronous. The ordering of transitions is partly uncoordinated; it is specified by a partial order.
Therefore, Petri nets can be used to model concurrent distributed systems.
Petri Nets: Graphical and Mathematical modeling tools
- graphical tool
- mathematical tool
The graphical presentation of a Petri net is a bipartite graph.
There are two kinds of nodes
- Places: usually model resources or partial state of the system
Transitions: model state transition and synchronization. - Arcs are directed and always connect nodes of different types
Tokens are resources in the places.
Definition of Petri Net
C=(P,T,I,O)
Places
P=p1,p2,p3,…,pnTransitions
T=t1,t2,t3,…,tnInput
I : T→Pr (r = number of places) ⋅tOutput
O : T→Pq (q = number of places) t⋅marking
µ : assignment of tokens to the places of Petri net µ=µ1,µ2,µ3,…µn
Petri net consist two types of nodes: places and transitions. And arc exists only from a place to a transition or from a transition to a place.
A place may have zero or more tokens.
Fire
A transition t is called enabled in a certain marking, if:
For every arc from a place p to t, there exists a distinct token in the marking
An enabled transition can fire and result in a new marking
Firing of a transition t in a marking is an atomic operation
Firing a transition results in two things:
- Subtracting one token from the marking of any place p for every arc connecting p to t
- Adding one token to the marking of any place p for every arc connecting t to p
Run-1 Safe PN
A run of a Petri net is a finite or infinite sequence of markings and transitions μ0−→t0μ1−→t1⋯−→−tn−1μn−→tn⋯ such that μ0 is the initial marking of the net, ti∈enabled(μi) for any i (i ≥ 0) , and that μi=(μi−1−⋅t