WNTR
WNTR copied to clipboard
Accuracy of WNTR and Epanet Simulators
Hello WNTR Team,
I am running PDD simulations on the C-Town network using WNTR. I am interested in comparing the demand from the SimulationResults
with the demand from the WaterNetworkModel
- in other words, evaluating the relative satisfied demand. I have noticed that I get slightly different results when I use the WNTRSimulator
than I get when I use the EpanetSimulator
(the WNTR simulator results are better, i.e. more close to the demand from the Water Network Model when required pressure is satisfied - in which case the demand from the results and the model should be identical).
I assume this has to do with the accuracy of the simulators. I can adjust the tolerance in the WNTRSimulator
using solver_options["TOL"]
but I have not managed to figure out how to adjust it in the EpanetSimulator
- adjusting wn.options.hydraulic.accuracy
or wn.options.hydraulic.tolerance
does not seem to help for the EpanetSimulator
and it is irrelevant for the WNTRSimulator
according to the documentation.
Is there any way of achieving better accuracy of the results using the EpanetSimulator
? Or would you say that the reason for the discrepancy between the results lies elsewhere?
Looking forward to your answer! Michaela
Are these large differences that you're seeing? You could try increasing the number of trials. If you have a simple script that demonstrates the issue, we'd be happy to take a look.
Hi Katherine,
thank you for the quick reply. The problem below on the example of Net3 illustrates the issue:
import wntr
from copy import deepcopy
inp_file = 'Net3.inp'
wn = wntr.network.WaterNetworkModel(inp_file)
wn.options.hydraulic.demand_model = 'PDD'
sim_wntr = wntr.sim.WNTRSimulator(wn)
results_wntr = sim_wntr.run_sim()
sim_epanet = wntr.sim.EpanetSimulator(wn)
results_epanet = sim_epanet.run_sim()
On the example of node 15 at time 0, this code will yield:
results_wntr.node['demand']["15"].loc[0] ->0.03911592177927145
results_epanet.node['demand']["15"].loc[0] -> 0.03911595
If we calculate the demand from the inp file for node 15 which is assigned the pattern 3 (using 1gpm = 0.0630901964 lps for conversion), we get:
base_demand * pattern_multiplier * conversion = 1 * 620 * 0.0630901964 lps = 0.03911592176800001m3/s
There is enough pressure on the node 15 (28m) while wn.options.hydraulic.required_pressure = 0.07
(default value).
which is closer to the WNTRSimulator
results than to the EpanetSimulator
results. Unfortunately I have not been able to figure out how to increase the number of trials for the EpanetSimulator
.
So, one place you can look for documentation is https://epanet22.readthedocs.io/en/latest/back_matter.html#options
This gives the details of the different EPANET options. I'm not sure how small the accuracy can be changed, but there are three different (at lesat) options that can affect accuracy, which are changed in wntr in wn.options.hydraulic.*: accuracy, headerror and flowchange. However, I've never done a whole lot with trying to drive accuracy down past six decimal points, so I don't know what combination would be necessary to get what you are looking for.
I hope this helps!
Hey,
thanks for the replies! Although I have not found a way to set the accuracy for the Epanet solver so that it actually changes anything about the results and gets closer to the WNTR solver accuracy, I have managed to be able to tell whether the demand is satisfied by precisely 100% by looking at the pressure (demand is perfectly satisfied if pressure > required pressure).
Perhaps the water_service_availability
metric could use this as well?
Comparing the pressure to a required pressure will not result in the same information that is captured by water service availability, but as you stated, you can determine if required pressure is satisfied by comparing pressure to a threshold.
@ucchejbb, can you advise on EPANET settings to change accuracy?