Transition Icon Properties
Transitions are lines that connect two states in a state diagram.
These lines have an arrow at one end signifying the direction of program flow through the transition.
Like a state, transitions have a display name (i.e. the text displayed on the state within the diagram) and an optional function (macro call, calculation, delay or execute C code) which is executed when the program flow traverses the transition.
In addition, transitions have a condition which is an expression that evaluates to true (non-zero) or false (zero).
The condition is used during program execution to determine if the program flow should proceed along that transition.
When a state has performed its own optional function, each transition leaving that state has its condition tested in turn to see which path the program flow should continue along.
Transitions have an optional label which can display the name of the transition, its condition, or its function.
Setting the colour of a transition sets the colour of its label.
The colour of the transition line and arrow cannot be altered.
The entry state icon includes a special transition leaving it which should point to the first state to be executed in the state diagram (after the entry state itself).
This transition is always connected to the enter state and cannot be deleted.
Also, it has no properties and so cannot have a label or code.
It is always executed as if its transition condition is true.
During program execution (simulation or ICD), the colour of the transition line changes to blue or orange when its condition is being evaluated – blue signifies the condition is false and the transition will be ignored, and orange signifies that the transition is true and the program flow with execute along this transition.
When the transition is executing, it changes to a thick orange line.
Transition Order
In a state diagram, if a state has multiple transitions leaving it then these need to be evaluated in a set order to ensure program execution is expected and repeatable.
For example, if two transitions leave a state both evaluate to “true”, we need to ensure one of the transitions has priority over the other.
When a state with multiple exit transitions is selected, the order of transition evaluation is displayed, where “1” shows the first transition to be evaluated.
This transition order is also shown if a transition is selected. A state with only one transition leaving it will not show the transition order.
The order can be set on the diagram itself by reconnecting the transitions to the state (the last transition to be connected will have the lowest priority).
Alternatively, the transitions can be reordered by editing the properties of the state icon and clicking “Set transition order” to open the Transition Order dialog.
When using the Transition Order dialog, the applicable transitions are listed using either their name, condition or function.
Highlighting a transition and pressing the up/down arrows will move it higher/lower in the transition order.
The transition at the top of the list will be evaluated first. When transitions are evaluated, the evaluation process stops once a transition has evaluated to true.
All other transitions leaving the state are assumed to be false even if they have not been evaluated yet.