History

By default, a state machine does not have any memory. The special notation

H
offers a mechanism to memorize the substate last visited, and to get back to it during a transition entering the encompassing superstate. The history indicator applies to the level in which the
H
symbol is declared. The
H
symbol may be placed anywhere within the state — the bottom left corner is the default location.

The following diagram represents a state

C
that memorizes the last active substate. The history is initialized when the transition issued from the initial state
A
is triggered.

It is also possible to memorizing the last active substate, regardless of its depth; this is indicated by the

H*
symbol. The intermediate memory levels are obtained by placing a symbol
H
in each hierarchical level. In the following example, state
A
memorizes the last active substate, independent of the nesting of substates.

The next example shows the use of history to implement a dishwasher. The washing cycle is split into three main stages: washing, rinsing, and drying. The door may be opened at any time — to add a cup, for example. As soon as the door is closed, the washing cycle restarts at the same point as where it was stopped.

© 1997 Editions, Eyrolles, Paris, France . All rights reserved.