México a de 20

**INSTITUTO TECNOLÓGICO Y DE ESTUDIOS SUPERIORES DE **
**MONTERREY **

PRESENTE.-Por medio de la presente hago constar que soy autor y titular de la obra denominada

, en los sucesivo LA OBRA, en virtud de lo cual autorizo a el Instituto Tecnológico y de Estudios Superiores de Monterrey (EL INSTITUTO) para que efectúe la divulgación, publicación, comunicación pública, distribución, distribución pública y reproducción, así como la digitalización de la misma, con fines académicos o propios al objeto de EL INSTITUTO, dentro del círculo de la comunidad del Tecnológico de Monterrey.

El Instituto se compromete a respetar en todo momento mi autoría y a otorgarme el crédito correspondiente en todas las actividades mencionadas anteriormente de la obra.

De la misma manera, manifiesto que el contenido académico, literario, la edición y en general cualquier parte de LA OBRA son de mi entera responsabilidad, por lo que deslindo a EL INSTITUTO por cualquier violación a los derechos de autor y/o propiedad intelectual y/o cualquier responsabilidad relacionada con la OBRA que cometa el suscrito frente a terceros.

### Multi-Leak Detection with Wavelet Analysis of Pressure

### Sensitivities in Water Distribution Networks-Edición Única

### Title

### Multi-Leak Detection with Wavelet Analysis of Pressure

### Sensitivities in Water Distribution Networks-Edición Única

### Authors

### Claudia Deniss Escalera Avitia

### Affiliation

### Tecnológico de Monterrey, Campus Monterrey

### Issue Date

### 2011-12-01

### Item type

### Tesis

### Rights

### Open Access

### Downloaded

### 18-Jan-2017 13:09:44

**INSTITUTO TECNOLÓGICO Y DE ESTUDIOS **

**SUPERIORES DE MONTERREY **

**MONTERREY CAMPUS **

**GRADUATE PROGRAM IN MECHATRONICS AND **

**INFORMATION TECHNOLOGIES **

**TEC de Monterrey **

**DEL SISTEMA TECN OLÓGICO DE MONTERREY**

**MULTI-LEAK DETECTION WITH WAVELET ANALYSIS **

**OF PRESSURE SENSITIVITIES IN WATER **

**DISTRIBUTION NETWORKS **

**THESIS **

**PRESENTED AS A PARTIAL FULFILLMENT OF THE **

**REQUIREMENTS FOR THE DEGREE OF: **

**MASTER OF SCIENCE IN AUTOMATION **

B Y

**CLAUDIA DENISS ESCALERA AVITIA **

INSTITUTO TECNOLÓGICO Y DE ESTUDIOS SUPERIORES DE MONTERREY MONTERREY CAMPUS

GRADUATE PROGRAM IN MECHATRONICS AND INFORMATION TECHNOLOGIES

**TECN OLÓGI CO **

**DE M ONTERREY **

**MULTI-LEAK DETECTION WITH WAVELET ANALYSIS OF PRESSURE **
**SENSITIVITIES IN WATER DISTRIBUTION NETWORKS **

**THESIS **

PRESENTED AS A PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE

DEGREE OF:

MASTER OF SCIENCE IN AUTOMATION

BY:

CLAUDIA DENISS ESCALERA AVITIA

**INSTITUTO TECNOLÓGICO DE ESTUDIOS SUPERIORES DE MONTERREY **

SCHOOL OF ENGINEERING A N D INFORMATION TECHNOLOGIES

**GRADUATE PROGRAM IN MECHATRONICS AND **
**INFORMATION TECHNOLOGIES **

The members of the thesis committee hereby approve the thesis of*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA B.S. Claudia *

*Deniss Escalera Avitia* as a partial fulfillment of the requirements for the degree of Master

of Science in Automation.

**Thesis Committee: **

PhD. Luis Eduardo Garza Castañon

PhD. Adriana Vargas Martinez

Synodal

M.C. Luis Rosas Cobos

Synodal

Director of the Masters of Science in Electronics and Automation

December 2011

**MULTI-LEAK DETECTION WITH WAVELET ANALYSIS OF **

**PRESSURE SENSITIVITIES IN WATER DISTRIBUTION NETWORKS **

B Y :

CLAUDIA DENISS ESCALERA AVITIA

**THESIS **

Presented to the Graduate Program in Mechatronics And Information Technologies

This Thesis is a partial requirement for the degree of Master of Science in

Automation

INSTITUTO TECNOLÓGICO Y DE ESTUDIOS

SUPERIORES DE MONTERREY

* To my parents Norma and Fernando whom I love and admire very much. *zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA

**ACKNOWLEDGEMENTS **

The realization of this work was only possible due to the several people's collaboration, to

which I desire to express my gratefulness.

To Dr. Luis Eduardo Garza, my advisor, for the continuous support, for his patience,

motivation, enthusiasm, and great knowledge. His guidance helped me in all the time

during the research and writing of this thesis. Without his help, this work would not be

possible.

Besides my advisor, I would like to thank the rest of my thesis committee: PhD. Adriana

Vargas Martinez and M.C. Luis Rosas Cobos for their encouragement and valuable

comments.

My sincere thanks also goes to Dr. Francisco Palomera for offering me this job which have

gave me a lot of opportunities and I have enjoyed so much.

I am grateful to my colleagues and coworkers, Luis Enrique, Andres, Angelo, Gabriel,

Denisse, Carlos M . , Jorge N . , Mario, Alberto, Jesus, Mariana, Claudia, Amparo, Juan,

Eduardo and Antonio, for the encouragement, advices, and suggestions; and for the friendship that always demonstrated along these months of realization of this work.

I would also like to thank to Ernesto whom has been there since the beginning always by

my side, inspiration in many ways.

Finally, I would like to thank to my parents and my brothers, their love gave me forces to

**ABSTRACT **

Leak detection becomes an important issue for managers of water supply networks.

They need to detect quickly all the unexpected events that could occur in the network, such as leakages, damage, or sensor malfunction. The cost of water is increasing; therefore loss

of water by leaks must be reduced because damages are often expensive. In most water

distribution networks, a large percentage of water is lost in transit from treatments units to

consumers. Around 25% of production is lost or unaccounted due to several causes but

mainly leakages, false measurements errors, public usage such as fire-fighting, earthquakes

and sometimes severely cold weather.

Most of the research until now proposes several methods for leak detection,

considering only one leak in the system. In this work, detection of several leaks is

proposed, using an extended horizon analysis of pressure sensitivities. The proposed

method is a combination of different detection methods, such as pressure sensitivities

matrix, wavelet analysis, phase-quadrant demodulation code, and finally a weighting and

voting system. This approach is tested in simulations for two different networks; a network

with high consumption, Hanoi network, and a larger network, Quebra. Simulation results showed that in presence of two leaks, the detection of these two leaks is around 80%,

detecting the leak node or one of the neighbors nodes around, and of 95% detecting the leak

node or the second order neighbors nodes, being these the neighbors of the neighbors; in

presence of three leaks, the detection of the three leaks is around 97% detecting the leak

node or the second order neighbors nodes. Extensive simulations were realized for each of

the water networks to validate the algorithm performance.

**INDEX **

**A C K N O W L E D G E M E N T S 6 **

**A B S T R A C T 7 **

**I N D E X 8 **

**F I G U R E I N D E X 10 **

**T A B L E I N D E X 11 **

**T A B L E O F S Y M B O L S 12 **

