{'fraction_non_alphanumeric': 0.03921481547275392, 'fraction_numerical': 0.016654083581294134, 'mean_word_length': 4.378074994029138, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Location of leaks in pipelines using parameter identification tools

This work proposes an approach to locate leaks by identifying the parameters of finite models associated with these fault events. The identification problem is attacked by using well-known identification methods such as the Prediction Error Method and extended Kalman filters. In addition, a frequency evaluation is realized to check the conditions for implementing any method which require an excitation condition.


Introduction
Water is the most precious resource on earth, reason by which leak detection methods have become issues of primary relevance in modern hydraulic networks. The main purpose of such methods is to obtain information in time on the leak location, to avoid undesirable consequences -as economical losses, damages to the environment, damages to the population, etc.
Due to its relevance, this problem has thus already been widely considered, and for a long time now (see e.g. the survey of Babbitt (1920)), which led to the development of a wide variety of techniques, from visual inspection to acoustic methods. But among them, the class of so-called transientbased approaches has been more particulary studied in the last two decades, motivated by the fact that compared with more conventional methods, they have the advantage of being noninvasive, less expensive, and with a large operational range.
The recent paper of Colombo et al. (2009) presents a pretty well-documented overview on LDI techniques, distinguishing direct transient methods, inverse transient approaches, and frequency-based analysis: the first ones are designed to give a direct interpretation of signal changes so as to detect leak effects in them (see e.g. Brunone (1999); Brunone and Ferrante (2001); ?); Wang (2002)); the second type of approaches refers to the problem of recovering parameters of a time-domain model from a set of actual measurements, allowing then to compare current measurements with a leak-free situation and monitor leaks in this way (e.g. as in Digerness (1980); Billman and Isermann (1987); Allidina and Benkherouf (1988); Pudar and Liggett (1992); Liggett and Chen (1994); Vitkovsky et al. (2000); Kapelan et al. (2004)), while the third family of techniques gathers all works related to frequency response analysis with regard to the effect of leaks (cf Mpesha et al. (2001); Ferrante and Brunone (2004); Lee et al. (2005a,b); Covas et al. (2005)).
In fact, when aiming at leak detection using transient information from a model, with only a limited number of mea-surements, identification (or similarly observer tools -eg as in Verde and Visairo (2004); Besançon et al. (2007); Torres et al. (2011); dos Santos et al. (2011)) can provide a good framework, typically combining transient signal exploitation with frequency requirements. This is in particular true when considering situations of possible multiple simultaneous leaks (eg as in Verde (2005)), whereas most of the available studies are limited to the case of single leak detection. In addition, various of those mentioned methods require an adequate quantity of sensors along the pipeline.
In the case of a pipe section delimited by a pair of (flow or pressure) sensors at each end, the detectability of multiple simultaneous leaks (with their location) is lost in steady-state, and requires instead an appropriate excitation (see eg Verde et al. (2003); Verde and Visairo (2004); Torres (2011)).
Injecting excitation in the systems allows to recover a frequency response diagram with the additionally required information. In that way, the identification approach can be related to studies on frequency response analysis. Classically indeed, the frequency response describes how the pipeline reacts at various frequencies, by relating the amplitude and phase of the system input and output at each frequency. The characteristics of the pipeline can then be extracted by using any frequency sweeping technique, and the unique requirement is that the frequency content of the input signal should be as high as possible such that maximum information is extracted from the pipeline. An example of a wide bandwidth signal is a single sharp pulse that can be generated through the fast perturbation of a valve as is suggested by Lee et al. (2008), or sinusoidal oscillations at various frequencies as is proposed in Covas et al. (2005), Sattar and Chaudhry (2008). . Most of such frequency approaches have in fact been based on some signatures in the frequency response diagram, used to estimate the leak position or magnitude. There are another interesting methods based on more sophisticated tools as the presented in Barradas et al. (2009) which use Artificial Neural Networks (ANN) to detect and diagnose multiple leaks in a pipeline by recognizing the pattern of the flow.
The purpose of the present paper is to emphasize how directly handling the leak detection issue as a problem of parameter identification instead, one can efficiently use the frequency information provided by the excitation of the system at certain frequencies. The main advantage of this approach over the other frequency-sweep-based methods is that the estimations of the positions and magnitudes of the leaks are obtained directly, avoiding the interpretation of signatures or patterns.
Fault detection via parameter identification is in fact a general methodology which relies on the principle that possible faults in a monitored system are associated with specific parameters and states of the mathematical model of the system given in the form of an input-output relation. For a better understanding of the concept one can refer to the books written by Isermann (2011) and Isermann and Münchhof (2011) for instance.
In a pipeline, leaks can then be seen as fault events associated to certain parameters to be considered in a model, such as the position and magnitude of the leak. As an option, a finite model can be obtained by solving approximately the Water Hammer equations classically describing the flow dynamics in a pipeline (Chaudry (1979)). Once the finite model is obtained, leak equations and their associated parameters can be included in it.
To diagnose the presence of leaks in a pipeline from a point of view parameter identification, an adequate identification approach must be chosen. There is a large variety of approaches to identify parameters, and for an admittedly review of some of these ones, the reader may consult Ljung (1999) or Kailath et al. (2000). In addition, different input signals can be used to excite the system, depending on the method chosen for the estimation, such as sine wave excitation, multi-tone excitation , random noise excitation, and pseudo-random signals. See for instance Novak et al. (2010); Solomou et al. (2004).
In the present work, to attack the identification problem, it is proposed to use the Prediction Error Method (PEM) offline with chirp signals as excitation inputs, as well as Extended Kalman Filters (EKF) based on the finite nonlinear models. The main reasons for these choices are: the popularity of the methods, their easy implementation and the wide quantity of available software to carry out them. To implement the approaches, firstly, the pipeline equations are discretized via the finite difference method, then the resulting nonlinear ODE system and their linearized versions are used to design the algorithms.
The paper is organized as follows: Section 2 is dedicated to the modeling of a pipeline and the deduction of finite models, while Section 3 exposes a frequency analysis of them. Section 4 describes how the leak location can be carried out by means of parameter identification and using finite models. In section 5, well-known identification algorithms are presented, whereas in Section 6, these are tested for leak location in simulation. Section 7 finally concludes the paper.

