You are on page 1of 7

117 © IWA Publishing 2012 Water Science & Technology: Water Supply | 12.

1 | 2012

WaterNetGen: an EPANET extension for automatic water


distribution network models generation and pipe sizing
João Muranho, Ana Ferreira, Joaquim Sousa, Abel Gomes
and Alfeu Sá Marques

ABSTRACT
João Muranho (corresponding author)
This paper focuses on the generation of synthetic models of water distribution networks (WDN).
Alfeu Sá Marques
Models are widely used in many fields related with WDN planning and operation. Therefore, the main IMAR – Instituto do Mar,
Departamento de Eng. Civil,
contribution of this work is to provide an automatic procedure to build models with the well-known Faculdade de Ciências e Tecnologia da
Universidade de Coimbra,
EPANET tool in a manner that, with a small amount of input data and a few clicks, the user can build a Rua Luís Reis Santos – Pólo II da Universidade,
3030-788 Coimbra, Portugal
network topology and assign suitable pipe diameters. For that purpose, a new application, called
E-mail: muranho@mail.telepac.pt
WaterNetGen, was designed and implemented as an extension to the EPANET software.
Ana Ferreira
WaterNetGen can be used to generate synthetic models of WDN, with several hundred nodes and Departamento de Eng. Civil,
Escola Superior Tecnologia,
pipes, within a few minutes. The sizing capability allows the selection of commercial diameters, such Instituto Politécnico de Castelo Branco,
Avenida do Empresário,
that the final network design satisfies certain user-defined design constraints, like minimum 6000-767 Castelo Branco, Portugal
diameter, maximum velocity and minimum pressure. The total water demand is allocated to the Joaquim Sousa
Departamento de Eng. Civil,
pipes taking into account their length and a demand coefficient. The water demand of each pipe is
Instituto Superior de Engenharia de Coimbra,
then assigned to its start and end nodes and follows a specific demand pattern. Rua Pedro Nunes – Quinta da Nora,
3030-199 Coimbra, Portugal
Key words | EPANET, model generation, pipe sizing, water distribution networks, WaterNetGen
Abel Gomes
Instituto de Telecomunicações,
Universidade da Beira Interior,
Rua Marquês d’Ávila e Bolama,
6000-001 Covilhã, Portugal

INTRODUCTION

