Skip to main content
WaCo Logo

License

WaCo is a library for simulating contaminations in water networks built on-top of the WNTR library.

For further details, consult the documentation.

Installation

The only requirement is the WNTR library that is used for the hydraulic simulations:

  • Python >= 3.9

  • wntr >= 1.1.0

The latest release of WaCo can be easily installed via pip.

pip install waco

You can also install the latest developement version directly from GitHub.

pip install --upgrade git+https://github.com/andreaponti5/waco

Getting Started

WaCo is composed by two modules:

  • sim: contains the functionalities to perform hydraulic simulations for extracting the demands and the contaminant diffusion in water networks. It mainly acts as a wrapper around the WNTR library.

  • analyzer: contains the functionalities to extract the detection times and the volumes of contaminated water from the simulations.

Note: Refer to the API Reference for more details about the two modules.

To extract the detection times you need to simulate the diffusion of contaminant with the sim and then use the analyzer module.

import waco

import wntr



wn = wntr.network.WaterNetworkModel("examples/networks/Anytown.inp")

trace = waco.sim.contamination(wn=wn)

det_time = waco.analyzer.detection_time(trace)

The detection times are returned in a Dataframe containing the time when the contaminant exceeds a given threshold in a node considering a specific injection point.

| node | inj_node | time |

|----------|:------------:|:--------:|

| 1 | 1 | 0 |

| 1 | 2 | 18900 |

| ... | ... | ... |

| 9 | 21 | 18900 |

| 9 | 22 | 5400 |

To extract the volume of contaminated water prior detection you also need to compute the demand at each node using the sim module.

demand = waco.sim.water_demand(wn)

contam_vol = waco.analyzer.contaminated_volume(trace=trace,

                                               det_time=det_time,

                                               demand=demand)

The volumes are returned in a Dataframe containing the volume of contaminated water prior detection in each node considering a specific injection point.

| node | inj_node | volume |

|----------|:------------:|:----------:|

| 1 | 1 | 0.031545 |

| 1 | 2 | 0.116008 |

| ... | ... | ... |

| 9 | 21 | 0.118453 |

| 9 | 22 | 0.102254 |

Metadata

Release files for waco 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for waco 0.1.0
File Size Uploaded
waco-0.1.0.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for waco 0.1.0
File Interpreter ABI Platform
waco-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.2 kB

Release files / waco-0.1.0.tar.gz

Download URL waco-0.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2990b0bf8ab351c6b665a5f34cf5d65a3a5bc3f0309e69f2885a126b1df26c57
BLAKE2b-256 checksum
How to use checksums
1b8726b41a233771f3dba95dc7716e74c29f4449a345690ef2b1bafcd22da57d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.3

Release files / waco-0.1.0-py3-none-any.whl

Download URL waco-0.1.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3b22cd129a2b170a47045c3d686063c08edb2aab027ab829f3b816aa0d73d9a
BLAKE2b-256 checksum
How to use checksums
7894768a3f4c833309427c3673d431d49dcf8d5298ab6a7ed361266f49847291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page