Elevators
The Engineering of Elevators
We have all experienced that specific brand of irritation: standing in a lobby, staring at the floor indicator, wondering why the elevator is taking an eternity to arrive. While they seem like simple boxes on strings, elevators are governed by surprisingly intricate logic.
In this exploration, we will decode the mechanics and mathematics behind vertical transportation.
1. Single-Car Logic: From SCAN to LOOK
When you only have one car to manage, the goal is simple: move efficiently.
The SCAN Algorithm
Patented in 1961, the SCAN method is the most basic approach. The car travels in a continuous loop:
- Start at the lobby.
- Ascend to the absolute top floor.
- Reverse direction and descend back to the bottom.
The flaw? It is inefficient. You often waste time traveling to the penthouse even if the highest request was only for the 10th floor.
The LOOK Algorithm
The LOOK algorithm improves upon this by "looking" ahead. Instead of blindly hitting the top or bottom, the car only travels as far as the highest or lowest requested floor before reversing.
2. Coordinating Multiple Cars
Complexity spikes when a building has a "bank" of multiple elevators. The core question becomes: Who picks up whom?
The naive approach is to simply send the closest car. While a central scheduler often starts by assigning a request to the nearest elevator, modern systems are far more nuanced.
Measuring Success: The Statistics of Waiting
How do we quantify "good" performance? We look at the distribution of wait times.
- The Simple Metric: What percentage of riders wait less than 30 seconds?
- The Rigorous Metric: Analyzing the histogram of thousands of trips.
Crucial Insight: Humans don't remember the average wait time. We remember the outliers—the times the elevator took "forever." This is why engineers focus on the p90 (the 90th percentile) rather than the p50 (the median).
Wait Time Definitions:
- : Half of all riders wait 1 minute or less.
- : 90% of riders wait 2 minutes or less.
Traffic Patterns
Wait times fluctuate based on the time of day:
- Morning: Heavy "up-peak" (Lobby Upper Floors).
- Lunch: Bi-directional, chaotic flow.
- Evening/Interfloor: Scattered, floor-to-floor movement.
3. Advanced Intelligence: The RSR Algorithm
To move beyond the LOOK algorithm, Otis developed the Relative System Response (RSR). Instead of proximity, RSR uses a scoring system to determine the best car for a job.
The score is calculated using the following logic:
Key RSR Components:
- Anti-Bunching: Penalizes a car if another car is already heading to that floor in the same direction (prevents "clumping").
- Idle Nearby: Rewards cars that are sitting idle within two floors of the caller.
- Dynamic Re-routing: If Car A is delayed, the system can re-assign the passenger to Car B in real-time.
# Conceptual RSR Scoring Logic
def calculate_rsr_score(car, request):
score = car.eta_to_floor(request.floor)
score += car.current_load * LOAD_PENALTY
if car.is_bunching(request.floor):
score += BUNCHING_PENALTY
if car.direction == request.direction:
score -= DIRECTION_BONUS
if car.is_idle and abs(car.floor - request.floor) <= 2:
score -= IDLE_BONUS
return score
4. Benchmarking: LOOK vs. RSR vs. Destination Dispatch
Is "smarter" always better? Not necessarily.
| Algorithm | Best Use Case | Weakness |
|---|---|---|
LOOK | Small buildings / Extreme high-flow | Inefficient routing in mid-traffic |
RSR | Medium to large buildings | Overkill for very small banks |
Dest. Dispatch | Massive skyscrapers (8+ cars) | Rigid; poor wait times in most cases |
The Paradox of Destination Dispatch
Some modern buildings use kiosks where you enter your destination before entering the car. Intuitively, giving the optimizer more data should reduce wait times. However, it often does the opposite.
More information = Better efficiency False.
The reason is rigidity. In a traditional system, the optimizer re-evaluates every 5 seconds and can re-route you. With a kiosk, you are locked into a specific car. If the state of the building changes 30 seconds after you press the button, the system cannot adapt. The loss of flexibility outweighs the gain in information.
5. Final Thoughts
Elevator logic is a balancing act between information and flexibility. Whether it's a simple SCAN or a complex RSR system, the goal is to minimize that p90 frustration.
Simulation Parameters for Testing:
- Floors: 8-100
- Cars: 4-20
- Flow Rate: 8-18 passengers/min
- Mode:
LOOK|RSR|Destination Dispatch
Next time you're staring at those closing doors, remember: there is a complex mathematical battle happening behind the walls to get you to your floor. Don't take the wait personally.