Sie sind auf Seite 1von 27

An Introduction to Petri Nets

11/23/99

AN INTRODUCTION TO PETRI NETS

INTRODUCTION

The point of view taken in this introduction to discrete event systems (DES) is that they consist of interacting nodes. Each node can be a system in itself and may be thought of as a component of the DES. These components can operate concurrently, i.e., a component can be performing one of its functions at the same time that another component is carrying out one of its respective functions. For example, a customer at an Automated Teller Machine (ATM) can be making a deposit when another customer at another ATM of the same network can be making a withdrawal. These two activities are not independent from the system's perspective: they change the state of the system by changing the level of deposits (assets) of the bank. Consider now the case when the two customers access the same account - a husband and wife with a joint account, or two employees in the accounts payable section of the same company. Problems of synchronization of the two operations arise. Note that there is no fixed, predetermined order to the two events. The deposit may be made before the withdrawal or the withdrawal before the deposit. The specific order may lead to different results; banks have developed detailed regulations regarding the timing and sequencing of deposits and withdrawals. How then can we describe these kinds of problems in a precise, unambiguous manner? The need to address such problems of concurrency in systems led Carl Adam Petri to introduce in his PhD thesis (1962) a special class of generalized graphs or nets now called Petri Nets. They are a modeling and analysis tool that is well suited for the study of Discrete Event Systems. The use of Petri Nets leads to a mathematical description of the system structure that can then be investigated analytically. In this introduction, the basic definitions and properties of Petri Nets are presented. While there is an extensive literature on the subject, both on the theory and on applications, there is no major introductory textbook available that presents Petri Net theory and contains in a consistent manner the many recent theoretical and computational results. Here, only the basic notions and properties are discussed. References related to specific topics are given throughout the note. Introductory material about Petri Nets may be found in Peterson (1981), Reisig (1985), and Cassandras (1993). Additional material can be found in Jensen (1991), Baccelli et al. (1992); Zhou and DiCesare (1993). You can obtaqin more information on Petri Nets by visiting the Petri Nets site in the world wide web (http://www.daimi.aau.dk/CPNets/ ).

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

FUNDAMENTALS

Since Petri Nets (PN) are a special type of graph, the presentation will start with some basic notions from graph theory. A graph consists of two types of elements, nodes or vertices and edges, and the manner in which these elements are interconnected. Formally (see any book on graph theory)), Definition 1 : A graph G = (V, E, ? ) consists of a nonempty set V called the set of nodes of the graph, a set E called the set of edges of the graph, and a mapping ? from the set of edges E to a set of pairs of elements of V. If the pair of nodes connected by an edge is ordered, then the edge is directed and an arrow is placed on the edge indicating the direction. If all the edges of the graph are directed, then the graph itself is called a directed graph or digraph. Three examples of graphs are shown in Figure 1. Note that the first one, consisting of only two unconnected nodes, can be considered both as a directed and an undirected graph.
n1 n2

n1

n2 Undirected Graph

n1

n2 Directed graph

Figure 1 Examples of graphs Two nodes that are connected by an edge in a graph are called adjacent nodes. Nodes need not be represented by dots only; they can be represented by circles, bars, boxes, or any other convenient symbol for the particular application. When a graph contains parallel edges, i.e., edges that connect the same pair of nodes and, if directed, have the same direction, then it is called a multigraph. Examples of multigraphs are shown in Figure 2.

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

n1

n2

n1

n2

n1

n2

n3 Multigraph

n3 Multigraph

n3 Not a multigraph

Figure 2 Examples of multigraphs While Petri Nets are multigraphs, in this note we will consider ordinary Petri Nets only. In many applications, parallel edges are very useful and the multigraph properties of Petri Nets can be used to advantage. However, they introduce notational and other complexities that are best addressed when extensions to Ordinary Petri Nets are considered (e.g., Colored Petri Nets) A second characteristic of Petri Nets as graphs is that they are bipartite graphs. This means that they have two types of nodes. Different symbols are used to distinguish the two types of nodes. By convention, the first type of node is called a place and is denoted by a circle or ellipse. The second type is called a transition and is denoted by a solid bar, or a rectangle. The edges of a Petri Net are called arcs and are always directed. The symbols are shown in Figure 3.

Places

Transitions

Arcs

Figure 3 Places, Transitions, and Arcs A bipartite graph has a special property: an edge can connect only two nodes that belong to different types. Therefore, there can be an arc from a place to a transition, from a transition to a place, but not from a place to a place or a transition to a transition. Note that this rule is easy to implement in any Petri Net editing software.

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

Now that Petri Nets have been placed in the context of graph theory, we are ready for some formal definitions. 3 ORDINARY PETRI NETS