**T A B L E O F A B B R E V I A T I O N S 13 **

**1 I N T R O D U C T I O N 14 **

**1.1 O B J E C T I V E OF T H E THESIS 15 **

**1.2 HYPOTHESIS 15 **
**1.3 S C O P E 16 **
**1.4 R E S U L T S A N D ORIGINAL CONTRIBUTIONS 16 **

**1.5 C H A P T E R ORGANIZATION 16 **

**2 L I T E R A T U R E R E V I E W 18 **

**3 T H E O R E T I C A L F R A M E W O R K 22 **

**3.1****zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA**** MATHEMATICAL MODELING**** 23 **

**3.2**** WAVELET ANALYSIS**** 24 **

**3.2.1 What is a wavelet system? 24 ****3.2.2 Continuous Wavelet Transform 25 **

**3.2.3 Scaling 25 ****3.2.4 Complex Shannon Wavelets 26 **

**3.2.5 Why is a wavelet analysis effective? 27 **

**3.3 P H A S E - Q U A D R A N T D E M O D U L A T I O N C O D E 27 **

**4 E P A N E T 2 9 **

**4.1 DESCRIPTION 3 0 **
**4.2 P R O G R A M M E R ' S T O O L K I T 3 0 **

**4.3 How T O USE E P A N E T 31 **

**4.3.1 Steps in Using EPANET 31 **

**4.4 N E T W O R K M O D E L IN E P A N E T 31 **

**4.4.1 Physical Components 31 ****4.4.2 Non-Physical Components 35 **

**4.5 FUNCTIONS IN E P A N E T 3 6 **

**4.5.1 Project Setup 36 ****4.5.2 Setting Map Options 37 ****4.5.3 Constructing a Network Model 37 **

**4.5.4 Setting Properties 38 ****4.5.5 Adding a Pump Curve 40 ****4.5.6 Saving and Exporting Projects 40 ****4.5.7 Running an Extended Period Simulation 40 **

**5.1 M E T H O D O L O G Y 42 **

**5.1.1 Sensitivity matrix algorithm 43 ****5.1.2 Angle between vectors method 46 ****5.1.3 Wavelet Analysis Method 46 **

**5.1.4 Leak isolation 48 ****5.1.5 Multiple leak isolation method 50 **

**5.2 DESCRIPTION OF W A T E R N E T W O R K S FOR T H E EXPERIMENTS 54 **

**5.2.1 Hanoi network 54 ****5.2.2 Quebra Network 64 **

**5.3 E X P E R I M E N T S A N D R E S U L T S 74 **

**5.3.1 Applications of the methods to the networks 74 **

**5.3.2 Hanoi Results 76 **

**5.3.3 Quebra Results**** 77 **

**5.3.4 Results Interpretation 78 **

**6 C O N C L U S I O N S 81 **

**6.1**** METHODS ANALYSIS**** 81 **

**6.2**** FUTURE WORK**** 82 **

**7 A P P E N D I X 83 **

**7.1 A P P E N D I X A : M A T L A B F I L E S 83 **

**7.1.1 Leak Isolation (Main Program) 83 ****7.1.2 Sensitivities Matrices Generation 87 ****7.1.3 Binary Matrices Generation 92 ****7.1.4 Leak isolation Wavelet Analysis and Angle between vector method 94 **

**7.1.5 Multiple leak isolation. Residues Generation 101 ****7.1.6 Multiple leak isolation, indexes selection 104 **

**7.1.7 HANOI neighbors 107 ****7.1.8 Multiple Leak Isolation, Voting And Grading 108 **

**Figure Index **

**Figure 1.**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Wavelet 24

**Figure 2.** Wavelet Transform 25

**Figure 3.** Scaling 26

**Figure 4.** Complex Shannon Wavelet 0.5-1 27

**Figure 5.** Phase Demodulation process (Daugman, 2004) 28

**Figure 6.** Physical Components in a Water Distribution System 32

**Figure 7.** Water Distribution Network 36

**Figure 8.** Property Editor 38

**Figure 9.** Block diagram of detection, isolation and estimation of leaks in a WDS 43
**Figure 10.** Algorithm for the Leak Isolation Process with Wavelet Analysis 49

**Figure 11.** Multiple Leak Isolation Process 53

**Figure 12.** Hanoi network 54

**Figure 13.** Hanoi Demand Pattern 56

**Figure 14.** Sensitivity matrix considering a leak in the 15th

node, Hanoi Network 57
**Figure 15.** Sensitivity matrix at the hour of highest consume, Hanoi network 57

**Figure 16.** Residues at node 15 59

**Figure 17.** Angle between vectors, simulating leak 15 59

**Figure 18.** Wavelet Analysis for node 15 at the hour of highest consume 60
**Figure 19.** Binary matrix of the leak in node 15 at the hour of highest consume 60

**Figure 20.** Wavelet analysis simulating leak at node 15 61

**Figure 21.** Multiple leak detection Hanoi network 63

**Figure 22.** Quebra network 64

**Figure 23.** Quebra Demand Pattern 67

**Figure 24.** Sensitivity matrix considering a leak in the 34t h

node, Quebra Network 68
**Figure 25.** Sensitivity matrix at the hour of highest consume, Quebra network 68

**Figure 26.** Residues at node 34 69

**Figure 27.** Angle between vectors, simulating leak 34 70

**Figure 28.** Wavelet Analysis for node 34 at the hour of highest consume 71
**Figure 29.** Binary matrix of the leak in node 15 at the hour of highest consume 71

**Figure 30.** Wavelet analysis simulating leak at node 34 72

**Table Index **

**Table 1.**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Symbols 12

**Table 2.** Abbreviations 13

**Table 3** Summary of research in the area of Leak Detection in Water Distribution Networks
21

**Table 4.** Node Properties 39

**Table 5.** Link Properties 39

**Table 6.** Setup parameters for the Hanoi network 55

**Table 7.** Setup parameters for the Quebra network 66

**Table 8.** Comparison of the Angle between vectors method versus the Wavelet Analysis

method in the Hanoi network with 1 leak simulated 76
**Table 9.** Leak identification for the different scenarios of leaks for the Hanoi network with

2 leaks simulated 76
**Table 10.** Leak identification for the different scenarios of leaks for the Hanoi network

with 3 leaks simulated 76
**Table 11.** Comparison of the Angle between vectors method versus the Wavelet Analysis

method in the Quebra network with 1 leak simulated 77
**Table 12.** Leak identification for the different scenarios of leaks for the Quebra network

with 2 leaks simulated 77
**Table 13.** Leak identification for the different scenarios of leaks for the Quebra network

**Table of Symbols **

* p * Nominal Pressures Matrix

*n * Number of Nodes in the Network

*m * Number of Samples

* P a * Current Pressures Matrix

*B * Pressures Residues

Pressures of Current Residues

*l * Leak Magnitude in liters per second

* s * Sensitivity Matrix

*Sa * Sensitivity Matrix of the current leak

*a * Angle between Vectors

* a_{h t e }* Angle between Vectors along the time horizon

a Wavelet Scale

*fc * Wavelet center frequency

*fb * Wavelet bandwidth

C Complex Wavelet coefficient

Cs Complex Wavelet Matrix of S

*Csa * Complex Wavelet Matrix of* Sa *

Csb Binarized Matrix of Cs

CM Comparison Matrix

*h * Number of proposed intervals of leak magnitude

