Water Network Tool for Resilience (WNTR)
repository·main·Indexed 19 days ago
https://github.com/usepa/wntrA Python-based simulation and analysis package for evaluating the resilience of water distribution networks. WNTR supports model generation, disruption simulation, hydraulic and water quality analysis, and stochastic simulations. It features a custom Algebraic Modeling Language (AML) for hydraulic models, Multi-Species Extension (MSX) capabilities for chemical dynamics, and support for automated network controls and rules.
What's inside WNTR
- WNTR is an EPANET-compatible Python package used to simulate and analyze the resilience of water distribution networks. It allows developers and researchers to model hydraulic behavior and assess how networks respond to various stressors or failures.
Overview of WNTR subpackages
mainWNTR is organized into several subpackages that handle different aspects of water network modeling and simulation:
wntr.network: Defines water network models, controls, model options, and graph representations.wntr.scenario: Defines disaster scenarios and fragility/survival curves.wntr.sim: Runs hydraulic and water quality simulations.wntr.library: Tools to help build water network models.wntr.metrics: Computes resilience metrics (topographic, hydraulic, water quality, water security, and economic).wntr.morph: Modifies network morphology (skeletonization, node coordinates, splitting/breaking pipes).wntr.gis: Geospatial capabilities, including converting models to GeoDataFrames.wntr.graphics: Generates graphics.wntr.epanet: Provides compatibility with EPANET 2.00.12 and EPANET 2.2.0.wntr.utils: Helper functions.
Overview of WNTR Python file examples
mainThe following Python scripts are available in the
examplesfolder:getting_started.py: Basic model generation, hydraulic simulation, and plotting.stochastic_simulation.py: Runs multiple simulations where pipe leak location and duration are drawn from probability distributions.pipe_criticality.py: Computes the impact of individual pipe closures on water pressure.fire_flow.py: Simulates hydraulic impacts of fire fighting flow demand.water_network_example.py: (Hosted in the Chama repository) Uses WNTR to optimize sensor placement to minimize detection time. Note: Requires Pyomo and a MIP solver.
Overview of WNTR Jupyter Notebook tutorials
mainThe following Jupyter Notebook tutorials are available in the
examplesfolder:getting_started_tutorial.ipynb: Generates a model, simulates hydraulics, and plots results.basics_tutorial.ipynb: Covers model building/modification, resilience metrics, fragility curves, skeletonization, and geospatial capabilities.model_development_tutorial.ipynb: Uses imperfect geospatial data to create a model.pipe_break_tutorial.ipynb: Computes impact of individual pipe breaks on network pressure.pipe_segments_tutorial.ipynb: Defines isolation valves and segments to compute impact of segment closures.fire_flow_tutorial.ipynb: Simulates fire fighting flow demand at hydrant nodes.earthquake_tutorial.ipynb: Simulates earthquake damage, repair efforts, fragility curves, and water service availability.salt_water_intrusion_tutorial.ipynb: Uses storm surge raster data to estimate salt intrusion.landslide_tutorial.ipynb: Uses GIS data to quantify disruptions from landslide-damaged pipes.multispecies_tutorial.ipynb: Uses EPANET-MSX to model multispecies chlorine decay.
Overview of WNTR capabilities
mainThe Water Network Tool for Resilience (WNTR) is a Python package used to simulate and analyze the resilience of water distribution networks. Key capabilities include:
- Model Generation & Modification: Generate water network models and modify network structure or operations.
- Disruption Simulation: Add disruptive events, such as pipe leaks.
- Response Strategies: Add response or repair strategies to the network.
- Hydraulic Simulation: Simulate both pressure-dependent demand and demand-driven hydraulics.
- Water Quality: Simulate water quality parameters.
- Resilience & Visualization: Evaluate network resilience and visualize simulation results.
What is WNTR?
mainThe Water Network Tool for Resilience (WNTR) is a Python package designed to simulate and analyze the resilience of water distribution networks. It allows users to model collections of pipes, pumps, valves, junctions, tanks, and reservoirs to predict how they perform during disruptive incidents.
Key capabilities include:
- Model Generation: Create models from scratch or from existing EPANET-formatted (
.inp) files. - Network Modification: Change network structure (adding/removing components) or operations (changing supply/demand, initial conditions, or controls).
- Disruption Modeling: Simulate incidents like pipe leaks, power outages, contaminant injections, or damage to tanks, valves, and pumps.
- Mitigation Modeling: Add response strategies such as leak repairs, pipe retrofitting, or power restoration.
- Hydraulic & Water Quality Simulation: Run simulations using either pressure-dependent demand or demand-driven hydraulic models, with the ability to pause and restart.
- Resilience Analysis: Run probabilistic simulations using fragility curves and compute resilience using topographic, hydraulic, water quality, and economic metrics.
- Visualization: Generate state transition plots, network graphics, and animations.
- Model Generation: Create models from scratch or from existing EPANET-formatted (
New features in WNTR v1.1.0
mainWNTR version 1.1.0 (released November 27, 2023) introduced several functional improvements and bug fixes:
- GIS Integration: The
snapGIS function now uses node names as a tie breaker. When converting GIS objects to WN models, vertices from line string geometries are now included. - Model Integrity: Variables and parameters now retain their values even when constraints are removed.
- New Functionality: Added a function for reversing link directions.
- Solver Improvements: The Newton Solver has been cleaned up for better performance/reliability.
- Documentation: Updated documentation includes specific column and field names for GeoJSON and Shapefiles.
- GIS Integration: The
WNTR License and Copyright Information
mainWNTR is copyright through Sandia National Laboratories and is distributed under the Revised BSD License.
Note that WNTR leverages various third-party software packages which are subject to their own separate licensing policies. For full details regarding the license and third-party dependencies, refer to the
LICENSE.mdfile in the repository.Quantifying water distribution system resilience with WNTR
mainWNTR provides a suite of metrics to quantify the resilience of water distribution systems across five primary categories: topographic, hydraulic, water quality, water security, and economic.
Because resilience can be defined as a single system-wide value or as a value that varies over time and space, WNTR supports different visualization methods to interpret these metrics:
- State Transition Plots: Used for metrics that vary over time (e.g., before, during, and after a disruptive incident). The x-axis represents time and the y-axis represents performance. These can represent system-wide performance or the performance of individual components like tanks or pipes.
- Network Graphics: Used for metrics that vary with respect to location (space).
- Network Animation: Used for metrics that vary with respect to both time and space.
Access WNTR overview and factsheets
mainFor comprehensive information regarding WNTR, including requirements and tutorials, refer to the EPA report:
https://cfpub.epa.gov/si/si_public_record_report.cfm?dirEntryId=367270&Lab=CESER
Additionally, the following factsheets are available for download:
- WNTR Overview Factsheet
- WNTR Model Requirements Factsheet
- WNTR Tutorials Factsheet
- WNTR Case Studies Factsheet
What is a valve layer and how is it used?
mainA valve layer is a type of data layer in WNTR that contains information not part of the core water network model or graph, but useful for analysis.
Valve layers allow you to group links and nodes into segments based on the location of isolation valves. These segments can be used to calculate specific metrics, such as:
- The number of valves surrounding each valve.
- The increase in segment demand if a specific valve is removed.
- The increase in segment pipe length if a specific valve is removed.
Understand MSX model variables and coefficients
mainMSX models are composed of species, coefficients, and terms used within expressions to define reaction dynamics.
Variables
All variables require a
name(which must be a valid EPANET-MSX ID, typically containing no spaces) and anote. Thenotecan be:- A string
- A dictionary with keys
"pre"and"post" - An
wntr.epanet.util.ENcommentobject
Coefficients
There are two types of coefficients used in reaction expressions:
- Constants: A single value used in every expression.
- Parameters: A global value used by default, but which can be modified on a per-pipe or per-tank basis.
Hydraulic Variables
Pre-defined hydraulic variables are available via
wntr.msx.base.HYDRAULIC_VARIABLES.