This tutorial describes how to use the TimingService, how to combine a generated model with manual code and how to model a hierarchical state machine. The idea of the tutorial is to switch a LED on and off. The behavior of the LED should be: blinking in a one second interval for 5 seconds, stop blinking for 5 seconds, blinking, stop,... For this exercise we will use a little GUI class that will be used in more sophisticated tutorials too. The GUI simulates a pedestrian traffic crossing. For now, just a simple LED simulation will be used from the GUI.
After the exercise is created you must copy the GUI to your src directory (see below).
The package contains four java classes which implements a small window with a 3-light traffic light which simulates the signals for the car traffic and a 2-light traffic light which simulates the pedestrian signals.
The GUI looks like this:
Within this tutorial we will just toggle the yellow light.
You will perform the following steps:
create a new model from scratch
define a protocol
create an actor structure
create a hierarchical state machine
use the predefined TimingService
combine manual code with generated code
build and run the model
open the message sequence chart