*nindex * Neighbors nodes for each node

* V * Number of neighbors for each specific node

* o h + 1, n * Number of occurrences of the node n in the column

*h +*1 from the matrix IC

*gh*Grade obtained of the node

**+1,n***n*in row h+1

Head loss (length)

q Flow rate (volume/time) A Resistance coefficient

B Flow exponent

**Table of Abbreviations **

D M A District Metered Area
WDS Water Distribution System

IC Comparison Index

X O R Exclusive OR

**1 INTRODUCTION **

Earth's surface consist of 70% water, but the 97.5% of water on Earth is salty water,

while from the rest 2.5% of fresh water, over two thirds is frozen in glaciers an polar ice caps. The remaining unfrozen fresh water is mainly found as groundwater, with only a

small fraction present above ground or in the air. Fresh water is a renewable resource although the world's supply of clean, fresh water is steadily decreasing. Water demand

exceeds the one supplied in many parts of the world. With the increase of the population at an unprecedented rate, the increase of the supply needs from the industry, the agriculture

and the farming, many more areas are expected to experience this imbalance in the near future.

In most water distribution networks, a large percentage of the water is lost in transit from treatment units to consumers. Typically around 25% of production is lost or

unaccounted due to several causes but mainly leakages, false measurement errors, public usage such as fire-fighting, earthquakes and sometime severely cold weather (Ragot &

Maquin, 2006).

The distribution system (in urban areas or strategically important trunk mains) is

subdivided into discrete zones or district meter areas (DMA), by the permanent closure of valves. A D M A will generally comprise 500-3000 properties. Flow (and sometimes

pressure) sensors are placed on the D M A boundaries and the collected data is subsequently

analyzed for leakage trends. The most popular operational use of in flow data is the analysis

of measured minimum night flows. Night flows (usually measured between midnight and

5:00 am) are used because water use is at a minimum and is easier to identify and subtract

absence of any other factors. If leakage has increased sufficiently then further investigation

is needed to find the location of leaks (Mounce, 2003).

Most of the research until today shows different leak detection methods, assuming

only one leak present in the network. This can be considered as ideal because is most likely

that multiple leaks are present at the same time in a big network being that the main reason

to address this problem in this research.

**1.1 Objective of the thesis **

The main objective of the thesis is to develop a methodology for the detection of multiple leaks based on the wavelet analysis of the pressure residues in a Water

Distribution System.

The specific objectives are:

1. To update the state of the art concerning to leak detection, and multiple leak

detection in a Water Distribution System.

2. To generate a leak detection scenario of a Water Network, with which is possible to

generate the necessary pressure data, assuring its reliability with the help of

EPANET.

3. To develop a detection method based on the pressure data.

4. To implement the algorithm of detection based in a Wavelet Analysis.

5. To validate the obtained results.

6. To compare results with the angle between vectors method, proposed in (Casillas,

2012).

**1.2 Hypothesis **

The base hypothesis in this thesis is that is possible to detect multiple leaks in a

Water Distribution Network taking as raw data the pressure in all the nodes of the same.

The data will be obtained through simulations of a network in the presence of leaks and in

**1.3 Scope **

The scope of this work is the implementation and validation of the proposed

algorithm, in simulated scenarios of a Water Distribution Network, in order to detect from

small leaks to larger leaks, in presence of one, two and three leaks at the same time and

with different magnitude sizes.

**1.4 Results and original contributions **

The main original contributions of this work are:

• The implementation and validation of a method that detects multiple leaks in Water

Distribution Systems.

• The detection of leaks in water distribution systems using Wavelet Analysis, and

subsequent phase-quadrant demodulation code.

**1.5 Chapter organization **

This thesis consists of 6 chapters:

**Chapter 2: Literature Review **

In this chapter a review of the work developed until now concerning the leak detection in

Water Distribution Systems is presented. The level of research is stated and a comparison

between the works, presented in the last years, is realized.

**Chapter 3: Theoretical Framework **

In this chapter the basic definitions are given to understand this research. Concepts as

**Chapter 4: EPANET **

This chapter describes the software EPANET, base of the simulations performed in this thesis, answering questions such as: What is EPANET capable of? How to use EPANET?

How does EPANET works?

**Chapter 5: Experimentation **

In this chapter the methodology is described, the experiments to be implemented are

proposed, the water networks Hanoi and Quebra are described and all the experiments and

results are presented.

**Chapter 6: Conclusions **

In this chapter the interpretation and qualification of the results of this investigation and the

**2 LITERATURE REVIEW **

The analysis of Distribution Water Networks has been a research topic since the

decade of 1970's, with the work of (Sato, 1975), where he proposes the use of channel

identification of blind spots, even when leak detection is not applied yet. In the 90's

(Liggett 1992) develop a leak detection method for pipe lines by applying the inverse

problem, using pressure and flow measurements. In this work assumptions of the orifice of

the leak in the pipe line must be done. Nevertheless the interest for leak detection since the year 2000 has grown with different publications; below a brief description of these

researches is done, and after that, Table 3 presents a summary of the research in the area of

Leak Detection in Water Distribution Networks.

In (Yang, Wen, & Li, 2008) a method to identify leaks is proposed using blind spots

based on previously leak detection researches that uses the analysis of acoustic and

vibrations signals (Fuchs & Riehle, 1991) models of buried pipelines to predict wave

velocities (Muggleton, Brennan, & Pinnington, 2002).

In (Mashford, 2009), a method to locate leaks is presented using Support Vector

Machines (SVM). This research presents a method to analyze data obtained by a set of

pressure control sensors of a pipeline network to locate and calculate the size of the leak. In

(Covas & Ramos, 2001), a method to detect and locate leaks based on the transitory inverse

analysis is presented. The main idea of this methodology is the identification of the location

of leaks in a network based on the pressure observed data collected during the occurrence

of the transitory events and the minimization of the difference of the observed and calculated parameters. In (Ragot & Maquin, 2006), a technique to isolate leaks using fuzzy

measurements (no fault presence) and the faulty measurements. In (Blesa et al., 2010),

model estimation with L P V systems and zonotopes, and leak detection with residual

analysis are introduced and tested in a small water network. In (Perez R. a., 2011), a

method that uses pressure measurements and the sensitivity residuals is presented. In this

methodology, first a model free of leaks is obtained offline and then the residuals are

analyzed on-line against a proposed threshold. If any inconsistency is found, an analysis to

detect and isolate the leaks begins using an established mapping. Although this approach

has good efficiency under ideal conditions, its performance is diminished with changes in

demand and noise in measurements. In (Casillas, 2012) an extended-horizon analysis of pressure sensitivities and residuals is performed introducing adequate isolation algorithms

to locate the leaks; also a comparison between different leak detection methods is done,

presenting the Angle between Vectors method as the best one, even when good results were

obtained, it was only for simple leaks and moderate noise.

As mentioned in the investigation above, there has been many and different ways to

address the problem of leak detection, having each method its advantages and

disadvantages. The research done untill today it is mainly focused to detect one leak in WDS, and detect multiple leaks in smaller systems with few nodes. The next work will

propose a new methodology to address the problem of leaks detection in a Water

Distribution Network; which address the detection of multiple leaks, and will prove the

effectiveness detecting multiple leaks, by identifying the node containing the leak or some

**SUM M ARY OF RESEARCH IN THE AREA OF LEAK DETECTION IN WATER DISTRIBUTION NETWORKS **