Definition 2 A Petri Net is a bipartite directed graph represented by a quadruple PN = (P, T, I, O) where: P = {p1,...,pn} is a finite set of places. T = {t1,...,tm} is a finite set of transitions. I (p,t) is a mapping P T {0,1} corresponding to the set of directed arcs from places to transitions. O(t,p) is a mapping T P {0,1} corresponding to the set of directed arcs from transitions to places. The nets under consideration in this chapter, where I and O take the values of 0 or 1, are called ordinary Petri Nets. An example of a Petri Net is shown in Figure 4; let it be denoted PN1. Places are represented by circles and transitions by bars. This is the convention that will be adopted for Ordinary Petri Nets. t3 p

t1

p1

t2

p3

t5

p2

t4

Figure 4. Petri Net PN1. The structure of this Petri Net, i.e., the quadruple that defines it, can be represented as follows:: P = {p1, p2, p3, p4 , p5 } 4

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

T = {t1, t2, t3, t4 , t5 }

I(p1, I(p1, I(p1, I(p1, I(p1, O(t1 , O(t1 , O(t1 , O(t1 , O(t1 ,

t1) = 0 t2) = 1 t3) = 0 t4) = 0 t5) = 0 p1 ) = p2 ) = p3 ) = p4 ) = p5 ) = 1 0 0 0 0

I(p2 , I(p2 , I(p2 , I(p2 , I(p2 , O(t2, O(t2, O(t2, O(t2, O(t2,

t1 ) = 0 t2 ) = 0 t3 ) = 0 t4 ) = 1 t5 ) = 0 p1) = 0 p2) = 1 p3) = 1 p4) = 0 p5) = 0

I(p3, I(p3, I(p3, I(p3, I(p3,

t1) = 0 t2) = 0 t3) = 0 t4) = 0 t5) = 1

I(p4 , I(p4 , I(p4 , I(p4 , I(p4 ,

t1 ) = 0 t2 ) = 0 t3 ) = 1 t4 ) = 0 t5 ) = 0

I(p5 , I(p5 , I(p5 , I(p5 , I(p5 , O(t5, O(t5, O(t5, O(t5, O(t5,

t1 ) = t2 ) = t3 ) = t4 ) = t5 ) =

0 1 0 0 0

O(t3 , p1 ) = 1 O(t3 , p2 ) = 0 O(t3 , p3 ) = 0 O(t3 , p4 ) =0 O(t3 , p5 ) = 0

O(t4, p1) = 0 O(t4, p2) = 0 O(t4 , p3 ) =0 O(t4, p4) = 0 O(t4, p5) = 1

p1) =0 p2) =0 p3) =0 p4) =1 p5) =0

We denote by t the set of all input places of transition t and call it the preset of t and by t the set of all output places of transition t and call it the postset of t. The same notation applies for places as well: the preset p denotes the set of all input transitions of place p, while the postset p denotes the set of all output transitions of place p. For the Petri Net PN1 of Figure 4, the following relations hold: p1 = {t1,t3}, t2 = {p2,p3} for the preset of p1 and the postset of t2. Note that by defining the set of places, the set of transitions, and the presets and postsets either of all places or of all transitions we obtain an equivalent representation of the structure of a Petri Net. The concepts of preset and postset become very useful in describing algorithms for the analysis of Petri Nets. Self-loops and Pure Petri Nets A place p and a transition t are on a self-loop, if p is both an input and an output place of t. A Petri Net will be pure, if it does not contain self loops. The Petri Net PN1 on Fig. 4 is pure, while the Petri Net PN2 in Fig. 5 is not: it contains the self-loop (t2, p3).

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

p3

p1 t1

p2 t2

p4 t3

p5

Figure 5 A Petri Net PN2 with a self-loop (t2, p3) The following notions are taken directly from graph theory and interpreted in the context of Petri Nets. Subnet of a Petri Net A subnet of a Petri Net PN = (P, T, I, O) is a Petri Net PNs = (Ps, Ts, Is, Os) such that: P Ps ; T T s and Is and Os are the restrictions of I and O to Ps Ts and Ts Ps, respectively. The self loop of PN2 in Figure 5 is one possible subnet : PN21 = (P1 , T1 , O1 , I1 ) where P1 = {p3 }; T1 = {t2 } I(p3 , t2 ) = 1 and O(t2 , p3 ) = 1 Paths A path is a set of k nodes and k-1 arcs, for some integer k, such that the i-th arc either connects the i-th node to the i+1-th node, or the i+1-th node to the i-th node. The path is directed, if for all i = 1, 2, ..., k, the i-th arc connects the i-th node to the i+1-th node. A path in which no arc is traversed more than once is called a simple path. A path in which no node is traversed more than once is an elementary path. 6

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

