Download presentation
Presentation is loading. Please wait.
1
12/07/2007Jiacun Wang1 SE-561 Math Foundations Petri Nets - II Dr. Jiacun Wang Department of Software Engineering Monmouth University
2
12/07/2007 Jiacun Wang MF-14 2 Review: Petri Nets A Petri net N is a tuple N = {P, T, I, O, M 0 }, where P is a finite set of places, graphically represented by circles T is a finite set of transitions, graphically represented by boxes Places P and transitions T are disjoint (P ∩ T = ), I: P × T N ( N = {0, 1, 2, …}) is the pre-incidence function representing input arcs, O: T × P N ( N = {0, 1, 2, …}) is the post-incidence function representing output arcs, M 0 : P N is the initial marking representing the initial distribution of tokens.
3
12/07/2007 Jiacun Wang MF-14 3 Review: Transition Firing A transition t is enabled at marking M i if and only if M i ≥ I(t) Let E(M i ) be the set of all transitions enabled at M i. Then t E(M i ). Suppose that the firing of t takes the Petri net from M i to M j. Then M j = M i - I(t) + O(t) Denoted by M i [t>M j Example p2p1 t3t2 t1 P = {p1, p2} T = {t1, t2, t3} I(t1) = (1, 1), I(t2) = (2, 0), I(t3) = (0, 2) O(t1) = (1, 0), O(t2) = (0, 1), O(t3) = (0, 1) M 0 = (2, 1) E(M 0 ) = {t1, t2} M 0 [t1> M 1 where M 1 = (3, 1)
4
12/07/2007 Jiacun Wang MF-14 4 High-Level Petri Nets: Motivation Up to now, we allowed places to be occupied by only “black” tokens. Traffic light example: Three lights, one color per light, one place for every light. Suppose we have one light that can be either red or green. Two attempts at modeling this situation:
5
12/07/2007 Jiacun Wang MF-14 5 High-Level Petri Nets: Motivation (cont.) If we had not just black tokens, but colored ones (e.g. red, green), we could construct a more natural model: More generally, we could allow arbitrary values as tokens, e.g. to model numeric variables: 15 green token red token
6
12/07/2007 Jiacun Wang MF-14 6 High-Level Petri Nets: Places A general solution is to assign a type to every place, i.e. a set of token values that are permitted on the place: In general, a place may contain a multiset of its type.
7
12/07/2007 Jiacun Wang MF-14 7 High-Level Petri Nets: Transitions In meaningful models, we need transitions to reason about the values of tokens: Switching the traffic light: Increasing variable:
8
12/07/2007 Jiacun Wang MF-14 8 High-Level Petri Nets: Transitions (cont.) Suppose we have two processes competing for a common resource. If both try to access the resource simultaneously, there is a ‘referee’ who decides which process should have priority over the other:
9
12/07/2007 Jiacun Wang MF-14 9 High-Level Petri Nets: Definition A high-level Petri net (HL-net) is a tuple N = (P, T, I, O, V, S, C, M 0 ), where P, T, I, O are as usual; V is a set of token values; S: P 2 V is a type assignment for places; C(t) is the firing condition of transition t (see next slide). M 0 : P × V N is the initial marking.
10
12/07/2007 Jiacun Wang MF-14 10 Transition Firing Conditions A firing condition decides which tokens may flow out of the pre- places and into the post-places of a transition. Formally, if we let t be the sum of the arc weights leading into and out of t, then the signature of Ct is Ct : Vt ! {false, true}. In figures, we place variable names onto the arcs and equip transitions with boolean expressions over these variables, like this:
11
12/07/2007 Jiacun Wang MF-14 11 Transition Firing Conditions (cont.) If a particular assignment of token values to variables evaluates to true, then the transition may fire under that assignment. Firing under some assignment is possible if for every pre-place p, p contains the token values assigned to the variables that are on the arc from p to t. Firing removes those tokens and puts corresponding tokens on the post-places. The assignment must respect the types; e.g. if v is the variable on the arc from place p to transition t, then v must be assigned to some value from S(p).
12
12/07/2007 Jiacun Wang MF-14 12 Example 1 For instance, in the following example, the transition could fire under the assignments (‘x = 1, x’ = 2), (‘x = 2, x’ = 3), (‘x = 3, x’ = 4), (‘x = 4, x’ = 5). In the given marking, we can remove the 2 token and replace it by a 3 token.
13
12/07/2007 Jiacun Wang MF-14 13 Example 2 In the common-resource example, suppose the prioritised process is changed after every access:
14
12/07/2007 Jiacun Wang MF-14 14 From High-Level Petri Nets to Ordinary Petri Nets: Places High-level nets allow easier modeling, but they are equally expressive, provided that the set of token values is finite. For each high-level place p, create an ordinary place p v for each v S(p). If M 0 (p, v) = k, then put k initial tokens on the ordinary place p v.
15
12/07/2007 Jiacun Wang MF-14 15 From High-Level Petri Nets to Ordinary Petri Nets: Transitions For each high-level transition t, create an ordinary transition t a for each assignment under which t may fire. If (p, t) is a high-level arc with variable x, connect p v to t a in the ordinary net, where v is the value of x in a. Arcs from transitions to places are treated analogously.
16
12/07/2007 Jiacun Wang MF-14 16 Final Exam Open book, open slides, open … No laptop Set theory: Venn diagram Functions: 1-to-1, onto. Graph theory: Graph matrix, Euler paths/circuits, Hamilton paths/circuits Petri nets: Given a Petri net, write its formal definition and list all reachable markings. Petri nets: Petri net modeling according to specification
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.