Modeling a pipeline
Assuming convective changes in velocity to be negligible, constant liquid density and constant pipe cross-sectional area, the momentum and continuity equations governing the dynamics of the fluid in a pipeline can be expressed as (Chaudry (1979)) where b is the wave speed in the fluid [m/s], g is the gravitational acceleration [m/s 2 ], A r is the cross-sectional area of the pipe [m 2 ], φ is the inside diameter of the pipe [m], and f is the Darcy-Weichbach friction factor. Closed-form solutions of these equations are not available. However, several methods have been used to numerically integrate them, such as the method of characteristics Chaudry (1979), the finite difference method Wylie and Streeter (1978), the orthogonal collocation method Torres et al. (2008), etc.

Nonlinear finite models
The presence of a leak in a given position z f i must be handled as a boundary condition for the system (1). This condition is the loss of flow caused by the leak given by: There are four possible configurations for the finite models; this depending on the Dirichlet boundary conditions imposed on the flow rates and pressure heads at the ends of the pipeline. For an explanation more detailed see Torres (2011).
System (1) with included leaks can be discretized in n s sections as follows: with i = 1, . . . , n s . If the upstream and downstream pressure heads of the pipeline (H in , H out ) are considered as the boundary conditions (BC), then H 1 = H in , H n s +1 = H out . The natural frequency of the pipeline under this configuration is given in Chaudry (1979) and expressed as: If the upstream pressure head and the downstream flow of the pipeline (H in , Q out ) are the BC, then H 1 = H in and Q n s +1 = Q out . The natural frequency for this boundary configuration is given for instance in Zecchin (2010) and expressed as: Considering that only two measurements at both ends of the pipeline are available (pressures or flow rates), the output vector is given by: where C has the appropriate dimensions. It has been shown in Verde et al. (2007) that equations (3)-(4) are useful to conceive algorithms for single leak detection.

Linear finite model
By linearizing Eq.
(3)-(4) around the equilibrium points (Q i ,H i ), it is obtained the linear model given by Eq. (7) corresponding to the pipeline with (H in , Q out ) as BC. When the BC are (H in , H out ), the last state (a pressure) of model given by Eq. (7) must be eliminated.

