The Barrier Component

Here is an example of a possible model of the barrier component. This shows the difference between protocol state machines (PSMs) and life cycle state machines (LSMs). In this model, the Barrier component has one port and provides an interface called BarrierI. This interface has one method called open. The component is intelligent in the sense, that the when the barrier component receives the open message, it opens the barrier, waits for the car to pass and closes the barrier afterwards.

Barrier component

BarrierI interface

Interface BarrierI PSM

The PSM for the BarrierI interface is rather simple. We choose a synchronous version of the operation open, which means that the client waits until the barrier is closed again. Thus, from a client perspective, the open operation can be called all the time.

BarrierI interface PSM

Barrier component implementation

The barrier component is implemented by a BarrierController class, which also implements the BarrierI interface. In addition it uses the class Barrier, which just understands two commands, up and down. The third class is the Sensor class, which detects if a car has passed the barrier and sends the message carPassed to the barrier controller.

Barrier component class diagram

BarrierController class LSM

The bahviour of the barrier is defined by the following LSM:

Barrier controller LSM

When the controller receives an open message, he sends the message up to the barrier to open the barrier. Then, either the sensor sends the message carPassed or after 1 minute waiting period, the barrier controller closes the barrier again.

Barrier class LSM

The barrier class has a simple LSM with two states and two messages up and down.

Barrier class LSM

Sensor class LSM

Finally, the sensor sends the message carPassed to the barrier controller when the car has passed the sensor.

Sensor class LSM


Part of 02291: System Integration
Hubert Baumeister
April 27, 2016