Skip to content

Latest commit

 

History

History
317 lines (219 loc) · 9.06 KB

examples.rst

File metadata and controls

317 lines (219 loc) · 9.06 KB

Example Applications

Example 1 - End-valve closure

This example shows how to simulate the closure of a valve located at the boundary of a network. The first example network is shown below in tnet1, adopted from [[STWY67],WOLB05]_. It comprises 9 pipes, 8 junctions, one reservoir, 3 closed loops, and one valve located at the downstream end of the system. There are five steps that the user needs to take to run the transient simulation using the TSNet package:

Tnet1 network graphics

  1. Import TSNet package, read the EPANET INP file, and create transient model object.

../examples/Tnet1_valve_closure.py

  1. Set the wave speed for all pipes to 1200m/s, time step to 0.1s, and simulation period to 60s.

../examples/Tnet1_valve_closure.py

  1. Set valve operating rules, including how long it takes to close the valve (tc), when to start close the valve (ts), the opening percentage when the closure is completed (se), and the shape of the closure operating curve (m, 1 stands for linear closure, 2 stands for quadratic closure).

../examples/Tnet1_valve_closure.py

  1. Compute steady state results to establish the initial condition for transient simulation.

../examples/Tnet1_valve_closure.py

  1. Run transient simulation and specify the name of the results file.

../examples/Tnet1_valve_closure.py

After the transient simulation, the results at nodes and links will be returned and stored in the transient model (tm) instance. The time history of flow rate on the start node of pipe P2 throughout the simulation can be retrieved by:

>>> print(tm.links['P2'].start_node_flowrate)

To plot the head results at N3:

../examples/Tnet1_valve_closure.py

yields tnet1_node:

Tnet1 - Head at node N3.

Similarly, to plot the flow rate results in pipe P2:

../examples/Tnet1_valve_closure.py

yields tnet1_pipe:

Tnet1 - Flow rate at the start and end node of pipe P2.

Example 2 - Pump operations

This example illustrates how the package models a transient event resulting from a controlled pump shut-off , i.e., the pump speed is ramped down. This example network, Tnet2, is shown below in tnet2. Tnet2 comprises 113 pipes, 91 junctions, 2 pumps, 2 reservoir, 3 tanks, and one valve located in the middle of the network. A transient simulation of 50 seconds is generated by shutting off PUMP2. There are five steps user needs to take:

Tnet2 network graphics

  1. Import TSNet package, read the EPANET INP file, and create transient model object.

../examples/Tnet2_pump_shutdown.py

  1. Set the wave speed for all pipes to be 1200m/s and simulation period to be 50s. Use suggested time step.

../examples/Tnet2_pump_shutdown.py

  1. Set pump operating rules, including how long it takes to shutdown the pump (tc), when to the shut-off starts (ts), the pump speed multiplier value when the shut-off is completed (se), and the shape of the shut-off operation curve (m, 1 stands for linear closure, 2 stands for quadratic closure).

../examples/Tnet2_pump_shutdown.py

  1. Compute steady state results to establish the initial condition for transient simulation.

../examples/Tnet2_pump_shutdown.py

  1. Run transient simulation and specify the name of the results file.

../examples/Tnet2_pump_shutdown.py

After the transient simulation, the results at nodes and links will be returned to the transient model (tm) instance, which is then stored in Tnet2.obj. The actual demand discharge at JUNCTION-105 throughout the simulation can be retrieved by:

>>> print(tm.nodes['JUNCTION-105'].demand_discharge)

To plot the head results at JUNCTION-105:

../examples/Tnet2_pump_shutdown.py

yields tnet2_node:

Tnet2 - Head at node JUNCTION-105.

Similarly, to plot the velocity results in PIPE-109:

../examples/Tnet2_pump_shutdown.py

yields tnet2_pipe:

Tnet2 - Velocity at the start and end node of PIPE-109.

Example 3 - Burst and leak

This example reveals how TSNet simulates pipe bursts and leaks. This example network, adapted from [OSBH08], is shown below in tnet3. Tnet3 comprises 168 pipes, 126 junctions, 8 valve, 2 pumps, one reservoir, and two tanks. The transient event is generated by a burst and a background leak. There are five steps that the user would need to take:

Tnet3 network graphics

  1. Import TSNet package, read the EPANET INP file, and create transient model object.

../examples/Tnet3_burst_leak.py

  1. The user can import custom wave speeds for each pipe. To demonstrate how to assign different wave speed, we assume that the wave speed for the pipes is normally distributed with mean of 1200m/s and standard deviation of :math: 100m/s. Then, assign the randomly generated wave speed to each pipe in the network according to the order the pipes defined in the INP file. Subsequently, set the simulation period as 20s, and use suggested time step.

../examples/Tnet3_burst_leak.py

  1. Define background leak location, JUNCTION-22, and specify the emitter coefficient. The leak will be included in the initial condition calculation. See WNTR documentation [WNTRSi] for more info about leak simulation.

../examples/Tnet3_burst_leak.py

  1. Compute steady state results to establish the initial condition for transient simulation.

../examples/Tnet3_burst_leak.py

  1. Set up burst event, including burst location, JUNCTION-20, burst start time (ts), time for burst to fully develop (tc), and the final emitter coefficient (final_burst_coeff).

../examples/Tnet3_burst_leak.py

  1. Run transient simulation and specify the name of the results file.

../examples/Tnet3_burst_leak.py

After the transient simulation, the results at nodes and links will be returned to the transient model (tm) instance, which is subsequently stored in Tnet3.obj.

To understand how much water has been lost through the leakage at JUNCTION-22, we can plot the leak discharge results at JUNCTION-22:

../examples/Tnet3_burst_leak.py

yields tnet3_leak:

Tnet3 - Leak discharge at node JUNCTION-22.

Similarly, to reveal how much water has been wasted through the burst event at JUNCTION-20, we can plot the burst discharge results at JUNCTION-20:

../examples/Tnet3_burst_leak.py

yields tnet3_burst:

Tnet3 - Burst discharge at node JUNCTION-20.

Additionally, to plot the velocity results in LINK-40:

../examples/Tnet3_burst_leak.py

yields tnet3_pipe:

Tnet3 - Velocity at the start and end node of LINK-40.

Moreover, we can plot head results at some further nodes, such as JUNCTION-8, JUNCTION-16, JUNCTION-45, JUNCTION-90, by:

../examples/Tnet3_burst_leak.py

The results are demonstrated in tnet3_multi. It can be noticed that the amplitude of the pressure transient at JUNCTION-8 and JUNCTION-16 is greater than that at other two junctions which are further away from JUNCTION-20, where the burst occurred.

Tnet3 - Head at multiple junctions.

More examples are includeded in https://github.com/glorialulu/TSNet/tree/master/examples.