This tutorial is intended to demonstrate how to create a UML model in MagicDraw that can be executed by Cameo Simulation Toolkit. The model used in this tutorial is a simple stopwatch whose timer will increment by 1 every second.
This tutorials provides the instructions to create a stopwatch model with MagicDraw and execute the stopwatch model step-by-step. You will also learn how to create a mock-up user interface to use with the stopwatch execution.
Before modeling a stopwatch, you will need to know the stopwatch structure and the stopwatch Behavior.
Stopwatch structure
The structure of the stopwatch model in this tutorial is very simple. It only contains a time property, which is typed by an integer. The time property will record the elapsed time when the stopwatch receives a starting Signal. Therefore, the structure of the stopwatch system contains a StopWatch class that has the time property.
Stopwatch Behavior
This tutorial uses the State Machine diagram to describe the main Behavior of the stopwatch. The stopwatch has two stages: Initial and final.
A stage consists of four States as follows:
- Ready
The State where the stopwatch is ready to start.
- Running
When it receives the start Signal, the stopwatch will run, and the timer will start. In this State, the stopwatch will be triggered by a time Event to increment the time value by 1 per second.
- Paused
The State where the stopwatch is paused and waiting for the user to restart it.
- Stopped
The State where the stopwatch stops running.
Related pages