Manual for SU-statemodeler
Version 3.0/2.2.0
Summary:
graphical editor for UML-statecharts
code-generator for Java, C++ and C#
available as a plug-in for Eclipse
integrated recognition of errors
facilitates modularization and reuse
integrated debugger for error search
easy to use
Contents
1 General............................................................................................................................................. 4
1.1 Overview...................................................................................................................................4
1.2 License...................................................................................................................................... 4
1.3 Versions.....................................................................................................................................4
1.4 Contact...................................................................................................................................... 4
2 Basics................................................................................................................................................5
2.1 States.........................................................................................................................................5
2.2 Pseudo states............................................................................................................................. 5
2.3 Transitions.................................................................................................................................5
2.3.1 Regular transitions............................................................................................................ 5
2.3.2 Internal transitions.............................................................................................................6
2.3.3 Trigger text........................................................................................................................ 6
2.4 Activities and actions................................................................................................................ 7
2.4.1 General.............................................................................................................................. 7
2.4.2 Transition behavior........................................................................................................... 7
2.5 States.........................................................................................................................................8
2.5.1 Naming rules..................................................................................................................... 8
2.5.2 Regions..............................................................................................................................8
2.6 Entry and exit points................................................................................................................. 9
2.7 Model modularization and reuse.............................................................................................10
3 Editor.............................................................................................................................................. 12
3.1 Overview.................................................................................................................................12
3.2 Using the editor.......................................................................................................................13
3.2.1 Context menus.................................................................................................................13
3.2.2 Creating objects...............................................................................................................13
3.2.3 Resizing objects.............................................................................................................. 13
3.2.4 Moving objects................................................................................................................14
3.2.5 Editing text......................................................................................................................14
3.2.6 Importing models............................................................................................................14
3.2.7 Complex states................................................................................................................ 15
3.2.8 Transitions.......................................................................................................................15
3.2.8.1 Create transitions.....................................................................................................15
3.2.8.2 Edit transitions.........................................................................................................17
3.2.9 Deleting objects...............................................................................................................18
3.2.10 Copy and paste.............................................................................................................. 19
3.2.11 Making changes undone................................................................................................21
3.2.12 Comments..................................................................................................................... 21
3.3 Expressions............................................................................................................................. 21
3.3.1 General............................................................................................................................ 21
3.3.2 Operators.........................................................................................................................22
3.3.3 Data types........................................................................................................................22
3.4 Error recognition.....................................................................................................................22
3.4.1 Syntax errors...................................................................................................................22
3.4.2 Logical errors.................................................................................................................. 23
3.5 Localization............................................................................................................................ 24
4 Code-generator............................................................................................................................... 25
4.1 Overview.................................................................................................................................25
4.2 Example model....................................................................................................................... 25
SU-statemodeler 3.0/2.2.0
Christian Pauli
2
4.3 General characteristics............................................................................................................25
4.3.1 Variables and types..........................................................................................................26
4.3.2 Functions and Activities..................................................................................................27
4.3.3 Listening to changes........................................................................................................28
4.4 Java.........................................................................................................................................28
4.4.1 General............................................................................................................................ 28
4.4.2 Implementing functions.................................................................................................. 28
4.4.3 Persisting states............................................................................................................... 29
4.4.4 Implementing actions...................................................................................................... 29
4.5 C++......................................................................................................................................... 29
4.5.1 General............................................................................................................................ 29
4.5.2 Type system.....................................................................................................................30
4.5.3 Object comparisons.........................................................................................................31
4.5.4 Implementing functions.................................................................................................. 32
4.5.5 Implementing actions...................................................................................................... 33
4.5.6 Compiling the code.........................................................................................................33
4.5.6.1 Compiling on Windows...........................................................................................33
4.5.6.2 Compiling on Linux................................................................................................ 33
4.5.7 Code variants...................................................................................................................34
4.5.8 Arduino generator........................................................................................................... 34
4.6 C#............................................................................................................................................34
4.6.1 General............................................................................................................................ 34
4.6.2 Implementing functions.................................................................................................. 34
4.6.3 Implementing actions...................................................................................................... 35
5 Products.......................................................................................................................................... 36
5.1 Standalone editor....................................................................................................................36
5.1.1 Overview.........................................................................................................................36
5.1.2 Debugger.........................................................................................................................37
5.1.3 System requirements....................................................................................................... 37
5.1.4 Obtaining the software.................................................................................................... 38
5.2 Eclipse plug-in........................................................................................................................ 38
5.2.1 Overview.........................................................................................................................38
5.2.2 Model files...................................................................................................................... 39
5.2.2.1 Creating a model file...............................................................................................39
5.2.2.2 Opening a model file...............................................................................................39
5.2.3 Color preferences............................................................................................................39
5.2.4 Exporting images............................................................................................................ 39
5.2.5 Generating code.............................................................................................................. 40
5.2.6 Error view....................................................................................................................... 42
5.2.7 Model properties.............................................................................................................42
5.2.8 Graphical debugger......................................................................................................... 43
5.2.9 Obtaining help.................................................................................................................43
5.2.10 Installing the plug-in.....................................................................................................43
SU-statemodeler 3.0/2.2.0
Christian Pauli
3
1 General
1.1 Overview
S(imple) U(ML)-statemodeler is an application for the development of state-based software
systems. The application consists of a graphical editor for UML-statecharts and a code-generator.
With the editor every kind of state-based system can be modeled. These models can be compiled
into code of several programming languages. To use SU-statemodeler, no programming skills are
required. The software is available as standalone editor and as plug-in for Eclipse.
This manual describes how to operate SU-statemodeler. Essentially this includes using the editor
and dealing with the generated code.
1.2 License
All SU-statemodeler-products (→ 5 ) and this manual are published under the following license:
This software and the related documentation have been created by
Christian Pauli and are protected by copyright.
Copyright holder is Christian Pauli, 2024.
The use of the software and related documentation are permitted for
private and commercial purposes, the provision by the creator is free of
charge. The redistribution of the software and its related documentation
requires express written consent of the copyright holder
The use of the software and its related documentation is at your own
risk. The creator provides no guarantee for the correctness, completeness
or quality of the software and its related documentation. The creator
does not guarantee that the software and its related documentation are
fit for a particular purpose.
The creator is not liable for damages, resulting from the use or
distribution of the software or its related documentation.
1.3 Versions
The version numbers in this manual always apply to the standalone editor and the plug-in for
Eclipse. See also chapter 5.
1.4 Contact
The author and distributor of the software is Christian Pauli. He can be contacted under
christian.pauli@christianpauli.de.
SU-statemodeler 3.0/2.2.0
Christian Pauli
4
2 Basics
2.1 States
A state-based software system, also called state machine, has clearly defined and finitely many
different states. If a state arises then it is active and determines the behavior of the software system.
A state can have subsidiary states which are called child states. According to this a state with child
states is the parent state of these child states. Two states that have the same parent state are called
sibling states. If a state is active then its parent state is active, too. If a state is not active then its
child states are not active, too.
2.2 Pseudo states
Pseudo states are no real states, because they only influence the behavior of transitions (→ 2.3 ).
Pseudo states are:
decision
join
fork
history state
initial state
end state
A decision influences the behavior during a transition by defining conditions that determine the
new target state of the transition.
A fork can define more than one target state of a transition that are active at the same time. A join
does the contrary: it determines one target state when a transition has more than one source state.
A history state is a the state which had been active before its parent state became inactive.
An initial state activates the first state of a state machine and is the origin of the behavior of the
system. Every parent state can only have one initial state. There should always exist a transition
originating from an initial state.
If a state machine takes its end state, there will be no more transitions. No transition can originate
from an end state. Every parent state can have one or more end states.
While a state can be active for a certain period, a pseudo state is principally never active. From
pseudo states only auto-transition can start from.
2.3 Transitions
2.3.1 Regular transitions
A (regular) transition is basically the change from one state to another. It always has a source state
and a target state. Both can be the same. The source state is left and becomes inactive. The target
state is entered and becomes active. An external transition is triggered by an event, additionally a
condition can influence the transition: if the condition is not true, the change of the state does not
take place. At last a transition can execute an action. An external transition can only be triggered if
the source state is active. An external transition without an event as trigger is called auto-
transition. An auto-transition does only happen if no child state within the source state is active, the
source state itself is active and all activities started by the source state are finished. If source state
and target state are the same then the state is deactivated and activated again. Transitions are used to
change the behavior of the state machine.
SU-statemodeler 3.0/2.2.0
Christian Pauli
5
A transition must not have an initial state as target state. Other pseudo state can be target state and
source state of a transition.
2.3.2 Internal transitions
An internal transition is always triggered by an event and can be influenced by a condition. Never
leading to a state change an internal transition only executes actions. It is used to trigger an action
but not to change the state of the system.
There are three kinds of internal transitions:
entry
exit
do
The event entry is triggered at activating, the event exit is triggered at deactivating a state. In
addition an action can be executed. The event do is triggered after entry and before exit and
can only be used to start activities (→ 2.4).
2.3.3 Trigger text
The trigger text consists of three parts:
1. event
2. condition
3. action
These parts appear in the following order:
event [condition] / action
All of these parts are optional. For the trigger the same rules as for state names apply. The condition
is a logical expression. The action can be a function call or an expression (e. g. g:=7). Syntax rules
for expressions are described in detail in chapter 2.5.1 .
In general all parts may appear with a transition. But with specific source or target states, not all of
the mentioned parts are allowed. The following enumeration shows the restrictions for certain
states.
source states only allowed
decision condition
entry or exit point action
fork -
join action
target states
join -
SU-statemodeler 3.0/2.2.0
Christian Pauli
6
2.4 Activities and actions
2.4.1 General
An action is an atomic, non-interruptible process. An example for an action is a function call. An
action is either completely or not executed. An activity consists of several actions. It is executed by
executing all its actions sequentially. An activity can be interrupted. This means that the execution is
aborted before all actions have been executed. This is only possible after or before an action is
executed. An exception are interruptible waiting actions.
An activity can contain cycles of actions. Action within these cycles are executed until the activity
is interrupted. Thus endless activities can be created.
Activities are used in statecharts to model parallel processes. An activity can only be executed if the
state is active. If the state becomes inactive the activity is interrupted. Activities are started by
internal transitions triggered by the event do. An activity has a name. For this name the same
syntax rules apply as for state names. There can be more than one transition triggered by do in a
state.
2.4.2 Transition behavior
A transition from a state that has been executing activities tries to finish these activities by
interrupting them. Afterward the transition must wait until all activities have actually been finished.
This might take an infinite amount of time because the currently executed actions cannot be aborted
immediately. Only interruptible actions can be interrupted immediately. If the implementation of an
action is faulty this can lead to deadlocks.
SU-statemodeler 3.0/2.2.0
Christian Pauli
7
Picture 1: activity
Picture 2: cyclic activity
Picture 3: activity
2.5 States
A state determines the behavior of a state machine.
2.5.1 Naming rules
It must have a unique name (within the editor window) and must not be empty. A new state gets a
provisional name by SU-statemodeler. This name can be changed by the user. The following syntax
rule must apply for state names:
[_a-zA-Z0-9]+
Examples for correct names:
State_1
Device_ON
device_off
_new_State
Examples for incorrect names:
state-1 (special character)
new state (blank)
Gerät_an (umlaut)
Device§on (special character)
2.5.2 Regions
By default only one child state is active within a parent state. If more than one child state is to be
active, then the parent state must have more than one region. In every region one state can be active.
Thus, complex states can be modeled. In SU-statemodeler regions are displayed as areas divided by
dotted lines (→ Picture 4). Every region can have one initial state.
SU-statemodeler 3.0/2.2.0
Christian Pauli
8
2.6 Entry and exit points
A state can have multiple entry and exit points. An entry point can be the target of a transition with
a source state “outside” of the state. An entry point forwards the transition to a child state. The state
itself is activated. The exit point is the counterpart of the entry point. It is the target of a transition
whose source state is a child state of the state. It forwards the transition to a state “outside” of the
state. The state itself is deactivated.
The following pictures show an example for an entry and exit point in SU-statemodeler.
The transition pointing to entry is forwarded to Childstate1, a child state of State_3. Vice
versa the transition coming from Childstate_1 pointing to exit is forwarded to State_2.
SU-statemodeler 3.0/2.2.0
Christian Pauli
9
Picture 5: external view State_3
Picture 4: regions
2.7 Model modularization and reuse
Importing models facilitates the reuse of models and can be used to divide them into separated
modules.
To import a model SU-statemodeler provides the import state. By this state another model (the
imported model) is embedded into the current model (the importing model). The imported model
becomes a sub-model of the importing model. Thus it is possible to create nested models.
When importing a model directly or indirectly into itself an import cycle occurs. Through import
cycles indefinite state machines can be modeled. Picture 7 shows such an import cycle, where
model A is indirectly imported into itself.
SU-statemodeler 3.0/2.2.0
Christian Pauli
10
Picture 6: internal view State_3
SU-statemodeler 3.0/2.2.0
Christian Pauli
11
Picture 7: import cycle
3 Editor
3.1 Overview
With the graphical editor of SU-statemodeler state machines can be modeled with the UML-
notation. The editor saves the models as XML-files (file ending smf). These files are called model
files. The editor is used via mouse and keyboard. Particular user operations can be made undone.
The editor recognizes syntax errors and certain logical errors and displays them.
Nearly everything in the editor is a state. The modeled system itself is a state with child states.
A state is displayed as a rectangle with round corners. Picture 8 shows the supported state types:
1. normal state
2. complex state
3. imported model
4. initial state
5. end state
6. join / fork
7. decision
8. shallow history
9. deep history
A transition is displayed as an arrow, the head points to the target state. A text field shows the
SU-statemodeler 3.0/2.2.0
Christian Pauli
12
states
pseudo-states
Picture 8: editor window with states
2.
4.
5.
6.
7.
8.
9.
3.
1.