Learn how to manage transitions in PAgraph.

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 44. Dragging a New Transition Between Two Existing States
Diagram showing dragging a new transition from State 1 to State 2.

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 45. Moving Transitions

Diagram showing the source state changing.

Rename Transition

Learn how to rename transitions in your diagrams to display the names in the code, explorer, and diagram area.

Transitions do not have a name once created. In the code view and in the Explorer, transitions are labeled with the state to which the transition leads. For example, to state 2 (2). Names do not display for such transitions in the diagram area. If you name the transitions, the name displays in the code view, Explorer, and 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 transforms into an input field. You can enter the new name in the input field.

You can reset the name so that it does not display the diagram area. To reset the name, complete the following steps:

  1. Switch to the Edit mode.
  2. 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 67. Transition Display
Condition Display in Chart Display in Explorer
No condition
Vertical arrow with solid line labeled Transition 1.


Solid horizontal line to the left of Transition 1 in the Explorer.

With condition
Vertical arrow with dotted line labeled Transition 2.


Dotted horizontal line to the left of Transition 2 in the Explorer.

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

Sequence of Transitions

The sequence of transitions applies when the conditions of at least two transitions that lead away from the active state are met at the same time.

A transition is executed when the transition condition is met or when 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. Select Move up or Move down.

Example 1


State 1 with no condition for transition 1 and a condition for transition 2.

In this example, Transition 1 has no condition. Transition 2 has a condition. Transition 2 is only checked after Transition 1. In addition, Transition 1 always executes. Therefore, Transition 2 never executes.

Example 2


State 1 in which transition 1 is checked after transition 2.

In this example, Transition 1 is checked after Transition 2. If the condition for Transition 2 is met, Transition 2 executes. Transition 1 does not execute. If the condition for Transition 2 is not met, Transition 1 executes.

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 46. Moving Bending Points
Diagram showing a transition line with moving bending points between State 1 and State 2.

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 47. State Machine with AnyTransition
State machine diagram with AnyTransition.

In the example, consider the case where State 1 is active at the start of a new cycle. In addition, the condition of AnyTransition 1 is met. Then, 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.