SinelaboreRT generates readable and maintainable code from hierarchical UML state machines. With its unique features and the C code generator the tool covers well the requirements of embedded real-time and low power application developers. With its C++, Python and Java backend it is also a perfect tool for developers of server or desktop applications.
Key Features:
The following example shows how the code generator works by means of a simple microwave oven.
Requirements:
The sate machine and the class diagram below shows a possible solution.
To generate for example C code call the code generator as follows:
java -cp "../../bin/*" codegen.Main-l cx -p md -t "Model:oven_package:oven" -o oven oven.xmi.xml
After checking the model against a set of well-formedness rules (e.g. no double state names) the complete state machine code is generated.
Done!
Look into the generated files:
In the examples folder you will find the complete code ready to be tested and expanded by you.
The code-generator supports a relevant subset of the design elements provided by Magic Draw. The supported elements are:
Download the demo version and try it right now. It includes many other examples.
I don't see the on-entry/on-exit/do code in my state diagram
Since MD version 19 (at least recognised it there) it is necessary to copy your code to the body text. See example below:
Is it necessary to specify an action name for on-entry/on-exit/do code?
If there is text in the name fieled (as shown above) it will be considered for code generation. If the name field is left empty the body part is used for code generation. The body text can be longer than one line. An example is shown below.