Matrix Representation of Petri Nets


Any Petri Net can be represented as an incidence matrix. For example, the Petri Net in Fig 1.

Fig. 1

can be specified in matrix form as follows:

  1. Find the D- matrix. It is an m x n (m rows, n columns) matrix, where m is the number of transitions and n is the number of places in the Petri Net. For each position [i,j] in the matrix, place a 1 in the position if transition i has input from position j. A 0 is placed in the position if position i does not have input from position j.
    D- matrix for PN of Fig. 1:

    0  0  0  0  1
    1 0 0 0 0
    0 1 0 0 0
    0 0 1 1 0

  2. Find the D+ matrix. It is an m x n (m rows, n columns) matrix, where m is the number of transitions and n is the number of places in the Petri Net. For each position [i,j] in the matrix, place a 1 in the position if transition i has output from position j. A 0 is placed in the position if position i does not have output from position j.
    D+ matrix for PN of Fig. 1:

    1  1  0  0  0
    0 0 1 1 0
    0 0 0 1 0
    0 0 0 0 1

  3. Find the D matrix (the composite change matrix). It is computed by subtracting D- from D+.
    (D+) - (D-) = D.

    1  1  0  0  0         0  0  0  0  1          1  1  0  0 -1
    0  0  1  1  0    -    1  0  0  0  0    =    -1  0  1  1  0
    0  0  0  1  0         0  1  0  0  0          0 -1  0  1  0
    0  0  0  0  1         0  0  1  1  0          0  0 -1 -1  1
    
    D matrix for PN of Fig. 1:

     1  1  0  0 -1
    -1 0 1 1 0
    0 -1 0 1 0
    0 0 -1 -1 1
A 1 x m matrix should be constructed to represent the firing of the Petri Net. In each position [1,j], place the number of times transition j is to fire.
Transition matrix for Fig. 1 (assuming t2, t3 firing): [0 1 1 0]

A 1 x n matrix should be constructed to represent the current marking of the Petri Net. In each position [1,j], place the number of tokens in position j. Marking matrix for Fig. 1: [2 1 0 0 0]

To determine the marking of the Petri Net after the transition(s) specified in the transition matrix, compute:
([Transition Matrix][D]) + [Marking Matrix] = [Next Marking]

[0 1 1 0]    1  1  0  0 -1    +    [2 1 0 0 0]    =    [1 0 1 2 0]
            -1  0  1  1  0
             0 -1  0  1  0
             0  0 -1 -1  1

Next Marking matrix for Fig. 1: [1 0 1 2 0]
At this stage, the Petri Net appears as in Fig. 2:


Fig. 2

A 1 x m matrix should be constructed to represent the firing of the Petri Net. In each position [1,j], place the number of times transition j is to fire.
Transition matrix for Fig. 2 (assuming t2, t4 firing): [0 1 0 1]

A 1 x n matrix should be constructed to represent the current marking of the Petri Net. In each position [1,j], place the number of tokens in position j. Marking matrix for Fig. 2: [1 0 1 2 0]

To determine the marking of the Petri Net after the transition(s) specified in the transition matrix, compute:
([Transition Matrix][D]) + [Marking Matrix] = [Next Marking]

[0 1 0 1]    1  1  0  0 -1    +    [1 0 1 2 0]    =    [0 0 1 2 1]
              -1  0  1  1  0
               0 -1  0  1  0
               0  0 -1 -1  1

Next Marking matrix for Fig. 2: [0 0 1 2 1]
At this stage, the Petri Net appears as in Fig. 3:


Fig. 3

Transition matrix for Fig. 3 (assuming t1, t4 firing): [1 0 0 1]

Marking matrix for Fig. 3: [0 0 1 2 1]

([Transition Matrix][D]) + [Marking Matrix] = [Next Marking]

[1 0 0 1]    1  1  0  0 -1    +    [0 0 1 2 1]    =    [1 1 0 1 1]
            -1  0  1  1  0
             0 -1  0  1  0
             0  0 -1 -1  1

Next Marking matrix for Fig. 3: [1 1 0 1 1]
At this stage, the Petri Net appears as in Fig. 4:


Fig. 4

Transition matrix for Fig. 4 (assuming t1, t2, t3 firing): [1 1 1 0]

Marking matrix for Fig. 4: [1 1 0 1 1]

([Transition Matrix][D]) + [Marking Matrix] = [Next Marking]

[1 1 1 0]    1  1  0  0 -1    +    [1 1 0 1 1]    =    [1 1 1 3 0]
            -1  0  1  1  0
             0 -1  0  1  0
             0  0 -1 -1  1

Next Marking matrix for Fig. 4: [1 1 1 3 0]
At this stage, the Petri Net appears as in Fig. 4:


Fig. 5


This process can be continued.
mchen@techfak.uni-bielefeld.de