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.
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.
- The ENTRY action can initialize the state. It is executed once when all incoming transitions switch, so that the state becomes active.
- The DO action is executed as long as the state is active.
- The EXIT action is intended to ensure that the state is exited in a valid state. The EXIT action is executed once when all outgoing transitions switch, so that the state is exited.
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: |
"Implicit start state" |
|
"Cycle-internal" |
|
"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. | The state is editable.
| |
Click on the green symbol | 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. |
| 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 : | The state is extended by an ENTRY action/method. | |
Click on : | The state is extended by a DO action/method. | |
Click on : | The state is extended by an EXIT action/method. | |
Focus on a state, which was extended by an action, and click on the symbol . | 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 or double-click on the assigned action. | 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 : | The action list for the state collapses. | |
Click on : | The action list for the state expands. |