You can create a transition between a state and any other statechart object except a region. The following sections provide information about creating transitions between objects on a statechart diagram.
|Note When you create a transition, the order in which you click the objects establishes the direction of the transition. The first state you click is the state from which the transition originates. The second object you click is the object at which the transition terminates.|
You can create a transition between two states that exist in the same statechart. These states can exist in any region. Complete the following steps to create a transition between two states.
To create a transition between a state and a pseudostate, move the cursor over the center of the pseudostate on the statechart diagram. After the cursor changes to the Wiring tool, click the pseudostate to initiate or terminate the transition.
To create a transition between a state and a connector, move the cursor over the gray area of the connector on the statechart diagram. After the cursor changes to the Wiring tool, click to initiate or terminate the transition.
To duplicate a transition node, press the <Ctrl> key and drag a transition node to another location on the statechart diagram. This action duplicates all triggers, guards, and actions of the original transition node. Then, connect the segments of the duplicated node to other states or pseudostates.
|Note If you configure a trigger for a transition node, duplicate that node, and then create a transition from an Initial pseudostate to that node, errors appear when you generate code for that statechart. These errors appear because transitions that leave an Initial pseudostate cannot have triggers. Complete the following steps to correct these errors.|
Recall that transitions are unidirectional. In some cases you might create a transition, define some logic for that transition, and then realize the transition needs to go the other way. You can reverse the direction of a transition without deleting and re-creating the transition node, which means that reversing the direction of a transition maintains any transition logic you configure.
For example, consider the following figure:
Complete the following steps to reverse the direction of this transition.
|Note Recall that the order in which you click the objects establishes the order of the transition. Therefore, you cannot create this segment by clicking State 1 and then the head of the transition node. The LabVIEW Statechart Module interprets this sequence as you attempting to create a transition segment to an object that does not allow any incoming segments.|
The transition now goes from State 2 to State 1 instead of from State 1 to State 2. The statechart diagram now resembles the following figure:
Notice the transition node itself remains unchanged except for the visual appearance. Reversing transition direction preserves any logic you had configured for this node.
You can adjust the placement and orientation of transition nodes by right-clicking this node and selecting the appropriate option.
|Note Manipulating a transition node does not affect the direction of the transition itself. The manipulation is for visual purposes only.|
Select the Rotate option to rotate the node 90 degrees. This action is useful if you want to move the transition node from a vertical transition segment to a horizontal transition segment, or vice-versa.
Select the Reverse option to reverse the beginning and end of the transition node. If the end of the node faces right and you select this option, the end of the node faces left.