WaterNetGen – EPANET extension – pipe sizing

Update: following a comment by Joaquim Sousa, one of the developers of WaterNetGen, I have updated the post since it seems I made a mistake and didn’t use the right settings for the SA method – sorry.

A few months ago, researchers from Coimbra (Portugal) released the WaterNetGen program. WaterNetGen is a free EPANet extension to automatically build water distribution networks  synthetic models, do pipe sizing, compute technical performance indicators, and allowed demand-driven and pressure-driven simulations.

WaterNetGen is an extension of the EPANET 2.0 software (Rossman 2000) that preserves the user interface and allows the generation of synthetic water distribution network models (Muranho et al. 2012) and its sizing based on simple heuristics (Muranho et al. 2011). It also allows to perform least cost design, by using a Simulated Annealing algorithm, and pressure-driven analysis, a better suited approach to model pressure dependent consumption and leakage.

I have not tested all its feature but did try the pipe sizing option which uses the Simulated Annealing optimization method. The network I tested was the Hanoi water network benchmark.

WaterGenNet menus

First open the Hanoi INP file using WaterNetGen. Now open the ‘Pipe Catalogue’ from the WaterNetGen menu and enter the following data.

 WaterGenNet pipe catalog

 Now click CRTL-A to select all pipes (nice) , right click on the map to select the ‘Pipe Type’

Choose the only available option (1 – 1):

WaterGenNet pipe type

Now fire up the ‘Pipe Sizing’ screen and set the values marked in red. Check the ‘Set Initial Diameters’ option, select  ‘Set to Max from Catalog’ and click the ‘Run’ button. This will set all pipes diameters to 1,016mm. I’m not sure why the minimum pressure is to be set in kPa and not meters or feet but 294Pa are about 30 meters. Also set the maximum pressure to a high value since the Hanoi problem does not have a maximum pressure constraint. The same goes for the velocity constraints – set the minmum value to 0.00001 and the maximum to 10.

 Last thing to do is set the ‘Generator Seed’ to 1 for the SA method:

Now click the ‘Run’ button and wait:


The solution cost is 6,081,115 which is around the range of previous published results. For example, WaterIng came up with a solution of 6,100,000. The optimized file is here but please note that it can be opened only with WaterNetGen and not the regular EPANet version.

I will try to evaluate the other WaterNetGen features in the near future.

