Transitions

Transitions describe the ways in which a state machine can flow from one state to another. Each transition has a source, a target, and a trigger, as well as potentially a guard or effect. SysML explicitly avoids specifying whether or not time may pass during transition navigation (UML 2.5.1 section 14.2.3.8), but Moxie executes transitions, including compound transitions, in zero simulation time.

Transition notation

The notation for a transition allows for a trigger, a guard, and an effect, as shown in Figure 1. Moxie requires the expressions for all three to be opaque expressions.

Figure 1: A transition with a trigger, guard, and effect

Triggers

Each transition has a triggering event, which can be one of several SysML types. Regardless of the type, however, when the transition's source state is active and the triggering event occurs, the state machine exits the source state and follows the transition to its target state. If you do not explicitly specify a triggering event for a transition, then it is automatically triggered when all regions inside the currently active state have reached a final state, or immediately if the state has no internal regions.

Conflicting Triggers

There can be cases where multiple triggering events occur at the same time, creating an ambiguity about which transition to follow. For example, consider the situation in Figure 2.

Figure 2: Conflicting Transitions

In this example, the Ready state is currently active, and both targets are detected at the same simulation time, placing the two transitions in conflict with each other. SysML state machines explicitly permit such conflicting transitions (UML 2.5.1 section 14.2.3.9.3) and leave the choice of which transition to follow to the particular execution engine (UML 2.5.1 section 14.2.3.9.1).

You must be careful to avoid introducing conflicting transitions into your state machines, as Moxie does not guarantee which transition is followed in such cases.

Guards

You can specify a guard for a transition in order to add a restriction to the triggering event. When a transition has a guard, the transition is only triggered if the guard expression evaluates to true at the simulation time that the event occurs. You cannot use a guard in place of an event to trigger a transition; a guard only determines whether a potential transition may or may not trigger for an event that is already occurring.

Effects

Transitions can specify an effect, which describes the consequence of taking the transition. Moxie requires specified effects to be opaque behaviors.

Compound transitions

A compound transition is simply a chain of two or more transitions connected by pseudostates that ultimately connects two states in a state machine (UML 2.5.1 section 14.2.3.8.4).