Metadata-Version: 2.4
Name: elevator-traffic-analysis
Version: 0.1.5
Summary: A Python package for elevator traffic analysis and simulation
Home-page: https://github.com/tkosman/elevator-traffic-analysis
Author: tkosman
Author-email: Your Name <your.email@example.com>
License: MIT
Project-URL: Homepage, https://github.com/tkosman/elevator-traffic-analysis
Project-URL: Repository, https://github.com/tkosman/elevator-traffic-analysis
Project-URL: Issues, https://github.com/tkosman/elevator-traffic-analysis/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyyaml
Requires-Dist: transitions
Requires-Dist: matplotlib
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: tox; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# Elevator Traffic Analysis

<a href="https://github.com/tkosman/contemplate-whirlpool/actions">
  <img src="https://img.shields.io/github/actions/workflow/status/tkosman/contemplate-whirlpool/main.yml?branch=main&label=CI&style=flat-square" alt="CI Status"/>
</a>

A Python package for simulating and analyzing elevator traffic using various scheduling algorithms. This tool allows you to model building elevator systems, simulate passenger traffic patterns, and visualize elevator movements and waiting times.

## Features

- **Multiple Elevator Algorithms**: Supports FCFS (First Come First Served), SCAN, LOOK, and SSTF (Shortest Seek Time First) scheduling algorithms
- **Flexible Scenario Configuration**: Define custom scenarios using YAML files
- **Visualization**: Generate plots showing elevator trajectories and passenger movements
- **Comprehensive Testing**: Includes unit tests with coverage reporting
- **Docker Support**: Easy deployment using containerization
- **CLI Interface**: Simple command-line interface for running simulations

## Requirements

To run the project, you need:

- **Docker** version `24.0.0` or higher (for Docker-based execution)
- **Operating system** supporting `bash` shell
- **Python 3.8+** (for alternative PyPI installation)

## Running with Docker

The project includes an `elevator-traffic-analysis` script that simplifies working with containers and running simulations.

### List Available Scenarios

```bash
cd elevator-traffic-analysis
./elevator-traffic-analysis list-scenarios
```

To add your own scenario, create a new YAML file (e.g., `new_scenario.yaml`) in the `scenarios` directory.

### Run an Example Scenario

The following command runs the `example` scenario, generates a plot, and displays passenger IDs on trajectories:

```bash
./elevator-traffic-analysis run example --plot --show-passenger-ids
```

### Display Available Options

```bash
./elevator-traffic-analysis --help
```

### Run Tests with Coverage

```bash
./elevator-traffic-analysis test
```

### Run Linter

```bash
./elevator-traffic-analysis lint
```

## Alternative Installation (PyPI)

The project is also available as a `pip` package. The example below uses a virtual environment for installation:

```bash
python3 -m venv myenv
source myenv/bin/activate
pip install elevator-traffic-analysis
```

After installation, you can list available scenarios:

```bash
elevator-traffic-analysis list-scenarios
```

Running simulations, generating plots, and other parameters work the same way as in the Docker version.

## Scenario Configuration

Scenarios are defined in YAML format. Example structure:

```yaml
n_floors: 10
n_elevators: 1
elevator_capacity: 8
elevator_logic: shortest_seek_time_first
passenger_schedule:
  0:
    - passenger_id: P__0
      appear_floor: F__0
      destination_floor: F__5
```

## Available Algorithms

- **FCFS** (First Come First Served): Services requests in the order they arrive
- **SCAN**: Elevator moves in one direction until no more requests, then reverses
- **LOOK**: Similar to SCAN but reverses immediately after the last request
- **SSTF** (Shortest Seek Time First): Services the closest request first

## Output

Simulations generate:
- Output YAML files with detailed simulation results (in `scenarios_out/`)
- Visualization plots showing elevator movements (in `scenarios_plots/`)

## License

MIT License - see the [LICENSE](LICENSE) file for details.
