• 沒有找到結果。

Chapter 2. Background

2.1 Petri Net

Petri Net model is originated from the early work of Carl Adam Petri ([15]). Most readers refer to [14] when applying Petri nets. Petri net can be used to model many kinds of system and analyze with associated techniques.

Figure 2.1 An example of a Petri net

A Petri net (also called “net” in this thesis for short) is a directed graph with two kinds of nodes, named place and transition. There are no arcs connecting two places or two transitions.

A Petri net is also equipped with an initial marking, i.e. initially putting tokens in some places.

A marking is a current state of the net, as will be shown in Definition 2.2. Figure 2.1 is a Petri net example. A circle means a place, a rectangle means a transition, and a dot means a token.

If the initial marking of the Petri net puts a token in place p0, Figure 2.1 shows the initial state of the Petri net.

t0 t1 t2

p0

p1

p3 p4

p2

Definition 2.1 (Petri net)

A Petri net is a tuple PN = (P, T, F, m0) where

 P is a finite set of places;

 T is a finite set of transitions such that P ∩ T = ∅;

 F is a finite set of directed arcs, F ⊆ (P ∪ T) × (P ∪ T), satisfying F ∩ (P × P) = F ∩ (T × T) = ∅;

 m0 is the initial marking, m0: P → ℕ where ℕ = {0, 1, 2, …}.

Definition 2.1 is the algebraic definition of a Petri net. While this thesis presents a technique about Petri Net, some precise algebraic definitions about Petri Net must be defined.

Definition 2.2 (marking)

 A marking of a set of place P is a mapping m: P → ℕ where ℕ = {0, 1, 2, …}.

 A marking of a Petri net PN = (P, T, F, m0) is a marking of a set of place P.

A marking of a net represents a state of this net. It is a function defined from a set of places (or a set of all places in a net) to the set of nonnegative integers which means the number of tokens on each place. For the reason of readability, a marking of a net in an example can be expressed as an array with nonnegative integers which each element in it means the number of tokens on each place. For example, the marking of the net showed in Figure 2.1 can be represented as (1, 0, 0, 0, 0).

Definition 2.3 (pre- /post- set) Let PN = (P, T, F, m0) be a Petri net.

 For an element x ∈ P ∪ T, its pre-set x is defined by

x = { y ∈ P ∪ T | (y, x) ∈ F }

 and its post-set x is defined by x = { y ∈ P ∪ T | (x, y) ∈ F }.

Definition 2.3 defines the notations about the input and output sets of a node (place or

transition) in a net. Note that the input and output sets of a place can only be the sets of transitions and the input and output set of a transition can only be the sets of places.

A transition t is said to be enabled at m0 if for all p ∈ t , m0(p) ≧ 1. A transition may fire if it is enabled. The new marking m’ is obtained by removing one token from each of its input places and by putting one token to each of its output places. This process is denoted by m [t >

m’. Extension to firing sequences is denoted by m [σ > m’ where σ is a sequence of transitions that brings m to m’.

Definition 2.4 (incidence matrix)

The incidence matrix C = [cij] is such that 𝑐𝑖𝑗 =

1 if tj ∈ 𝑝 𝑖\ 𝑝𝑖

−1 if tj ∈ 𝑝𝑖 \ 𝑝 𝑖 0 otherwise

Definition 2.5 (P-characteristic vector)

The P-characteristic vector is a vector of dimension |P|, where |P| is the number of places. In a P-characteristic vector PCV.pi, ∀ pi ∈ P: the dimension for pi is set to be 1, and the rest are 0.

For example, PCV.p1=(0,1,0,0,0) is a P-characteristic vector of the Petri net in Figure 2.1, where each dimension represents a place and the number in the dimension for p1 is 1.

Definition 2.6 (T-characteristic vector)

The T-characteristic vector is a vector of dimension |T|, where |T| is the number of places. In a T-characteristic vector TCV.ti, ∀ ti ∈ T: the dimension for ti is set to be 1, and the rest are 0.

A transition t is enabled by a marking m if m marks all places in t. In this case t can occur. Its occurrence transforms m into the marking m'. The sentence “m marks all places in

t” indicates that the marking m puts at least one token on each place in t. m’ = m + C * et

shows the behavior of Petri nets while an occurrence of a transition (t) can transform from one marking (m) to another (m’) in a net, that is, from one state to another. Intuitively, when a transition is fired, it removes a token from each input place of it and adds a token on each output place of it.

For any m such that m0 [σ > m, m = m0 + C*𝜎 where 𝜎 , called the firing count vector, is a vector whose i-th entry denotes the number of occurrences of ti in σ. If there is a marking m’ that m [t > m’, the firing count vector at m’ is 𝜎 ’ = 𝜎 + et.

Figure2.2 The marking after firing t1

For example, in the net showed in Figure 2.1, if t0 is fired, the marking of this net becomes Figure 2.2 – a token is removed from p0 and two tokens is added on p1 and p2 separately. The marking of the net showed in Figure2.2 can be represented as m’ = (0, 1, 1, 0, 0), while m is the marking of Figure 2.1.

t0 t1 t2

p0

p1

p3 p4

p2

m C TCV.t0 m’ Independent Petri Net Editor” PIPE2 [16], is a graphical tool of open source with Java. PIPE2 contains the following analysis modules: Invariant, Simulation, and State Space, etc. Invariant Analysis Module calculates T- and P-invariants and the P-invariant equations. Simulation Analysis shows the average number of tokens in each place. In State Space Analysis Module, the result of the analysis is the determination of the boundness and the safeness of the current Petri net.

2.3 The Incremental Analysis Based on Occurrence Graph

2.3.1 Occurrence Graph

An occurrence graph (O-graph) can also be called a reachability graph. An O-graph of a Petri net is a graph uses all reachable markings from the initial marking as its nodes and uses all possible behaviors as its arcs. A behavior represents a transition being fired on a marking and the marking being transformed to another. Since O-graphs are state diagrams of Petri nets, they provide a very straightforward and easy-to-use method to analyze many properties of Petri nets.

相關文件