Metadata-Version: 2.4
Name: swmmEnv
Version: 0.1.0
Summary: Multi-agent reinforcement learning environment for SWMM stormwater simulation
Home-page: https://github.com/DujDDx/swmmEnv
Author: dujddx
Author-email: dujddx <dujddx@163.com>
License: MIT
Project-URL: Homepage, https://github.com/DujDDx/swmmEnv
Project-URL: Documentation, https://github.com/DujDDx/swmmEnv#readme
Project-URL: Repository, https://github.com/DujDDx/swmmEnv.git
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
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
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: pyswmm>=2.1.0
Requires-Dist: pettingzoo>=1.24.0
Requires-Dist: gymnasium>=0.29.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Provides-Extra: marl
Requires-Dist: marllib; extra == "marl"
Requires-Dist: ray[rllib]>=2.0; extra == "marl"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# SWMMEnv

Multi-agent reinforcement learning environment for SWMM (Storm Water Management Model) simulation.

## Overview

SWMMEnv provides a PettingZoo-compatible interface for training multi-agent reinforcement learning (MARL) algorithms on stormwater management simulations. It integrates:

- **PySWMM**: SWMM simulation engine
- **PettingZoo**: Multi-agent RL environment interface
- **MARLlib**: Training framework (MAPPO, QMIX, etc.)

## Features

- Read standard SWMM `.inp` files and rainfall `.dat` files
- Control pump stations, gates, and weirs
- Global reward for coupled stormwater systems
- Config-driven design for different SWMM models
- Time synchronization between RL steps and SWMM simulation steps
- State normalization for stable training

## Installation

```bash
pip install -e .
```

## Quick Start

```python
from swmmEnv import SWMMParallelEnv, load_config

# Load configuration
config = load_config("config/example.yaml")

# Create environment
env = SWMMParallelEnv(config)

# Reset and get initial observations
observations, info = env.reset()

# Take a step
actions = {"pump_1": 0.8, "gate_1": 0.5}
observations, rewards, terminations, truncations, infos = env.step(actions)

# Close environment
env.close()
```

## Configuration

See `config/default_config.yaml` for configuration structure.

## Project Structure

```
swmmEnv/
├── swmmEnv/
│   ├── sim/           # Simulation modules (engine, time_sync, normalizer, mapping)
│   ├── envs/          # RL environments (core MDP + PettingZoo wrapper)
│   ├── reward/        # Reward functions
│   └── config/        # Configuration system
├── tests/             # Unit tests
├── examples/          # Example scripts
└── data/              # Sample SWMM models
```

## License

MIT License
