USEPA / WNTR

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

Differences with my epanet from zero model and inp from wntr model #409

Closed aljdmn closed 5 months ago

aljdmn commented 7 months ago

Hi,

Its my first time using the inp files from wntr, in this case i tried to create the same model i used in the past to train with EPANET.

So, i have two files: FILES.zip

one created in EPANET = "proyecto 1.4. (cambio alturas) The original one created with wntr code = "lastmodel" ; python original code: "lastmodel"

In theory these two files have to match between them, but if i open both in EPANET and runs the simulation it doesnt work. The problem im seeing is "lastmodel" there´s no way of forcing the flow, being 0,01LPS all the time.

(Units in SI)

In case someone could help me, i attached these two files.

And thank you for the support.

kbonney commented 6 months ago

Hi @aljdmn,

I took a look at your files and found that the two networks you are trying to compare do have some differences. For example, the pump curves are slightly different, there is slightly different topology in the bottom right part of the networks, and the pipe lengths do not match either.

If your goal is to get the proyecto 1.4. (cambio alturas).net file into WNTR, I would recommend saving it as a inp file using EPANET and load it into WNTR using wntr.network.WaterNetworkModel("/path/to/inp_file.inp").

aljdmn commented 6 months ago

Indeed my goal is create a python program to create and simulate the same things for example 'proyecto 1.4.' does. 'Proyecto 1.4. is a file to compare with my wntr code in similar parametres.

Yesterday, after reading the answer, i found the problem was the units, in wntr i wrote the units in International System, but creating the .inp file 'lastmodel.inp' from my wntr code, if i open it in Epanet after that, the units change.

I used this code to fix that: wntr.network.io.write_inpfile(wn,"C:\Users\domen\Desktop\lastmodel2.inp",units='SI')

But, if i load it again (for example to make changes) this Error ocurr: image

image

i dont know how to load the file, thank you.

kbonney commented 6 months ago

Using "SI" in write_inp will cause this issue when reading the inp file because "SI" is not an expected unit type for an EPANET inp file. Instead, the unit option needs to take its value from one of the following types listed in the "flow" column on this page in the EPANET documentation. This should probably be checked for when running the write_inp function to avoid confusions like this. Also, keep in mind that the unit option is meant to select the units of the output, not the input. WNTR is always SI so you don't need to specify that.

To match your original model you would want to set units="LPS". I ran the code this way, and the units look correct but the hydraulics are still different. Instead of recreating the model from scratch, which is likely introducing hard to detect errors, I suggest doing the following to create a WNTR model:

  1. Load proyecto 1.4. (cambio alturas).net into EPANET.
  2. Save the network as an inp file (file>export>network)
  3. Load this inp file into WNTR using the following command: wn = wntr.network.WaterNetworkModel("/path/to/inp_file.inp")
kaklise commented 5 months ago

Closed via #410