This tutorial you will construct a state machine model for a simple stopwatch that increments by 1 every second. This model is a version of the stopwatch model used in the tutorial for Cameo Simulation Toolkit (CST). However, unlike in the CST toolkit, Behaviors will be defined using Alf, rather than Activity diagrams.
The structure of the stopwatch model in this tutorial is very simple. It only contains a time property, which is typed as Integer. The time property records the elapsed time once the stopwatch receives a starting Signal. Therefore, the structure of the stopwatch system contains a StopWatch class that has the time property.
The tutorial uses a State Machine diagram to describe the main behavior of the stopwatch. The State Machine consists of four States:
The tutorial consists of the following steps: