Summary of Chart Semantic Rules

Enter a Chart

The set of default flow paths execute (see Execute a Set of Flow Charts). If this action does not cause a state entry and the chart has parallel decomposition, then each parallel state becomes active (see Enter a State).

If executing the default flow paths does not cause state entry, a state inconsistency error occurs.

Execute an Active Chart

If the chart has no states, each execution is equivalent to initializing a chart. Otherwise, the active children execute. Parallel states execute in the same order that they become active.

Enter a State

  1. If the parent of the state is not active, perform steps 1 through 4 for the parent.

  2. If this state is a parallel state, check that all siblings with a higher (that is, earlier) entry order are active. If not, perform steps 1 through 5 for these states first.

    Parallel (AND) states are ordered for entry based on whether you use explicit ordering (default) or implicit ordering. For details, see Explicit Ordering of Parallel States and Implicit Ordering of Parallel States.

  3. Mark the state active.

  4. Perform any entry actions.

  5. Enter children, if needed:

    1. If the state contains a history junction and there was an active child of this state at some point after the most recent chart initialization, perform the entry actions for that child. Otherwise, execute the default flow paths for the state.

    2. If this state has children that are parallel states (parallel decomposition), perform entry steps 1 through 5 for each state according to its entry order.

    3. If this state has only one child substate, the substate becomes active when the parent becomes active, regardless of whether a default transition is present. Entering the parent state automatically makes the substate active. The presence of any inner transition has no effect on determining the active substate.

  6. If this state is a parallel state, perform all entry steps for the sibling state next in entry order if one exists.

  7. If the transition path parent is not the same as the parent of the current state, perform entry steps 6 and 7 for the immediate parent of this state.

Execute an Active State

  1. The set of outer flow charts execute (see Execute a Set of Flow Charts). If this action causes a state transition, execution stops. (Note that this step never occurs for parallel states.)

  2. During actions and valid on-event actions are performed.

  3. The set of inner flow charts execute. If this action does not cause a state transition, the active children execute, starting at step 1. Parallel states execute in the same order that they become active.

Exit an Active State

  1. If this is a parallel state, make sure that all sibling states that became active after this state have already become inactive. Otherwise, perform all exiting steps on those sibling states.

  2. If there are any active children, perform the exit steps on these states in the reverse order that they became active.

  3. Perform any exit actions.

  4. Mark the state as inactive.

Execute a Set of Flow Charts

Flow charts execute by starting at step 1 below with a set of starting transitions. The starting transitions for inner flow charts are all transition segments that originate on the respective state and reside entirely within that state. The starting transitions for outer flow charts are all transition segments that originate on the respective state but reside at least partially outside that state. The starting transitions for default flow charts are all default transition segments that have starting points with the same parent:

  1. Ordering of a set of transition segments occurs.

  2. While there are remaining segments to test, testing a segment for validity occurs. If the segment is invalid, testing of the next segment occurs. If the segment is valid, execution depends on the destination:

    States

    1. Testing of transition segments stops and a transition path forms by backing up and including the transition segment from each preceding junction until the respective starting transition.

    2. The states that are the immediate children of the parent of the transition path exit (see Exit an Active State).

    3. The transition action from the final transition path executes.

    4. The destination state becomes active (see Enter a State).

    Junctions with no outgoing transition segments

    Testing stops without any state exits or entries.

    Junctions with outgoing transition segments

    Step 1 is repeated with the set of outgoing segments from the junction.

  3. After testing all outgoing transition segments at a junction, backtrack the incoming transition segment that brought you to the junction and continue at step 2, starting with the next transition segment after the backtrack segment. The set of flow charts finishes execution when testing of all starting transitions is complete.

Execute an Event Broadcast

Output edge-trigger event execution is equivalent to changing the value of an output data value. All other events have the following execution:

  1. If the receiver of the event is active, then it executes (see Execute an Active Chart and Execute an Active State). (The event receiver is the parent of the event unless a direct event broadcast occurs using the send() function.)

    If the receiver of the event is not active, nothing happens.

  2. After broadcasting the event, the broadcaster performs early return logic based on the type of action statement that caused the event.

    Action Type

    Early Return Logic

    State Entry

    If the state is no longer active at the end of the event broadcast, any remaining steps in entering a state do not occur.

    State Exit

    If the state is no longer active at the end of the event broadcast, any remaining exit actions and steps in state transitioning do not occur.

    State During

    If the state is no longer active at the end of the event broadcast, any remaining steps in executing an active state do not occur.

    Condition

    If the origin state of the inner or outer flow chart or parent state of the default flow chart is no longer active at the end of the event broadcast, the remaining steps in the execution of the set of flow charts do not occur.

    Transition

    If the parent of the transition path is not active or if that parent has an active child, the remaining transition actions and state entry do not occur.

Was this topic helpful?