How would I design the elevators for a new 40 story office
building that had an average of 100 people per floor to most efficiently fill and empty the building given a standard 9-5 workday and traffic conditions in my city? The answer needed to be completely detailed, including expected passengers per car, time per stop, average floors stops per trip at various hours, etc.
- How many elevators are there?
- What is the capacity of each elevator?
- Is the efficiency goal focused only at the start & end of day & not in between (i.e. lunch time, breaks)?
2. General optimal critiera
- provide even service to each floor
- minimize how long passengers wait for an elevator to arrive
- minimize how long passengers spend to get to their destination floor
- serve as many passengers as possible
The first advice that I’ve read is to ask some questions before you start answering. It will show that you are strategic & don’t jump to random assumptions. So I will probably ask questions like: Is the efficiency goal focused only at the start & end of day & not in between (i.e. lunch time, breaks)? How many elevators are there? What is the capacity of each elevator?
2) Assuming that everything is average, i.e. 6 elevators, 15 people per elevator, and focus only on start and end date, then the sample data should follow a normal distribution.
730-8 – 2%
8-830 – 14%
830-9 – 34%
9-930 – 34%
930-10 – 14%
10-1030 – 2%
3) I will break this down & solve the worst case scenario first. This means, 34 people x 40 floors = 1360 people to be transported by 6 elevator x 15 = total 90 capacity during 830-9 or 9-930 am.
4) Focusing on this more manageable problem, 1360 / 90 means each elevator will make 15 full cycles (lobby to highest floor and back) 5) Since we want to minimize the cycle time for each elevator, we assign one elevator per subset of 40/6 consecutive floors. This should address the issue on minimizing time per stop. 6) That means, the final design should be a load balancing of the elevators by minimizing the travel time — Elevator A – 1st to 7th floor, B – 8th to 14th floor, and so forth. Do you guys see anything wrong with this line of thinking?
1 Elevator Object, 应该包含physical components: Door, Indicator Lights,
Control Panel. 一些性质(Non physical properties): Speed, Num of floors,
capacity, max weight. 所能从事的操作methods: moveto, stop, ringbell。然后电
梯应该能够handle user request, 所以还应有一个requestQueue, 电梯应该根据自己
的state 和 requestQueue做出moveto, stop的决定，所以有一component:
2 Door, properties: State, method: open, close， getState.
3 Indicator light(指示所到楼层），properties: state; method: on, off,
4 Control Panel, 包含physical component: Floor Buttons, Other buttons(也可直
接把Buttons 当作 elevator的components，还没考虑哪一个方法好）
5 Button, properties: floorNum, Parent Elevator, methods: OnPress(Observer
6 ElevatorRequestHandler: handleRequest(Elevator ele, requestList rlist), 可
以define 一个interface, 然后又各种不同实现
7 Request: 可以define 一个abstract class, 然后有子类movingRequest,
helpRequest doorRequest etc.
A Single Elevator
- press a button to summon the lift
- press a button to get to a specific floor
- floor button and level button
- illuminates when pressed
- place an ‘elevator request’ when pressed
- moves up/down
- open/close the door
Each button press results in an elevator request which has to be served. Each of these requests is tracked at a global place. ElevatorRequests, the class which stores elevator requests can use different strategies to schedule the elevator requests.
The elevator is controlled by a controller class which we call ElevatorController. The elevator controller instructs the elevator what to do and also can shutdown/start up the elevator of the building. The elevator controller reads the next elevator request to be processed and serves it.
Button (Abstract) Class
Button is abstract class defining common behavior like illuminate, doNotIlluminate. FloorButton, ElevatorButton extend Button type and define placeRequest() which is invoked when the button is pressed.
In conclusion, ElevatorController runs the show by reading the ElevatorRequests to process and instructing the Elevator what to do. User send request by pressing Buttons.
Extend the answer to multiple elevators
- Each elevator have 1 controller.
- Floor based requests can be served by any elevator, thus these requests are added to a common area accessible by all controllers.
- Each elevator controller runs as a separate thread and checks if it can process a floor request. Mind synchronization issues.