Behavioural Models

From Modelling Finite Automata to Analysing Business Processes

Exercises

4.3 Petri Nets

Remark: For modelling coloured Petri nets in the following exercises you may use the “CPN Tools” from http://cpntools.org

a) Communication as Petri nets

You already know the following types of communication. For each, draw a condition event net which shows the behaviour of sender and receiver.

  1. synchronous (real-world)
  2. synchronous (delivery-based)
  3. synchronous (response-based)
  4. asynchronous

Hint: Both sender and receiver should initially be busy (i.e. not ready to communicate) and have a final state which indicates that they have finished the communication.

b) Parkinglot

Given is a description of a parking lot. Design a Petri net of it following the tasks below.

4.3b Parkinglot.png

Fig. 4.3 b) ParkinglotThere are five parking spaces between two streets. Each parking space can be entered from either side. The streets (“Weske Avenue” and the “Kunze Street”) are both one-way streets and have high traffic, hence, a car should not go in reverse. This means that cars must enter the parking lot by driving forward and leave it also by driving forward into the other street.Initially, there are two cars parking on the parking lot (one in each direction), three cars driving on the “Weske Avenue”, and two cars driving on the “Kunze Street”.

  1. Model the parking lot system as a place transition net. Do not differentiate each parking space but ensure that each car leaves in the correct direction. Furthermore, please make sure that not more than five cars are parking at the same time.
  2. Model the parking lot system as a coloured Petri net. Please try to use now only three different states (both streets and the parking lot). Cars are to be differentiated by their license plate.

a) Shop as a Petri net

Next, an online shop for railway tickets and seat reservations is described. Please model the described online shop for train tickets and reservations as a coloured Petri net:

A national railway company has the following pricing system:

Customers might have a “TrainCard25” or a “TrainCard50” to get an automatic 25% or 50% discount on the ticket prices. Furthermore, customers also have a number of bonus points assigned to their account. There are 5 points granted for each Euro paid in the online shop for the (possibly discounted) tickets. If a customer has more than 1000 bonus points, they may use them to get an additional 25% bonus on the price for a single ticket. The reservation fee is 5€ and cannot be discounted by the “TrainCard”s or bonus points.

The online shopping process can be described as follows:

Users need to login first. They start with an empty shopping cart.

Tickets can be selected by a three-step selection process:

  1. Pick a ticket from the ticket pool, which may be either 19€, 29€, 49€, 69€ or 99€.
  2. Choose whether to use bonus points for the selected ticket.
  3. Accept or decline a seat reservation.

If at least one ticket is ordered (i.e., the shopping cart is not empty), the shopping card can be checked out (i.e., the user pays and their shopping cart is cleared). The user is not forced to log out at that point, but may continue to buy tickets.

Hints: