This repository contains the code for the paper "Applying the Elastic Water Column Model with Dynamic Elements to a Physical Test Rig" by Kevin T. Logan, Michaela Lestakova and Peter F. Pelz, presented at the WDSA/CCWI 2026.
paper abstract
Applying control methods to water distribution systems requires suitable system models. The elastic water column model, which has been expanded to incorporate dynamic elements like pumps and valves, is a promising model for control applications due to its formulation in state-space form. However, the model has so far only been validated numerically. The presented work implements the elastic water column model with dynamic elements for water distribution systems in Python and applies it to a small-scale physical test rig. The experimental results are compared with the simulation results to show that the EWCM-DE implementation is a suitable tool for real-time control.This project contains the implementation of the elastic water column model with dynamic elements (EWCM-DE) as proposed by Imani et al. (2025). The model has been implemented specifically for the resilience demonstrator, a test rig built at the Chair of Fluid Systems, TU Darmstadt. An object-oriented EWCM-DE implementation in the form of a DAE system is located under test_rig_control_model/ewcmde.py. The simulations of each scenario presented in the paper are performed in Jupyter notebooks located in notebooks.
Visualisation of the simulation results is performed in the notebook notebooks/plots.py. By default, this notebook downloads the corresponding reference experimental and simulation datasets from TU Datalib, the institutional repository of TU Darmstadt, in which the data is published as supplementary material: https://doi.org/10.48328/tudatalib-2263.
Clone this repository using
git clone git@github.com:fluid-systems/test-rig-control-model.gitIt is quite useful to use pyenv as a tool for managing Python verions installed on your system. You can find instructions on how to download and install pyenv for Linux/Mac and Windows.
In any case, you need to ensure that the Python version specified in the project's dependencies in pyproject.toml (3.12.1) is available.
We use poetry for package management and virtual environments in this project. You can find installation instructions for poetry here.
After cloning the project, open the folder containing it in VS Code. Ensure that the required Python version is the one used by VS Code. When using pyenv you can do this by first checking that it is available with
pyenv versionsTo make the specific version used in the folder, you can run
pyenv local 3.12.1You need to specify two settings in poetry before installing dependencies and creating a virtual environment.
Set
poetry config virtualenvs.prefer-active-python trueThis ensures that the currently active version of Python gets used for creating the environment. Not doing this will lead to conflicts between the specified dependencies and the Python version in the virtual environment poetry creates.
Set
poetry config virtualenvs.in-project trueThis ensures that the virtual environment gets installed in the project folder rather than the default directory for poetry.
Now you can install dependencies and create the virtual environment by running
poetry installDon't forget to select the Python in the created .venv as the executable used in VS Code for this project.
This project uses pre-commit hooks to ensure that all code that gets pushed to the remote repository complies with formatting and typing standards. Install the pre-commit hooks by running
poetry run pre-commit install
On every commit, this will run linting and formatting as well as type checking. Accordingly, you need to ensure to fully type your code. Lint and format on save using ruff as specified in the development dependencies in the pyproject.toml.
This work has been funded by the LOEWE initiative (Hesse, Germany) within the emergenCITY center [LOEWE/1/12/519/03/05.001(0016)/72].