1 Introduction


A. Törn - Contents - - Previous chapter - Next chapter - - Previous page - Next page

1.8 Petri Net execution (simulation)

The specification of a model by a Petri Net is complete in that sense that given an initial state it is possible to automatically execute or simulate the model. We may also say that a Petri Net is an executable specification of a system.

An execution of the model may reveal inadequacies in the model and is thus a complementary way to validate the model. There exist many tools, which can be used for execution of Petri Nets. We will here use a tool developed here and called SimNet (available at ~fschoult/usr/bin/SimNet).

The stopping of the execution of the tool is based on elapsed system time so we assume that all the transitions take unit time to execute. Below is an example of a trace output (edited) from a run with the tool on the Petri Net for the vending machine as specified in Section 1.5. A run of a Petri Net is a sequence of consecutively fired enabled transitions, see column 2 below.

    Time Trans       R     CR     GS     GF
    0.00             1      0      5      0

    1.00 READ        0      1      5      0

    2.00 DISP        1      0      4      1

    3.00 READ        0      1      4      1

    4.00 DISP        1      0      3      2

    5.00 READ        0      1      3      2

    6.00 DISP        1      0      2      3

    7.00 READ        0      1      2      3

    8.00 DISP        1      0      1      4

    9.00 READ        0      1      1      4

   10.00 DISP        1      0      0      5

   11.00 READ        0      1      0      5   
         REF         0      1      5      0  = 1.00
The states above corresponds to the state after the firing of the transition. The firing of a transition with time means that at the start tokens are consumed, this intermediate state holds for the firing time, and then the tokens are deposited. This explains the state after READ at 11.00 (0 1 0 0).