Bird
Raised Fist0
LLDsystem_design~7 mins

Multiple elevator coordination in LLD - System Design Guide

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Problem Statement
When multiple elevators operate independently without coordination, they can cause inefficient service such as multiple elevators responding to the same floor request, long wait times, and uneven load distribution. This leads to passenger frustration and wasted energy as elevators travel unnecessarily.
Solution
Multiple elevator coordination assigns elevator requests intelligently to the best-suited elevator based on current position, direction, and load. It uses a centralized or distributed controller to optimize elevator movements, minimizing wait times and avoiding duplicate responses. This coordination ensures elevators serve requests efficiently and fairly.
Architecture
Floor Request
Elevator Coordinator
Elevator 2

This diagram shows floor requests sent to a central elevator coordinator, which assigns tasks to multiple elevators based on their state and location.

Trade-offs
✓ Pros
Reduces passenger wait times by assigning the closest or most suitable elevator.
Prevents multiple elevators from responding to the same request, improving efficiency.
Balances load among elevators to avoid overuse of a single elevator.
Improves energy efficiency by minimizing unnecessary elevator movements.
✗ Cons
Requires a centralized or distributed coordination system, adding complexity.
Coordination logic can become complex with many elevators and floors.
Potential single point of failure if centralized coordinator is not redundant.
Use when a building has multiple elevators serving overlapping floors and experiences high passenger traffic, typically more than 3 elevators and 10 floors.
Avoid when the building has only one elevator or very low traffic where coordination overhead outweighs benefits.
Real World Examples
Otis Elevator Company
Uses group supervisory control systems to coordinate multiple elevators in skyscrapers, reducing wait times and improving energy efficiency.
Thyssenkrupp
Implements AI-based elevator coordination to optimize elevator dispatching in busy office buildings.
KONE
Employs destination control systems that coordinate multiple elevators by grouping passengers going to the same floors.
Code Example
The before code shows elevators handling requests independently, which can cause inefficiency. The after code introduces an ElevatorCoordinator that assigns each floor request to the closest elevator, improving efficiency and reducing wait times.
LLD
### Before: Independent elevator handling requests
class Elevator:
    def __init__(self, id):
        self.id = id
        self.current_floor = 0
        self.requests = []

    def add_request(self, floor):
        self.requests.append(floor)

    def move(self):
        if self.requests:
            next_floor = self.requests.pop(0)
            self.current_floor = next_floor

# No coordination: multiple elevators may respond to same request

### After: Coordinated elevator system
class Elevator:
    def __init__(self, id):
        self.id = id
        self.current_floor = 0
        self.direction = None
        self.requests = []

    def assign_request(self, floor):
        self.requests.append(floor)

    def move(self):
        if self.requests:
            next_floor = self.requests.pop(0)
            self.current_floor = next_floor

class ElevatorCoordinator:
    def __init__(self, elevators):
        self.elevators = elevators

    def assign_request(self, floor):
        best_elevator = None
        min_distance = float('inf')
        for elevator in self.elevators:
            distance = abs(elevator.current_floor - floor)
            if distance < min_distance:
                min_distance = distance
                best_elevator = elevator
        if best_elevator:
            best_elevator.assign_request(floor)

# Usage
elevators = [Elevator(1), Elevator(2)]
coordinator = ElevatorCoordinator(elevators)
coordinator.assign_request(5)
coordinator.assign_request(3)
for elevator in elevators:
    elevator.move()
OutputSuccess
Alternatives
Independent Elevator Control
Each elevator operates autonomously without coordination, responding only to its own requests.
Use when: Use in small buildings with one or two elevators where coordination complexity is unnecessary.
Destination Control System
Passengers input their destination floor before entering the elevator, allowing the system to group passengers and assign elevators efficiently.
Use when: Use in high-traffic buildings where grouping passengers reduces stops and travel time.
Summary
Uncoordinated elevators cause inefficiency by duplicating responses and increasing wait times.
Coordinating elevators assigns requests to the best elevator based on position and state, improving service.
Coordination adds complexity but is essential for buildings with multiple elevators and high traffic.

Practice

(1/5)
1. What is the main goal of multiple elevator coordination in a building?
easy
A. To reduce wait and travel times for passengers
B. To increase the number of elevators in the building
C. To make elevators move randomly
D. To keep all elevators idle at the ground floor

