Skip to content

State

A state models a situation during which some (usually implicit) invariant condition holds.

The invariant may represent a static situation such as an object waiting for some external event to occur. However, it can also model dynamic conditions such as the process of performing some behavior (i.e., the model element under consideration enters the state when the behavior commences and leaves it as soon as the behavior is completed)

The following kinds are supported for code generation:

Simple state (a state that does not have substates)

  • Composite state
  • Embedded engineer only supports Simple Composite States (with just one region)

Regions

Orthogonal States (with more than one region) will be handled as separate State Machines.

Actions

Entry Action

An optional behavior that is executed whenever this state is entered regardless of the transition taken to reach the state. If defined, entry actions are always executed to completion prior to any internal behavior or transitions performed within the state.

Do Action

An optional behavior that is executed while being in the state. The execution starts when this state is entered, and stops either by itself or when the state is exited whichever comes first.

Exit Action

An optional behavior that is executed whenever this state is exited regardless of which transition was taken out of the state. If defined, exit actions are always executed to completion only after all internal activities and transition actions have completed execution.

Note

According to Uml Specification 2.4.1 a State may only contain a single Entry, Do and/or Exit action (one of each).

How to create and use Entry/Do/Exit actions:

  • Select a State and enter a name for the action in the Feature & Properties tab. This will create an "operation" in the state.

Action

  • When selecting the action either in the Project Browser the Diagram or the Features & Properties tab you can enter User Code or select an Activity in the Behavior Properties tab.

Action

Use the Element button to select a modeled behavior.

Currently we support:

  • Open the Specification dialog for the state and scroll down to find Entry, Do Activity and Exit groupings.

Action

  • Select a Behavior Type for your action

Action

Currently we support:

  • Activity
  • FunctionBehavior
  • OpaqueBehavior

After selection of the Behavior Type either an Activity, OpaqueBehavior or an FunctionBehavior will be added to the State and can be filled with User Code or with a modeled Activity.

Action