Clearly, all elementary paths are simple paths, but the converse is not true. In Figure 5 the path (p1 , t1 , p2 , t2 , p4 , t3 , p5 ) is an elementary path and a simple path. The path (p1 , t1 , p2 , t2 , p3 , t2 , p4 , t3 , p5 ) is a simple path, but not an elementary one, since the node t2 is traversed twice. Connectivity A Petri Net is connected if and only if there exists a path - not necessarily directed - from any node to any other node. Strong Connectivity A Petri Net is strongly connected if and only if there exists a directed path from any node to any other node. The net of Fig. 4 , PN1, is connected but not strongly connected: there is no directed path from p1 to t1, for instance. A net with the same nodes and links as PN1 with the exception of t1 and its link to p1 would be strongly connected. The net PN2 in Fig. 5 is also connected and, very clearly, not strongly connected. Indeed, both nets have some common properties. In Fig. 4, transition t1 has no preset, there are no incoming arcs. In Fig. 5, place p1 has no preset, no incoming arcs. When a connected node has only outgoing arcs, we will call it a source; when it has only incoming arcs, we will call it a sink. (Sometimes these are referred to as start and end nodes.) If a net has even one sink or source, it cannot possibly be strongly connected. Directed Circuit A directed circuit is a directed path from one node back to itself. Directed Elementary Circuit A directed elementary circuit is a directed circuit in which no node appears more than once. The net PN1 in Fig. 4 has two directed elementary circuits:


A. H. Levis

p1 - t2 - p3 - t5 - p4 - t3 - p1 t2 - p2 - t4 - p5 - t2

v.3.3

An Introduction to Petri Nets

11/23/99

Directed elementary circuits play a key role in the performance analysis of DES models described by Petri Nets. An algebraic characterization of those circuits will be given in section 7 for a specific class of Petri Nets. 4 LINEAR ALGEBRAIC APPROACH

In section 3, Petri Nets were introduced using a graph theoretic approach. Petri Nets can also be described in terms of integer arithmetic. This ability of representing models both graphically and in terms of integer arithmetic makes them particularly attractive as tools for computer aided design, where the user can be interacting graphically with the nets on a monitor (editing) while at the same time he can use a number of algorithms to support the analysis. Incidence Matrix The topological structure of a pure Petri Net can be represented by an integer matrix C, called an incidence or flow matrix. C is a n m matrix whose m columns correspond to the transitions and whose n rows correspond to the places of the net. C is defined as follows: Cij = O(tj,pi) - I(pi,tj) for 1 = = 1 = = i n, j m. (1)

Note that the definition is restricted to pure Petri Nets. There is actually a problem with non-pure Petri Nets in the sense that self-loops cannot be represented in the incidence matrix: a 1 and a -1 cancel each other to yield a zero in the matrix, thus losing track of the existence of the self-loop. The mappings O and I can be reconstructed from the matrix C in the following trivial way: O(tj,pi) = max {Cij , 0}, I(pi,tj) = min {Cij , 0}.

The incidence matrix of the Petri Net PN1 is given below.

0 1 1 1 0 0 1 0 1 1 0 C1 = 0 1 0 0 0 0 1 0 1 0 0 1 0 1

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

MARKINGS AND EXECUTION

Petri Nets would not be very useful, if all we could do is draw a diagram describing the relationships among the objects represented by the nodes. There are other established techniques to do this that are easy to use, and have supporting software. An essential feature of Petri Nets is that they can be executed; one can observe the interactions between the components and study the dynamics of the system modeled by a Petri Net. In this section, the marking of a Petri Net will be introduced and the firing of transitions will be described. This will lead us to further characterization of the properties of ordinary Petri Nets. In addition to the two types of nodes - places and transitions - and the arcs, a fourth object is introduced in order to describe the dynamics of a Petri Net. This object is the token, denoted by a solid dot , and residing inside the circles representing the places. In ordinary Petri Nets, the tokens do not represent specific information and are not distinguishable. They are only markers, indicating the presence or absence of whatever they represent - a condition, a signal, a piece to be machined, etc. Places can hold an arbitrary number of tokens, or they can be restricted as to the number they can hold (capacitated places). A simple arc from a place to a transition indicates that the transition requires one token in that place as one of the conditions for it to be enabled. In a multigraph, the multiplicity of the arc denotes the number of tokens from that place that the transition requires in order to be enabled. In what follows, we will assume no restriction in the number of tokens a place may hold, and we will assume that the arc multiplicity is 1. These conditions will be revised when Colored Petri Nets are discussed. Marking A marking of a PN - denoted by M - is a mapping: P {0,1,2,...} which assigns a nonnegative integer number of tokens to each place of the net. A marking can be represented by a n-dimensional integer vector whose components correspond to the places of the net. In Figures 4, and 5 no tokens are shown. The marking of these nets is denoted by the following null vectors: PN1: PN2: M0 = [0 0 0 0 0]T. M0 = [0 0 0 0 0]T.