Mathematical models have been widely used in the planning repository to evaluate the effectiveness and efficiency of
and operation of water distribution networks (WDN): pipe new algorithms). The website of the Centre for Water Sys-
design (Savic & Walters ; Cunha & Sousa ; Maier tems at Exeter University (http://centres.exeter.ac.uk/
et al. ; Geem ), pump operation (McCormick & cws/) has several WDN models that can be downloaded
Powell ; Rao & Salomons ; López-Ibáñez et al. and used. A WDN model for a ‘virtual city’ is presented
), water quality studies (Rossman et al. ), and so in Brumbelow et al. (), where hydraulic analysis soft-
on. A model provides a mathematical framework for ware is combined with geographical information system
describing a particular system, which can be extremely (GIS) software to develop a model that can support
useful to identify and evaluate alternative scenarios for research in WDN and its interdependency with other
system planning and operation. infrastructures. The topography of the ‘virtual city’ is
The availability of public accessible repositories of defined in GIS, and is later used to generate the nodes’
WDN models with different sizes (number of nodes/ elevations of the WDN model. To evaluate the perform-
pipes) can be of great interest (for example, the research ance of WDN, Möderl et al. () generated models
community and software developers can use the using an algorithmic approach based on a modular

doi: 10.2166/ws.2011.121
118 J. Muranho et al. | An EPANET extension for WDN models generation and pipe sizing Water Science & Technology: Water Supply | 12.1 | 2012

design system that was developed as a MATLAB-tool, in METHODS


which networks have a grid-based structure described
by matrices (see Sitzenfrei et al. (), for further Model generation
developments).
A file format that is frequently used to create WDN models The model generation process proposed in this paper aims to
is the ‘.inp’ file, defined by Rossman () in EPANET. build synthetic models similar to real-world WDN models.
EPANET is an open-source software that enables extended The models can represent WDN of small dimension (few
period simulation of hydraulic and water quality behaviour hydraulic elements – nodes/pipes) or huge systems composed
within pressurized pipe networks to be performed. of several interconnected subsystems that supply residential dis-
Although repositories of WDN models are of great inter- tricts or industrial zones. The model generation process enables
est, this work presents a different approach to obtain models: the user to define the map dimensions, the number of clusters
automatically building them with the desired dimensions and (districts or zones), the number of junctions in each cluster, the
characteristics. The main goal is to produce models in the fra- heuristics underlying the pipe generation, and the base elevation
mework of the modelling tool without involving other tools and elevation change rate for node elevations generation.
(e.g., GIS, which requires expertise to set up). This type of The idea behind the creation of clusters is to mimic real-
model is very useful for testing software tools (e.g., tools for world systems which can be organized in several DMAs.
skeletonization, district metered areas (DMAs) design, resili- Each cluster is composed of a user-defined number of junc-
ence testing, pipe sizing, technical performance evaluation, tions, which are connected by pipes introduced by a user-
calibration, linear solvers, and so on) or for WDN operator defined pipe generation method. The elevation of each
training. The (synthetic) WDN models are generated in node is obtained from a ground generator procedure.
such a way that their pipes do not cross over themselves The pipe generation begins with the generation of a Mini-
(the graph of the network is planar – for further details mal Spanning Tree (MST) linking the cluster nodes, so every
about graph theory see (Gross & Yellen )). These node gets connected to its nearest node. This procedure is
synthetic models have not only the desired number of junc- based on the Prim () algorithm, with weights defined by
tions, but also pipes with suitable diameters. the Euclidian distance between nodes. Additional pipes are
Designing a WDN involves selecting sizes for its com- added to the graph according to one of the following available
ponents in terms of their technical viability, considering methods (K, X and Y are user-defined integer values; the dis-
for this purpose various aspects such as hydraulic par- tance between nodes is defined in geographic terms), and the
ameters, demand patterns, reliability, water quality and degree of a node is the number of pipes that start or end at
costs. Although WaterNetGen (Muranho et al. ) is not that node (i.e. the number of pipes connected to the node):
a WDN design package, it can select pipe diameters in
order to satisfy certain pressure and velocity constraints. 1. K-nearest Nodes. This algorithm finds the K-nearest neigh-
WaterNetGen maintains the original EPANET’s user- bours for every node. Some nodes may have a degree less
interface to preserve the user experience, although some than K because there are no more neighbours to connect
new work-oriented features have been introduced such as, (as the models correspond to a planar graph, the connec-
for example, node split, pipe split, link type replacement, tions may not be allowed because they cross over
node type replacement, and editing of group properties of existing links, or all neighbours already have a degree K );
selected pipes. Compatibility to the previous EPANET pro- 2. Random K-nearest Nodes. This method selects the K-
jects is assured at ‘.inp’ file level. nearest nodes with a degree less than K, and for each
The next section presents the synthetic model gener- of those a new connection is introduced if a randomly
ation process. Afterwards, the water demand loading generated number in [0, 1] is less than 0.5;
process and the pipe-sizing feature are described. Then, 3. Connect X from Y – after selecting the set of the Y nearest
some performance tests are shown and the conclusions nodes, this method chooses arbitrarily X of those nodes
are presented. to introduce new connections.
119 J. Muranho et al. | An EPANET extension for WDN models generation and pipe sizing Water Science & Technology: Water Supply | 12.1 | 2012

The selection of a pipe generation method depends on changing elements from imported models, such as those
the intended use for the model. The number of loops and obtained from CAD drawings.
branches is indirectly controlled by a user-defined percen-
tage of dead end nodes presented in the final model. Water demand loading
The clusters have the additional benefit of reducing the
cardinality of the search space for the process of finding Assigning water demand to nodes can be a tedious task,
neighbours. especially for networks with a great number of nodes. To
The elevations are generated taking into account the mitigate this, WaterNetGen assigns water demand coeffi-
junctions’ nearness. The computation of node elevations cients to pipes, and makes an automatic distribution of the
starts with the assignment of the base elevation to a node, average water demand. This approach follows from guide-
and then progressively computes the elevations of its lines used for demand loading in real-word WDN design.
linked nodes. The nodal elevation is computed based on The demand coefficients are used to transform the pipe
the average of the elevations of their neighbours plus a lengths into equivalent lengths that represent the density of
random value in the interval [!change rate, þchange rate]. the inhabitants supplied by those pipes. For example, if
The idea behind this procedure is to introduce some noise pipes p1 and p2 have the same length, and p1 and p2 have
in an otherwise flat surface: large values of change rate demand coefficients equal to 0.5 and 1.0, respectively,
give rise to hilly surfaces and small values produce almost then pipe p2 water demand will be double that of pipe p1.
flat surfaces. The water demand coefficient value is set in a new link prop-
erty of the model. The demand coefficient can be set on a
The generation process one-by-one basis or can be set at once to a set of selected
pipes.
The user has to decide whether each cluster has a tank or The total average water demand must take into account
not. If so, it is created near the highest elevated junction, the intended use for the model. For example, for pipe sizing
and its elevation equal is to the elevation of this node plus purposes, the total water demand must include not only the
some user-defined value. domestic water consumption, but also the water losses and
The generation of a network with N clusters starts with leaks, possibly combined with demand patterns that define
the division of the map space in a two dimensional matrix the way that water demand and water losses vary during
with N entries (or zones). Afterwards, the cluster elements the day.
(junctions, tanks and pipes) are created and the clusters After setting up the demand coefficients, and introdu-
are interconnected to produce a connected network. Each cing (user-defined) or computing (from the number of
cluster is linked to its neighbour’s clusters through their inhabitants and the per capita demand) the total average
nearest nodes. Finally, if the highest node of the WDN is water demand, the nodal demands are automatically
not connected to a tank, an additional tank is created and handled by WaterNetGen – each pipe demand is assigned
connected to this node. to its start and end nodes (50% for each) as new demand cat-
The user can manually add more elements to the model egories. Figure 1 illustrates this procedure, considering a
(junctions, pipes, tanks, reservoirs, valves). With the population of 10,000 inhabitants with a per capita demand
enhanced interface, the user can split nodes and pipes, equal to 200 L per day. The network has a total equivalent
and change the node type (junction tank, or reservoir) or pipe length of 4,050 m and must supply an average
the link type (pipe, valve or pump). The split of a pipe gen- demand of 23.148 L per second.
erates a new junction and a new pipe. The properties of the Each pipe has its own demand pattern (new link prop-
old and the new elements are adjusted: lengths of both pipes erty). Therefore, when the user changes a pipe demand
are set proportionally to the split point, and the elevation of pattern, its associated node demand categories are also
the new junction is also set proportionally. These new edit- updated. As usual, water demands for special users (e.g.,
ing capabilities are especially useful in the context of schools, hospitals) must be assigned to the respective nodes.
120 J. Muranho et al. | An EPANET extension for WDN models generation and pipe sizing Water Science & Technology: Water Supply | 12.1 | 2012

contributes with the same amount of water to the network.


The diameters of the remaining pipes (out of the tree) are set
equal to their minimum diameter.

Pipe diameter adjustment

The pipe diameters are changed based on one of two rules:


(1) the water velocity in the pipes must be below some maxi-
mum value; and (2) the pressure in the nodes must be above
some minimum value.
To adjust the diameters based on the maximum velocity,
the user must define a formula to evaluate the maximum
velocity allowed as a function of the pipe diameter: for
example V(D) ¼ 0.127D 0.4, where D stands for the pipe diam-
eter in millimetres and V is the maximum velocity allowed in

Figure 1 | Example network with 1 tank, 5 nodes and 7 pipes. (Pipe water demand
ms!1 (Sa Marques & Sousa ). In each step of the iterative
coefficients, equivalent lengths and demand categories.) procedure the EPANET’s hydraulic solver is used to evaluate
the pipe flows. The maximum velocity for each pipe is
Pipe sizing computed based on its diameter and the upstream flow
(remember that the upstream flow is equal to the EPANET
The pipe sizing is done on the top of a pipe catalogue that pipe flow plus 50% of the pipe water demand). The pipe diam-
lists the (commercial) available diameters. The pipe sizing eter is set to the smallest value that can carry the upstream
is an iterative procedure used to assign a commercial diam- flow without exceeding the maximum velocity allowed.
eter to each pipe in order to come up with a network design For sizing purposes, the minimum nodal pressure must
that fulfills certain constraints (e.g., minimum diameter, be associated to the number of storeys of the buildings.
maximum velocity and minimum pressure). The process The minimum nodal pressure allowed is evaluated by an
starts with a set of diameters that are iteratively adjusted user-editable formula: for example, P(N) ¼ 100 þ 40N,
towards the final solution. where N is the number of storeys above ground, and P is
the minimum pressure allowed in KPa. The minimum
Initial diameters pressure rule is computationally harder to satisfy. In the cur-
rent approach it is implemented as an iterative procedure in
The starting point of the pipe sizing process is the initial which each iteration comprises the following steps: (1) ident-
diameter assignment. Three approaches have been ify the node with the greatest minimum pressure constraint
implemented: (1) setting all diameters equal to some user- violation, i.e., the critical node, and the time step within
defined value; (2) setting the diameters based on the mini- which it occurs; (2) identify the shortest paths from the criti-
mum allowed diameter; and (3) setting the diameters cal node (and time step) to all sources (i.e., tanks and
based on the shortest path (Epp & Fowler ). In the reservoirs) – (a variation of the Epp & Fowler () algor-
latter approach, the algorithm starts by identifying the short- ithm is used to find the shortest path between two nodes. In
est paths from nodes to sources. The assignment of the current implementation, the search starts from the critical
diameters starts at the tree leafs and works backward until node and stops when all the nodes have been visited. The
all sources (i.e., tanks and reservoirs) are found, computing number of paths identified may be less than the number of
the flow (i.e., sum of all downstream consumptions) and sources because the flow direction may invalidate some
fixing the diameter of each visited pipe. When the network paths. Nevertheless, there exists at least one path connecting
has more than one source, it is assumed that each one the critical node to one source); and (3) upscale the diameter
121 J. Muranho et al. | An EPANET extension for WDN models generation and pipe sizing Water Science & Technology: Water Supply | 12.1 | 2012

of the pipe with the greatest unit head loss in each path. At of the clusters and choose the pipe generation method.
the beginning of each iteration the critical node is identified The program automatically sets the number of junctions
and, if it is different from the previous iteration, the list of per cluster but the user can change these values. By
paths is rebuilt. default, the clusters have no tank. This network was gen-
The combination of these two rules (for velocity and erated using the method ‘Random K-nearest Nodes’ (see
pressure) can quickly generate suitable pipe diameters. Model Generation section above) with a K ¼ 2 for pipe
Although in certain network configurations, mainly when generation.
there is a great variation in nodal elevations, the pipe diam- The program takes less than one minute to create the
eters of the paths from the critical node tend to continuously new network model. As can be seen in Figure 2, there are
increase, the user can control this growing process through three tanks (one more than the user has set). As pre-
the judicious use of the new EPANET pipe property ‘Allow viously stated, WaterNetGen always guarantees one tank
diameter changes’, so that the user can freeze the update near the highest elevation node (as cluster 6 has the high-
process for the selected set of pipes. est elevation node and had no tank assigned, an
The user can also make use of the improved EPANET additional tank was introduced near the highest node –
interface to split pipes and nodes, and easily insert pressure the tank on the right in Figure 2). The ground surface
reduction valves to avoid or prevent the pressure exceeding corresponding to the node elevations gives an idea of
the maximum value allowed. the network topography. The assignment of a base
elevation and an elevation change rate per cluster
allows the creation of models with multiple hills and
RESULTS AND DISCUSSION valleys.
Table 1 shows some performance results for models gen-
Figure 2 illustrates the generation of a synthetic model erated with different numbers of junctions and clusters,
with 1,000 junctions distributed by 6 clusters. Although where the pipes were generated by the ‘Random K-nearest
not strictly necessary, the user can change the parameters Nodes’ method with K ¼ 2.

Figure 2 | Water distribution network synthetic model (Clusters configuration, EPANET model and Ground surface).
122 J. Muranho et al. | An EPANET extension for WDN models generation and pipe sizing Water Science & Technology: Water Supply | 12.1 | 2012

Table 1 | Synthetic models with several configurations The use of clusters to represent, for example, metered
district areas, allows the construction of synthetic models
Junctions Clusters Pipes Generation time (s) Sizing time (s)
with features similar to real-world WDN models. The clus-
500 1 540 5 10
ters have the additional benefit of accelerating the model
1,000 1 1,078 26 17
construction (for the same number of junctions, models
1,000 2 1,075 13 17
with more clusters are generated faster).
5,000 2 5,397 809 13
Assigning the nodal water demand within WaterNetGen
5,000 4 5,397 237 9
is a relative easy task owing to the use of pipe demand coef-
5,000 10 5,418 137 97
ficients and pipe demand patterns, and the use of nodal
10,000 10 10,775 579 42
demand categories for its representation.
The sizing capability of WaterNetGen assigns suitable
In general, models with more junctions need more time. diameters to pipes such that the network satisfies certain
The sizing time includes the time to set up the initial diam- design constraints (minimum pressure and maximum
eters (all examples start with a small value for the diameter) velocity). The simplified design procedure used in Water-
and to obtain a final solution that satisfies the maximum vel- NetGen can be of great interest for the design of large WDN.
ocity and the minimum pressure constraints. The authors believe that this software can be very useful
In some cases it is not possible to find diameters that in building models to support research activities, as well as
satisfy both of these constraints. In such cases, user interven- in the development of WDN specific software.
tion is needed to add pumps (increase pressure), valves
(reduce pressure), or even to add additional tanks.
The use of clusters reduces substantially the execution ACKNOWLEDGEMENTS
time of the model generation procedure for the same
number of junctions. This happens because the generation This work has been produced with the partial support of the
of the MST is much faster for clusters with fewer nodes. Portuguese Foundation for Science and Technology,
The pipe generation methods included in WaterNetGen through POPH/FSE funding, under Doctoral Grant No.
are able to easily generate models with features close to SFRH/BD/48252/2008. The authors are grateful to the
real-world WDN models, with great variability (dimension, anonymous reviewers for their criticism and constructive
topology and topography) in a short amount of time. suggestions that undoubtedly helped to improve the paper.
Although WaterNetGen is not intended to be a WDN
design package, further research is currently being
conducted to compare its design results with those obtained AVAILABILITY
with optimization methods (Savic & Walters ; Cunha &
Sousa ; Maier et al. ; Geem ). WaterNetGen can be downloaded from www.dec.uc.pt/
~WaterNetGen.

CONCLUSIONS
REFERENCES

The EPANET extension presented here automatically gener-


Brumbelow, K., Torres, J., Guikema, S., Bristow, E. & Kanta, L.
ates and sizes synthetic WDN models. It is up the user to  Virtual cities for water distribution and infrastructure
define the number of clusters (districts/zones) and the system research. In: Proceedings of the World Environmental
number of junctions per cluster, to choose the pipe gener- and Water Resources Congress 2007: Restoring Our Natural
Habitat ASCE, Reston, VA.
ation method, and set the base values for junction
Cunha, M. C. & Sousa, J.  Water distribution network design
elevations. The generation of mid-size synthetic WDN optimization: a simulated annealing approach. Journal of
models is quite easy and takes only a few minutes. Water Resources Planning and Management 125 (4), 215–221.
123 J. Muranho et al. | An EPANET extension for WDN models generation and pipe sizing Water Science & Technology: Water Supply | 12.1 | 2012

Epp, R. & Fowler, A. G.  Efficient code for steady-state flows in Prim, R. C.  Shortest connection networks and some
networks. Journal of the Hydraulics Division 96 (HY1), 43–56. generalizations. The Bell System Technical Journal 36 (6),
Geem, Z. W.  Optimal cost design of water distribution 1389–1401.
networks using harmony search. Engineering Optimization Rao, Z. & Salomons, E.  Development of a real-time, near-
38 (3), 259–277. optimal control process for water-distribution networks.
Gross, J. L. & Yellen, J.  Graph Theory and its Applications, Journal of Hydroinformatics 9 (1), 25–38.
2nd edition. Chapman & Hall/CRC, Boca Raton, FL. Rossman, L. A.  EPANET Users Manual. Risk Management
López-Ibáñez, M., Prasad, T. D. & Paechter, B.  Ant colony Research Lab., U.S. Environmental Protection Agency,
optimization for optimal control of pumps in water Cincinnati, OH.
distribution networks. Journal of Water Resources Planning Rossman, L. A., Clark, R. M. & Grayman, W. M. 
and Management 134 (4), 337–346. Modeling chlorine residuals in drinking-water
Maier, H. R., Simpson, A. R., Zecchin, A. C., Foong, W. K., Phang, distribution systems. Journal of Environmental Engineering
K. Y., Seah, H. Y. & Tan, C. L.  Ant colony optimization 120 (4), 803–820.
for design of water distribution systems. Journal of Water Sá Marques, J. A. & Sousa, J. J.  Hidráulica Urbana: Sistemas
Resources Planning and Management 129 (3), 200–209. de Abastecimento de Água e de Drenagem de Águas
McCormick, G. & Powell, R. S.  Derivation of near-optimal pump Residuais (Urban Hydraulics: Water Supply and Wastewater
schedules for water distribution systems by simulated annealing. Drainage Systems). 2nd edition. Coimbra University Press,
Journal of the Operational Research Society 55, 728–736. Coimbra, Portugal.
Möderl, M., Fetz, T. & Rauch, W.  Stochastic approach for Savic, D. A. & Walters, G. A.  Genetic algorithms for the least-
performance evaluation regarding water distribution systems. cost design of water distribution networks. Journal of Water
Water Science and Technology 56 (9), 29–36. Resources Planning and Management 123 (2), 67–77.
Muranho, J., Ferreira, A., Sousa, J., Gomes, A. & Sá Marques, A. Sitzenfrei, R., Möderl, M. & Rauch, W.  Graph-based
 WaterNetGen Users Manual. Civil Engineering approach for generating virtual water distribution systems in
Department, Sciences and Technology Faculty, University of software VIBe. Water Science and Technology: Water Supply
Coimbra, Portugal. 10 (6), 923–932.

First received 13 April 2011; accepted in revised form 9 November 2011

You might also like