#### Question

An elevator in a three-story building services floors 1, 2, and 3. Input consists of a signal to the elevator of an up-or-down request (U or D) together with the floor from which the signal originates. The elevator responds to an input signal by moving to the correct floor. For example, when the elevator is on floor 1 and receives a D-3 signal, it moves to floor 3. Draw a state graph for a finite-state machine that describes the elevator behavior.

#### Solution

Verified#### Step 1

1 of 4Let us define the state of the finite-state machine as:

$s_0$=Elevator is on floor 1

$s_1$=Elevator is on floor 2

$s_2$=Elevator is on floor 3

When we are on floor 1, then we can only request to move up and thus the only possible request from floor 1 is $U-1$.

$\bullet$ If the elevator was at floor 2, then the elevator needs to move to floor 1 and thus we require an arc from state $s_1$ to state $s_0$ with label $U-1$.

$\bullet$ If the elevator was at floor 3, then the elevator needs to move to floor 1 and thus we require an arc from state $s_2$ to state $s_0$ with label $U-1$.