since both nets have five places. The marking vector represents the state of the Petri Net, i.e., the distribution of tokens in the places of the net defines its state. The system state changes when the distribution of tokens
A. H. Levis v.3.3

An Introduction to Petri Nets

11/23/99

changes. It should be apparent that, in general, the number of states of a Petri Net is very large. Consider, for example, a net in which the places are allowed to hold at most one token. If there are n places in the net, then the possible number of states is 2n. The process by which the distribution of tokens changes is the firing of transitions. Recall that we are considering nets with places that can hold an arbitrary number of tokens and with arcs that have multiplicity 1. Then, the following definitions hold: Enablement and Firing A transition t is enabled by a given marking M if and only if there is at least one token in each input place of t. When a transition is enabled it can fire. A token is removed from each of the input places of t (the preset of t) and a token is generated in each of the output places of t (the postset of t). The new marking M' reached after the firing of t is defined as follows: ( p P ) M'(p) = M(p) + O(t,p) - I(p,t). (2)

In the Petri Net of Figure 4, t1 is the only transition that is enabled. Its preset is null and, therefore, it is always enabled. It can actually fire an infinite number of times. No other transition is ever enabled from this initial marking. Now consider the Petri Net of Figure 5, but with the initial marking vector: PN2: M0 = [1 0 1 0 0]T

as shown in Figure 6. Transition t1 is enabled, but t2 is not enabled since one of its input places, p2, does not contain a token. When t1 fires, the token is removed from p1 and a new token appears in p2. (Figure 7) Note that in Petri Nets the firing operation does not "move" tokens through the net. The token in p1 did not move to p2. We will see later in this chapter that "conservation" of tokens is not a usual property of a net. Now, t2 is enabled, since there is a token in each of its input places, p2 and p3. When t2 fires, the tokens in p2 and p3 are removed and new tokens are generated in p3 (!) and p4, as shown in Figure 8. Note that the marking of the place p3 does not change after the firing of transition t2. Note also that p3 and t2 form a self loop.

A. H. Levis

v.3.3

10

An Introduction to Petri Nets

11/23/99

p3

p1 t1

p2

p4

p5

t2

t3

Figure 6 PN2 with initial marking ( t1 is enabled).

p3

p1 t1

p2

p4

p5

t2

t3

Figure 7 The state of PN2 after one firing (t1 fires; t2 is enabled).

p3

p1 t1

p2 t2

p4 t3

p5

Figure 8 The state of PN2 after two firings (t2 fires, t3 is enabled).

Transition t3 is now enabled and it fires. The token is removed from p4 and a token is generated in p5 (Figure 9). No more transitions are enabled and execution of the net is terminated. The process we have just witnessed is referred to as the token game.

A. H. Levis

v.3.3

11

An Introduction to Petri Nets

11/23/99

p3

p1 t1

p2 t2

p4 t3

p5

Figure 9 The state of PN2 after three firings (t3 fires - no transition is enabled.) Firing sequence The sequential firing of transitions t1, t2, ..., ts will be denoted as: s = t1 t2 ... ts-1 ts. The set of all firing sequences of a PN will be denoted by T . For PN2 , the example of Figures 6 to 9, the firing sequence is 3 = t1 t2 t3 . For the example of Figure 4, PN1, the only possible firing sequences are the power series of t1, denoted by t1m, where m is a positive integer. Reachability Set Given an initial marking M0 of a Petri Net PN, the reachability set - denoted (M0) - is the set of all possible reachable markings. In other words, a marking M belongs to (M0) if there exists a firing sequence leading from M0 to M. The reachability set of the example net PN1, given the initial marking M0, is: 1(M0) = { [ n 0 0 0 0 ]T | n positive integer }. Transition t1 is always enabled and can fire generating tokens in p1. No ohter transition becomes enabled. The reachability set of the net PN2, given the initial marking M0 = [1 0 1 0 0]T shown in Figure 6, consists of the following three markings:

A. H. Levis

v.3.3

12

An Introduction to Petri Nets

11/23/99

Fig. 7: Fig. 8 Fig. 9

M1 = [0 1 1 0 0]T M2 = [0 0 1 1 0]T M3 = [0 0 1 0 1]T

