Process modeling - Monmouth University

Download Report

Transcript Process modeling - Monmouth University

SE-561
Math Foundations
Petri Nets - II
Dr. Jiacun Wang
Department of Software Engineering
Monmouth University
12/07/2007
Jiacun Wang
1
Review: Petri Nets
A Petri net N is a tuple N = {P, T, I, O, M0}, 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 = f),
 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,
 M0 : P  N is the initial marking representing the initial
distribution of tokens.
12/07/2007
Jiacun Wang
MF-14 2
Review: Transition Firing

A transition t is enabled at marking Mi if and only if
Mi ≥ I(t)
 Let E(Mi) be the set of all transitions enabled at Mi. Then t  E(Mi).
 Suppose that the firing of t takes the Petri net from Mi to Mj. Then
Mj = Mi - I(t) + O(t)
Denoted by Mi[t>Mj
 Example
P = {p1, p2}
T = {t1, t2, t3}
I(t1) = (1, 1),
I(t2) = (2, 0),
O(t1) = (1, 0),
O(t2) = (0, 1),
M0 = (2, 1)
E(M0) = {t1, t2}
M0[t1> M1 where M1 = (3, 1)
12/07/2007
I(t3) = (0, 2)
O(t3) = (0, 1)
p1
p2
t2
Jiacun Wang
t1
t3
MF-14 3
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:
12/07/2007
Jiacun Wang
MF-14 4
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:
green token
red token
 More generally, we could allow arbitrary values as tokens, e.g. to
model numeric variables:
1
12/07/2007
5
Jiacun Wang
MF-14 5
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.
12/07/2007
Jiacun Wang
MF-14 6
High-Level Petri Nets: Transitions

In meaningful models, we need
transitions to reason about the values of
tokens:
Switching the traffic light:
Increasing variable:
12/07/2007
Jiacun Wang
MF-14 7
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:
12/07/2007
Jiacun Wang
MF-14 8
High-Level Petri Nets: Definition
 A high-level Petri net (HL-net) is a tuple N = (P, T, I, O, V, S, C,
M0), where
 P, T, I, O are as usual;
 V is a set of token values;
 S: P  2V is a type assignment for places;
 C(t) is the firing condition of transition t (see next slide).
 M0 : P × V  N is the initial marking.
12/07/2007
Jiacun Wang
MF-14 9
Transition Firing Conditions
 A firing condition decides which tokens may flow out of the preplaces 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:
12/07/2007
Jiacun Wang
MF-14 10
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/07/2007
Jiacun Wang
MF-14 11
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.
12/07/2007
Jiacun Wang
MF-14 12
Example 2
 In the common-resource example, suppose the prioritised
process is changed after every access:
12/07/2007
Jiacun Wang
MF-14 13
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 pv for each v 
S(p).
 If M0(p, v) = k, then put k initial tokens on the ordinary place pv .
12/07/2007
Jiacun Wang
MF-14 14
From High-Level Petri Nets to
Ordinary Petri Nets: Transitions
 For each high-level transition t, create an ordinary transition ta for
each assignment under which t may fire.
 If (p, t) is a high-level arc with variable x, connect pv to ta in the
ordinary net, where v is the value of x in a.
 Arcs from transitions to places are treated analogously.
12/07/2007
Jiacun Wang
MF-14 15
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





12/07/2007
Jiacun Wang
MF-14 16