**YEAR ** **AUTOR ** **APPLICATION **

**CHARACTERISTICS ** **ADVANTAGES ** **DISADVANTAGES ** **REF. **

2 0 1 1 Vi o l et a Casillas, Luis Garza

Leak d et ect i on using an ext end ed t i m e hori zon analysis o f p ressure sensi t i vi t i es.

Present s a co m p a ri so n b et ween

d i f f erent m et hod s b ased on p ressure

sensi t i vi t i es

It was i m p l em en t ed f o r single l eaks. Perf orm ance is d i m i ni shed wi t h noise

in d em a n d and m easurem ent s.

(Casillas, 2 0 1 2 )

2 0 1 0 Ram on Perez, Vicenc. Pui g, et a l .

Det ect i on by b i nari zat i on o f sensi t i vi t i es and resi d ue m at ri ces. Op t i m a l l ocat i on of m easurem ent sensors.

The use of sensi t i vi t i es in t he

nod es based o n changes in p ressure is

p resent ed

The t hreshol d sel ect i on is d i ffi cul t and a d et erm i n a n t f act or f or

t he d et ect i o n . Im p l em ent ed just f or

single leaks.

(Perez, Pui g, Pascual , Qu eved o , Land eros, &

Peral t a, 2 0 1 0 )

2 0 1 0

J. Gert l er, J. Ro m era , V. Pui g and J. Qu eved o

Leak l ocat i on usi ng Pri nci p al Co m p o n en t s

Anal ysi s.

It uses a st ruct ural resi d ue d esi gn, and m anages t o d et ect

t wo leaks.

Is l i m i t ed by t he use of PCA, b ecause is not

ad eq uat e f o r large net work s. Test ed wi t h

sm al l net work s.

(Gert l er, Ro m era , Pui g, & Qu eved o ,

2 0 1 0 )

2 0 0 9

M . Tab esh, A. H. Asad i yani Yek t a,

R. Burrows

An n u a l wa t er b al ance and m i n i m u m night

f l o w analyses are ap p l i ed .

It d et ect s unaut hori zed co n su m p t i o n s, op erat i ons errors, m anagem ent errors

of faul t y m et ers

Is based on t he annual wa t er b al ance and needs t hi s f act or; t he read i ng of each m et er

is n eed ed .

(Tabesh, 2 0 0 9 )

2 0 0 9 Jho n M a sh f o rd et al .

Leak l ocat i on usi ng a vect o r m achi ne.

It uses k n o wn p at t ern recogni t i on t echni q ues.

The result s are p oor, b et ween 3 2 and 5 7 %

of leak l ocat i on.

(M a sh f o rd , 2 0 0 9 )

2 0 0 8 Jin Yang et a l .

Leak i d ent i f i cat i on using b l i nd sp ot s t h ro u gh vi b rat i on and

acoust i c analysis

The sp eed p rop agat i on is easy t o cal cul at e, whi ch helps

t o t he i d ent i f i cat i on.

It req ui res of t h e ap p l i cat i on o f a l ot o f

com p l ex m et hod s.

(Yang, We n , & Li, 2 0 0 8 )

2 0 0 7

M a r c o Ferrant e, Bruno Brunone, M .ASCE, and Silvia

M e n i c o n i .

Use t he Wavel et s f o r t h e Transi ent Pressure

Signals f o r Leak d et ect i on

It d et ect s ab norm al i t i es in t he

signals d esp i t e t he wh i t e noise

A st ead y-osci l l at ory f l o w m ust be creat ed

in o rd er t o ap p l y t hi s m et h o d ; is not ap p l i ed

in a real net work .

2006 Jose Ragot , Di d i er M a q u i n .

Diffuse analysis of resi d ues b ased in t he m o d el of t he p rocess.

It uses t he Eucl i d i an d i st ance b et ween t he

leak si gnat ures and t he resi d ues t o locat e

a leak.

Posi t i ve and negat ive t hreshol d s are n eed ed ,

wh i ch m akes t he l ocal i zat i on d i ffi cul t .

(Ragot & M a q u i n ,

2 0 0 6 )

2005

Javi er Al m a n d o z, Enri q ue Ca b rera , M .ASCE, Franci sco

Arregui , Enri q ue Cab rera Jr., and Ri card o Cob acho.

Di scri m i nat i on or t he p hysi cal losses and

vo l u m e of wa t er co n su m ed b ut not

m ea su red .

It i d ent i fi es uncont rol l ed f l o w rat e in a d i st ri b ut i on

net work

It d oes not d et ect leaks.

(Al m and oz, Cab rera,

M .ASCE, Arregu i , Cab rera Jr., & Cob acho,

2 0 0 5 )

2 0 0 5

Dalius M i si u n a s, M a rt i n Lam b ert , Angus Si m p so n , and Gust af Ol sson

Based on t he cal cul at i on of t he t ransi ent wa ve and

t ransm i ssi on coef f i ci ent s

Burst s of rel at i vel y sm al l sizes are d et ect ed . Sensors in all t h e nodes are not

necessary.

It onl y d et ect s burst s leaks.

(M i si unas, Lam b ert , Si m p so n , &

Ol sson, 2 0 0 5 )

2 0 0 1 Di di a Covas and Hel ena Ram os

Leak d et ect i on b ased in t he i nverse t ransi ent anal ysi s.

It t akes ad vant age of cert ai n i nt erest

i nst ant s.

It was onl y p roven f o r one sp eci fi c leak.

(Covas & Ram os,

2 0 0 1 )

2 0 0 0 Osa m a Hunai d i and Al ex Wa n g

Uses t he Cross-correl at i on m et h o d f or

leak d et ect i o n .

Low cost , f l exi b l e, i m p roves accuracy.

Is not ap p l i ed t o a wa t er net work .

(Hunai d i & Wa n g, 2 0 0 0 )

1 9 9 2

Ranko S. Pu d a r and Jam es A.

Ligget t .

Leak d et ect i on in p i p e lines by sol vi ng t he i nverse p ro b l em , using

p ressure and f l o w m easurem ent s.

The leaks are exp ressed in t erm s of

p ressure.

Is necessary t o assum e t he ap p roxi m at ed ori f i ce of t he leak.

(Pu d a r & Liggett,

1 9 9 2 )

1 9 7 5 Y. Sat o.

Prop oses t h e use of channel i d ent i f i cat i on

of b l i nd sp ot s.

The p rop osed m et h o d is used in m any of t he

p ost eri or work s.

The leak d et ect i on is not a p p l i ed .

(Sat o, 1 9 7 5 )

**3 THEORETICAL FRAMEWORK **

This chapter is divided into three main sections: The first part describes the mathematical model of a Water Distribution Network. The second part describes the main

concepts of Wavelet Analysis, What a Wavelet System is, How to perform a Continuous

Wavelet Transform, What a scale is, How to implement a Complex Shannon Wavelet

Transform, and why a wavelet analysis is efficient. And, the third part describes how to

implement a Phase Quadrant Demodulation Code, taking as the basis of the analysis a

**3.1****zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA**** Mathematical modeling **

The governing laws for flow in pipe systems under steady conditions are

conservation of mass and energy. The law of conservation of mass states that the rate of

storage in a system is equal to the difference between the inflow to and outflow from the system in pressurized water distribution networks. No storage can occur within the pipe

network, although tank storage may change over time. Therefore, in a pipe or junction

node, the inflow and the outflow must balance. For a junction node

