Change the name ID of each node


#1

Hi everyone
I have a network, I do not like naming nodes, and it’s not easy for me to work with them.

Is there any command in (epanet-matlab toolkit ) that I can automatically change the name ID of each node?
for example in my network, i have some node with node ID , j1,j2…,j1325,n1,n2,n3,t1,t2,r1,r2.
(I uploaded a part of the network)

i want to change all the name ID to 1,2,3,4,5,… respectively. I wanted to do this manually, but the number of nodes is very high and I want to do this automatically. How can i do this?

I have other question too

does anybody know wich command in toolkit, is useful for water age analysis?

Thank you so much
Best


#2

If it is one-off process, I suggest you do this by editing the INP file through an editor tool (e.g. Excel) which is very quick and you are able to name them with more flexibility in Excel spreadsheet


#3

Unfortunately I did not see a function for this job,
epanet api dont have EN_setlinkid and EN_setNodeid
im report t to epanet team
issue


#4

Thanks for your answer, can you explain more about editing the INP file through Excel . could you recommend a good source to me?

Thanks again!


#5

you must edit in epanet GUI
because if you set rule for nodes you must change all it
its better to change in epanet GUI


#6

You can just simply drag and drop the INP file in spreadsheet. With whatever technique (e.g. drag/drop), once opening the inp file in Excel, you should be able to see all entries in a separate cell. If not, you should covert this through DATA menu in Excel through “Text to Columns” button. This video is also als another way of opening INP/text file in Excel (https://youtu.be/37kwwEeFKvY). Finally, locate the node section in the spreadsheet and select those node IDs and change/convert to what you want and finally close the file and if it asks for saving the INP file, press Yes (You don’t need to change/save it with another extension or xls file).
Hope this helps,
Kourosh


#7

Another option is to use the epanetReader package for R.

This would allow you to:

net <- read.inp("my_network_file.inp") 
net$Junctions$ID <-   vector_of_new_names
write.inp(net, "my_updated_network_file.inp")

Care is needed after updating the Junction IDs because the above will not change the IDs in the other places where they appear in the inp file such as the [Pipes] table. You can use the merge() function to create a lookup from old to new IDs.


#8

Hello @linkhochon

You can download my tool ENRenameIDs
If it shows you an error, write me
It’s in Spanish, but it’s very intuitive

Regards


#9

Hi @Ovegas , Thanks a lot .

I downloaded it and had no errors,But I do not know how to use it.Unfortunately, I do not know Spanish.
Can you explain a little how can I use it ?

image

Thanks & Best


#10

Click on the button of the three points and look for the inp file of Epanet. Then the number of elements will be displayed. In tab 2 you can remove all the elements or groups. Finally click on the accept button. The resulting file is saved in the same directory as the original file


#11

Thanks again @Ovegas
I did what you said, But there is a problem. In my network, nodes are represented by j1, …, j334. And tanks with t1, …, t5, and reservior with r1, …, r3. when I removed the elements , the name ID of reservoirs, tanks are the same.
I mean, I have three 1. One represents a reservoir ,another represents a tank ,And the other is a node.
I want to have different name ID.
Is there any way that I can do this with your tool ?
d-town.inp (124.9 KB)
d-town_RenameID.inp (146.7 KB)

Capture

Best


#12

Epanet does not allow repeating an identifier by category (node and link)
Do not use prefix for the nodes and add a prefix “T” for the tanks (Depositos), and a prefix “R” for the reservoirs (Embalses)d-town_RenameID_Ovegas.inp (146,7 KB)