Composite State

A composite state is used for grouping the states it covers. It can be used for two different use cases:

Samples of the implementation of various use cases can be found at the foot of this page.

Composite State 1:

A composite state is shown as a yellow, filled rectangle with rounded corners. Its name is displayed in the upper left corner of the rectangle. Regions are separated by black dashed lines.

In the case of a composite state with several regions, the priority of each region is displayed in the top right-hand corner and the name of each region in top left-hand corner of the region. The lines, names and priorities are editable.

Syntax rules

General syntax rules for composite states

 

Syntax rules for a composite state with precisely one region

 

Syntax rules for a composite state with multiple regions

ENTRY, DO, EXIT actions/methods

A composite state that has precisely one region can be assigned ENTRY/DO/EXIT actions/methods.

In order to enable this function, the option "Allow ENTRY/DO/EXIT actions" must be activated. This option is located in the properties of the composite state. For these actions or methods you can choose any implementation language.

Call behavior

Make sure you refer to the samples, which describe and illustrate the call behavior of the UML state diagram.

Properties

"Property"

Description

"Identifier"

Name of the composite state

Example: DoorAutomation

"Color"

Color of the composite state

Click on the set color to change the color of the composite state via the drop-down menu that opens.

Default: Composite State 2:

"Allow ENTRY/DO/EXIT actions"

Requirement: this property is available when the selected composite state has exactly one region. In this case you can also assign actions to a composite state if it is part of a nesting of composite states.

Composite State 3:: you can assign an ENTRY, DO or EXIT action to the selected composite state.

Composite State 4:: you cannot assign ENTRY, DO or EXIT actions to the selected composite state.

"Execute DO actions, even if inner composite states are active"

Requirement: several composite states are graphically nested within each other.

The option is only available for the outer composite state and is passed on to the inner composite states.

Composite State 5:: at runtime the DO action of the outer composite state is executed continuously, even if an inner composite state is active. In the editor the note "{is also executed for inner composite states}" appears next to the DO action, in order to highlight this action behavior.

Composite State 6:: when one of the inner composite states becomes active, the DO action of the outer composite state pauses.

"ENTRY action"

Requirement: the selected composite state has precisely one region and the property "Allow ENTRY/DO/EXIT actions" is activated.

Assign an action to the selected state by specifying its action name.

"DO action"

"EXIT action"

Edit composite state

The user inputs in the state diagram editor can be summarized as follows:

User input in the state diagram editor

Response in the state diagram

Description

Focus on a composite state.

Composite State 7:

The composite state is editable.

  • You can edit the name through two single clicks on the name.
  • You can add outgoing transitions via the command icons that are shown above the state.
  • The size of the composite state is adjustable.
  • The state can be removed with the [Del] key.

Conditional editing options:

  • The composite state can be extended with an ENTRY, DO and/or EXIT action, if the composite state has a region and the property "Allow ENTRY / DO / EXIT actions" is enabled.

Click on the green symbol Composite State 8:

 

A completion transition is added. If you click on an existing state, it becomes the target state of the transition. Click in an empty area to create a new state.

Click on the green symbol Composite State 9:

 

An exception transition is added. If you click on an existing state, it becomes the target state of the transition. Click in an empty area to create a new state.

Focus on a composite state and hold the mouse pointer over the state.

Composite State 10:

 

Pull one of the blue Composite State 11: squares to another position.

 

The size of the composite state was adjusted.

Click on the green symbol Composite State 12:

Composite State 13:

The state is subdivided, and a further region is added. The name and priority are displayed for each region.

Click twice (two single clicks) on the name of a region.

Composite State 14:

The name of the region is editable.

Click twice (two single clicks) on the priority of a region.

Composite State 15:

The priority of the region is editable. Enter a number to define the priority of the region. The priorities of the other regions are automatically adjusted.

Click on the dividing line and move it.

 

The dividing line is moved to adjust the size of the regions.

Click on the dividing line and press the [Del] key.

 

The dividing line is removed, so that the regions that were separated by it become one region.

Focus on a composite state and hold the mouse pointer over the state.

Composite State 16:

Requirements:

  • The composite state has one region.
  • The property "Allow ENTRY / DO / EXIT actions" is enabled

Click on one of the three symbols

Composite State 17:

 

These command icons extend a composite state with an ENTRY, DO or EXIT action.

Clicking on one of the rectangles brings up the following:

  • Composite State 18:: extension by ENTRY action
  • Composite State 19:: extension by DO action
  • Composite State 20:: extension by EXIT action

Focus on a state, which was extended by an action, and click on the symbol Composite State 21:.

Composite State 22:

For action lines the symbol appears at the end of the line, if no action has been assigned yet.

The dialog "New action object" opens for generating a new action. The name of the action is shown after a slash.

See also: "Add new action object"

Click twice (two single clicks) on the ENTRY, DO or EXIT expression (irrespective of whether an action was already assigned or not).

 

The line editor opens with IntelliSense support, so that a new action can be assigned. If the required action is selected in IntelliSense, the action can be selected by double-clicking or single-clicking plus [Enter].

Focus on a state that was assigned an action. Click on the symbol Composite State 23: or double-click on the assigned action.

Composite State 24:

The assigned action, "SampleMethod" in the sample, opens in the editor. The action object can be edited in the POU editor that opens.

Pull a composite state from the Toolbox view to a composite state with precisely one region.

Composite State 25:

The composite states are nested.

If the property "Allow ENTRY / DO / EXIT actions" is enabled for the outermost state, you can assign each composite state its own actions (ENTRY/ DO / EXIT).

Add a DO action to the outermost composite state and activate the option "Execute DO actions, even if inner composite states are active" under Properties.

Composite State 26:

At runtime the DO action, e.g. "DoMethod", is executed continuously, even if one of the inner composite states is active.

With deeper nesting, this option and its value are passed on to inner states.

The note "{is also executed for inner composite states}" appears in the editor.

Pull a state from the "Toolbox" window to a region of the composite state.

 

The state is assigned to this region.

If the Composite State 27: symbol appears, the insert position to which the mouse points is not allowed.

Samples of composite states

Composite state with exception and completion transition and with a region with start and end state:

Composite State 28:

Composite state without completion transition and with a region without start and end state:

Composite State 29:

Composite state with one region and its own DO action:

Composite State 30:

Nested composite states, some with their own ENTRY/DO/EXIT action:

Composite State 31:

Composite state with several regions/orthogonal state with fork:

Composite State 32:

Sample "Lift": orthogonal state with completion and exception transition:

Composite State 33: