EPyT-Control -- EPANET Python Toolkit - Control
EPyT-Control is a Python package building on top of EPyT-Flow for implementing and evaluating control algorithms & strategies in water distribution networks (WDNs).
Besides related control tasks such as state estimation and event diagnosis, a special focus of this Python package is Reinforcement Learning for data-driven control in WDNs and therefore it provides full compatibility with the Stable-Baselines3 package.
Unique Features
Unique features of EPyT-Control are the following:
- Support of hydraulic and (advanced) water quality simulation (i.e. EPANET and EPANET-MSX are supported)
- Compatibility with Gymnasium and integration of Stable-Baselines3
- Wide variety of pre-defined actions (e.g. pump state actions, pump speed actons, valve state actions, species injection actions, etc.)
- Implementation of classic control aglorithms such as PID and LQR controllers
- Signal processing methods such as state estimation (e.g. Kalman filters) and event diagnosis
- Neural surrogate models for state transition (e.g., state-of-the-art hydraulic and water quality surrogate model)
- High- and low-level interface
- Object-orientated design that is easy to extend and customize
Installation
EPyT-Control supports Python 3.10 - 3.14
PyPI
pip install epyt-control
Git
Download or clone the repository:
git clone https://github.com/WaterFutures/EPyT-Control.git
cd EPyT-Control
Install all requirements as listed in REQUIREMENTS.txt:
pip install -r REQUIREMENTS.txt
Install the toolbox:
pip install .
Quick Example
Interface of Environments
Basic example demonstrating the environments' interface:
# Define/Specify MyEnv
# ....
# Load hypothetical environment "MyEnv"
with MyEnv() as env:
# Show the observation space
print(f"Observation space: {env.observation_space}")
# Run 1000 iterations -- assuming that autorest=True
obs, info = env.reset()
for _ in range(1000):
# Sample and apply a random action from the action space.
# TODO: Replace with some smart RL/control method
action = env.action_space.sample()
obs, reward, terminated, _, _ = env.step(action)
# Show action and observed reward
print(action, reward)
Applying Reinforcement Learning to a given Environment
Simple example of using Stable-Baselines3 for learning a policy to control the chlorine injection in a given environment called SimpleChlorineInjectionEnv:
from stable_baselines3 import PPO
from gymnasium.wrappers import NormalizeObservation
# Define/Specify SimpleChlorineInjectionEnv
# ....
# Load chlorine injection environment
with SimpleChlorineInjectionEnv() as env:
# Wrap environment
env = NormalizeObservation(env)
# Apply a simple policy learner
# You might want to add more wrappers (e.g. normalizing inputs, rewards, etc.) and logging here
# Also, inceasing the number of time steps might help as well
model = PPO("MlpPolicy", env, verbose=1)
model.learn(total_timesteps=1000)
model.save("my_model_clinject.zip") # Save policy
Documentation
Documentation is available on readthedocs: https://epyt-control.readthedocs.io/en/stable/
License
MIT license -- see LICENSE
How to Cite?
If you use this software, please cite it as follows:
@misc{github:epytcontrol,
author = {André Artelt},
title = {{EPyT-Control -- EPANET Python Toolkit - Control}},
year = {2025},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {https://github.com/WaterFutures/EPyT-Control}
}
How to get Support?
If you come across any bug or need assistance please feel free to open a new issue if non of the existing issues answers your questions.
How to Contribute?
Contributions (e.g. creating issues, pull-requests, etc.) are welcome -- please make sure to read the code of conduct and follow the developers' guidelines.
Metadata
Release files for epyt-control 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| epyt_control-0.7.1.tar.gz | 333.7 kB | Without provenance | Details for epyt_control-0.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| epyt_control-0.7.1-py3-none-any.whl | Python 3 | none | any | Details for epyt_control-0.7.1-py3-none-any.whl |
Total release size: 412.1 kB
Release files / epyt_control-0.7.1.tar.gz
| Download URL | epyt_control-0.7.1.tar.gz |
|---|---|
| Size | 333.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff1b06af8317b2b059f8b5722e7af88d5a414ff67681ddfcae618da93a31f181
|
|
BLAKE2b-256 checksum How to use checksums |
fc1e4d07c7a2e5d06d83c29c2529561fa4dec0492bf4615c5cf55b9def30f31d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / epyt_control-0.7.1-py3-none-any.whl
| Download URL | epyt_control-0.7.1-py3-none-any.whl |
|---|---|
| Size | 78.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b972c94e1cd202f82f178445704020bc96c9379f47f3d0017023f32361c5e8e
|
|
BLAKE2b-256 checksum How to use checksums |
214812725857a90f02a8557c414b88869ae8172a6f0f95eb51a8f0a8d7c78684
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for epyt-control 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.