Tuesday, 29 September 2009

Roller-coaster

A roller-coaster control system only permits its car to depart when it is full. Passengers arriving at the departure platform are registered with the roller-coaster controller by a turnstile. The controller signals the car to depart when there are enough passengers on the platform to fill the car to its maximum capacity of M passengers. The car goes around the roller-coaster track and then waits for another M passengers. A maximum of M passengers may occupy the platform. Ignore the synchronization detail of passengers embarking from the platform and car departure. The roller coaster consists of three processes: TURNSTILE, CONTROL and CAR. TURNSTILE and CONTROL interact by the shared action passenger indicating an arrival and CONTROL and CAR interact by the shared action depart signaling car departure. Draw the structure diagram for the system and provide FSP descriptions for each process and the overall composition.
const M = 3
TURNSTILE = (passenger -> TURNSTILE).
CONTROL = CONTROL[0],
CONTROL[i:0..M] = (when (i CONTROL[i+1]
|when (i==M) depart -> CONTROL[0]).
CAR = (depart -> CAR).
||ROLLERCOASTER = (TURNSTILE || CONTROL || CAR).

No comments:

Post a Comment