-
Notifications
You must be signed in to change notification settings - Fork 210
Open
Labels
Description
Thanks for this opensource work. I am not sure whether this is the right place for my interest, so I give it a go.
Summary
I would like to be able to simulate pressure remediating effects of air valves. I have obtained the technical sheet which details the following diagram for an air valve
I thus assume that if the differential pressure is below zero, the valve opens and air enters the system (Belüftung = ventilation in m3/h). This in effect dampens negative pressures. I would like to simulate this behaviour using WNTR for further use in PTSNET.
Example
A sample has been started as follows:
# Import packages
import os
import numpy as np
# Leaving out imports for PTSNET
import wntr
import wntr.network.controls as controls
# Generate Epanet file
wn = wntr.network.WaterNetworkModel()
wn.options.time.duration = 60*60
wn.options.time.hydraulic_timestep = 5
wn.options.time.report_timestep = 5
wn.options.time.start_clocktime = 0
wn.options.hydraulic.inpfile_units = 'LPS'
wn.options.hydraulic.headloss = 'D-W'
wn.options.hydraulic.specific_gravity = 0.9997
wn.options.hydraulic.viscosity = 1.306
wn.options.hydraulic.trials = 40
wn.options.hydraulic.accuracy = 0.001
wn.options.hydraulic.checkfreq = 2
wn.options.hydraulic.maxcheck = 10
wn.options.hydraulic.damplimit = 0
wn.options.hydraulic.unbalanced = 'STOP'
wn.options.hydraulic.pattern = '1'
wn.options.energy.global_efficiency = 75
wn.options.energy.demand_charge = 0
wn.options.reaction.limiting_potential = 0
wn.options.reaction.roughness_correl = 0
# Add nodes to the network
wn.add_reservoir('res', 0, coordinates=(0,0))
wn.add_junction('p_in', elevation=0, coordinates=(1,0))
wn.add_junction('p_out', elevation=0, coordinates=(2,0))
wn.add_junction('cv',elevation=0, coordinates=(3,0))
wn.add_junction('v_in', elevation=10, coordinates=(10,10))
wn.add_junction('v_out', elevation=10, coordinates=(11,10))
wn.add_tank('tank', elevation=10, diameter=10, init_level=3, max_level=20, overflow=True, coordinates=(12,10))
#Add links to the network
wn.add_pipe('res_out', 'res', 'p_in', 1, 1, 0.12, minor_loss=0.5)
wn.add_pump('pump', 'p_in', 'p_out', 'HEAD', pump_parameter='curve1')
wn.add_pipe('cv', 'p_out', 'cv', 1, 1, minor_loss=2, initial_status='CLOSED', check_valve=True)
wn.add_pipe('p1', 'cv', 'v_in', 10000, 1, 0.12, minor_loss=10)
wn.add_valve('valve', 'v_in', 'v_out', 1, 'TCV', minor_loss=0.5, initial_status='OPEN')
wn.add_pipe('tank', 'v_out', 'tank', 1, 1, 0.12, minor_loss=0.5)
# Add a tank volume curve to the model and assign it to a tank
wn.add_curve('curve1', 'HEAD', [
(.200, 30),
(.400, 19),
(.500, 5)])
wn.get_link('pump').pump_curve_name = 'curve1'
# Plot pump curve
wntr.graphics.plot_pump_curve(wn.get_link('pump'))
wntr.network.write_inpfile(wn, 'networks/test.inp', units='LPS')
# Adding BEV/controls
wn.add_junction('bev',elevation=1, coordinates=(3,1))
wn.add_pipe('bev', 'bev', 'cv', 1, .1, minor_loss=1, initial_status='CLOSED', check_valve=True)
pipe = wn.get_link('bev')
act1 = controls.ControlAction(pipe, 'status', 1)
print(act1)
bev_out = wn.get_node('cv')
cond1 = controls.ValueCondition(bev_out, 'level', '<', 0.)
print(cond1)
ctrl1 = controls.Control(cond1, act1, name='control1')
print(ctrl1)Then I am lost in space
Environment
Provide information on your computing environment.
- Operating system: Ubuntu 24.04
- Python version: 3.9.22
- WNTR version: 0.5.0