Water Age Analysis Example

[1]:
from IPython.display import display, HTML
display(HTML('<a target="_blank" href="https://colab.research.google.com/github/WaterFutures/EPyT-Flow/blob/main/docs/examples/water_age.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>'))
Open In Colab

This example demonstrates how to perform a water age analysis.

[2]:
%pip install epyt-flow --quiet
Note: you may need to restart the kernel to use updated packages.
[3]:
from epyt_flow.data.networks import load_ctown
from epyt_flow.simulation import ScenarioSimulator
from epyt_flow.utils import to_seconds

Create a new simulation based on the C-Town network:

[4]:
network_config = load_ctown(verbose=False)
sim = ScenarioSimulator(scenario_config=network_config)

Set simulation duration to two days:

[5]:
sim.set_general_parameters(simulation_duration=to_seconds(days=2))

Enable water age analysis by calling enable_waterage_analysis():

[6]:
sim.enable_waterage_analysis()

Place quality sensors at all nodes by calling set_node_quality_sensors() – i.e. measuring the water age at each node:

[7]:
sim.set_node_quality_sensors(sensor_locations=sim.sensor_config.nodes)

Run the entire simulation:

[8]:
scada_data = sim.run_simulation()

Retrieve and show simulated water age at the first two nodes:

[9]:
scada_data.plot_nodes_quality(sensor_locations=sim.sensor_config.nodes[:2])
../_images/examples_water_age_16_0.png
[9]:
<Axes: xlabel='Time (15min steps)', ylabel='$hrs$'>

Do not forget to close the simulation!

[10]:
sim.close()