Frequency analysis of the pipeline with leaks
In this section, we present a frequency analysis of the pipeline models previously given. The aim is to highlight some important aspects to be considered for leak detection when parameter identification methods are employed.
For the analysis, the physical parameters listed in Table 1 are used, corresponding to a pipeline available at CINVESTAV. For more details about the configuration see Begovich et al. (2009). This pipeline has a pump at the upstream and a valve at the A relevant issue to analyze in the finite models is its frequency behavior as function of the spatial discretization. Fig.  1 and Fig. 2 expose the frequency behavior (magnitude and phase) of the nonlinear model given by Eq. (3)-(4) discretized into different n s sections. The frequency diagram was obtained using the physical parameters listed in Table 1 and the pressure head inputs: with ω 0 = 0 as the start frequency and k = 0.0001 as the rate of frequency increase. The window of time has been fixed T w = 10000 [s], such that the higher frequency of the signal has been ω = 6.28 [rad/s]. For this boundary configuration, the natural frequency is ω th = 13.5774 [rad/s]. Due to the configuration of the pipeline treated here, changes in the pressure affect the behavior of the flow. There are two significant aspects to remark from this figure, firstly, the existence of resonant peaks at frequencies which are multiples of the natural frequency. Secondly, a better representation of these peaks with a higher quantity of sections, which is indeed important to represent accurately the real behavior of a pipeline in the frequency domain. Hence, if we want to use a finite model at certain frequencies for any task of fault detection, we have to use a model with the enough quantity of sections. On the contrary, if the work frequencies are low, then a model with many sections is not needed.   Fig. 4 illustrate a comparison between the frequency behavior of the normal-operation pipeline and the frequency behavior of the pipeline affected by one and two leaks. To obtain these plots, the nonlinear model (3)-(4) with 22 sections was excited only via pressure using the pressures (8). The compared data are the magnitude and phase of the relation Q out /H in . In case of the presence of leaks, the resonant peaks are diminished and the phase is altered. This fact is very significant because is the evidence of a special frequency behavior due to the presence of leaks. Behavior required in identifications tasks.

Leak location
Hereafter, we present how the nonlinear and linear models previously presented can be handled for leak location by means of parameter identification. Note that, the smallest detectable leak for this methodology and other ones depends on the residual generated by the inlet and outlet flows, i.e r 1 = Q in − Q out . When this residual exceed a threshold, a leak is detectable. To impose a threshold, the precision of the instruments and noise must be considered. In the work Torres et al. (2013) diverse residuals to detect a leak and faults in sensors and actuators are studied.

Single leak location
When a leak happens, a discontinuity in the mass flow rate occurs, then the pipeline can be seen as partitioned in two sections (see Fig. 5). Reflecting on this point, the models to be used for the conception of location algorithms must represent at least two sections of the pipeline, reason by which the nonlinear model (3)-(4) and the linear model (7) must be set with n s ≥ 2.

Nonlinear model
In order to use a nonlinear model for the location of a leak trough the parameters linked with the leak event, let us consider that the inputs are the pressures at the ends of the pipeline, i.e., u = [H in , H out ], the end flow rates as the outputs, i.e., y = [Q in , Q out ] = [Q 1 , Q 2 ] and the fluid model (3)-(4) with n s ≥ 2, i.e., where the added states ∆z 1 and σ 1 represent the leak position (z f 1 ) and its coefficient, while H 2 is the pressure at leak point (H f 1 ). Notice that the second section of the model is given by ∆z 2 = L − ∆z 1 . Therefore, by identifying only the parameters which extend the state vector, one can locate the position of the leak and its magnitude.

Linear model
In order to obtain an adequate linear model for a single leak detection, let us consider the following points: • If n s = 2 is chosen for the system (7), the state vector of the resulting two-sections system is given by with equilibrium points • Considering as BC the pressure heads at the pipeline ends, H out ] is the input vector of the system, while y 1 = [Q in , Q out ] is the output vector.
• The position of the leak, z f 1 , is given by the size of the first section i.e. z f 1 = ∆z 1 .
• The parameter vector θ to be estimated must be defined on basis of the required leak information. Then, θ have been set with Finally, the required model for leak detection is given by the equations system (10) with a second section expressed as ∆z 2 = L − θ −1 1 = γ(θ 1 ).
It is so important to note that the change in the operation point of the pressure (x 2 ) is included in the estimation of θ 2 . This can be made because one is interested to get the position and the loss of flow function of θ 2 , instead of the leak coefficient σ 1 and pressure at the leak positionx 2 .

Two-leaks location
Because of the two discontinuities caused in a pipeline by the presence of two simultaneous leaks, models representing three sections must be used for the location purpose (see Fig.  5). Thus, n s ≥ 3 for the nonlinear system (3)-(4) and the linear system (7).

Nonlinear model
In order to use a nonlinear model for the location of a leak trough the parameters linked with the leak event, let us consider that the inputs are the pressures at the ends of the pipeline, i.e., u = [H in , H out ], the end flow rates as the outputs, i.e., y = [Q in , Q out ] = [Q 1 , Q 3 ] and the fluid model (3)-(4) with n s ≥ 3, i.e., where the joint states ∆z 1 , ∆z 2 , σ 1 and σ 2 represent the position of both leaks (z f 1 , z f 2 ) and their coefficients respectively, whereas H 2 and H 3 are the pressures at the leak points (H f 1 ,H f 2 ). Notice that the third section of the model is given by ∆z 3 = L − ∆z 1 − ∆z 2 . Therefore, by identifying only the parameters which extend the state vector, one can locate the both leak positions and their magnitudes.

