Water network model¶
The water network model includes junctions, tanks, reservoirs, pipes, pumps, valves, demand patterns, pump curves, controls, sources, simulation options, and node coordinates. Water network models can be built from scratch or built directly from an EPANET INP file. Sections of EPANET INP file that are not compatible with WNTR are described in Limitations. The example water_network_model.py can be used to generate, save, and modify water network models.
A water network model can be created by adding components to an empty model:
wn = wntr.network.WaterNetworkModel() wn.add_pattern('pat1', ) wn.add_pattern('pat2', [1,2,3,4,5,6,7,8,9,10]) wn.add_junction('node1', base_demand=0.01, demand_pattern='pat1', elevation=100.0, coordinates=(1,2)) wn.add_junction('node2', base_demand=0.02, demand_pattern='pat2', elevation=50.0, coordinates=(1,3)) wn.add_pipe('pipe1', 'node1', 'node2', length=304.8, diameter=0.3048, roughness=100, minor_loss=0.0, status='OPEN') wn.add_reservoir('res', base_head=125, head_pattern='pat1', coordinates=(0,2)) wn.add_pipe('pipe2', 'node1', 'res', length=100, diameter=0.3048, roughness=100, minor_loss=0.0, status='OPEN') wn.options.time.duration = 24*3600 wn.options.time.hydraulic_timestep = 15*60 wn.options.time.pattern_timestep = 60*60
A water network model can also be created directly from an EPANET INP file:
inp_file = 'networks/Net3.inp'
The water network model can be written to a file in EPANET INP format. By default, files are written in LPS units. The EPANET INP file will not include features not supported by EPANET (i.e., pressure dependent demand simulation options).:
For more information on the water network model, see
WaterNetworkModel in the API documentation.