The goal of this activity is to create an initial version of a state machine model for the service interface. Open file IService.interface and modify the dummy state machine such that it matches the following description:
-
Initially the vending machine only accepts the SwitchOn command, which leads to result OK and the machine becomes operational.
-
When the machine is operational, it accepts command LoadProduct. Moreover it can be switched off by the SwitchOff signal.
|
When ready with the state machine,
extend the project file with a generator for UML diagrams as follows.
Open file VendingMachine.prj,
place the cursor between the two brackets and
use Ctrl-space to inspect the possible generators;
select "Generate UML Block" by double clicking. Save the .prj file.
Next right-click on file VendingMachine.prj (or somewhere in the editor of the file) and choose "Run As → Run generators".
-
In the lower right corner there is an indication in green while the workflow is being executed.
-
When finished, the result can be inspected in folder src-gen/uml.
-
Since the project file contains a task to generate UML, the CommaSuite tool generates UML state machine diagrams in the form of
-
.png files; note that there are reduced version of the state machine which is convenient for large state machines
-
.plantUML files; to show the diagram,
-
open the file (in case a pop-up occurs, select "Associate '*.plantuml' files with the current editor … ")
-
open the PlantUML view; go to menu Window/Show View/Other… , expand the PlantUML folder and choose PlantUML.
PlantUML files are displayed using Graphviz. Sometimes showing the correct diagram requires a few repeated clicks in source and view. If diagrams are not displayed, check the installation manual on the GraphViz installation.
-
-