UML 2 State Machine Diagrams 41 State Diagrams

State diagrams are a graphical representation of finite state machines. A finite state machine (FSM) or finite automaton models the behavior of a system in terms of states, transitions, and actions. An FSM is a tuple of the form:

where S is a [finite] set of all possible states, S0 is the initial state where S0 G S, S is an alphabet with all possible symbols, S = Sx S ^ S is a transition function that indicates a state change. The condition(s) for such a change to take place is defined by rule(s), and a is the set actions or behaviors to describe what is to be performed at a given state. An action can be one of the following:

- entry action - executed when entering a state

- exit action - executed when exiting a state

- input action - executed based on the current state and input conditions

- transition action - executed while a transition from a state to another is taking place

Figure 1 illustrates an FSM for turning on/off a lamp. It consists of two states: lamp on and lamp off; two transitions: lamp on ^ lamp off, and lamp off ^ lamp on. Transitions are triggered when the condition becomes true. The lamp is turned on/off as a result of an entry action to the corresponding state.

Fig. 1. Finite State Machine consisting of states, transitions and actions. The example shows a Finite State Machine for turning on/off a lamp. It consists of two states: Lamp On and Lamp Off; two transitions to change states, and two entry actions: "turn lamp on", and "turn lamp off"

Figure 1 illustrates an FSM for turning on/off a lamp. It consists of two states: lamp on and lamp off; two transitions: lamp on ^ lamp off, and lamp off ^ lamp on. Transitions are triggered when the condition becomes true. The lamp is turned on/off as a result of an entry action to the corresponding state.

entry action
0 0

Post a comment

  • Receive news updates via email from this site