State

A state is the main element of a state diagram. A state machine (or state diagram) passes through various states and executes their actions during its runtime. A state can have ENTRY, DO or EXIT actions, which are executed at specified times during the runtime of the state.

State 1:

A state is displayed as a rectangle with rounded corners.

Normal state

A normal state is clocked by the task in which it is called. This means that the transition into the next state is not called before the next task cycle switches.

Cycle-internal state

If a state machine consists of cycle-internal states, the switching characteristics are independent of the task cycle. This means that completion of the actions of an internal state is followed immediately by the transition. The transition condition is checked immediately, and the transition action is executed when the condition is met. Also, the system immediately switches to the target state when the transition condition is met.

Whether a state switches cycle-internally is set in the property “Internal state”.

ENTRY, DO, EXIT actions/methods

A state can have an ENTRY, DO and/or EXIT action or method. 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 state

Example: Enable, Production, ErrorHandling

"Color"

Color of the state

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

Default: State 2:

"Implicit start state"

  • No: [Default] set the property to No if you require a normal state.
  • Diagram: set the property to diagram if you want that the state to be also a start state. A state machine requires a start state at the top level and also each region in a composite state.

"Cycle-internal"

  • State 3:: tick the checkbox to set the state cycle to internal. In "Cycle-internal" the transition is immediately switched to the next state.
  • State 4:: [Default] untick the checkbox to set the state cycle to normal. The state then changes with the task cycle. A transition to the next state is executed with a cycle change of the task.

"Max. DO cycle calls"

Requirement: this property is available if the property "Cycle-internal" is activated.

Define the maximum number of calls of the DO action per cycle. Enter a number between 1 and 32767. This setting is relevant for the cycle-internal states if the outgoing transition of the cycle-internal state is not fulfilled during the processing of the cycle-internal state and will also not be fulfilled during the DO calls. Setting the maximum number of calls ensures that calling the cycle-internal state does not lead to an infinite loop.

"ENTRY action"

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

"DO action"

"EXIT action"

Edit state

The following user inputs are available, provided "Pointer" or "Choice" is enabled in "Toolbox" (standard mode).

User input in the state diagram

Response in the state diagram

Description

Focus on a state.

State 5:

The state is editable.

  • You can edit the name through two single clicks on the name.
  • You can add outgoing transitions via the command icon above the state.
  • Via the three icons in the center of the state you can extend the state with an ENTRY, DO and/or EXIT action.
  • The state can be removed with the [Del] key.

Click on the green symbol State 6:

State 7:

An outgoing transition is created. 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.

Generate several transitions on the same state.

State 8:

If a state has more than one outgoing/incoming transition, the priorities of the transitions define their execution order. The priority of the transitions is shown in a small circle.

Click on State 9::

State 10:

The state is extended by an ENTRY action/method.

Click on State 11::

State 12:

The state is extended by a DO action/method.

Click on State 13::

State 14:

The state is extended by an EXIT action/method.

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

State 16:

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 State 17: or double-click on the assigned action.

State 18:

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

Click on State 19::

State 20:

The action list for the state collapses.

Click on State 21::

State 22:

The action list for the state expands.