Skip to main content

Simulate the diffusion of contaminants in water networks.

Project description

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 |

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waco-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waco-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file waco-0.1.0.tar.gz.

File metadata

  • Download URL: waco-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for waco-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2990b0bf8ab351c6b665a5f34cf5d65a3a5bc3f0309e69f2885a126b1df26c57
MD5 3a514d1662b92480f9f93e7c1cca5b0e
BLAKE2b-256 1b8726b41a233771f3dba95dc7716e74c29f4449a345690ef2b1bafcd22da57d

See more details on using hashes here.

File details

Details for the file waco-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: waco-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for waco-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3b22cd129a2b170a47045c3d686063c08edb2aab027ab829f3b816aa0d73d9a
MD5 2d62c84c0ce75296260dd74587149c74
BLAKE2b-256 7894768a3f4c833309427c3673d431d49dcf8d5298ab6a7ed361266f49847291

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page