A multithreaded elevator system implemented in Python that simulates real-world elevator operations. This Multithreaded Elevator System simulator is a Python project designed to simulate the operations of an elevator system in a multi-story building. The simulation handles elevator movement, user requests, and direction of travel.
This system allows you to simulate elevator operations using Python's threading and queue modules. It has a modular structure that allows for customizing the number of elevators, the speed of the elevators, and the range of floors they can serve.
- Multithreading: The system utilizes Python's threading module to simulate the concurrent operation of multiple elevators.
- PriorityQueue: Each elevator maintains a priority queue of floor requests to optimize its operation.
- User Interaction: Users can input their current floor and desired direction, and the system will assign the best elevator to serve them.
The project contains the following files:
main.py: The entry point of the system. Here we initialize the elevator system and start a thread for user input.elevator_system.py: Contains theElevatorSystemclass which manages all elevators and handles floor requests.elevator.py: Contains theElevatorclass which simulates an individual elevator's operation.
- Clone the repo
git clone https://github.com/nkamali/elevator
- Run
main.pyto start the system.
python main.py- When prompted, input your current floor number and the direction you want to go in.
What floor are you on?
10
Going up or down?
up- To exit the system, input
quitwhen asked for the floor number.
When rendered in a markdown viewer or editor, the code blocks will be displayed with syntax highlighting, and the commands and prompts will be formatted as monospaced text.
This project uses Python 3.8+.
To contribute, please fork the repository and use a feature branch. Pull requests are warmly welcome.
- Navid Kamali - Initial work - navidk