States and contexts

A context is an instance of the transition type. In that sense, we could imagine our Place User behavior in this way:

Multiple context instances

Each context needs to keep track which state is currently processed. There is no single current state, but each context has a state pointer which shows which state is currently the one with respect to this context. One could also say:

The current state of the Place User is the tuple of all current states of all contexts.

We have three classes of states, acording to the definitions shown for the Hybrid type system.

  1. Stable states: These states are only left when a message reaches the PU in this state (in this context) which is accepted. Then a transition happens which changes the state to the next one, as defined in the state transition table.
  2. Unstable states: These states are left for reasons which are not explained by incoming messages. For example, an initial unstable state could be left just because this PU came to life. Events may also trigger a transition from an unstable state to another state.
  3. Semistable states: These states have a combination of stable and unstable characteristic. They may accept a message and trigger a transition according to the transition table, but for some other reason, they may also change state as it they were unstable.

As a convention, we call a state nonstable when it is not stable, i.e. when it is unstable or semistable.

The connections (transitions) between states are fixed, as are their modes, too. That is, you cannot make a state stable when it was unstable. This would mean changing the transition type of the Place User, or effectively changing the behavior of your PU. Of course, the same is true for changes of other modes, and for changes of transitions.

Therefore, it is reasonable to define the context mode:

A context is stable (unstable, semistable) if and only if its current state is stable (unstable, semistable).

Hence, a nonstable context is in a nonstable state.

We sometimes call contexts spontaneous contexts when they are in a nonstable initial state.