*Y zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA.R i n -1. R o u t =* E

*CI)*

**Q e xt**Where* qin* and qo u t are the pipe flow rates into and out of the node and

*is the*

**q****ext**external demand or supply. Conservation of energy states that the difference in energy

between two points is equal to the energy added to the flow in components between these

points minus the frictional losses. A n energy balance can be written for paths between the

two end points of a single pipe, between two fixed graded nodes (a node for which the total

energy is known, such as a tank) through a series of pipes, valves, and pumps, or around a

loop that begins and ends at the same point. In a general form for any path

Eieyp* hpj - Y . i e iv hu =* (2)

Where* hI i t* is the headloss across component /along the path,

*is the head added*

**h****P****j**by pump* j,* and

*is the difference in energy between the end points of the path. The*

**AE**primary network component is a pipe. The relationship between pipe flow* q* and energy

loss caused by friction* Hi* in individual pipes can be represented by a number of equations,

including the Darcy-Weisbach and Hazen-Williams equations. The general relationship is

of the following form:

*HL =Kq*

* r*

(3)

Where* K* is a pipe coefficient that depends on the pipe's diameter, length, and

**3.2****zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA**** Wavelet Analysis **

A wave is usually defined as an oscillating function of time or space, such as a sinusoid. A wavelet is a "small wave", which has its energy concentrated in time to give a

tool for the analysis of transient, non- stationary, or time-varying phenomena. It still has the

oscillating wave-like characteristics but also has the ability to allow simultaneous time and

frequency analysis with a flexible mathematical foundation.

The main idea is to take wavelets and use them in a series expansion of signals or functions much the same way Fourier series uses the wave or sinusoid to represent a signal

or function. The signals are functions of a continuous variable, which often represents a signal or function.

**3.2.1 What is a wavelet system? **

The wavelet expansion set is not unique. There are different wavelets systems that

can be used effectively, but all seem to have the following three general characteristics

(Burrus, Ramesh, & Haitao, 1998).

A wavelet system is a set of building blocks to construct or represent a signal or

function. Is a two-dimensional expansion set (usually a basis) for some class of one- (or

higher) dimensional signals.

The wavelet expansion gives a time-frequency localization of the signal. This means

most of the energy if the signal is well represented by a few expansion coefficients. The

calculation of the coefficients from the signal can be done efficiently.

**3.2.2 Continuous Wavelet Transform **

The continuous wavelet transform (CWT) is defined as the sum over all time of the

signal multiplied by scaled, shifted version of the wavelet function*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA W: *

C(scale, position) =* j^oof(t)*
*x*

*V (scale,* position, t)dt (4)

The results of the** CWT** are many wavelet coefficients** C,** which are a function of
scale and position. Multiplying each coefficient by the appropriately scaled and shifted

wavelet yields the constituent wavelets of the original signal.

*Signal Constituent wavelets of different scales and positions *

**Figure 2.** Wavelet Transform.

**3.2.3 Scaling **

Scaling a wavelet means stretching (or compressing it). The scale factor is often

denoted by the letter*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA a. The smaller the scale factor, the more "compressed" the wavelet *

**Figure 3.**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Scaling.

**3.2.4 Complex Shannon Wavelets **

The expansion used in this work is the Complex Shannon Wavelets which is

obtained from the frequency B-spline wavelets by settingzyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA* m* to 1. A complex Shannon

wavelet is defined by

TO) =** 4TbSinc**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA(fbR)e*2*

*™f*

**K*

(5)

Depending on two parameters:

fb = bandwidth parameter

fc = wavelet center frequency

The condition* Fc > * is sufficient to ensure that zero is not in the frequency

**3.2.5 Why is a wavelet analysis effective? **

The wavelets are near optimal for a wide class of signals for compression,

denoising, and detection.

The wavelet expansion allows more accurate local description and separation of

signal characteristics. A wavelet expansion coefficient represents a component that is itself

local and is easier to interpret. The wavelet expansion may allow a separation of

components of a signal that overlap in both time and frequency.

Wavelets are adjustable and adaptable. Because there is not just one wavelet, they

can be designed to fit individual applications.

**3.3 Phase-quadrant demodulation code **

Based on the phase demodulation process used to encode iris patterns (Daugman,

2004), each pressure residue is transformed into a complex matrix using wavelets, and then

is demodulated to extract its phase information. The phase demodulation process, Figure 5,

is used to encode pressure residues in a DMA. Residues are projected onto complex

Shannon wavelet (5), generating complex-value coefficients whose real and imaginary

quantized to one of the four quadrants, setting two bits of phase information. This process

is repeated for each residue generated by each leak and for each residue of the time horizon

being analyzed, generating as many matrices as residues exists. This meanszyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA* fixm* matrices,

being* n* residues for each Sensitivity Matrix and

*the number of samples in the time*

**m**horizon).

Then, H'(R) can be regarded as a complex-valued bit whose real and imaginary

parts are either 1 or 0.

**4 EPANET **

This Chapter is dedicated to the Simulation Software EPANET, describing how was it developed, how to use it, how to interphase it with other software, what are its main

**4.1 Description **

Developed by EPA's Water Supply and Water Resources basically, EPANET is a

software package that models water distribution piping systems. Is a Windows program that

performs extended-period simulation of the hydraulic and water quality behavior within pressurized pipe networks.

Pipe networks consist of pipes, nodes (pipe junctions), pumps, valves, and storage

tanks reservoirs. EPANET tracks the flow of water in each pipe, the pressure at each node,

the height of the water in each tank, and the concentration of a chemical species, throughout the network during a simulated period. Chemical species, water age, source, and

tracing can be simulated.

EPANET provides an integrated computer environment for editing network input

data, running hydraulic and water quality simulations, and viewing the results in a variety of formats. These include color-coded network maps, data tables, time series graphs, and

contour plots (U.S. Enviromental Protection Agency, 2011).

**4.2 Programmer's Toolkit **

For the realization of this thesis the EPANET Programmer's Toolkit were used in

conjunction with M A T L A B . The Toolkit is a dynamic link library (DLL) of functions that

allow developers to customize EPANET's computational engine according to their own

needs. There are over 50 functions that can be used to open a network description file, read

and modify various network design and operation parameters, run multiple extended-period

simulations accessing results as they are generated or saving them to a file, and write

selected results to a file in a user-specified format.

The toolkit is useful for developing specialized applications, such as optimization or

automated calibration models that require running many network analyses; it can simplify

adding analysis capabilities to integrated network-modeling environments based on

computer-aided design (CAD), geographical information system (GIS), and database

**4.3 How to use EPANET **

**4.3.1**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Steps in Using EPANET

Usually the following steps must be carried out when using EPANET to model

water distribution systems:

(1) Draw a network representation of the distribution system.

(2) Edit the properties of the objects that make up the system.

(3) Describe how the system is operated.

(4) Select a set of analysis options.

(5) Run a hydraulic/water quality analysis.

(6) View the results of the analysis.

**4.4 Network Model in EPANET **

This section describes how EPANET models the physical objects that constitute a

distribution system as well as its operational parameters.

**4.4.1 Physical Components **

EPANET models a water distribution system as a collection of links connected to

nodes. The links represent pipes, pumps, and control valves. The nodes represent junctions,

tanks, and reservoirs. Figure 6 illustrates how these objects can be connected to one another

**Figure 6.**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Physical Components in a Water Distribution System.

**4.4.1.1 Junctions **

