https://github.com/ksalekk/elevator-simulator
https://github.com/ksalekk/elevator-simulator
algorithms elevator-simulation java multithreading
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ksalekk/elevator-simulator
- Owner: ksalekk
- Created: 2024-05-28T22:28:25.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-29T20:04:04.000Z (about 2 years ago)
- Last Synced: 2025-01-21T09:09:30.235Z (over 1 year ago)
- Topics: algorithms, elevator-simulation, java, multithreading
- Language: Java
- Homepage:
- Size: 141 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elevator Simulator
## General
Simple Java console program that simulates the working of an elevator in a building. The program is parameterized with positional arguments:
```
F number of floors in the building
t unit of the simulation time, i.e. the time in seconds needed to move one floor by the elevator
p the probability of a passenger appearing in unit t on a random floor with the intention of traveling to random floor
```
The program graphically visualizes the state of the entire system in every unit of time *t* (location of the elevator, current source and destination floors, passengers waiting on each floor etc.).
## Elevator algorithm and architecture
### Elevator algorithm
- no requests => elevator stay at the current floor
- elevator move in one chosen direction from src to dest
- if the request is on src->dest track, elevator stops and service it (take/release passengers)
- request is send when passenger takes elevator (src) or go inside elevator (dest)
### Architecture

## Run
1. Make sure you have installed JDK
```
javac -version
```
2. Clone the repository and compile all .java files
```
git clone https://github.com/ksalekk/elevator-simulator.git
cd ./elevator-simulator
javac -d bins ./src/edu/ksalekk/elevatorsimulator/*.java
cd ./bins
```
3. Run test program with specified parameters (remember not to type .class extension)
```
java edu/ksalekk/elevatorsimulator/ElevatorSimulatorTest 5 2 0.3
```
You can also run the program in your IDE.