SinelaboreRT Header Logo

SinelaboreRT

It's better when it's simple!

User Tools

Site Tools


Sidebar

Tool Landing Pages

Examples

Designers Toolbox

How-To

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

PageDateUserTags
Generate efficient source code from UML state diagrams and activity diagrams! 2017/04/23 11:02 Peter Mueller  
Navigation 2017/04/23 10:55 Peter Mueller  
wiki:news:03jan2013

Version 3.1

Region support for the C++ backend

A UML state might be divided into regions. Each region contains sub-states. Regions are executed in parallel. You can think of regions as independent state machines displayed in one diagram.

For each region an own method is generated in the state machine class. Its name is automatically derived from the region name. If a state contains several regions they are called one after the other (in alphabetical order). If the event sent to the state machine was processed in one of the regions no further event handling happens in the parent state. Otherwise the event is processed in the parent state. This is similar to the event handling of normal hierarchical state machines.

To maintain consistency during execution of machine code a copy of the instance data is created at the beginning of the state machine code. All state machine internal tests are performed on the original instance data. All changes are done on the copy. This ensures that all regions see the same situation when running. At the end of the machine code the modified instance data is copied back to the original data.

Here is an example how the generated C++ code looks like:

// State machine event handler
int testcase::processEvent(TESTCASE_EVENT_T msg){
 
	int evConsumed = 0;
 
	if(m_initialized==false) return 0;
 
	//Create copy of statevar
	stateVarsCopy = stateVars;
 
	switch (stateVars.stateVar) {
 
		case S1:
			/* calling region code */
			evConsumed |= testcaseS1Region1(msg);
			evConsumed |= testcaseS1Region2(msg);
 
			/* Check if event was already processed  */
			if(evConsumed==0){
                          ...
 
 
                break;
	} /* end switch stateVar_root */
	// Copy state variables back
	stateVars = stateVarsCopy;
 
	return evConsumed;
} // end processEvent
 
 
 
// Region handler code for state S1 Region1
int testcase::testcaseS1Region1(TESTCASE_EVENT_T msg){
   ...
}
 
// Region handler code for state S1 Region2
int testcase::testcaseS1Region2(TESTCASE_EVENT_T msg){
   ...
}

New Parameter PrefixStateNamesWithMachineName

This parameter allows to prefix state names with the C machine name. Use this option if multiple state-machine header files are included into one other file (e.g. main.c) to avoid definition conflicts due to double used state names. See also parameter PrefixMsg- WithMachineName.

New Parameter PrefixStateNamesWithParentName

This parameter allows to prefix state names with the parent state name. Use this option if you have a hierarchical state machine and want to use the same state names in different child states. Example: There are two parent states called EngineOn and EngineOff. And in both states you have children FuelPumpOn and FuelPumpOff. To make the children names unique they can be prefixed with the parent name.

This new version is free for users who bought their license within the last two years.

wiki/news/03jan2013.txt · Last modified: 2013/01/03 20:48 by pmueller