Solution

  1. Step 1: Understand elevator coordination purpose

    Multiple elevator coordination aims to improve efficiency by reducing passenger wait and travel times.
  2. Step 2: Evaluate options based on goal

    Options B, C, and D do not focus on improving passenger experience or efficiency.
  3. Final Answer:

    To reduce wait and travel times for passengers -> Option A
  4. Quick Check:

    Goal of coordination = reduce wait/travel times [OK]
Hint: Focus on passenger experience improvement goals [OK]
Common Mistakes:
  • Confusing coordination with adding more elevators
  • Thinking elevators should stay idle
  • Assuming random movement improves service
2. Which of the following is a correct way to assign an elevator to a new request in a multiple elevator system?
easy
A. Always assign the elevator on the ground floor
B. Assign the elevator farthest from the request floor regardless of direction
C. Assign the elevator closest to the request floor moving in the same direction
D. Assign elevators randomly to balance usage

Solution

  1. Step 1: Understand assignment criteria

    Elevators should be assigned based on proximity and direction to minimize wait time.
  2. Step 2: Analyze options

    Assign the elevator closest to the request floor moving in the same direction matches this logic. Options A, B, and C ignore direction or proximity, causing inefficiency.
  3. Final Answer:

    Assign the elevator closest to the request floor moving in the same direction -> Option C
  4. Quick Check:

    Closest elevator + direction match = correct assignment [OK]
Hint: Match elevator direction and proximity for assignment [OK]
Common Mistakes:
  • Ignoring elevator direction when assigning
  • Choosing elevators randomly
  • Always picking ground floor elevator
3. Consider a system with 2 elevators: Elevator A at floor 3 moving up with destinations [5, 7], Elevator B at floor 6 moving down with destinations [4, 2]. A request comes from floor 4 to go up. Which elevator should be assigned?
medium
A. Neither elevator
B. Elevator B
C. Either elevator
D. Elevator A

Solution

  1. Step 1: Analyze elevator positions and directions

    Elevator A is at floor 3 going up; Elevator B is at floor 6 going down.
  2. Step 2: Match request direction and elevator direction

    Request is at floor 4 going up. Elevator A is below floor 4 and moving up, so it can pick up on the way. Elevator B is above floor 4 but moving down, so it cannot pick up going up.
  3. Final Answer:

    Elevator A -> Option D
  4. Quick Check:

    Elevator moving towards request floor in same direction = Elevator A [OK]
Hint: Pick elevator moving towards request floor in same direction [OK]
Common Mistakes:
  • Choosing elevator moving away from request
  • Ignoring elevator direction
  • Assuming either elevator works
4. In a multiple elevator system, the controller assigns requests but sometimes an elevator gets stuck and does not update its position. What is the likely problem and how to fix it?
medium
A. Elevator state not updated; add regular position updates and health checks
B. Elevator hardware failure; replace elevator immediately
C. Controller assigns requests randomly; fix assignment logic
D. Elevator doors stuck open; fix door sensors

Solution

  1. Step 1: Identify cause of stuck elevator in system

    If elevator position is not updated, controller cannot assign requests properly.
  2. Step 2: Determine fix

    Adding regular position updates and health checks ensures controller has current elevator status to assign requests correctly.
  3. Final Answer:

    Elevator state not updated; add regular position updates and health checks -> Option A
  4. Quick Check:

    Missing updates cause stuck state; fix with health checks [OK]
Hint: Ensure elevator regularly reports position to controller [OK]
Common Mistakes:
  • Assuming hardware failure without checking software updates
  • Blaming random assignment logic
  • Ignoring elevator state updates
5. You are designing a multiple elevator coordination system for a 20-floor building with 4 elevators. To minimize average wait time during peak hours, which strategy is best?
hard
A. Assign elevators randomly to requests to balance load
B. Divide floors into zones and assign elevators to zones dynamically
C. Let all elevators serve all floors equally without zoning
D. Keep all elevators idle at ground floor until called

Solution

  1. Step 1: Understand peak hour challenges

    High traffic causes many requests; serving all floors equally can cause delays and conflicts.
  2. Step 2: Evaluate zoning strategy

    Dividing floors into zones and assigning elevators reduces travel distance and wait time by localizing service.
  3. Step 3: Compare other options

    Random assignment or no zoning causes inefficiency; keeping elevators idle wastes capacity.
  4. Final Answer:

    Divide floors into zones and assign elevators to zones dynamically -> Option B
  5. Quick Check:

    Zoning elevators reduces wait time in tall buildings [OK]
Hint: Use zoning to reduce travel distance and wait time [OK]
Common Mistakes:
  • Ignoring zoning benefits in tall buildings
  • Assuming random assignment balances load
  • Keeping elevators idle wastes capacity