Creating a New State Machine Block

New Building Block Wizard

alt text

  1. Use the New building block button int the Building Blocks menu bar. It looks like a building block with a plus sign.
  2. Choose the name of the new building block
  3. Choose the block type to be State Machine Block
  4. Choose to which project the new building blocks belongs to
  5. Click Finish

The wizard will create a new empty state machine block:

alt text

As the block is empty you will see the error message State machine is empty in the Analysis window.

The block editor provides tabs for Parameters, State Machine, Contract, Overview and Documentation.

Editing the STM block

Java Code

To edit the java code of this building block, right click within the State Machine tab and choose Go to Java Code: alt text

To be able to use methods as operations associated with a transition they have to be public and have to have return value void. To use methods as guards for transitons from choice states, they have to have return value boolean.

For general advice regarding java methods for building blocks hava a look here.


First you need to specify the parameters of this block.

Right click the empty list within the Parameters tab and choose New Parameter…:

alt text

to add a parameter node:

Specify the name and what kind of parameter node you want to create. Read more about parameter nodes. You may specify a type for this parameter node or omit this field in case no data is associated with it.

Usually you will have one or more Starting Event(s), some Input Events and Output Events and maybe a Terminating Event. For example:

alt text

State Machine

The state machine describes the behaviour of the block. You have to specify the parameters first, as they will be used when working with the state machine.

The state machine is described in transitions. To add an transition right click the state machine table and choose Add Transition… from the context menu: alt text

and a wizard for creating the new transition will pop up:

  • Source / Target State: Each transition has a source state and a target state, which can normal states or choice states. Define source and target state using the Select buttons, which offer existing states, recently / commonly used states and let you define new states.

  • Trigger: The trigger specifies for normal source states what pin(s) will make this transition happen. Use the Select button on the side to choose between existing input parameters, timers and events.

  • Guard: For transitions from choice source states you specify no trigger but a guard defining which of several transitions from one choice state will be executed.

  • Operations: Choose operations which you want to be executed with this transitions. You have to add them to the Java code of this block first and they have to be of type public void to be listed here.

  • Timers: Choose timers, which have been defined before (Trigger)

  • Outputs: Choose which output parameters to invoke with this transition.


For STM blocks you do not define the block contract, but it is derived from the state machine. Have a look at the derived block contract once you are done with defining the state machine to double check that the block works as intended.


This tab is the same as for normal building blocks.


This tab is the same as for normal building blocks.