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

Model-based testing of state machines 2020/02/23 19:32 Peter Mueller  
DCF77 Radio Clock 2020/02/23 19:27 Peter Mueller ,
Getting started with a Traffic Lights example on MSP430 - part 1 2020/02/23 19:26 Peter Mueller , , , ,
Astah SysML 2020/02/23 19:22 Peter Mueller  
Generate production quality code from state diagrams created with Enterprise Architect 2020/02/23 19:20 Peter Mueller  
Features 2020/02/23 19:18 Peter Mueller  
Generate efficient source code from UML state diagrams and activity diagrams! 2020/02/22 20:00 Peter Mueller  

Reading data from an energy meter via Modbus – Activity diagram in practise

Background: For a data logger application the voltage and real power values should be read from an energy meter using the Modbus RTU protocol. The application runs in the context of collectd1) on a FreeBSD server and stores the values in a RRD database. The program can be called with a command line parameter that defines the data point to read and the serial port to use. The console output is in a format that is directly processed from collectd.

Example call and console output to read the line voltages:

./energy /dev/cuaU0 VOLTAGE

Solution: In contrast to the microwave oven example where an activity is called from within a state diagram (see news entry from 24.5.2014) in this example a complete small command line program is modelled. The model was created with Enterprise Architect. Besides the basic design elements like actions, initial – and final nodes also a conditional node was used. This type of node is a convenient block to model multiple choices and actions in one block instead of using multiple choices and action blocks.

To generate code from the model export it into an XMI file using the latest XMI 2.4.1 format (this is important). Then call the code generator the following way to generate C-code from the mode file:

java -jar ../../codegen.jar -p EA -A -t "Model:implementation_model:modbus_client" -o modbus_client modbus_client.xml

And finally compile and link the object with the used Modbus library to create the exe file:

gcc -I/usr/local/include/modbus/ -g strommessung.c -L/usr/local/lib -lmodbus

Thats all! Here is the generated code: modbus_client_activity.c. A simple main file calls the generated method:

#include "modbus_client_activity.h"
int main(int argc, char* argv[]){
	return activity(argc, argv);

If you are interested in the model file just send a mail! Your thoughts are also very welcome!

Have fun!


How do you like this article?
 stars  from 8 votes
collectd is a daemon which collects system performance statistics periodically and provides mechanisms to store the values in a variety of ways, for example in RRD files.

Leave your comments

Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.
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/24june2014.txt · Last modified: 2014/06/24 22:16 by pmueller