You are on page 1of 1

SOEN 6481 Software Systems Requirements Specification (Winter 2015/16)

Worksheet #8: UML State Machine Diagrams


State Machines are a well-known technique for modeling the dynamic behaviour of a system, where the
actions of an object depend on its current state especially in control systems, but also GUIs, games, web
sites, or (network) protocols.

Exercise: Create a UML State Machine Diagram for a Water Level Controller. The controller ensures
that the water level is maintained between [low, high] in a tank.
Assumption: in the initial state, the tank is empty.
Initial state: water is flowing into the tank, until it changes its state to monitoring-high.
Monitoring-high state: The controller stays in this state as long as the level of water is in the range
[low, high]. If the water level exceeds high, then it changes its state to control-close.
Control-close state: The controller will close the source valve and open the drain valve. This triggers the
event flow-out and transition to the state monitoring-low.
Monitoring-low state: The controller stays in this state as long as the level of water is above low. If the
water level goes below low, then it changes its state to control-open.
Control-open state: The controller will close the drain valve and open the source valve. This triggers the
event flow-in and a transition to the state monitoring-high.
Draw the UML state machine diagram corresponding to these requirements statements:

You might also like