State Diagram

A state diagram describes the behavior of systems by a finite number of states with corresponding transitions.

Diagram Model

Name

Graphical Representation

Description

Pseudo States

../../../_images/state-points.png

Entry and exit points are used to start and stop the state machine. The termination point is used for abnormal exiting.

State

../../../_images/state-state.png

A simple state defines a situation where certain well-defined conditions are valid. The current state of an object is called active state.

State Activities

../../../_images/state-detail.png

Entry, do and exit activities can be specified within the state element.

Transition

../../../_images/state-transition.png

A transition is a directed relationship that describes a change from source state to target state (which can be the same state). A transition is triggered by events:

  • call event: request to execute an operation

  • signal event: asynchronous signal received

  • change event: one or more attribute values of the object changed

  • time event: point in time reached or time passed

  • any receive: any event where the reaction is not specified by other transitions

Events can be ignored, can trigger a state change or can trigger state internal actions without state change.

Sub-State Machine

../../../_images/state-sub.png

This element specifies a state which is detailed in another diagram.

Composite State

../../../_images/state-composite.png

Also defines a sub-state machine, but the internal states are modelled directly in the same diagram. A composite state can have own entry and exit points or the internal states are directly connected to the other states.

Decision

../../../_images/state-decision.png

Usually a decision is modelled by different transitions from one state to other states. But in some cases a decision can make a diagram more readable and reduce complexity.

Fork and Join

../../../_images/state-forkjoin.png

This can be used to model parallel states in different threads, cores, etc.

Example

../../../_images/state.drawio.png