Skip to content

Rocket-007/Elevator-Simulator

Repository files navigation

Elevator-Simulator

my simulation of a building elevator system



This project is to develop a model to simulate the behaviour of elevators in a multi-story building. By adjusting different

variables and running simulations, we could test different theories and scenarios and investigate the impact on passenger wait times.


Demo
Youtube Video



In this UML class diagram, we have five classes: Simulation, Building, Floor, Passenger, and Elevator.

Simulation Class: The Simulation class handles the running of the building samples for analysis. It provides control keys such as:

Controls:
Arrows_keys = Pan Camera
Z and X = Zoom Camera
R = restart/reload running Simulation
O = reload all
Spacebar = pause/play Simulation
1 and 2 = slowdown/speedup Simulation time
Tab = Hide/Show Building Simulation data monitor
Shift = Hide/Show Elevator data monitor
Ctrl = Hide/show Person data monitor
Alt = Hide/Show Person to Elevator line

The Simulation class contains methods like:

Methods:

  • zoom_in_out(): method for zooming in and out on the building
  • update_cam_movement(): method for panning the camera around the building
  • slow_fast_time(): slow down or speed up the simulation time scale.
  • pause_and_play(): stop or continue the running simulation.
  • reload_running_sim(): reload the running simulation.

Building Class: The Building class represents the overall building. It contains: 

  • floor: attribute for the number of floors in the building
  • elevator_array: A building may have more than one elevator, this contains an arrray of all the Elevator objects in the building.
  • elevator_array_size: attribute for the number of elevators in the building.
  • people: attribute for number of people in the building.
  • wait_time_average: this is the attribute that specifies the effectiveness and efficiency of the building’s elevators system. It is simply calculated by getting the average time it takes for each person to get their destination. 
  • simulation_done: attribute that represents if the simulation for the particular building is done i.e: all persons have arrived at their destination floor.
  • simulation_time: attribute that represents the time it takes the simulation for the particular building to be done

Floor Class: represents each floor in the building. It contains Rooms that control the visual appearance of the floor walls.

Person Class: The Person class represents an individual in the building. It contains attributes and methods such as:

Attributes:

  • destination_floor: attribute or value for the floor the person intends to go to.
  • current_floor: the floor the person is currently on.
  • states: array or list of the three different states the person can be on. “idle”: is not moving around, “move_left”: walks left by the distance of step_length and speed of horizontal_speed, “move_right”: walks right by the distance of step_length and speed of horizontal_speed.
  • current_state: attribute specifying the state the person is in from states.
  • in_elevator: contains the elevator object the person is inside if any.
  • in_elevator: provides the name of the elevator the person is currently inside, blank if not in any.
  • step_length: value for the distance per step the person can take.
  • horizontal_speed: value for how fast a step_length is attained.
  • wait_time: the time it takes for the person to get to his/her destination floor

Methods:

  • update_moving(current_state): method that update the person's position base on the calculated current_state.
  • direct_to_elevator(Elevator): directs the person to the nearest and free(not full) elevator on the same floor.
  • enter_elevator(Elevator): puts the person in the specified elevator.
  • placing_in_elevator(Elevator): orderly arrange the person in the specified elevator.
  • undo_placing_in_elevator(Elevator): remove the placing of the person form the specified elevator.
  • exit_elevator(Elevator): removes the person from the specified elevator.
  • calculate_wait_time(): calculates and updates the wait_time method.

Elevator Class: The Elevator class represents the elevator itself. It has attributes and methods such as:

Attributes:

  • current_floor: the floor the elevator is currently on.
  • vertical_speed: how fast the elevator moves from floor to floor.
  • passengers: amount of people in the elevator.
  • max_passengers: highest number of people allowed in the elevator.
  • stopped: for stopping the elevator from advancing up or down, i.e: opening the door.
  • stopped_time: time for stopped to be true.
  • going_up: attribute for indicating if the elevator is going to a higher floor.
  • going_down: attribute tha indicates if the elevator is going to a lower floor.
  • moving_index: position of the elevator in the drawn movement_path.
  • movement_path: array or list containing the path the elevator will follow. In the case of this driving algorithm, the elevator uses the ‘elevator algorithm’.It goes in a continuous path, going to the topmost floor while stopping, picking and dropping passengers, then goes back to the down to bottomost floor while again stopping, picking and dropping passengers. This cycle repeats.

Methods:

  • moving(): method for processing the movement_path attribute then moving the elevator through it at a speed of vertical_speed.
  • stopping(): stops the elevator for stopped_time after every new path.



About

my simulation of a building elevator system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published