Skip to content

Premise

The main idea behind modelling your behavior is to get a faster/better understanding and/or a more abstract view of certain aspects of the behavior. (It is easier to draw/view a decision tree then to read/write a description of a decision tree)

This is why Embedded Engineer allows you to model your behaviors as Activities or State Machines.

State machines are generated as switch/case constructs, so they're both fast and memory efficient.

States can be nested indefinitely and conform to the UML2 semantics.

Before you use state machines in your code, please read the chapter Structure Definitions!

Structure Definitions

The generated code for state machines requires a structure definition, which defines how the state of the state machine is stored. It also needs a definition of time, and a method to check if a given timespan has passed.

In order to keep the generated code flexible, we've built a template which you can insert into your model.

See also

FSM

Semantics

The semantics of the generated code for state machines is pretty close to the semantics defined in UML 2.4.

However, there are a few variation points in the specification, and not every semantical property is defined in UML. Therefore please consider the special semantics of code generated with Embedded Engineer for the elements in this chapter.

Execution Sequence

The order of execution of entry/exit activities as well as transition effects is as defined in UML 2.4

Execution Sequence

Note that for composite states, the active states are exited recursively starting with the innermost state. Then the transition effect is executed, after which the target states are entered recursively, starting with the outermost state. Entry and exit points allow even finer control over the execution order of effects. For entry-points, this is the order of execution:

  1. The active states are exited like with normal transitions.
  2. The transition effect of the incoming transition is executed.
  3. The entry action of the composite state is performed.
  4. The transition effect of the outgoing transition will be executed.
  5. The target states are entered like with normal transitions.

For exit-points the behavior is analogue:

  1. The active states are exited like with normal transitions.
  2. The transition effect of the incoming transition is executed.
  3. The exit action of the composite state is performed.
  4. The transition effect of the outgoing transition is executed.

Execution Sequence

History

Embedded Engineer supports shallow and deep history.

Create shallow/deep history

The fastest way to create a shallow or deep history is by using the quick link function of Enterprise Architect.

To use the quick link function select the source element and use the drag/drop the arrow symbol in the right top corner to your destination target/or empty space.

History

When drag/dropping the quick link feature from your source element onto a composite state you then can select either deep or shallow history.

History

See also