Open Walternate0 opened 1 week ago
Hi @Walternate0,
I cannot fully reproduce the code you shared as I don't know what Qdesign
is. Can you provide the exact values you are using for the base demand of the junctions?
Sorry about that. Here you go.
wn.add_junction('J1', base_demand = 0.00722222222, elevation = 58, coordinates = (5, 5))
wn.add_junction('J2', base_demand = 0.01083333333, elevation = 28, coordinates = (10, 7.5))
wn.add_junction('J3', base_demand = 0.02166666666, elevation = 28, coordinates = (10, 2.5))
wn.add_junction('J4', base_demand = 0.02166666666, elevation = -2, coordinates = (15, 5))
Changing (or commenting out) wn.options.hydraulic.inpfile_units
does not convert the values you used to create the WaterNetworkModel, it only changes the UNITS line in the INP file that WNTR writes. The default value is GPM. So if the values are in LPS, you'll want to make sure the INP file has units LPS. If you change the units to GPM, the values in the INP file are still the same and the results will be different.
Thanks. My output for the default run (without setting LPS) is
name
J1 26.384113
J2 54.709061
J3 47.950264
J4 78.631935
Res 0.000002
Name: 0, dtype: float32
and my output for the run where LPS is set is:
name
J1 26.214180
J2 54.018902
J3 44.879860
J4 75.778847
Res 0.000002
Name: 0, dtype: float32
They are slightly different, particularly at J4. I did verify that WNTR is performing the correct conversion when writing the INP files, so I suspect this issue is isolated to EPANET. There are slight rounding errors introduced by EPANET when using converted values, which could explain the difference.
One potential way around this is to use the WNTRSimulator, however it cannot do D-W loss.
Hi @kbonney, I arrived at a similar conclusion to yours, but then I was baffled by the scale of the difference. You think that ~3 meters of pressure is a result of rounding/conversion errors in EPANET? Thanks a lot for the fast replies BTW :)
Changing (or commenting out)
wn.options.hydraulic.inpfile_units
does not convert the values you used to create the WaterNetworkModel, it only changes the UNITS line in the INP file that WNTR writes. The default value is GPM. So if the values are in LPS, you'll want to make sure the INP file has units LPS. If you change the units to GPM, the values in the INP file are still the same and the results will be different.
Sorry, this reply above is incorrect, changing the inpfile_units changes the values in the INP file and the results should be preserved. We did find a potential issue with converting the roughness coefficient, which might be causing the differences. We will look into that very soon.
Summary
I am using WNTR to model a simple WDN. I create and modify the wn object using WNTR. Changing the 'inpfile_units' attribute provides different results from the simulation (also run in WNTR). From what I understand, this should not be the case.
Example
Environment Provide information on your computing environment.