Refer to the following sections for more information about managing transitions.

Creating Transitions

You can only create transitions in the graphical area. Transitions can only be created between two existing elements, because they always require a defined source and target element.

You have the following options to create transitions:

  • Automatically create a transition when you create a new element by dragging it on the diagram area. A transition is automatically created between the source and target element.
  • Subsequently create transitions by dragging between two existing elements in the diagram area.
Figure 47. Dragging a New Transition Between Two Existing States

All elements contained in the Toolbox are allowed as source or target element, except for the following:

  • Comment
  • Do4Ever
  • DoAtStateChange

Move Transition

A transition must always have a source and a target element. Therefore, you cannot drag a transition to the empty diagram area.

To move a transition, you must mark it in the diagram area. Then you can drag the selected start or end points of the transition to the desired source or target element. The transition is moved to this element if it is allowed as a new start or end point.

In the following figure, on the left side the source state is changed, and on the right is the target state.

Figure 48. Moving Transitions


Rename Transition

Transitions do not have a name once created. In the code view and in the Explorer, they are labeled with the state to which they lead. For example, to state 2 (2). No name is displayed for such transitions in the diagram area. If you give a name to the transitions, it is displayed in the Code view and in the Explorer as well as in the diagram area.

You have the following options to rename transitions:

  • Select the marked transition in the diagram area and press <F2>.
  • In the diagram area, select Rename from the Context menu.

In all cases, the display of the transition name is transformed into an input field, in which you can enter the new name.

To reset the name so that it is no longer displayed the diagram area, change to the Edit mode and delete your name from the input field.

Delete Transitions

You have the following options to delete transitions:

  • Select the transition in the Explorer or diagram area and press <Del>.
  • In the Explorer or diagram area, select Delete from the Context menu.
Important Once you delete a transition, the action cannot be reversed.

Transitions With and Without Condition

Transitions that do not contain program code for the condition are marked as arrows with a solid line. Transitions that contain a condition are represented as arrows with a broken line.

Table 40. Transition Display
Condition Display in Chart Display in Explorer
No condition



With condition



The program code for the condition is entered in the code entry for transitions in the code view.

Sequence of Transitions

The order of transitions is only relevant if the condition of at least two transitions that are leading away from the active state is met at the same time.

A transition is executed when either the transition condition is met or the transition has no condition. If the active state has two transitions with a fulfilled condition at the same time, the order of the transitions in the Explorer is critical.

Tip To change the order of transitions, open the Context menu in the Explorer and select Move up or Move down.

Example 1



In the example above, Transition 1 has no condition and Transition 2 has a condition. Since Transition 2 is only checked after Transition 1 and since Transition 1 is always executed, Transition 2 is never executed.

Example 2



In this example, Transition 1 is checked after Transition 2. If the condition for Transition 2 is met, Transition 2 is executed and Transition 1 is not. If the condition for Transition 2 is not met, Transition 1 is executed.

Using Bending Points

Transitions are always created as a straight line between the source and target element. By inserting bending points, you can influence the arrangement and position of these lines.

Insert Bending Points

To insert bending points at the corresponding transition, open the Context menu and select Insert Point from the Context menu. You can repeat this process as often as necessary.

Position Bending Point

Move the mouse over the bending point until the pointer changes to an arrow that points in four directions. Grab the bending point with the mouse and drag it to the desired location.

Figure 49. Moving Bending Points

If a bend is exactly 90 °, the corner is rounded.

Remove Bending Point

To remove a bending point, move the mouse in the diagram area over this bending point until the mouse is a pointer. Open the Context menu and select Remove point.

Stop

Stop in a transition causes the successor state to only be entered in the next call cycle of the state machine. Without this Stop, the next state is immediately activated and the program code is executed in the initialization part.

All transitions are created by default without a Stop. If a Stop is desired, it must be explicitly created.

You can create a Stop using either of the following methods:

  • Drag a Stop element from the Toolbox to the chart area. In this case, you must manually create the two transitions that lead to the Stop or go away from it.
  • Select Stop from the Context menu for an existing transition.
Note You can click a Stop element in the chart area, but it is not possible to store program code for it.
Tip To remove a Stop from a transition, open the Stop element from the Context menu and click Remove stop.

State Machine with AnyTransitions

AnyTransitions are always checked at the start of a cycle before the code of the current state is executed. The code of the exit part of a state is executed before switching to the AnyTransition.

Example

Figure 50. State Machine with AnyTransition

In the example, if State 1 is active at the start of a new cycle, and the condition of AnyTransition 1 is met, the following sequence arises for code execution:

  1. exit part of State 1
  2. activity part of AnyTransition 1
  3. init part of State 3
  4. cyclic part of State 3
Note The condition of a AnyTransition is only checked if the AnyTransition has a follow-up state. An AnyTransition without a follow-up state is neither checked nor the activities part is executed.

AnyTransitions are checked once in each cycle and then executed if necessary. If no Stop is defined between two states, the AnyTransitions are not checked again before entering the next state.