Junctions are points in the network where links join together and water enters or

leaves the network. The basic input data required for junctions are:

• elevation above some reference (usually mean sea level)

• water demand (rate of withdrawal from the network)

• initial water quality

The output results computed for junctions at all time periods of a simulation are:

• hydraulic head (internal energy per unit weight of fluid)

• pressure

• water quality

Junctions can also:

• have their demand vary with time

• have multiple categories of demands assigned to them

• have negative demands indication that water is entering the network

• being use as water quality sources where constituents enter the network

**4.4.1.2 Reservoirs **

Reservoirs are nodes that represent an infinite external source or sink of water to the

network. They are used to model such things as lakes, rivers, groundwater aquifers, and

tie-ins to other systems. Reservoirs can also serve as water quality source points.

The primary input properties for a reservoir are its hydraulic head (equal to the

water surface elevation if the reservoir is not under pressure) and its initial quality for water

quality analysis.

Because a reservoir is a boundary point to a network, its head and water quality cannot be affected by the dynamic within the network. Therefore it has no computed output

properties.

**4.4.1.3 Tanks **

Tanks are nodes with storage capacity where the volume of stored water can vary

with time during a simulation. The primary input properties for tanks are:

• bottom elevation (where water level is zero)

• diameter (or shape if non-cylindrical)

• initial, minimum and maximum water levels

• initial water quality

The principal outputs computed over time are:

• hydraulic head (water surface elevation)

• water quality

Tanks are required to operate within their minimum and maximum levels. EPANET

stops outflow if a tank is at its minimum level and stops inflow if is at its maximum level.

**4.4.1.4 Pipes **

Pipes are links that convey water from one point in the network to another.

higher hydraulic head (internal energy per weight of water) to that at lower head. The

principal hydraulic input parameters for pipes are:

• start and end nodes

• diameter

• length

• roughness coefficient (for determining head loss)

• status (open, closed, or contains a check valve)

Computed outputs for pipes include:

• flow rate

• velocity

• head loss

• Darcy-Weisbach friction factor

• average reaction rate

• average water quality

The hydraulic head lost by water flowing in a pipe due to friction with the pipe

walls can be computed using one of three different formulas:

• Hazen-Williams formula

• Darcy-Weisbach formula

• Chezy-Manning formula

The Hazen-Williams formula is the most commonly used head loss formula in the US. It cannot be used for liquids other than water and was originally developed for

turbulent flow only. The Darcy-Weisbach formula is the most theoretically correct. It

applies over all flow regimes and to all liquids.

Each formula uses the following equation to compute head loss between the start and end node of the pipe:

*hL=A-q*

*B*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA

Where

hL = head loss (Length)

q = flow rate (Volume/Time)

A = resistance coefficient

B = flow exponent

**4.4.1.5 Pumps **

Pumps are links that impart energy to a fluid thereby raising its hydraulic head. The principal input parameters for a pump are its start and end nodes and its pump curve (the

combination of heads and flows that the pump can produce). In lieu of a pump curve, the

pump could be represented as a constant energy device, one that supplies a constant amount

of energy (horsepower or kilowatts) to the fluid for all combinations of flow and head.

EPANET can compute the energy consumption and cost of a pump.

**4.4.1.6 Valves **

Valves are links that limit the pressure or flow at a specific point in the network.

The principal input parameters include:

• start and end nodes

• diameter

• setting

• status

The computed outputs for a valve are flow rate and head loss.

**4.4.2 Non-Physical Components **
**4.4.2.1 Time Patterns **

A time pattern is a collection of multipliers that can be applied to a quantity to allow

it to vary over time. Nodal demands, reservoir heads, pump schedules, and water quality

source inputs can all have time patterns associated with them. The time interval used in all

each can have a different number of periods. When the simulation clock exceeds the

number of periods in a pattern, the pattern wraps around to its first period again.

**4.5 Functions in EPANET **

In this section will be described the analysis of a simple distribution network, Figure

7, that consists of a source reservoir from which water is pumped into a two-loop pipe

network. There is also a pipe leading to a storage tank that floats on the system.

SOURCE

**Figure 7.** Water Distribution Network.

**4.5.1 Project Setup **

The first task is to create a new project in EPANET following the next steps:

1. Select File | New to create a new project.

2. Select Project | Defaults to open the Project Default dialog form.

3. On the ID Labels page, clear all of the ID Prefix fields and set the ID Increment to

1. This will make E P A N E T automatically label new objects with consecutive

numbers. This step is important in for the future use of the ID nodes, in order have

4. On the Hydraulics page of the dialog choose G P M as Flow Units and

Hazen-Williams (H-W) as Head loss Formula.

4.5.2 Setting Map Options

Next step is to set some map display options so that the ID labels will be displayed

as added objects to the network.

1. Select View | Options to bring up the Map Options dialog form.

2. Select the Notation page on this form and check off the boxes for Display Node

IDs and Display Link IDs. Leave the others unchecked.

3. Then switch to the Symbols page and check all of the boxes.

4. Click the O K button to accept these choices and close the dialog.

5. Finally, before placing objects on the map the dimensions should be set.

6. Select View | Dimensions to bring up the Map Dimensions dialog form.

4.5.3 Constructing a Network Model

Once the parameters are all set, the next step is to draw the Network's nodes:

1. First add the reservoir by clicking the button on the Map Toolbar. (If the

toolbar is not visible then select View | Toolbars | Map). Then click the mouse on

the map at the location where the reservoir belongs.

2. Next to add are the junction nodes. Click the button on the Map Toolbar and

3. Now add the tank by clicking the button and then clicking the map where the

tank is located.

4. Now add all the pipes using the button to connect the corresponding nodes.

5. Finally, add the pump by clicking the button, clicking on node 1 and then on

node 2.

6. To add map labels use button on the map.

4.5.4 Setting Properties

As objects are added to the project, EPANET assigns them a default set of

properties. To change the value of a specific property for an object it must be selected the

object into the Property Editor (Figure 8). If the Editor is already visible then simply click

on the object or select it from the Data page of the Browser. If the Editor is not visible then

it can appear by clicking the Browser's Edit button

Figure 8. Property Editor.

The nodes in the example network are assumed to have the following properties,

**Node ** **Elevation Demand **
**(ft) ** **(gpm) **

1 700 0

2 700 0

3 710 150

4 700 150

5 650 200

6 700 150

7 700 0

8 830 0

**Table** 4. Node Properties.

Double clicking each node, add the name parameters. The pipes in the network have

the following lengths and diameters:

**Pipe Length ** **Diameter **
**(feet) ** **(inches) **
1 3000 14

2 5000 12

3 5000 8

4 5000 8

5 5000 8

6 7000 10

7 5000 6

8 7000 6

**Table 5.** Link Properties.

By clicking in each link and the properties listed and for all Roughness Coefficients

4.5.5 Adding a Pump Curve

For the pump, is necessary to assign a pump curve (head versus flow relationship).

1. Select the pump (Link 9) into the Property Editor and enter the ID label 1 in the

Pump Curve field.

2. Create Pump Curve 1. From the Data page of the Browser window, select Curves

from the dropdown list box and then click the Add button A new Curve 1 will

be added to the database and the Curve Editor dialog will appear.

3. Enter the pump's design flow (600) and head (150) into this form. E P A N E T will

automatically create a complete pump curve from this single point. The curve's

equation is shown along with its shape.

4.5.6 Saving and Exporting Projects

