5 Call behavior - transition action
Basic sample This "UML state diagram" sample is based on the sample 4 Call Behavior - Basis. All elements and calling aspects of sample 4 are also contained in this sample, so that the explanations there also apply to this sample and are necessary for understanding this sample. Only the additions to sample 4 are described below. Therefore, please read the description of sample 4 first. |
Complementing sample 4 Call Behavior - Basis, this "UML state diagram" sample illustrates another aspect of the call behavior from UML state diagram. For this purpose, the following UML SC elements are additionally included:
- Transitions with transition actions (Transition, Completion Transition, Exception Transition)
Sample project: TF1910_UmlSC_Sample5_CallingBehaviour_Transitions.zip
Overview:
The following sub-aspects illustrate the call behavior of states, composite states and transitions. With the help of different programming means the different calling aspects are illustrated (programming tools => calling aspect).
- Counter => Call frequency
- Entering the called state action in an array => Call sequence
- Task cycle IDs => Assignment of the call to the cycle ID
The respective assignment of the programming tools to the call aspect is explained below.
Counter => Call frequency:
A transition action is called once when the state transition is executed via the transition.
Entering the called state action in an array => Call sequence:
Each action called in a state, composite state or transition enters its name (e.g. "State1__Entry" or "Transition_LeaveState1") into an array. This illustrates the call sequence of the different actions and indicates that:
- the basic call sequence for a state is: first ENTRY, DO, EXIT and then the transition action. Then the ENTRY action of the newly activated state is called. In the sample project:
- State2__Exit
- Transition_LeaveState2
- State3__Entry
- if an inner state of a composite state is activated with a region (use case grouping/nesting) and if this also activates the composite state, the call sequence "from outside to inside" is: outer state EXIT, transition action, composite state ENTRY, inner state ENTRY, composite state DO, inner state DO. In the sample project:
- State1__Exit
- Transition_LeaveState1
- Comp1_Entry
- State2__Entry
- Comp1_Do
- State2__Do
- if a composite state is exited e.g. via a (pseudo) exception transition, the calling sequence "from inside to outside" is: inner state EXIT, if necessary inner composite state EXIT, outer composite state EXIT, transition action, outer state ENTRY. In the sample project:
- State4__Exit
- Comp2_Exit
- Comp1_Exit
- Transition_LeaveComp1_ToComp3
- State7__Entry
Task cycle IDs => Assignment of the call to the cycle ID:
Each action called in a state, composite state or transition stores the cycle ID of the respective first and last call. This illustrates which call takes place in which cycle and indicates that:
- the state transition is executed in the following cycle after the transition condition is met,
and that when a state is exited, the transition action is called in the same cycle as the EXIT action of the exited state and as the ENTRY and DO actions of the activated state.
In the screenshot "Visu_CallingOrder_CycleNr" of the ZIP: - State2 / DO-Last Call: 1233 (ID of the cycle in which the call occurred)
- Transition / Rising Edge: 1233
- State2 / EXIT-Call: 1234
- Transition-Call: 1234
- State3 / ENTRY-Call: 1234
- State3 / DO-First Call: 1234
- if a state is exited and a composite state with a region and its own actions is activated, the transition action is called in the same cycle as the EXIT action of the exited state and as the ENTRY and DO actions of the activated (composite) state.
In the screenshot "Visu_CallingOrder_CycleNr" of the ZIP: - State1 / DO-Last Call: 1055
- Transition / Rising Edge: 1055
- State1 / EXIT-Call: 1056
- Transition / Call: 1056
- CompositeState1 / ENTRY-Call: 1056
- State2 / ENTRY-Call: 1056
- CompositeState1 / DO-First Call: 1056
- State2 / DO-First Call: 1056
- if a composite state with a region and its own actions is deactivated, the transition action is called in the same cycle as the EXIT action of the exited (composite) state and as the ENTRY and DO actions of the activated state.
In the screenshot "Visu_CallingOrder_CycleNr" of the ZIP: - CompositeState1 / DO-Last Call: 1743
- CompositeState2 / DO-Last Call: 1743
- State4 / DO-Last Call: 1743
- Transition / Rising Edge: 1743
- State4 / EXIT-Call: 1744
- CompositeState2 / EXIT-Call: 1744
- CompositeState1 / EXIT-Call: 1744
- Transition / Call: 1744
- State7 / ENTRY-Call: 1744
- State7 / DO-First Call: 1744
- State6 / ENTRY-Call: 1744
- State6 / DO-First Call: 1744
Visualization:
In addition to the convenient online mode of the UML SC diagram, the behavior of the state machine and the values of the counters, the table and the task cycle IDs can be tracked via the visualizations. The visualization also contains switches for switching between the states and for resetting the values.
The values of the transition conditions can be changed not only via the visualization or the declaration editor of the FB, but also directly via the UML SC diagram. |
If the transition consists of only one transition variable, the value of the variable can be changed for writing or forcing by double-clicking on the monitoring value. If a value was prepared for writing or forcing, this is indicated in the upper right-hand corner of the monitoring area (see also: Online Mode).