Tagged with: , , ,
23 comments on “WaterNetGen – EPANET extension – pipe sizing
  1. Joaquim Sousa says:

    Thank you Elad.
    The Simulated Annealing (SA)is a heuristic (like Genetic Algorithms) that depend much on the parameters it uses.
    With a good set of parameters (starting temperature, cooling schedule and stop criterion) it is able to produce excelent solutions (but it may consume a lot of time).
    For exampel, in my PhD (with the algorithm I have created implemented in a specific application I have developed)SA was able to find solutions a little below 6,100,000 in about 30 seconds on a desktop computer. I have found solutions for all the examples I have found in the literature with the same cost or even a little lower. But for example, to solve the complete original Anytown network it took about four hours and found solutions quite better than those published before.
    If you want to find excelent solutions you must know very well the SA algorithm and how it works to give it the best set of parameters. The solution implemented in WaterNetGEN is ment to give allways what we call “good solutions” even for those that don’t know SA. I’m not sure we have avhieve it, experience will tell. Thats why we want to share it with everybody and receive feedback to improve it with sugestions people may give.

  2. Joaquim Sousa says:

    The SA algorithm has been used in many research projects and you can find some results in these publications:
    Cunha, M.C., e Sousa, J.J.O. (1999). “Water distribution network design optimization: Simulated Annealing approach.” Journal of Water Resources Planning and Management, ASCE, Vol. 125, No. 4, pp. 215-221.
    Cunha, M.C., e Sousa, J. (2001). “Hydraulic infrastructures design using Simulated Annealing.” Journal of Infrastructure Systems, ASCE, Vol. 7, No. 1, pp. 32-39.
    Sousa, J., Ribeiro, A., Cunha, M.C., e Antunes, A. (2002). “An optimization approach to wastewater systems planning at regional level.” Journal of Hydroinformatics, Vol. 4, No. 2, pp. 115-123.
    Haddad, N., Sousa, J., Cunha, M., e Moussa, M. (2003). “Computation and optimization of the water distribution networks of Kairouan City.” Houille Blanche – Revue Internationale de l’Eau, 6, pp. 58-62.
    Cunha, M.C., Sousa, J. (2010). “Robust Gomes, R., Sá Marques, A., Sousa, J. (2011). “Estimation of the benefits yielded by pressure management in water distribution systems.” Urban Water Journal, Vol. 8, No. 2, pp. 65–77.
    Gomes, R., Sá Marques, A., Sousa, J. (2011). “Estimation of the benefits yielded by pressure management in water distribution systems.” Urban Water Journal, Vol. 8, No. 2, pp. 65–77.

  3. Joaquim,
    Thanks for the info. As you wrote, these are good results even when I used the default SA settings.
    If you managed to run the AnyTown network why don’t you try the new battle:

    Are you going to release the source code of WaterNetGen?

  4. Joaquim Sousa says:

    Now I see you didn’t use the SA algorithm, you selected “Minimum Pressure” wich is a simplified procedure we have implemented to produce quick good designs (as you concluded) that satisfy the minimum pressure constraints. There is no optimization in this option, only some empirical design heuristics we have conceived.
    To design by SA you must select “Simulated Annealing” and the design will be performed by the SA algorithm considering all the velocity an pressure constraints (minimum and maximum) simultaneously.
    The minimum pressure in kPa is due to the Portuguese standards (the kPa value is converted in m). But if you want to maintain the original hanoi minimum pressure constraint you should consider 294 kPa (30 m) instead of 304 kPa (31 m). You should also change the velocity constraints (introduce 10 m/s for the maximum and 0.000001 m/s for the minimum) because these constraints don’t exist in the original Hanoi problem.
    Sugestion: start by “Set Initial Diameters” and “Pre-sizing Heuristic = Set to Max. from Catalog” and Run. After this perform the design by using Simulated Annealing (in “Configure SA”,use “Generator Seed” = 1.
    With these values probably you will obtain a better solution. The solution I have found is 6,081,115 (admissible).

  5. Joaquim Sousa says:

    WaterNetGen was developed by several researchers (I am only one from the group).
    By now, we all wish to share the use of WaterNetGen with the international community.
    We never wonder about to release the source code.
    First we would like to try it hardly and afterwards who knows?

  6. Joaquim – I have updated the post to use SA.

    Last year I wrote a post about the future of EPANet:
    Your code could be a step in the right way 🙂

  7. Joaquim Sousa says:

    Thank you Elad!

  8. Rolly Jamero says:

    Just looking for a software that i might be interested to use in my design of water distribution network

  9. Andjelko Topalovic says:

    I am a engineer who in his practice uses EPANET 2. My colleague has sent me to your site and I hope you will help me by sending this precious upgrade of EPANET. Best regards and best wishes in future work and life.

  10. moufdi says:

    About “WaterNetGen” – documentation in french ?


  11. Matan Maskit says:

    Hi there:)
    T downloaded yesterday the extension, it looks great and very usefull. I’m tryong to modeling Leakge in the pipes and I have few questions about it:

    1. I inserted leakage coefficients and exponent in the pipe menu (e.g 10^-7, 1.18) – but no Leakage is reflected in the results. What could be the reason?

    2. How has the pipe-leakage been modeled in the program? Does it by (BLP^a)? (B=Leakage coefficient, L=pipe Length, P=average pressure in the pipe, a=exponenet cofficient)

    3. How/where can i see the total Leakage in the system?

    4. Last question – Is the extension could be either connected with Mathlab?

    Thanks, Matan Maskit from the technion, Israel

    • Hi Matan Maskit,

      Sorry for the late reply.

      There is available a new WaterNetGen upgrade that deals with pipe leakages.

      Short answers to your questions:
      1) Select PDA mode (that is, click the PDA button) and set the leakage parameters (clik “PDA properties” button and accept the defaults);


      3)The new version allows to see desired results as a table/graph or at the map interface as a property of the pipes/nodes.

      4) The EPANET DLL was modified a lot, so in theory it is possible but requires a guided tour (if you inspect the .inp file, you see a lot of new data for WaterNetGen).


  12. slv says:

    can u pls tell me from where i can download WaterNetGen.

  13. Frank says:

    hi I am very new in the use of Simulated annealing in Waternetgen but i love the idea of automatically selecting optimal pipe sizes in EPANET.
    can somebody explain to me in simple terms what the various parameters in the SA used in waternetgen means.
    eg Elasticity,Generator seed,increase probability,%acceptance, cooling rate,stop criterion,service levels etc.

    i would be very grateful

    • Ankit Man Shrestha says:

      Frank..did you get the reply?? if yes plz do send the answer as well..i would be very much thankful..my email “ankitmansth@gmail.com”

  14. Navid says:

    Hi. I am a BS student working on water distribution networks for my thesis. can anyone please answer this question I have had for a long time?
    I have checked many codes, articles and software for water distribution design. but in none of them has taken into account the minimum velocity limit. I am wondering how is that reasonable? since low velocity (below 0.3 m/s) would cause serious problems due to sedimentation.

  15. Ankit Man Shrestha says:

    I am known to this software since jst a week……i felt grt to find this software….it does lots of amazing and useful things…but my problem is same as stated above my Frank….””can somebody explain to me in simple terms what the various parameters in the SA used in waternetgen means…eg Elasticity,Generator seed,increase probability,%acceptance, cooling rate,stop criterion,service levels etc”….at last thanks a lot and salute to the creator of this software…

  16. Bipul Das says:

    Hi , i have been using epanet basic version for pipe sizing . now i got this extension and know it is very useful . i have tried the steps shown above but the resulting pressure at nodes always negative. Do you know what should be the reason . whats are other considerations to be taken while designing with PDA .. Its rather very Useful software… plz Help me getting this done . Thank you .

  17. Hamza says:

    how can i adjust the pipe diameters in epanet so that the pressure on each node is between 14-18 m considering the flow units in lps.
    anyone help please


    Hi there.
    I have a problem assigning the demand through PDA and DDA in WaterNetGen. I do not understand how to define the variables of the principle that the program uses.
    Thank you very much for your help.


      * P_mín≤ P_disponible < P_crítico
      Q_demanda= Q_requrido×((P_disponible-P_mín)/(P_crítico-P_mín ))^exp

      * P_disponible≥P_crítico

      * P_disponible<P_min

  19. victor ortiz says:

    Hello, I am a student of mechanical engineering, I would like to download the waternetgen extension but I could not, it would be possible for you to provide it to me, I want to do my degree work explaining the applications and scope of this wonderful program.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.