Once the project is completed, and after save the project, this can be exported by

using File | Export | Network command, in this way is save as a readable text, this file has

### an

**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA****n****.inp**### "extension.

4.5.7 Running an Extended Period Simulation

In order to perform an extended period analysis of operation is needed the creation

of a Time Pattern that makes demands at the nodes vary in a periodic way over the course of a day. To set the pattern time step as well as the simulation duration:

1. Select Options -Times from the Data Browser.

3. Enter the pattern time step.

4. Enter the simulation Duration.

To create the time pattern:

1 Select the Patterns category in the Data Browser

2 Click the button (or press the Insert key). A new Pattern 1 will be created and

the Pattern Editor dialog should appear.

3. Enter the multiplier values 0.5, 1.3, 1.0, 1.2 for the time periods 1 to 4.

4. Click the O K button to close the Pattern Editor.

The multipliers are used to modify the demand from its base level in each time

period. The pattern will wrap around to the start once again after each 24-hour interval of

time.

Now assign the Pattern 1 to the Demand Pattern property of all of the junctions in

the network.

To start running the simulation select Project | Run Analysis, select node pressures

**5 EXPERIMENTATION **

This chapter describes the methodology applied. The creation of the sensitivity

matrices, the angle between vector method, the wavelet analysis, the phase demodulation, the detection of leaks in systems with one leak, and the detection of multiple leaks in

systems with two or three leaks.

It includes a description of the water networks in which the experiments would be performed, Hanoi and Quebra Networks. Finally it presents the experiments and results of

the implementation of the algorithm.

**5.1 Methodology **

The main objective of the proposed scheme is to detect, isolate and identify multiple leaks in a hydraulic network, using pressure measurements in the nodes of the hydraulic

network. A leak will be considered as a water flow loss through a defect of an element of

the network that is being measured. Figure 9 shows the leak detection, isolation and

identification process. It is considered the existence of two and three leaks of different

sizes at a given time. The data of node pressures are obtained from extensive simulations of

normal and leak scenarios. From these data, pressure sensitivities and residuals are obtained

**Figure 9.**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Block diagram of detection, isolation and estimation of leaks in a WDS.

A l l the leaks are simulated in the nodes of the network. This is performed by adding an extra demand of water at a specific node.

To compare the efficiency of the method, changes in the leak magnitude and noise in the demands were simulated. A time horizon of 24 hours was selected for the

simulations.

For the proposed method, sensitivity matrix that quantifies the effect of leaks in all

nodes and pressure sensors in the network is needed to initiate the detection of the leaks.

Matlab® and Epanet® are used altogether to simulate the leaks to obtain and analyze the network data using the algorithms proposed in this thesis.

**5.1.1 Sensitivity matrix algorithm **

In the first part of the algorithm, the normal operation scenario of the network is

built and the simulated pressures at each node of the network are obtained; first, an ideal

scenario without noise and without leaks is simulated, and a matrix with the pressures in all

(7)

Where:

* P* is the matrix of pressures in no leak situation

* Pij* represent the pressure of node

*at time*

**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA****i***in no leak situation*

**j****Pa** is the matrix of current pressures

**pa.** is the current pressure of node* I* at time instant

**j*** n* is the number of nodes in the network

* m* is the number of samples through the simulation time

The second part is the construction of scenarios with the presence of a leak. The

pressures in nodes when a leak in the network is present are stored in the following matrix:

(8)

Where:

* Pf* is the matrix of pressures when a leak is present at node

**k*** Pf* is the pressure of node

*at time instant*

**i***when a leak is present at node*

**j**

**k*** n* and

*are the same as defined previously*

**m**In the third part of the algorithm, the residual matrices are obtained as follows:

(9)

Where:

*Rk* is the matrix of residuals when a leak is present at nodezyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA** k **

**rfj****zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA = — p*** is the residual of node* i* at time / when a leak is present at node

**k***Ra*is the matrix of current residuals

* ra.. = pij — pa..* is the current residual of node

*at time*

**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA****i**

**j**If is necessary to isolate the leak magnitude, the residuals are converted into sensitivities

for each node, as in (11).

(1 1 )

(1 2 )

Where:

5^ is the matrix of sensitivities when a leak is present at node** k **

is the sensitivity of node* I* at time

*when a leak is present at node*

**j**

**k*** I* is the assumed leak magnitude (liter/second)

5a is the matrix of sensitivities when a leak is present on a specific and unknown

node.

Reordering the matrices of sensitivities in a way that each matrix contains the

sensitivities from all nodes, give us equation (13):

(1 3 )

Where:

**5.1.2 Angle between vectors method **

This method consist in calculate the existent angle between each vector of current

residues, against each vector from the sensitivity matrices, in order to observe the vector with is the smaller angle. The angle is obtained according to:

(14)

Where:

S**(m,n)*** zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA l s* a

vector of the matrix of sensitivities when a leak is present at node* n* at

instant** m **

* Rcurrentres(jri)* is the vector of current pressure residue at instant

**ftl**This implies the calculation of* m* vectors of size

*this according to the number of*

**ft,**possible leaks for each sample along the time horizon. Based on the time horizon analysis,

is necessary to obtain a media of the angle obtained, with (15).

(15)

Once*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA <xhte is obtained, corresponding to the angles of all the possible leaks, is *

necessary to define the smallest angle, which will indicate the most likely indicator of a leak.

*indexleak = min(cchte)*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA (1 6 )

**5.1.3 Wavelet Analysis Method **

After obtaining the sensitivities matrices for each leak (getting as many matrices as

nodes are in the network), the process of binarization using wavelet analysis is performed

with the help of the M A T L A B toolbox, using the following parameters and based on

*C(scale,position) = f (t)*P(scale,position, t)dt *

*V(R) = J7bsinc(fbR)e zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA*

**2i**

**"fe****R **

(4)

(5)

Where:

*fb* = 1; Bandwidth parameter

*fc =* 1.5; Wavelet center frequency

*a =* 1:1:16 Scale

Cs = cwt(Sm1 : n n) =

*Csa -***zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA c w t ( 5 a1 : n m) = **

(1 7 )

(1 8 )

Where:

C i s a complex wavelet coefficient obtained from (4) depending of the scale and

position

* Cs* is the complex matrix of each column from

*therefore obtaining*

**Sm,***matrices*

**n**for each sensitivity matrix obtained up until now.

* Csa* is the complex matrix of each column from 5a, obtaining

*matrices for each*

**m**sample of the current leak.

Once the* n* matrices for each hour are obtained, binarization is the next step, for

which is used the phase demodulation process, shown previously in Figure 5:

Where:

*Cba>1 = *

*Cba_2 = *

* Csb is* the binarized matrix of

*The same process is repeated for the matrix*

**Cs.***zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Csa.*

Now the representation for each leak is one matrix* Csb,* for one sample. The same

procedure is performed for current residues matrix Ra obtaining* m* number of matrices,

one for each sample.

**5.1.4 Leak isolation **

The test for leak isolation is implemented by the Boolean Exclusive-OR operator

(XOR) applied to the residues encoded (Figure 5), comparing each matrix* Cbs* against the

binary matrix obtained from* Jla.* The result from this operation is a binary matrix with the

differences between two pressure residues. Then all the differences in each matrix

generated from the X O R operation are summed up and a new vector is generated

containing these differences, repeating this process for all the leaks analyzed for the time

horizon* (itt),* and generating the follow matrix:

