Tasks

Modeling a statemachine

  1. Make sure the YAKINDU Modeling perspective is active.
  2. Create a new project.
  3. Click File > New > Other... > YAKINDU > YAKINDU Statechart Model.
  4. Click Next name the sct file and click Finish
  5. The YAKINDU statechart editor opens on the statechart model. It already has an initial state and an unnamed simple state connected by a transition.
  6. Now you can add states and transitions from the palette.

To edit the states and transitions you can use the properties view. It has an integrated Xtext support. This makes correct editing easier. You can also change the appearance of the model elements.

On the palette you will also find a composite submachine state. This is a state that contains a complete statemachine. You can choose an existing statemachine or create a new one.

Related topics

Xtext JFace Integration
Statemachine Elements reference
SText Reference

Validating a statemachine

The statemachine is validated automatically during build. The elements that cause problems get error markers. You can find the details about the problems on the problems view.

Simulating a statemachine

The YAKINDU simulation engine supports simulation modes:

The default setting is cycle based with a cycle period of 300 ms. In this mode the simulation engine processes the state machine transitions in steps of the given cycle duration. The following statechart illustrates this. It is simulated cycle based with a cycle period of 3 seconds.

What happend during simulation is the following:

  1. After 3s init switches to pre1
  2. After 3 further seconds recursive transition to pre1 is processed (not after 2s the transition says)
  3. After 3 further seconds recursive transition to pre1 is processed again and the condition becomes true so result gets activated

In contrast to cycle based the event driven simulation mode concentrates on the events of a state machine. The same state machine above could be simulated as follows:

  1. Immediately init switches to pre1
  2. Immediately the event touch is raised twice
  3. The condition becomes true so that the result state is reached after 2 or 3 seconds instead of 9

Start a simulation with the different modes as follows

  1. Make sure the YAKINDU Simulation Perspectiv is opened.
  2. Start the simulation by clicking Run > Run Configurations....
  3. Select the statechart you want to simulate and the simulation mode.
  4. Apply the setting and Run the simulation.

Simulation Concept
Simulation perspective
Simulation View

Generating C code

Generating Java code