USEPA / WNTR

An EPANET compatible python package to simulate and analyze water distribution networks under disaster scenarios.
Other
317 stars 183 forks source link

epanet 2.2 vs wntr PDD #210

Open kaigaon opened 3 years ago

kaigaon commented 3 years ago

I am new to wntr and python and have been trying to read the documents related to learning wntr. I also tried some examples specifically the criticality analysis which I tried running wntr PDD and epanet 2.2 PDD. This resulted to giving me different values as shown on the graph below. The orange line represents the result of pressure at node 161 of Net3 network using wntr pdd while the blue line represents the result using epanet 2.2 pdd. I have also attached the code here for your reference. Could you please help me check if the code is correct, and if it is better to use wntr or epanet2.2 for criticality analysis?

epanet_vs_wntr

import wntr import numpy as np

create a water network model

inp_file = 'Net3.inp' #'TLNv1.01.inp'# wn = wntr.network.WaterNetworkModel(inp_file)

adjust simulation options for criticality analysis

analysis_end_time = 168 *3600 wn.options.time.duration = analysis_end_time wn.options.hydraulic.demand_model = 'PDD' wn.options.hydraulic.required_pressure = 18 wn.options.hydraulic.minimum_pressure = 0

add controls

pipe_name = '177'#'8'# pipe = wn.get_link(pipe_name) act = wntr.network.controls.ControlAction(pipe, 'status', wntr.network.LinkStatus.Closed) cond = wntr.network.controls.SimTimeCondition(wn, '=', '48:00:00') ctrl = wntr.network.controls.Control(cond, act) wn.add_control('close pipe ' + pipe_name, ctrl)

sim = wntr.sim.WNTRSimulator(wn) results = sim.run_sim() sim = wntr.sim.EpanetSimulator(wn) results = sim.run_sim(version=2.2)

pressure = results.node['pressure'] pressure_node7 = pressure.loc[:,'161'] print(pressure_node7.min()) ax = pressure_node7.plot() text = ax.set_xlabel("Time (s)") text = ax.set_ylabel("Pressure (m)")

kaklise commented 3 years ago

We recently ran across this same issue. It seems that the EPANET simulation continues to supply water from drained tanks, which elevates pressures in the system. An issue was posted on the OpenWaterAnalytics GitHub site (https://github.com/OpenWaterAnalytics/EPANET/issues/623) and a software update has been merged. We'll check in with the OpenWaterAnalytics group to see when they plan to tag a new release of EPANET. We hope to get the updated EPANET dlls into WNTR soon.