From the matrix above a voting system is now applied where the node with fewer

votes is selected as the most likely place of a leak. The votes are obtained summing all

columns, where every row represents each node in the network. The algorithm is shown in

Figure 10.

**LEAK ISOLATION PROCESS **

**Figure 10.**zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA Algorithm for the Leak Isolation Process with Wavelet Analysis.

**5.1.5 Multiple leak isolation method **

In the case of multiple leaks the same methodology is performed, but the following

steps are added.

From the voting system, the first three leaks detected are taken, being the first

column of matrix Index Comparison*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA (IC): *

/CC3.1) = (2 1 )

After that, a range of possible leaks magnitude is selected, for example in the

network Quebra from 0.01* l/s* to 0.1* l/s.* The number of intervals is also selected, in this

case 10 intervals from 0.01 to 0.1 with a step of 0.01* l/s. *

The leak associated with the* indexCM1 is simulated using the leak magnitude for *

each interval, obtaining a new residue for this leak and a new* Rnk .The process of wavelet *

transform is performed again obtaining a complex matrix representing this residuezyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA** Csn. **

The complex matrix Csris obtained as shown in equation (22):

*Csr = Csa — real{Csn)* (2 2 )

Where* Csr* is the complex matrix derived from the subtraction of the complex

matrix from the current residue minus the real part of the complex matrix from the

simulated residue of i n d e xC M 1 with the corresponding interval of the leak magnitude. Only

the real part of* Csa* is considered because is the most representative part when a change of

the leak magnitude occurs.

Then** Csr** is binarized according to (19) , and the leak isolation process is repeated,
by using equation (20), applying the voting system once again, selecting the first three leaks

detected, repeating this process for all the leaks magnitudes from the proposed interval,

*lC(3,h +*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA 1 )

Where:

* h* is the number of proposed intervals of leak magnitude.

On the other side a matrix with all the index nodes is formed,

*Neighbors(n,v) = *

Where:

(2 3 )

(24)

* nindex* represents the indexes of the neighbors nodes for each node

* v* represents the number of neighbors for each specific node

//represents the number of nodes in the network

After obtaining* IC,* each column is analyzed comparing the indexes obtained

against each row of the neighbor's matrix, where each time a neighbor or the particular

node appears a vote is given. For each column from* IC,* a row is formed with

*columns*

**n**with the votes.

*Voting _2{h+Xn) * (25)

Where:

* °h+i,n* represents the number of occurrences of the node

*in the column*

**n***from*

**h+1**the matrix* IC,* shown in (23).

* n* represents the number of nodes in the network.

* h+1* is the number of columns on

*an*

**IC,***is the number of proposed intervals for*

**h**Now a grading system is applied: for each row, the most voted node gets a 5, the

second a 2 and the third a 1, this applies for all rows from equation (23) except for the first

one, because this contains the value of the first leak detected, where the*zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA indexzyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBACM{x,i )* from

(23) is the most likely to be one of the multiple leaks so this gets a grade of 25. The first

most voted from the first column gets a 2 (if is not* indexCM^^ ). *

*Grading ( h + l i f l ) = * ( 2 6 )

ForzyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA** g****lil:n **

*3 zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA1 ,1 m = *

ForzyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA** 9 2 :h + \ ,l:n **

**9 h + l,n — **

Where:

* 9h+\,n* represents the grade obtained of the node

** it**

in the row**it**

*from equation*

**h+1**(23).

Finally all the columns from equation (26) are summed and the first five nodes with

the highest values are selected and ordered from highest to lowest (based on their ranking).

**5.2 Description of Water Networks for the Experiments. **

To test the methodology presented previously, two networks were used: Hanoi

(Rodriguez, 2006), and Quebra provided by EPANET.

**5.2.1 Hanoi network **

This network is presented in Figure 12 and represents a network with big flows. The

demand pattern is design and carried out in a simulation of 24 hours with a sampling time

of 60 minutes. This gives a total of 25 samples (24 hours* 1 sample/hour=24+l for the

initial sample hour).

**Figure 12.** Hanoi network.

This network has 31 demand nodes with indexes from 2 to 32, 34 pipes and a

**Pipes Length **
**(m) **
**Diameter **
**(mm) **
**Roughness **
**(mm) **
**M inorLoss **
**Coeff. **

**Node Demand **
**(l/ s) **

1 1 0 0 1 0 1 6 1 2 0 0 2 2 4 7 .2 2

2 1 3 5 0 1 0 1 6 1 2 0 0 3 2 3 6 .1 1

3 9 0 0 1 0 1 6 1 2 0 0 4 3 6 .1 1

4 1 1 5 0 1 0 1 6 1 2 0 0 5 2 0 1 .3 9

5 1 4 5 0 1 0 1 6 1 2 0 0 6 2 7 9 .1 7

6 4 5 0 1 0 1 6 1 2 0 0 7 3 7 5

7 8 5 0 1 0 1 6 1 2 0 0 8 1 5 2 .7 8

8 8 5 0 1 0 1 6 1 2 0 0 9 4 5 .8 3

9 8 0 0 1 0 1 6 1 2 0 0 1 0 1 4 5 .8 3

1 0 9 5 0 7 6 2 1 2 0 0 1 1 1 3 8 .8 9

1 1 1 2 0 0 6 1 0 1 2 0 0 1 2 1 5 5 .5 6

1 2 3 5 0 0 6 1 0 1 2 0 0 1 3 2 6 1 .1 1

1 3 8 0 0 5 0 8 1 2 0 0 1 4 1 7 0 .8 3

1 4 5 0 0 3 0 0 1 2 0 0 15 7 7 .7 8

1 5 5 5 0 3 0 0 1 2 0 0 1 6 8 6 .1 1

1 6 2 7 3 0 3 0 0 1 2 0 0 1 7 2 4 0 .2 8

1 7 1 7 5 0 5 0 8 1 2 0 0 1 8 3 7 3 .6 1

1 8 8 0 0 5 0 8 1 2 0 0 1 9 1 6 .1 7

1 9 4 0 0 6 1 0 1 2 0 0 2 0 3 5 4 .1 7

2 0 2 2 0 0 1 0 1 6 1 2 0 0 2 1 2 5 8 .3 3

2 1 1 5 0 0 5 0 8 1 2 0 0 2 2 1 3 4 .7 2

2 2 5 0 0 3 0 0 1 2 0 0 2 3 2 9 0 .2 8

2 3 2 6 5 0 1 0 1 6 1 2 0 0 2 4 2 2 7 .7 8

2 4 1 2 3 0 7 6 2 1 2 0 0 2 5 4 7 .2 2

2 5 1 3 0 0 7 6 2 1 2 0 0 2 6 2 5 0

2 6 8 5 0 5 0 8 1 2 0 0 2 7 1 0 2 .7 8

2 7 3 0 0 3 0 0 1 2 0 0 2 8 8 0 .5 6

2 8 7 5 0 3 0 0 1 2 0 0 2 9 1 0 0

2 9 1 5 0 0 4 0 7 1 2 0 0 3 0 1 0 0

3 0 2 0 0 0 3 0 0 1 2 0 0 3 1 2 9 .1 7

3 1 1 6 0 0 3 0 0 1 2 0 0 3 2 2 2 3 .6 1

3 2 1 5 0 3 0 0 1 2 0 0

3 3 8 6 0 5 0 8 1 2 0 0

3 4 9 5 0 6 1 0 1 2 0 0