Stateflow    

after Temporal Logic Operator

The syntax for the after operator is as follows:

where E is the base event for the after operator and n is one of the following:

The after operator is true if the base event E has occurred n times since activation of its associated state. Otherwise, it is false. In a chart with no input events, after(n,wakeup) (or after(n,tick)) evaluates to true after the chart has woken up n times.

The following example illustrates use of the after operator in a transition expression.

This example permits a transition out of the associated state only if there have been 10 occurrences of the CLK event since the state was activated and the temp data item has the value COLD.

The next example illustrates usage of event notation for temporal logic conditions in transition expressions.

This example is semantically equivalent to the first example.

The next example illustrates setting a transition condition for any event visible in the associated state while it is activated.

This example permits a transition out of the associated state on any event after 10 occurrences of the CLK event since activation of the state.

The next two examples underscore the semantic distinction between an after condition on its own base event and an after condition on a nonbase event.

The first expression says that the transition must occur as soon as 10 CLK events have occurred after activation of the associated state. The second expression says that the transition can occur no sooner than 10 CLK events after activation of the state, but possibly later, depending on when the ROTATION event occurs.

The next example illustrates usage of an after event in a state's during action.

This example causes the Heater_on state to display a status message each CLK cycle, starting 5*BASE_DELAY clock cycles after activation of the state. Note the use of event notation to express the after condition in this example. Use of conditional notation is not allowed in state during actions.


  Rules for Using Temporal Logic Operators before Temporal Logic Operator