EPANET-PLUS is a C library that merges EPANET and EPANET-MSX into a single library. Most importantly, it also provides a Python package with a high-performance interface (i.e., C extension) to the C library, together with additional helper functions for an easier use of EPANET and EPANET-MSX.
Unique features of EPANET-PLUS that make it superior to other Python interfaces of EPANET are the following:
- High-performance (single) interface to the latest version of EPANET and EPANET-MSX
- Additional C-functions to extend EPANET and EPANET-MSX
- Python toolkit with handy functions for working with EPANET and EPANET-MSX
Note that EPANET-PLUS supports Python 3.9 - 3.13. The Python package contains the the C library as a C extension and is already pre-build for all major platforms.
pip install epanet-plus
Download or clone the repository:
git clone https://github.com/WaterFutures/EPANET-PLUS.git
cd EPANET-PLUS
Install all requirements as listed in REQUIREMENTS.txt:
pip install -r REQUIREMENTS.txt
Build and install the package:
pip install .
from epanet_plus import EPyT, EpanetConstants
if __name__ == "__main__":
# Load an .inp file in EPANET using the toolkit class
epanet_api = EPyT("net2-cl2.inp")
# Print some general information
print(f"All nodes: {epanet_api.get_all_nodes_id()}")
print(f"All links: {epanet_api.get_all_links_id()}")
print(f"Simulation duration in seconds: {epanet_api.get_simulation_duration()}")
print(f"Hydraulic time step in seconds: {epanet_api.get_hydraulic_time_step()}")
print(f"Demand model: {epanet_api.get_demand_model()}")
# Run hydraulic simulation and output pressure at each node (at every simulation step)
epanet_api.openH()
epanet_api.initH(EpanetConstants.EN_NOSAVE)
tstep = 1
r = []
while tstep > 0:
t = epanet_api.runH()
print(epanet_api.getnodevalues(EpanetConstants.EN_PRESSURE))
tstep = epanet_api.nextH()
epanet_api.closeH()
# Close EPANET
epanet_api.close()Documentation is available on readthedocs: https://epanet-plus.readthedocs.io/en/latest/
MIT license -- see LICENSE
If you use this software, please cite it as follows:
@misc{github:epanetplus,
author = {André Artelt},
title = {{EPANET-PLUS}},
year = {2025},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {https://github.com/WaterFutures/EPANET-PLUS}
}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.
Contributions (e.g. creating issues, pull-requests, etc.) are welcome -- please make sure to read the code of conduct and follow the developers' guidelines.