1 Introduction


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

1.4 A modeling case study

A vending machine stocks five items. When a coin is accepted, an item can be dispensed. Now and then a service man replenishes the machine by filling up emptied slots.

We begin by by constructing a simple model. In this there is an external characteristic of the machine, a light showing if the machine is ready (READY). The refilling takes place when the stock is empty. We model the internal control of the machine. There are three activities: READ COIN, DISPENSE, and REFILL (GS= Goods Storage, GF= Goods storage Free slots):

 Activities   pre-condition      post-condition
 READ COIN    READY              COIN READ
 DISPENSE     COIN READ, GS      READY, GF
 REFILL       GF= 5              GS= 5, GF empty
In the description above we have used GS and GF in a different meaning than earlier. We earlier described a place as a condition which only can have two values, true and false, indicated by one or zero number of tokens. Such places are called safe. Now we are proposing that there can be more than one token in a place, representing the content of a storage. This is an extension to Petri Nets.

We must now restate our firing rule: "When a transition fires, then for each arc in the set of input places one token is removed from that place and for each arc in the set of output places one token is added to that place".

As a consequence of this extension there may be several arcs from a place to a transition. This also means that a transition is enabled only if at least the number of required tokens are present in all input places. Instead of drawing several arcs from a place to a transition we may alternatively draw just one but indicate by an inscription on the arc the multiplicity of the arc.

A further consequence of this extension is that t and t are not anymore sets but what is called bags, i.e., the same element may appear several times in t and t.

Next we model all the activities for the simple vending machine model.