# Elevator sim in C++

*label*Programming

*timer*Asked: Oct 10th, 2013

*account_balance_wallet*$50

**Question description**

**General Description**

You are responsible for designing an elevator simulation model for a bank of elevators in an office building scenario. This elevator simulator will determine, for a given number of elevators, how many passengers per hour can be carried from the lobby to the upper floors of the building.

- The user will determine the number of elevators in the building.
- The number of floors in the building will be fixed.
- The number of passengers that an elevator can hold will be fixed.
- All elevators will be of the same size.
- As they leave the elevator at their floor, the passengers will be counted.
- The destination floor will be determined using a "random" interval.
- The elevator will return to the lobby when all of the passengers on it have been delivered to their floors.
- The simulation will model an eight-hour interval.
- The simulation will generate a report showing the behavior of the system. The total number of passengers delivered (the total number of passengers delivered by each elevator and the number delivered to each floor by each elevator) will also be reported.

**Simulation Scenario**

This elevator simulator will determine, for an office building with a given number of floors, a given occupancy, and a given pattern of usage how many elevators will be necessary to serve the passengers in a given minimum amount of time.

The goal is to determine how many elevators are necessary, such that passengers will be served within one minute of pressing the elevator call button.

- The user will determine the number of elevators in the building at the beginning of each run of the simulation.
- The number of floors in the building will be fixed at five.
- The number of passengers that an elevator can hold will be fixed at eight. All elevators will be of the same size.
- Passengers will arrive at the elevators in a random fashion, within the parameters set below, and press the call button indicating their preference to travel up or down.
- It takes the elevator 0:15 seconds to travel from one floor to the next.
- The simulation will note the time it takes for an elevator to arrive and service the passenger.
- It takes 0:03 seconds for a passenger to board the elevator and 0:03 seconds for a passenger to leave the elevator.
- When a passenger boards the elevator, that passenger will press the button for his destination floor.
- The elevator will begin its trip when either the maximum passenger count for the elevator is reached or no passenger has boarded within 10 seconds.
- The elevator will remain at the floor it was on when delivering the last of its passengers for a period of 10 seconds before moving to its next call or returning to the ground floor.
- The passenger's destination floor will be determined
using a "random" interval.
- There are 100 persons working on each of floors 2-5. No one works on the ground floor (floor 1). All businesses in the building open for business at 8:00 AM and close at 5:00 PM. Workers begin randomly arriving for work at 7:30 AM. Everyone leaves the building randomly by 5:30 PM.

- Customers arrive at the building and visit floors throughout the day at a rate of approximately one every five minutes. Customers randomly spend between 15 and 45 minutes conducting their business then exit the building.
- All workers have lunch between 12:00 and 1:00. At 12:00, 50% of workers go to the first floor between 12:00 and 12:15 to go out for lunch. The workers return randomly between 12:45 and 1:00.
- It is expected that passengers will be served within 1 minute of pressing the elevator call button.
- The simulation will model a day of usage.
- The simulation should collect the following data. The time each passenger pressed the call button. The time each passenger boarded the elevator. The destination floor of each passenger.
- The following information should be reported daily and in total. The total number of passengers delivered. The total number of passengers delivered by each elevator. The number of passengers delivered to each floor by each elevator. The minimum and maximum time passengers waited. The percentage of passengers served within one minute.
- Run the simulation with various numbers of elevators to determine how many elevators will be necessary to service 95% of the passengers within one minute of pressing the call button.

## Tutor Answer

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors