Exercise 1
Exercise 1
Assignment 1
A German traffic light turns from green to red
through yellow.
a) Provide a Petri net that is able to behave like a
German traffic light. There should be three
places indicating the state of each light.
b) Give a Petri net that exactly behaves like a
German traffic light. Make sure that the Petri
net does not allow state transitions which are
not possible.
Solution
Without this, the traffic light can behave
properly, but there are also potential
anomalies such as:
- transition red_yellow fires repeatedly
without switching to yellow or green and
thus accumulation of multiple tokens in
yellow.
- yellow_red can fire before green_yellow
fires
Assignment 2
A secret project by the government (lets call it
Project X), will be executed by one person and
consists of 6 tasks: A, B, C, D, E, and F. The
figure below specifies the order in which there
tasks need to be executed
Assignment 2
a) Model the project in terms of a classical
Petri-net.
b) How to model that E is optional?
c) How to model that D and E should be
executed consecutively, i.e., B and C are
not allowed between D and E?
Solution a)
Solution b)
To make E optional, a by-pass for this transition
has to be made.
Solution c)
Place c8 is introduced to make sure that if transition D
starts, B and C are not able to be executed because they
also need a token in c8. When transition E is finished, a
token is produced for c8 to make new transitions
possible.
Assignment 3
A circular rail network consists of four tracks. Each track is in one of
the following states:
- Busy, i.e., there is a train on the track.
- Claimed, i.e., a train has successfully requested access to
the track.
- Free, i.e., neither busy nor claimed.
There are two trains driving on the circular track. The track where a
train resides is busy. To move to the next track a train first claims the
next track. Only free tracks can be claimed. Busy tracks are
released the moment the train moves to another track. One can
abstract from the identity of trains only the state of the rail network is
considered.
a) Model the dynamic behavior of the rail network in terms of a Petri
net.
b) Is it easy to model the situation with 10 tracks (160 states!)?
Solution
a) One track can be modeled as shown below:
Solution
A track consists of three places (b = busy, c =
claimed and f = free) and the transitions
between them. To make four tracks with two
trains, we copy this track four times and place
two tokens in a b-place and two tokens in an f-
place.
Then we have to make some additions. A train
can only move to another track if it has
successfully claimed another one. Therefore it
has to check if the other track is free. These are
the arcs between the b-places and the use_track
transition.
Two tracks
Also note that the transitions use_track and
clear_track of two subsequent tracks are
executed at the same time. Therefore, we fuse
them in one transition: transfer.
b) Yes, just add new tracks. While the total number
of states increases rapidly, the size of the Petri
net is linear in the number of tracks. Note that
the number of states equals: