Why tokens are not added?

249 views Asked by At

Reading this article it says:

A firing of an enabled transition removes one token from each input place and adds one token to each output place.

Now if I have the following net, with all single arcs

enter image description here

After firing T1 I would expect P2 to contain 2 tokens - from P1 and P4. But the result is one token in P2. Without getting too deep into math, how it's possible to explain it?

2

There are 2 answers

1
Dima Chubarov On BEST ANSWER

One way of thinking about Petri nets is to look at them as Predicate/Event nets where places represent predicates and transitions represent events that change the truth value of predicates. Tokens indicate which predicates hold true after a given sequence of events.

For instance, your net can be a model of the following situation in a college library

 P1 = "A book is available at the library"
 P4 = "A book is needed by a student"
 P2 = "The student has the book"

And

 T1 = "A book is dispatched to a student"

Then firing T1 is possible only if P1 and P4 are true, i.e. hold a token. After firing T1 we arrive to a state where P1 and P4 conditions are invalidated and P2 becomes true.

Interpreting Petri nets in this way it is easy to convince oneself that tokens are immaterial and therefore the number of tokens in the system, that is the number of predicates that are true at a given state, can change without any specific intervention.

Petri nets provide for different interpretations. It is easy to see that in order to ensure that the number of tokens stays the same, a Petri net should have a property where each transition has equal number of incoming and outgoing arcs.

0
John Frederick Chionglo On

A Petri Net is a description of a system in terms of net elements and annotations. There are four types of net elements: Place, Transition, Input and Output. An input connects a place to a transition. An output connects a transition to a place.

The de facto standard graphics (annotation) of:

  1. A place is a circle or oval.
  2. A transition is a square or a rectangle.
  3. An input is an arrow from a circle (oval) to a square (rectangle).
  4. An output is an arrow from a square (rectangle) to a circle (oval).
  5. A place whose mark is one has one black dot. A place whose mark is 0 is empty.
  6. [There is no de facto standard graphics for an enabled transition or an enabled input.]

The de facto standard logic annotation(s) of:

  1. An input are:

    a) A test condition to determine if the input may fire: if the mark of the input place is greater than or equal to 1 then the input is enabled – it may fire. Otherwise, the input is not enabled – it may not fire.

    b) A computation logic: subtract 1 from the mark of the input place. To compute the input is to fire the input.

  2. An output is a computation logic: add 1 to the mark of the output place. To compute the output is to fire the output.

  3. A transition are:

    a) A test condition to determine if the transition may fire: if every input of the transition is enabled, the transition is enabled – it may fire.

    b) Computation logic: fire every input and fire every output of the transition.

A typical interpretation of a Petri Net is to collect all enabled transitions, select one of the enabled transitions to fire, and to fire the selected transition. In this case, the interpretation is to select and to fire transition T1. After firing T1, the mark of places P1 and P4 should be 0 and the mark of place P2 is 1.

Therefore the reason why the tokens are not added as you expected is probably because the de facto standard logic annotation of the output is not the same as the logic annotation you thought was associated with the output.