The Reachability set is an important tool in the theoretical development of Petri Nets. Reachability analysis is also referred to as Occurrence Graph Analysis. However, it will not be discussed further in this note. We have already seen that the marking of a Petri Net can be represented by a n-dimensional integer vector. The same notation - M - can be used for both the marking and its vector representation. If s is a firing sequence associated with a firing vector Ns, where each element of Ns is the number of times the corresponding transition fires in the sequence s, the marking M' reached from the initial marking M after the firing of s is given by: M' = M + C . Ns (3)

where C is the incidence matrix. The algebraic relation (3) should be used carefully, bearing in mind that some information has been lost in the process leading from a firing sequence to a firing vector. To illustrate the point, let us consider the Petri Net PN1 of Figure 4. Let relation (3) be applied to the following initial marking and firing vector:

0 0 M =
0

1 1 ,
1 NS

0 0 0

1 1 1

Then,
0 0 M = M + C1 N S =
1 0 1

1 -1 1 0 0 0 1 0 -1 0 + 0 1 0 0 -1 0 0 -1 0 1 0 -1 0 1 0

1 1 1 1 1 =

1 0 0 0 0 .

0 0 0

A. H. Levis

v.3.3

13

An Introduction to Petri Nets

11/23/99

M1 is a positive integer vector corresponding to a valid marking of the Petri Net PN1. As shown already, M1 is in the reachability set of M0. While there exists a firing sequence that will take the marking of PN1 from M0 to M1, it is impossible to find a firing sequence associated with the firing vector N1s that will take the marking of PN1 from M0 to M1. N1s corresponds to the firing of transitions t1, t2, t3, t4 and t5. In fact, t1 is the only transition that is ever enabled from the initial marking M0. This fact is obscured in the algebraic relation (3). Note that the firing vector: N2S = [1 0 0 0 0]T, which corresponds to a legitimate firing sequence of PN1 consisting of the firing of t1 only, results correctly in the final marking M2 = [1 0 0 0 0]T. Consider also the example PN2. Note that the self loop results in the third row of the incidence matrix being zero. This means that the initial marking of p3 will not be affected by any firing sequence vector. The firing sequence (t1, t2, t3) results in the final marking shown in Fig. 9.

1 -1 0 0 0 1 -1 0 M3 = M0 + C2 * N1 = 1 + 0 0 0 s 0 0 -1 1 0 0 0 -1

0 1 0 = 1 1 1 0 1

Additional properties of ordinary Petri Nets that are based on the markings of a net are described in the next section . 6 MORE PROPERTIES OF PETRI NETS

Boundedness A marking M0 is bounded if there exists a positive integer k such that for every reachable marking M - element of the reachability set (M0) - the number of tokens in each place is bounded by k. If k equals one, the marking is said to be safe. A Petri Net PN is structurally bounded if any initial marking of PN is bounded.

A. H. Levis

v.3.3

14

An Introduction to Petri Nets

11/23/99

PN1 is not bounded under M0 - or any other marking - since p1 can have an arbitrarily high number of tokens. Conservation A Petri Net PN with initial marking M0 is strictly conservative, if for all markings M, elements of the reachability set (M0), the number of tokens remains constant, i.e.,

pi P

M(pi ) =

p i P

M0(pi )

Strict conservation for a whole net is not a very useful property in most applications. However, strict conservation in subnets will turn out to be very useful in modeling finite resources in manufacturing systems or in variable structure systems. Clearly, a necessary condition for a Petri Net to be conservative is for any transition in the net to have the same number of places in its preset and postset. If it doesn't, then the number of tokens before the firing of the transition will differ from the number of tokens after the firing of that transition and the condition for conservation will be violated. The Petri Net of Figure 6 with the marking shown is strictly conservative, as can be seen by counting the number of tokens in Figures 6 to 9. The notion of conservation of tokens can be generalized by associating rational non-negative coefficients, or weights, with each place. We are able to do that because we have assumed all tokens to be indistinguishable. A Petri Net PN with initial marking M0 is conservative with respect to a weighting vector w, if for all markings M, elements of the reachability set (M0), the weighted number of tokens remains constant, i.e.,

pi P

w i M(pi ) =

pi P

w i M0(pi )

Then strict conservation can be interpreted as a special case of the above definition: the case where the vector w is (1, 1, . . . , 1). Liveness A marking M0 is live if, for any transition t and for every reachable marking M there exists a firing

A. H. Levis

v.3.3

15

An Introduction to Petri Nets

11/23/99

sequence from M that includes t. In other words, every transition of the net can fire an infinite number of times. A Petri Net PN is structurally live, if any initial marking of PN is live. Related to liveness is deadlock. Deadlock occurs where one more transitions in a net cannot fire. That is, given the state of the system, there is no sequence of transition firings in the net that will result in the enablement of the deadlocked transitions. Note that according to the definition of liveness, if a transition is not deadlocked, then it must be live - there exists a firing sequence such that the transition will be enabled. Consider the net shown in Figure 10. There are two parallel processes, (t2 , t3 ) and (t4 , t5 ) that are interacting; the whole system is coordinated by transition t1 .

