Lift
The lift problem is the task of designing a computer program to control lifts (elevators) in a building so that the lifts respond to the requests of people who wish to use the lifts. It is an apparantly simple problem, but is in fact
Issue: where do the lifts rest when they are not being used?
If there are a number of lifts, where are they going to rest. Well given the chances
Issue: does the destination of the lift change "mid-flight" according to the buttons pressed within the lift
Issue: How do we model time, and time decisions?
We can use a tick concept to model the movement of the elevator.
Issue: How many threads?
We can implement the main program as a thread.
We can implement elevators and the people as threads.
Real-time Events
The addition of a person who has a destination, is a realtime event, which
Sizing
How many floors in the building?
How many lifts are there?
How fast do the lifts move?
How often do new passengers arrive at the lifts?
Characteristics of a Time Unit
100 Milliseconds - "wait (100)” construct
Characteristics of a Lift
Initial Floor
Current Floor
Door Status Open/Closed
Capacity
A lift has a capacity of a number of people
Characteristics of a Person
Unique ID
Arrival Floor
Arrival Time
Destination Floor
Destination Floor Time
Length of Journey
Behaviour of a person:
How long will a person wait before they take the stairs?
A person is either in a lift or on a floor. If the person is on a floor, they will either be on the arrival floor or at the destination floor. People do not get out of lifts that are not at their destination floor.
The destination floor is different from the arrival floor, otherwise, why get the lift.