Petri Nets Sunday November 18 2012 1 Definition
Petri Nets Sunday, November 18, 2012 1
Definition of Petri Net n C = ( P, T, I, O) Places P = { p 1, p 2, p 3, …, pn} ¨ Transitions T = { t 1, t 2, t 3, …, tn} ¨ Input I : T Pr (r = number of places) ¨ Output O : T Pq (q = number of places) ¨ n marking µ : assignment of tokens to the places of Petri net µ = µ 1, µ 2, µ 3, … µn 2
Basics of Petri Nets n Petri net is primarily used for studying the dynamic concurrent behavior of network-based systems where there is a discrete flow. 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. n A place may have zero or more tokens. n Graphically, places, transitions, arcs, and tokens are represented respectively by: circles, bars, arrows, and dots. 3
Basics of Petri Nets … n Below is an example Petri net with two places and one transaction. n Transition node is ready to fire if and only if there is at least one token at each of its input places p 1 t 1 p 2 state transition of form (1, 0) (0, 1) p 1 : input place p 2: output place 4
Basics of Petri Nets … n Sequential Execution Transition t 2 can fire only after the firing of t 1. This impose the precedence of constraints "t 2 after t 1. " n p 2 t 2 p 3 Synchronization Transition t 1 will be enabled only when a token there at least one token at each of its input places. n p 1 t 1 Merging Happens when tokens from several places arrive for service at the same transition. 5
Basics of Petri Nets … n Concurrency t 1 and t 2 are concurrent. - with this property, Petri net is able to model systems of distributed control with multiple processes executing concurrently in time. t 1 t 2 6
Basics of Petri Nets … n Conflict t 1 and t 2 are both ready to fire but the firing of any leads to the disabling of the other transitions. t 1 t 2 7
Example: In a Restaurant (A Petri Net) Waiter free Customer 1 Customer 2 Take order wait eating Serve food Order taken Tell kitchen wait eating Serve food 8
Example: In a Restaurant (Two Scenarios) n Scenario 1: ¨ Waiter takes order from customer 1; serves customer 1; takes order from customer 2; serves customer 2. n Scenario 2: ¨ Waiter takes order from customer 1; takes order from customer 2; serves customer 1. 9
Example: In a Restaurant (Scenario 1) Waiter free Customer 1 Customer 2 Take order wait eating Serve food Order taken Tell kitchen wait eating Serve food 10
Example: In a Restaurant (Scenario 2) Waiter free Customer 1 Customer 2 Take order wait eating Serve food Order taken Tell kitchen wait eating Serve food 11
Example: Vending Machine (A Petri net) Take 15 c bar Deposit 10 c 5 c 15 c Deposit 5 c 0 c Deposit 5 c Deposit 10 c Deposit 5 c 20 c Deposit 10 c Take 20 c bar 12
Example: Vending Machine (3 Scenarios) n Scenario 1: ¨ Deposit 5 c, deposit 5 c, take 20 c snack bar. n Scenario 2: ¨ Deposit n 10 c, deposit 5 c, take 15 c snack bar. Scenario 3: ¨ Deposit bar. 5 c, deposit 10 c, deposit 5 c, take 20 c snack 13
Example: Vending Machine (Token Games) Take 15 c bar Deposit 10 c 5 c 15 c Deposit 5 c 0 c Deposit 5 c Deposit 10 c Deposit 5 c 20 c Deposit 10 c Take 20 c bar 14
Petri Net examples (Dining Philosophers) n n Five philosophers alternatively think and eating Chopsticks: p 0, p 2, p 4, p 6, p 8 Philosophers eating: p 10, p 11, p 12, p 13, p 14 Philosophers thinking/meditating: p 1, p 3, p 5, p 7, p 9 15
Time in Petri Net n Original model of Petri Net was timeless. Time was not explicitly considered. n Even though there arguments against the introduction of time, there are several applications that require notion of time. n General approach: ¨ Transition is associated with a time for which no event/firing of a token can occur until this delay time has elapsed. ¨ This delay time can be deterministic or probabilistic. 16
Modeling of Time n Constant times ¨ Transition occurs at pre-determined times (deterministic) n Stochastic times ¨ Time is determined by some random variable (probabilistic) ¨ Stochastic Petri Nets(SPN) 17
Stochastic Petri Nets n n An SPN is defined as a 7 -tuple SPN= (P, T, I(. ), O(. ), H(. ), W(. ), M 0) where PN = (P, T, I(. ), O(. ), H(. ), M 0) is the P/T system underlying the SPN Transitions have an exponentially distributed delay W(. ): T --> R assigns a rate to each transition (inverse of the mean firing time) 18
Stochastic Petri Nets … n The stochastic process underlying an SPN is a CTMC in which ¨ the state transition rate diagram is isomorphic to the reachability graph ¨ the transition labels are computed from the W(. ) functions of the transitions enabled in a state. 19
Stochastic Petri Nets … 20
Generalized Stochastic Petri Net (GSPN) n Two types of transitions timed with an exponentially distributed delay ¨ immediate, with constant zero delay ¨ immediate have priority over timed ¨ n Why immediate transitions: to account for instantaneous actions (typically choices) ¨ to implement logical actions (e. g. emptying a place) ¨ to account for large time scale differences (e. g. bus arbitration vs. I/O accesses) ¨ 21
Generalized Stochastic Petri Net (GSPN) … 22
Stochastic Activity Network (SAN) n The desire to represent system characteristics of parallelism and timeliness, as well as fault tolerance and degradable performance, precipitated the development of general level performability models known as stochastic activity networks. n Stochastic activity networks are probabilistic extensions of activity networks the nature of the extension is similar to the extension that constructs stochastic Petri nets from (classical) 23 Petri nets.
Stochastic Activity Network (SAN) … 24
- Slides: 24