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: , , ,
Posted in EPANET related, Free software
14 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

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>