Exercise · Volume 1 · 2.2.5-4
Exercise 2.2.5-4
not stated yet in Lean solution written
| Rating | 24 |
|---|---|
| Kind | Informal: the exercise has no formal statement, so Lean does not state it from the written solution |
| Section | Section 2.2.5 of Volume 1 |
The task
Say when the elevator would behave differently if the activity E9 were removed, and whether it could visit floors in another order.
The exact wording is in your copy of the book.
Hints
Open one hint at a time. Try the exercise again after each.
Hint 1
E9 is started in step E3 with a delay of 300 units, and E6 cancels it. What can keep the elevator from reaching E6 for 300 units?
Solution
Show the solution
Activity E9 sets and calls the DECISION subroutine. It starts units after the doors have opened, and it is cancelled when the elevator starts to move. Only if the doors stay open that long does E9 act at all.
That happens when many people get out, one after another, since step E4 spends 25 units on each. With twelve or more people at one floor the doors are open for units or more. If the state is during this time, which happens when the elevator turned neutral at E2 although calls for other floors exist (see Exercise 3), E9 starts DECISION while nobody has yet entered. DECISION sets the state toward the lowest floor with a call, since the state is neutral. Then the elevator has a direction before the first person at the floor has chosen one.
Without E9 the state would remain until somebody gets in, and in step U5 the first person to enter would set the direction by the chosen floor. So the elevator can really go in another direction, and so visit floors in another order. Suppose calls from floor are waiting and the first person who gets in wants to go to floor . With E9 the state is , and the elevator visits floor first. Without E9 the person sets and floor comes first. The case is rare, and the author of the text calls it the most puzzling observation made on the real elevator.
Remarks
The variable has another use: it makes the arrival of a new call run DECISION in step U2 when the elevator has stood still for 30 seconds or more.
This solution is drafted, and a person has not reviewed it yet. The source.
In Lean
not stated yet The exercise is not stated in Lean yet.
The status is computed from the Lean build. The node of the map.
Something is wrong? Report it.