p2

t2

p4

t3

p1

t1

p7 p6 p3 t4 p5 t5

p8

t6

Figure 10 Example of deadlock Consider the initial marking M0 = [1 0 0 0 0 0 0 0]T. Transition t1 is enabled and, when it fires, tokens are generated in places p2 and p3 . The new marking, M1, is [0 1 1 0 0 0 0 0]T. Since there are no tokens in places p6 and p7 , both transitions t2 and t3 are deadlocked. No further activity is possible. On the other hand, if the initial marking is M0 = [1 0 0 0 0 1 0 0]T or the symmetric one, M0 = [1 0 0 0 0 0 1 0]T, then all transitions are live. These are not the only markings that cause deadlock or are live. Can you find others? We now turn our attention to several local properties of Petri Nets that affect their execution.

Conflict-free Petri Net 16

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

A Petri Net is conflict-free if every place which is an input of more than one transition is in a self-loop with each such transition. The presence of a common resource can generate conflict. The example in Figure 11 shows that p1 is the preset of both transitions t1 and t2 . Both are enabled by the presence of the token in p1 . If t1 fires then t2 is no longer enabled. Conversely, if t2 fires, t1 is disabled.

t1 p1

p2

t2

p3

Figure 11 Example of Conflict A slightly more complicated case is shown in Figure 12. Here place p5 is in the presets of both t4 and t5 . In this example, conflict actually occurs because both p4 and p6 contain tokens. The potential for conflict exists when a place has more than one output arcs, i.e., it is an input place to more than one transition. The only case when more than one output arc is allowed is when the place is both an input and an output place of a set of transitions - it is in self-loop with those transitions. p4
t4 p5 t5 p6 p8 p7

Figure 12 Another Example of Conflict.

A. H. Levis

v.3.3

17

An Introduction to Petri Nets

11/23/99

In general, we do not wish to have conflict in our models. The presence of a conflict indicates the presence of ambiguity in our model. We have two choices: (a) we may introduce a rule for resolving the ambiguity regarding which one of the concurrently enabled transitions will fire first, or (b) we may change the structure of the system - redesign - to eliminate the conflict. The first approach can be implemented through the introduction of a special type of transition, the switch. Unlike all the notions introduced in the previous sections of this chapter, switches are not part of the definition of ordinary Petri Nets as found in the general literature. Switches were defined by Jensen to automate the resolution of conflicts without recourse to High Level Nets. In the situation in Figure 11, the choice is arbitrary and there is no way in the theory of ordinary Petri Nets to automate this choice. This is a serious shortcoming when the models are to depict choices by definition, selection from alternatives. Switches are specifically introduced to resolve this problem. The generalization of Petri Nets in the form of Colored Petri Nets has eliminated the difficulties that led to the introduction of awkward constructs such as switches. While conflict is a local phenomenon in the sense that only the presets of the transitions with common input places are involved, confusion involves firing sequences. Confusion occurs when in the presence of concurrency a firing sequence leads to conflict while another one does not. Figure 13 illustrates such an occurrence. Transitions t1 and t3 are enabled concurrently. At this point, there is no conflict. If transition t3 fires first, then transition t1 fires and execution terminates since no other transitions are enabled. But if t fires first, then the presence of a token in p3 enables 1 transition t2 and conflict, as shown in Figure 12, results.
p1 t1 p2 t2 p3 t3 p4 p6 p5

Figure 13 Confusion Both conflict and confusion result from concurrency. With the introduction of timed Petri Nets, it is sometimes possible to use rules or protocols for resolving confusion. 7 PETRI NET CLASSES 18

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

Using these concepts, special classes of Petri Nets have been defined. In the early development of Petri Nets, this became necessary in order to obtain useful results for practical applications. The trend now is to try to generalize the results, rather than have a large collection of isolated results for very special cases. Several classes will be introduced here either because of their relevance to the algorithms for the generation of system architectures or because they are useful in performance evaluation. Recall that pure Petri Nets are nets that do not have self-loops. Marked Graphs A Marked Graph is a Petri Net PN = (P, T, I, O) such that the preset and the postset of each place each have exactly one element. This means that each place is the input to only one transition and the output of only one transition. There is a single arc coming into each place and a single arc going out. Neither the Petri Net PN1 nor the Petri Net PN2 in Figures 4 and 5, respectively, are marked graphs. Place p1 in PN1 has two transitions in its preset, t1 and t3. The net PN2 is not a marked graph because it has places as source and as sink: place p1 has an empty preset, and place p5 has an empty postset. Both conditions violate the definition of a marked graph. The following two theorems, due to Commoner and Holt, are of primary importance. Theorem 1 In an marked graph, the number of tokens in any elementary directed circuit - the token content of the circuit - remains invariant by transition firings. Theorem 2 A marking of an marked graph is live if and only if the token content of every directed elementary circuit is strictly positive.

