Find. (1) A finite-state model of the elevator controller. (2) The quickest possible time for a passenger to get out at floor 5, measured from the 'going-up' button press at floor 1. (3) The longest possible time for the same trip. (4) The longest possible time if floor 3 has the highest dispatch priority.
Check: the specs give two different per-level travel figures — 20 s for the full nonstop 1-to-5 run (4 levels) but 7 s for "one level," and $4\times7=28\ \text{s}\ne20\ \text{s}$. This is modelled below as the ordinary express-vs-local distinction: a continuous multi-floor run has no intermediate accel/decel overhead and uses the given 20 s figure, while the 7 s figure applies whenever the car must stop at an intermediate level (each stop adds its own start/stop overhead). Parts (3) and (4) are worst-case DESIGN estimates — the source gives no information about competing calls, so the intermediate-stop pattern that produces the "longest possible" time is a stated, explicit assumption, not a source value.
Approach. Model the controller as a finite-state machine, then treat "quickest possible" as the best case (car already idle at the calling floor) and "longest possible" as the worst case (car starts at the farthest floor and is forced to fully serve every intermediate floor in both directions before reaching the passenger).
Part (1) — finite-state model. Figure 1 models the car as a five-state cycle: Idle (door closed, at rest) → Door Opening (3 s) → Door Open / Dwell (10 s) → Door Closing (5 s) → Moving (car in transit) → back to Idle on arrival. A call (car or hall button) is the only external event that can start the cycle from Idle; every other transition is timer- or limit-switch-driven, which is exactly why each state's dwell is itself a hard deadline in the controller's own real-time task.
Figure 1 — elevator controller FSM. Every transition after the initial call is timer- or limit-switch-driven.
Part (2) — quickest possible time to get out at floor 5. Best case: the car is already idle at floor 1 with its door closed when the 'going-up' button is pressed, so no travel to reach the caller is needed.
Sum the mandatory pipeline of actions. Door opens for the passenger to board, dwells the full 10 s, closes, the car makes the express 1→5 run, then opens again so the passenger can step out:
$$t_{\text{quick}} = t_{\text{open}} + t_{\text{dwell}} + t_{\text{close}} + t_{\text{full}} + t_{\text{open}} = 3+10+5+20+3 = \boxed{41\ \text{s}}$$
Part (3) — longest possible time (no floor priority). Worst case: the car starts idle at floor 5 (the farthest point from the caller) and, before it can even reach floor 1, is assumed to be flagged down and fully serve every intermediate floor — 4, 3, 2 — on the way down; after our passenger boards at floor 1, the same worst case repeats on the way back up, with full stops at 2, 3, 4, before the car finally reaches floor 5.
Down-leg (floor 5 → floor 1), 3 intermediate stops. Four single-level hops plus a full open–dwell–close cycle at each of floors 4, 3, 2:
$$t_{\text{down}} = 4\,t_{\text{level}} + 3\,(t_{\text{open}}+t_{\text{dwell}}+t_{\text{close}}) = 4(7) + 3(18) = 28+54 = 82\ \text{s}$$
Board at floor 1. A full door cycle for our passenger:
$$t_{\text{board}} = t_{\text{open}}+t_{\text{dwell}}+t_{\text{close}} = 18\ \text{s}$$
Up-leg (floor 1 → floor 5), 3 intermediate stops. By symmetry with Step 1, stopping at floors 2, 3, 4:
$$t_{\text{up}} = 4\,t_{\text{level}} + 3\,(18) = 82\ \text{s}$$
Exit at floor 5. One more door-open for the passenger to step out: $t_{\text{exit}} = t_{\text{open}} = 3\ \text{s}$. Summing all four legs,
$$t_{\text{longest}} = t_{\text{down}}+t_{\text{board}}+t_{\text{up}}+t_{\text{exit}} = 82+18+82+3 = \boxed{185\ \text{s}}$$
Part (4) — longest possible time with floor 3 given highest priority. Giving floor 3 the highest dispatch priority means a fresh floor-3 call can always cut in ahead of any other pending request. In the worst case, such a call arrives just as the car's doors are closing after already serving floor 3 — on both the down-leg and the up-leg of Part (3) — forcing the controller to reopen and repeat the full door cycle before departure is allowed either time.
Add one extra full door cycle at floor 3 on each leg.
$$t_{\text{extra}} = 2\,(t_{\text{open}}+t_{\text{dwell}}+t_{\text{close}}) = 2(18) = 36\ \text{s}$$
$$t_{\text{longest,priority}} = t_{\text{longest}} + t_{\text{extra}} = 185+36 = \boxed{221\ \text{s}}$$
Quantity
Result
Quickest time to exit at floor 5 (Part 2)
41 s
Longest time to reach floor 5, no priority floor (Part 3)