SinelaboreRT Header Logo


It's better when it's simple!

User Tools

Site Tools


UML-Tool specific Intro

Language Backends



Designers Toolbox

Integrated state-chart editor with auto-layout

Focus on modeling and not on moving states around to create a nice looking diagram! Syntax aware text fields offer a comfortable way to specify actions, guards etc. When the diagram passed the model checker it can be directly simulated. Connect the diagram to the real hardware to monitor the state machine in action.

There are better ways to model state machines than using spread sheets!

In the past different μC manufacturers have published application notes about the benefit of using state machines for the design of embedded software. An example is the application note SLAA402 from Texas Instruments (TI). It suggests to generate source code based on a spread sheet table. Nowadays several affordable UML modeling tools are available supporting the efficient design of state machines in a graphical way. SinelaboreRT generates production quality source code from state diagrams created with many different UML tools. Give it a try!

Latest Changes

Generating C++ Code 2020/02/15 13:06 Peter Mueller  
Generating C code 2020/02/15 13:05 Peter Mueller  
Generating Python Code 2020/02/15 13:00 Peter Mueller  
Navigation 2020/02/15 12:56 Peter Mueller  
Generating Java Code 2020/02/15 12:54 Peter Mueller  
Generating C# code 2020/02/15 12:26 Peter Mueller  
Generating Lua Code 2020/02/15 12:14 Peter Mueller  
Generate efficient source code from UML state diagrams and activity diagrams! 2020/02/14 18:22 Peter Mueller  
Action disabled: backlink

Using Activities -- Updated Microwave Oven

In the manual a simplified microwave oven is used to explain the generation of source code from state machine diagrams. This example was updated here to show how to generate code also from activity diagrams.

The extended state machine of the oven is shown below. For demonstration on how to use activities the oven performs a hardware selftest at startup. The hardware test happens on the incoming transition of the choice. Depending on the result of the selftest the machine enters an error state (marked in red) or the normal operation state (super). The hardware selftest routine was modelled as activity diagram.

The following code snipped shows the call of the hardware selftest. The selftest function itself was fully generated from the code generator

uint8_t hwStatus; // selftest status
void  oven(OVEN_INSTANCEDATA_T *instanceVar){
	/*execute entry code of default state once to init machine */
		hwStatus = hardwareTest();
			instanceVar->stateVar = Error;
			instanceVar->stateVar = Super;
	switch (instanceVar->stateVar) {

The hardware selftest function was modelled in an own activity diagram. A class can have one or more activity diagrams. The code generator generates an own c-file/header per activity. The activity of the hardware test function is shown below. The single steps do not really do anything useful and only the most basic features of an activity diagram are used. But it shows the principles and how well both generators complement each other.

To generate code from the diagram call the code generator as follows. The -A enables the generation of code from activity diagrams. Without this flag state machine code is generated. To generate both call the generator twice.

java -jar codegen.jar -p EA -A -t "Model:Class Model:first_example_step3" -o oven  first_example_step3.xml

The latest download contains the full model and code in the examples folder. The example is called microwave_handbook_enterpr_arch

In case of questions just send a mail.

Have fun!

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
wiki/news/18may2014.txt · Last modified: 2014/05/18 18:41 by pmueller