State Machines

A. H. Levis

v.3.3

19

An Introduction to Petri Nets

11/23/99

A State Machine is a Petri Net such that the preset and postset of each transition have exactly one element. Note the graph theoretic duality of marked graphs and state machines. Duality in Petri Nets is explored further in the exercises at the end of the note. Simple Nets A Simple Net is one in which no two transitions have the same preset and the same postset.

Simple Net: Different postsets

Not a Simple Net: Same preset and postset

Figure 14 Simple Nets This notion of simple net becomes relevant when we consider issues of redundancy in the construction and evaluation of distributed systems. 8. INVARIANTS

The use of invariants provides a theoretical basis for constructing algorithms for the analysis and evaluation of the architecture of distributed systems. The particular invariant discussed in this section is the place-invariant or S-invariant (from the German Stelle for place). The S-invariant is an integer vector with dimension equal to the number of places in the net. The i-th element corresponds to the i-th place. The value of the i-th element is an integer weight ( a non negative integer) attached to the marking or token content of the i-th place. This description reflects the definition for conservation in a Petri Net introduced in section 4. Indeed, the notion of place invariant is that the weighted sum of the token content of the places in a net is constant for any firing sequence. 20

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

Definition 3: S-invariants An S-invariant is an n 1 non-negative integer vector x which is in the kernel or null space of the transpose of the incidence matrix, CT. By the definition of the kernel of CT, this vector x satisfies the relation: CT x = 0. (4)

This definition of the S-invariants is preferred because it leads to an algorithm for their determination. Support The set of places whose corresponding components in x is strictly positive is called the support of the invariant and is denoted <x>. The support of an invariant is said to be minimal if and only if it does not contain the support of another invariant but itself and the empty set. Consider the basic property of the S-invariants - conservation with respect to a weighting vector. The relationship between Equation (4) and the conservation property is established by the following theorem. Theorem 3 The vector x is an S-invariant of a Petri Net if and only if for any initial marking M0 and for any reachable marking M (i.e., M(M0) ), xT M = xT M0. (5)

The proof is straightforward: Equality (5) is obtained by premultiplying Equation (3) by xT and by using (4) to eliminate the term xTCNs. Equation (5) establishes the conservation of the number of tokens belonging to the support <x>, weighted by the value of the components of the Sinvariant vector. S-components

A. H. Levis

v.3.3

21

An Introduction to Petri Nets

11/23/99

Let x be an S-invariant of a Petri Net PN and let <x> be its support. Then <x> is a set of places of PN, i.e., a subset of P. The S-component associated with x - denoted [x] - is the subnet of PN whose set of places is <x> and whose transitions are the input and output transitions of the places of <x>. [x] = (Px, Tx, Ix, Ox) with Px = <x>, Tx = {p | pPx} {p | pPx}. Ix the restriction of I to Px Tx. Ox the restriction of O to T x Px. S-invariant nets An S-invariant net is a Petri Net whose set of places is the support of an S-invariant. In other words, this net has an S-invariant whose components are all strictly positive. Example Consider the Petri Net PN3 of Figure 15.
p3 p1 t2

t1 p2 t3

Figure 15. Petri Net PN3. The incidence matrix of the Petri Net PN3 is:

A. H. Levis

v.3.3

22

An Introduction to Petri Nets

11/23/99

1 -1 C3 = 1 0 -1 1 -1 0

0 -1 0 1

The vector x = [x1 x2 x3 x4]T will be an S-invariant if and only if: C3T x = 0 or equivalently, if
x1 + x2 - x3 - x4 = 0 -x1 + x3 = 0 -x2 + x4 = 0

Solving the three simultaneous equations yields x1 = x3 and x2 = x4. Therefore, x = [x1 x2 x1 x2]T. The two minimal support S-invariants are obtained by setting x1 equal to one and x2 equal to zero, or x1 equal to zero and x2 equal to one: x1 = [ 1 0 1 0 ]T, and x2 = [ 0 1 0 1 ]T, with <x2> = {p2,p4}. with <x1> = {p1,p3}

The corresponding S-components are shown in Figure 16. p3 t1 t1 p1 p2 p4 t2 t3

Figure 16 The two S-components of PN3

A. H. Levis

v.3.3

23

An Introduction to Petri Nets

11/23/99