Linear model
Let us take into account the following considerations to obtain a suitable model for the detection of two simultaneous leaks: • If n s = 3 for the system (7), the state vector of the resulting three-sections system is given by and the vector of equilibrium points is expressed bȳ • Considering as boundary conditions, the input vector is • The position of the first leak, z f 1 , is given by the size of the first section i.e. z f 1 = ∆z 1 , whereas the position of the second leak, z f 2 , is given by the size of the first section plus the second section i.e. z f 1 = ∆z 1 + ∆z 2 .
• The parameter vector θ to be estimated have been fixed with the components: In this case, similarly to the single leak estimation, one is interested in the loss of flows which are functions of θ 2 , θ 5 respectively, instead of the four independent parameters.
Finalizing, a suitable model for simultaneous-leaks detection is given by the system (12) with a third section given by . This model can be useful for the detection of sequential leaks by assuming θ 1 and θ 2 as known parameters.

Identification methods
Following, two of the most popular methods of identification used in this work are briefly described.

Prediction Error Method
Consider an innovation representation of a continuous-time LTI system of the forṁ where y ∈ R p is the output vector, u ∈ R m the input vector, x ∈ R n the state vector and (A,B,C,D) are matrices of appropriate dimensions. The unknown parameters in the state space model are contained in these matrices. Consider the application of the Prediction Error Method (PEM) to the multi-input multi-output (MIMO) model (13). The prediction error e(t, θ) is computed by a linear state space model with inputs u(t), y(t) of the forṁ with the initial conditionx(0, θ) = 0. Then, in terms of e(t, θ), the performance index is given by Thus the parameter vector is obtained by minimizing V N (θ) with respect to θ.θ = arg min V N (θ) If we can evaluate the gradient ∂V N /∂θ, we can in principle compute a (local) minimum of the criterion V N (θ) by utilizing a (conjugate) gradient method. In this work, this methodology has been applied off-line. For a more detailed explanation of the method, the reader can be consult Katayama (2005).

Extended Kalman Filter
An extended model, such as (9) and (11), can be represented by the following state representation: then an observer can be designed as follows (Reif et al. (1998)): where the state estimate is denoted byx(t) and the observer gain K(t) is a time-varying q × m matrix computed as with and a positive real number α > 0.

Identification tests
In order to show the feasibility of the approach proposed in this article, some results concerning the location of leaks using the PEM and EKF's are presented in the following.
To locate one leak an extended Kalman filter (16) was conceived, and for its design the model (9) represented by the general form (15) was considered.
In Figure 6, the measured outputs and their estimations performed by the filter are exposed. Whereas in Fig. 7 is presented the estimation and the real position. The tuning parameter of the filter was fixed α = 0.3 and this was initialized with different initial conditions with respect to the system. Now, we give some results corresponding to the detection and isolation of two simultaneous leaks.   The pipeline affected by the leaks was represented by the nonlinear model with twenty sections and it was excited with and the downstream flow rate Q out = 9.08 × 10 −3 + 0.1 × 10 −3 sin (ω 0 + πkt) t [m 3 /s] (20) where ω 0 = 0 and k = 0.0001. The window of time was fixed T w = 20000 (s). The natural frequency in this case is given by ω th = 6.788 (rad/s) calculated from Eq.(6). For the choice of these signals have been considered: (a) the amplitude being enough small to keep the validity of the linear models, (b) the performance of the actuators installed in the pipeline for the generation of the signals, (c) the use of a chirp signal because of their advantages in estimation algorithms w.r.t. noise (see Novak et al. (2010)) and (d) the sample time used to carry out the PEM, which in this test simulation has been chosen T = 0.01 (s). The parameter vector was initialized aŝ To conclude this section, it is necessary to highlight the performance of the Extended Kalman Filter designed for the single leak location, which works very well even in low frequencies and varied initial conditions. This, because it was designed with a nonlinear model and the parameters to identify were only two. On the contrary, the PEM algorithm designed for the location of two leaks was sensitive to the initial conditions and shown problems concerning to the identification region. This fact is due to the low frequencies used for the parameter identification, the small dimension of the model and the high quantity of parameters to identify. Therefore, some proofs must be carried out at high frequencies and using high dimensional models.

Conclusion
Here, we have proposed an approach based on the identification of parameters and operation changes related with leaks.
To put into practice the identification tasks, it has been essential to excite the system with a persistent input. Since the entire frequency behavior of a pipeline can only be modeled by complex models (see Matko et al. (2000)), a frequency evaluation of approximated solutions of the fluid pipeline equations has been done in order to verify the validity of the proposed identification method. From this, it has been shown that simple models can be used to identify the leak parameters, but only at low frequencies. If higher frequencies are required, then more complex models must be used.