Note that since the two S-components were constructed from minimal support S-invariants, they are minimal S-components; they do not contain any other S-components by themselves. The following result, due to Memmi and Roucairol, justifies a posteriori the introduction of minimal support invariants.

Theorem 4 Let I1, I2, ..., IS be the minimal supports of the S-invariants of a Petri Net. Let xi be an invariant whose support is Ii, i.e. Ii = <xi>. The set {x1, x2, ..., xS} is a base of the set of all Sinvariants, i.e. a minimal set of generators. Therefore, every S-invariant x can be written as a linear combination of the xi, with positive rational coefficients i:
x =

1is

i xi

Note that the set of minimal supports of a Petri Net is necessarily finite, since the number of places is finite. The following result, due to Hillion, relates directed circuits and S-components of a marked graph. It gives an algebraic characterization of a topological concept and will be extensively used in the chapter on performance evaluation. Theorem 5 The minimal S-components of a marked graph are exactly its elementary directed circuits. For an example of the result of this Theorem, see Exercise 5. 9. CLOSURE In this note, some basic definitions and fundamental properties of ordinary Petri Nets were defined. The purpose was to introduce a graphical and analytical formalism for use in the modeling and evaluation of DES and executable models of information architectures.

10 EXERCISES 24

A. H. Levis

v.3.3

An Introduction to Petri Nets

11/23/99

1 Equivalent representations Show that the structure of a Petri Net is uniquely defined by the following representations and that the representations are equivalent. (a) The quadruple (P, T, I , O) (b) The sets P and T and the presets and postsets of every transition in T (c) The sets P and T and the presets and postsets of every place in P.

2 Equivalent Representations Determine the structure of the following Petri Net and write it in the forms (a), (b), and (c) of Exercise 1

p4 Idle

t3 Remove

p5 t4 Ready to consume p3 Consume

p1 Idle

t1 Produce Ready to put

t2

Put in buffer

3 Incidence Matrix Construct the Incidence Matrix C of the Petri Net in Figure 10 of the text. 4 Execution of Petri Nets Consider the example of Figure 10. Using the matrix equation describing the execution of Petri Nets, analyze the dynamic behavior of this net for several initial markings. List the results in the form of a table with the firing sequence on the left column and the resulting marking vector on the right. (a) M0 = [1 0 0 0 0 0 0 0)]T (b) M0 = [1 0 0 1 0 0 0 0]T (c) M0 = [1 0 0 1 1 0 0 0]T
A. H. Levis v.3.3

25

An Introduction to Petri Nets

11/23/99

(d) M0 = [0 0 0 1 0 0 0 0]T (e) M0 = [0 0 0 0 0 1 1 1]T What conclusions can you draw? Are all places bounded? If not, which one(s) are not and why? 5 Invariants Determine the minimal support S-invariants of the following Petri Net:
p4

t1

p2

t2

p3

t3

p1

6 Duality The concept of duality applies to Petri Nets, although only limited use of it has been made. The dual of a Petri net is obtained by interchanging places and transitions in the formal description of its structure. P -> T' T -> P' I(p, t) -> O(t', p') O(t, p) -> I(p', t')

Determine the duals of the following Petri Nets: (a) The one in Exercise 2 (b) The one in Exercise 5 (c) The one in Figure 10 Write their structure in a convenient form and draw the net. 7 Duality Show that the dual of the dual is the primal net. Illustrate the result by obtaining the dual of the net obtained in Exercise 6 (c) and show that it is the net of Figure 10. 8 Duality and invariants Determine the S-invariants of the dual of the net in Exercise 5 (obtained in 6 (b)). ****************************************************************************** REFERENCES

A. H. Levis

v.3.3

26

An Introduction to Petri Nets

11/23/99

Bacceli, Francois, Guy Cohen, Geert Jan Olsder, and Jean-Pierre Quadrat, Synchronization and Linearity: An Algebra for Discrete Event Systems, Wiley, Chichester, England, 1992. Cassandras, Christos G., Discrete Event Systems, Richard D. Irwin, Inc., Homewood, IL, 1993. David, R. and H. Alla, Petri Nets and Grafcet: Tools for Modeling Discrete Event Systems, Prentice-Hall, London, 1992. Jensen, Kurt, Coloured Petri Nets, Springer-Verlg, Berlin, 1992. Peterson, James L., Petri Net Theory and the Modeling of Systems, Prentice Hall, Englewood Cliffs, NJ, 1981. Reisig, Wolfgang, Petri Nets, An Introduction, Springer-Verlg, Berlin, 1985. Zhou, MengChu, and Frank DiCesare, Petri Net Synthesis for Discrete Event Control of Manufacturing Systems, Kluwer Academic Publishers, Boston, 1993.

A. H. Levis

v.3.3

27

Das könnte Ihnen auch gefallen