University
stringclasses
19 values
Text
stringlengths
458
20.7k
ADE
Chapter 2 โ€“ Anomaly detection and topological identification Figure 2-3. Effect of the presence of a branch on a transient pressure head trace. These figures show that the wave reflections induced by the presence of a topological element affects the transient pressure signal significantly. The initial effect is either a drop or an increase in pressure depending on the topological element. If the transient wave is moving from a smaller diameter into a larger diameter (expansion), the pressure in the pipeline drops while if a contraction or a branch (where all diameters are the same) is present, the pressure in the pipeline increases. Figure 2-2 and Figure 2-3 reveal that the presence of simple topological elements can alter a transient pressure wave in comparison with a single pipeline. In all three cases presented in these figures, the maximum pressure recorded was larger than the initial transient wave injected into the system. This behavior has been reported previously demonstrating the importance of knowing the topology of the system before conducting condition assessment tests (Wylie 1983; Karney and McInnis 1990; Ellis 2008). For instance, Bohorquez et al. (2020b) analyzed the superposition of waves from a transient event with different topological configurations showing that the pressure response can be magnified if the transient wave propagates into a large hydraulic impedance section, effectively accumulating head in a pipeline. Different transient based methods have been applied to the identification of topological elements in water pipelines, in particular for the identification, location and characterization of branches. Time reflectometry methods have been implemented through the analysis of the transient signal directly (Brunone et al. 2008; Meniconi et al. 2017) or using a wavelet transform (Meniconi et al. 2011b) to confirm the existence and status of a branch in a single pipeline. These applications have demonstrated that the existence of a branch induces changes in the transient pressure signal that can be used for its identification and characterization. Meniconi et al. (2011b) determined the 17
ADE
Chapter 2 โ€“ Anomaly detection and topological identification location of a branch (disregarding its status) by identifying the reflections from this element in the first 2๐ฟ/๐‘Ž seconds of the wavelet transform after the transient test while the status can be defined based on the transient signal between 2๐ฟ/๐‘Ž and 4๐ฟ/๐‘Ž seconds after the transient test. Although successful, these applications are based on the visual inspection of the obtained signals and a manual analysis of the signals is required. Inverse Transient Analysis has also been used for the identification of branches and the determination of pipeline lengths. Kim (2016) proposed a Genetic Algorithm (GA) approach for the simultaneous location and characterization of a branch, a leak and a blockage in a numerically modeled pipeline. A numerical model in the frequency domain was selected to generate numerical transient pressure traces of possible configurations of the system. This application of ITA proved successful in the location and characterization of the branch in this pipeline demonstrating that these methods can be used for topological identification. More recently, Capponi and Ferrante (2017) proposed the use of the network admittance matrix method, a numerical method to solve the transient flow equations in the frequency domain, to determine the lengths of a maximum of three segments of pipelines in a single pipeline with a branch. This numerical approach proved successful for tests where the length of the upstream segment of the main pipeline was known. However, for cases where this segmentโ€™s characteristics were unknown and were included as an unknown in the optimization process, the success of the ITA was highly dependent on the initial conditions of the optimization algorithm. In general, the nature of the potential solution space is very important in the success of an ITA application as optimization algorithms might select local optima instead of the desired global optimum (Capponi and Ferrante 2017). In addition, ITA methods can be computationally expensive as they require separate transient numerical simulations for each trial considered in the optimization process (Stephens et al. 2004) and often rely on assumptions and simplifications of the transient numerical model for complex applications (Stephens et al. 2013). A frequency response method has also been proposed for branch identification in water pipelines. Duan and Lee (2015) obtained analytical expressions for the frequency response function of a pipeline with a branch and used it in combination with an optimization algorithm to detect inactive branches in a numerical pipeline. This application proved successful in the determination of the branch location and 18
ADE
Chapter 2 โ€“ Anomaly detection and topological identification accurate in defining the length of the branch as long this length was not significant in comparison with the main pipeline. Although this method does not require a benchmark frequency response function, its accuracy is limited to certain system characteristics and it is not fully automatic as an optimization process is needed to solve the analytical expressions proposed. 2.3 Burst Detection Water breaks or bursts can be significantly disruptive in water distribution systems; therefore, locating and characterizing these abnormal events is vital for the correct functioning of water supply systems. When a burst occurs in a pipeline, a negative pressure wave travels along the pipeline in both directions, interacting with different elements in the pipeline and its boundary conditions (Misiunas et al. 2005). For the case of a reservoir-pipeline-valve system, Figure 2-4 presents the transient pressure signal observed at the end of the pipeline for two different bursts happening at two different locations along this pipeline. In both cases, the burst has been modeled as a circular orifice that is open rapidly (Misiunas et al. 2005). This figure shows that the negative transient wave generated by the burst is reflected in the system reservoir and the time of arrival of this reflected wave can be used to determine the location of the burst. In general, a burst located closer to the pipeline reservoir will induce a drop in the pressure followed by a quick recovery while a burst located close to the downstream end will induce a more prolonged low pressure before the reflection from the reservoir arrives at the end of the pipeline. In addition, the severity of the burst can be determined by the magnitude of the pressure drop. In terms of detecting and locating a burst by analyzing the negative transient wave that this abnormal event generates, some applications have been previously proposed. It is important to highlight that these techniques address the burst location with passive monitoring of the pressure behavior in the system. There is no generation of a transient event via a valve closure, for example, as techniques proposed for anomaly detection or topological identification. 19
ADE
Chapter 2 โ€“ Anomaly detection and topological identification (a) (b) Figure 2-4. Effect of the occurrence of a burst on a transient pressure head trace. Burst located at a) 30%, and b) 85% of the pipeline length. Liggett and Chen (1994) introduced the idea of using event detection algorithms with the capacity of detecting the sharp change in pressure generated by the occurrence of a burst. These detection algorithms would work in conjunction with an ITA approach to locate the burst by successively modeling these events at different nodes of the system. Later, Misiunas et al. (2005) proposed a time reflectometry framework to detect the occurrence of bursts using a two-sided cumulative sum algorithm to detect the abrupt pressure changes and an offline analysis to determine the location of a burst. This application proved successful, however, its accuracy depends on the relation between the opening rate of the burst and the proximity of the burst to the boundaries of the pipeline (Misiunas et al. 2005). Wavelet transforms have also been applied to the passive detection of bursts in water distribution systems. Srirangarajan et al. (2013) used multiscale wavelet analysis to detect bursts and differentiate them from noise-induced peaks and additional elements in the system. This approach was combined with a graph-based search algorithm for the location of bursts based on the wave arrival at different pressure measurement points. Although the proposed technique was successful in detecting the abnormal events, the burst location procedure reported errors of up to almost 30% highlighting the difficulty of locating bursts in complex systems. Finally, frequency domain methods have been used to detect bursts combining wavelet transforms and the use of spectrograms to denoise the raw signal and detect the occurrence of a burst (Zan et al. 2011). This method proved to be robust for the detection of abnormal events; however, the location of the burst was not addressed. 20
ADE
Chapter 2 โ€“ Anomaly detection and topological identification 2.4 Summary of Gaps Considering the existing techniques for leak detection, topological identification and burst detection using transient pressure signals, a series of gaps in these techniques have been identified: - The applicability of some of these techniques is dependent on the availability of an exact numerical model of the analyzed pipeline. Often these models might not be available or might be outdated. - Techniques such as time reflectometry require manual analysis of the raw or processed pressure signal. This manual interpretation can be difficult when more complex systems are analyzed or pipelines subject to background noise are inspected. - Some techniques can be computationally expensive depending on their application. These methods involve repetitive optimization procedures that can easily become impractical, in terms of the amount of time required for the analysis, if the analyzed problem is too complex. Moreover, if the same system needs to be analyzed multiple times, procedures need to be conducted independently increasing the computational effort. - Methods involving optimization techniques are also sensitive to initial conditions and may be susceptible to finding a local minimum instead of the desired global optimum. - Some existing techniques require partial or complete knowledge of the behavior of the intact pipeline to determine some necessary parameters or for comparison purposes. This requirement limits the application of these techniques in existing pipelines where the intact conditions are not fully known. Although existing techniques have proven that using fluid transient waves for pipeline inspection is possible, automatic techniques that do not require specific information from the analyzed pipeline and can provide accurate and fast results are still needed. 21
ADE
Chapter 3 3 Artificial Neural Networks In the last 70 years, Artificial Intelligence has emerged as the science and engineering discipline aimed at making intelligent machines (McCarthy 2007). Developments in Artificial Intelligence have focused on different ways to simulate human intelligence, from rule-driven engines based on if-then statements (Bobrow and Stefik 1986) to more complex applications such as computer vision (Schalkoff 1989; Lemley et al. 2017) and speech recognition (Waibel 1989). Applications of Artificial Intelligence involving algorithms that allow computer programs to automatically improve through experience are broadly defined as Machine Learning (Mitchell 1997). Machine Learning algorithms adjust themselves in response to the datasets they are exposed to (training datasets) by maximizing the likelihood of their predictions being correct in a different, unseen, dataset (testing dataset). Artificial Neural Networks (ANNs) are considered a subfield of Machine Learning where the transformation of the data representation is conducted by a system inspired by how neurons are connected in human brains (Cai et al. 2020). An ANN can be viewed as a learned function, mapping a set of inputs to a set of outputs. The use of ANNs has proven to be effective, computationally efficient, and robust, provided enough information for its training exists (Caputo and Pelagagge 2003). In addition, ANNs have the ability to incorporate new information into previously trained networks provided that these results come from the same underlying distribution (Shamir et al. 2010). This chapter presents an overview of ANNs to provide context for this research. The following includes basic principles behind how ANNs function and the two main architectures explored in the applications presented in this thesis. In addition, a succinct literature review of previous applications of ANNs to pattern 23
ADE
Chapter 3 โ€“Artificial Neural Networks recognition, to the use of numerical data for ANN training, and the application of ANNs to problems in water research is presented. 3.1 Artificial Neural Networks The concept of using networks of artificial neurons to solve logic problems was first proposed in 1943 (McCulloch and Pitts 1943). However, it was not until decades later that their use became feasible when algorithms capable of adjusting the response of the ANN to a training dataset were proposed (Dreyfus 1990). These algorithms required extensive computational resources which impeded widespread use of ANNs until recently, when the fast improving computational power and increase of data availability has allowed the application of ANNs to more practical problems. A basic architecture for an ANN is comprised of three elements: a series of inputs, a hidden layer containing multiple neurons and a series of outputs. The neurons are densely connected with the inputs by input links and each link is scaled with a real- number value commonly known as weight. These weights transform and combine the inputs in each neuron using an activation function embedded in that neuron producing a real-number value as an output. The process of learning occurs by changing the weights that connect the input and the neurons using an external stimulus in the form of the training data containing examples of input-output pairs of the function to be learned (Aggarwal 2018). ANN architectures can vary in terms of topology. If the architecture of an ANN contains more than one hidden layer, it is considered a deep network because the relation between the inputs and the outputs is less direct. The creation, training and application of these ANN architectures, constitute the field known as Deep Learning (Marcus 2018). 3.1.1 Fully Connected Dense Neural Networks Dense neural networks, also known as multilayer neural networks, multilayer perceptrons or feed-forward networks are neural networks that consist of a fully connected input layer, multiple hidden layers and an output layer. The information provided by the input layer feeds the successive hidden layers through the corresponding weights in the forward direction until the output is predicted (Aggarwal 2018). The key feature of a dense neural network (referred to as a dense network in this thesis) is that all the layers are fully connected meaning that a neuron in any layer 24
ADE
Chapter 3 โ€“Artificial Neural Networks of the network is connected to all the neurons in the previous and the next layer (Haykin 1998). Figure 3-1 presents a diagram describing the architecture of a dense network with two hidden layers. Figure 3-1. Fully connected dense neural network. As can be seen in this figure, each element of the input layer connects with each neuron in the first layer through different weights. Similarly, each neuron of the first hidden layer is connected with each neuron of the second hidden layer. Finally, each neuron in the second hidden layer is connected to one of the three neurons that predict the three outputs for this dense network. Dense networks can embed a lot of information in their weights, given their large connectivity, and are capable of expressing very complex functions to the point that, in theory, these networks are able to capture any arbitrary function (Hornik et al. 1989). However, to accomplish this, a large number of hidden layers or neurons in a layer would be required. This would translate in a large number of weights to be trained creating the risk that a network over-fits to the training data and does not generalize adequately to new data. 3.1.2 Convolutional Neural Networks Different alternatives to conventional dense neural networks, without the principle of full connectivity have successfully been proposed as part of the development of machine learning algorithms. Biological neural networks are connected in ways humans do not fully understand but in the few cases that the biological structure has 25
ADE
Chapter 3 โ€“Artificial Neural Networks been understood, significant advances have been achieved by designing ANNs using those principles. One example of this strategy are convolutional neural networks. This networks are inspired in the organization of the neurons in the visual cortex of cats (Aggarwal 2018). Convolutional neural networks have proven successful in tasks such as image classification (Ciresan et al. 2011), object detection (Zhu et al. 2015) and signal processing (Kiranyaz et al. 2019). Most of the applications of convolutional neural networks involve a 2-dimensional input (e.g. an image), however, signal processing and pattern recognition applications, including those presented in this thesis, often use 1-dimensional inputs. A diagram describing the architecture of a 1D- convolutional network is presented in Figure 3-2. Figure 3-2. Convolutional neural networks. The primary difference between a convolutional network and a dense network is that a convolutional layer consists of a set of learned filters. A filter is a learned template in the form of a set of weights which map a small window of the input into a corresponding window in the next layer of the network. To map an entire image, a filter is slid across its entire input signal to produce a corresponding signal for the next layer. In training, each filter learns a specific shape or pattern (feature) in its input that is useful for the task at hand. In many convolutional neural networks there are multiple convolutional layers, each with their own filters. These networks typically step down in terms of the resolution of the signal in the deeper layers. This means that filters in deeper layers capture progressively larger portions of the initial input signal. Another characteristic of the convolutional networks is that the last few layers (usually three) 26
ADE
Chapter 3 โ€“Artificial Neural Networks are dense layer or fully connected layers where the information processed through the convolutional layers is condensed into the outputs. The connectivity characteristics of convolutional networks provide these networks with the ability to capture local interactions between data points in the input which can potentially work well in applications where there is potential to exploit locality of features in the input data. Because the neurons in convolutional networks are not fully connected, for a given number of input nodes, these networks have many less weights and thus are less prone to over-fitting. 3.2 Artificial Neural Networks Training The process of training an ANN is a multivariable optimization problem where the set of weights that connects the layers of the ANN is computed to minimize an error function between the real and the predicted outputs. Multiple optimization algorithms have been used to train ANNs (Karaboga and Akay 2007; Kawam and Mansour 2012) but one of the most widely used algorithms is Stochastic Gradient Descent (SGD). This algorithm updates the weights by moving along the negative direction of the gradient (calculated from a random batch of the complete training dataset) seeking for the global minimum of the error function (Aggarwal 2018). Although the SGD algorithm has a number of advantages in comparison to other optimization algorithms such as fast execution times, it also has some disadvantages related primarily to the possibility of finding a set of weights around local minima of the error function. Considering that one execution of this algorithm can be completed in a relatively short period of time (depending on the number of weights to train), the iterative process runs through multiple executions of the SGD algorithm until the error function drops below a defined threshold. This iterative training approach is not considered a standard practice in the machine learning field; however, this approach based on a 1+1 Evolutionary Strategy has proven effective in previous applications (Beyer and Schwefel 2002). Because each time that the SGD algorithm is executed the training dataset is divided differently to achieve the final set of weights, each iteration will result in a different set of weights. By preserving the best result achieved so far until the threshold is met or the maximum 27
ADE
Chapter 3 โ€“Artificial Neural Networks of iteration is reached, the best set of weights is retained at the end of the training process. 3.3 Artificial Neural Networks for Pipeline Inspection using Fluid Transients Artificial neural networks have been used in a wide range of data-intensive fields, including machine diagnostics (Samanta and Al-Balushi 2003), credit rating (Huang et al. 2004), and facial recognition (Ming and Fulcher 1996), amongst many others (Abiodun et al. 2018). However, to the knowledge of the author of this thesis, deep artificial neural networks have not been previously used for the interpretation of transient pressure traces for the inspection of pressurized water pipelines. This section presents selected past applications of ANNs as examples to provide context to the methods and applications presented in this thesis. Mounce and Machell (2006) proposed the use of two artificial neural network architectures (static ANN and time delay ANN) to detect the occurrence of bursts using flow data at a DMA level showing potential for identifying changes in the flow that corresponded to unusual fluctuations. Similarly, Mounce et al. (2010) proposed the use of support vector regression models to predict time series data in a moving time window and compared these series with measured data for the detection of anomalies. The use of this supervised learning technique was applied to historical data proving that 78% of the alerts corresponded to actual abnormal events in the system. These applications confirm the potential of merging hydraulic measurements and machine learning algorithms for the detection of system anomalies. However, the frequency of sampling for these applications is not applicable to a transient analysis. Other researchers have proposed techniques for the detection of leaks in liquid pipelines using support vector machine models (SVM). Ni et al. (2013) showed that SVM models can predict the occurrence of leaks more accurately than traditional multi-layer perceptrons (fully connected ANNs with three layers) when applied to the numerical model of an oil pipeline. Similarly, Li et al. (2018) proposed the use of SVM algorithms to detect the occurrence of a leak on a moving window in combination with a time reflectometry approach to determine the location of the leak. Both applications proved successful when applied to numerically modeled pipelines, although the 28
ADE
Chapter 3 โ€“Artificial Neural Networks datasets used to train these models were small and difficult to reproduce in more realistic conditions. Deep artificial neural networks have not been used to interpret transient pressure traces for condition assessment of pipelines, yet other applications of pattern recognition have been reported. For instance, Kiranyaz et al. (2015) proposed the use of 1D- convolutional networks to monitor and detect patient-specific electrocardiograms (ECG). Using a combination of data from general databases and patient-specific ECG records, a 1D-convolutional network has been successfully applied to the detection of anomalous heartbeat based only on ECG measurements. This application highlights the ability of 1D-convolutional networks in interpreting time series to identify and classify anomalies. Other relevant applications include the use of physical models for the training of an ANN. Hajgatรณ et al. (2020) trained a dueling deep q-network with hydraulic simulation data to optimize pump operations (defining pump speeds) using only measured flow data at the time the method is applied demonstrating the capability of deep learning techniques to solve problems in near real time. Similarly, Yu et al. (2019) successfully used the numerical model of a benchmark building to obtain vibration data for the training of a convolutional network to predict the location and the severity of damage in the building. Although this application was not validated in an experimental setting, it proved that is possible to train an ANN based on information obtained from a physical model. Previous studies have shown that deep artificial neural networks can be used to interpret flow and pressure in water distribution systems for the detection and broad location of abnormal events. In addition, applications in different fields have demonstrated the ability of deep artificial neural networks to identify patterns in time series. However, deep artificial neural networks have not been applied for the identification, location and characterization of anomalies and abnormal events in pressurized pipelines. 29
ADE
Chapter 4 4 Synopsis of Publications The overall aim of this thesis is to develop and apply data-driven techniques for the active and passive inspection of water pipelines using fluid transients and Artificial Neural Networks (ANNs). This chapter discusses the relationship between the three journal publications that have arisen from this research with the proposed aims and summarizes their content and contributions as a way of introduction to the following chapters. To discuss the connection between the journal publications and the research aims, Figure 4-1 illustrates the contributions of each publication to the fulfilment of the research aims presented in Figure 1-1. The development of a framework to combine the use of fluid transient waves and Artificial Neural Networks for the condition assessment of water pipelines (Aim 1) is presented in Journal Publication 1. This framework has been described in all publications; however, a more in-depth definition and analysis have been included in Journal Publication 1 applied to the identification of the location and size of a junction in a pipeline as a stepping stone in the fulfilment of the overall aim of this research. Two novel techniques are proposed in this research that use Artificial Neural Networks to interpret transient pressure signals obtained from a pipeline. The methodology for the active inspection of pipelines (Aim 2) comprising the location of anomalies or topological elements after the generation of an artificial transient event (Aim 2.1) is described in Journal Publication 1 and Journal Publication 2. First, Journal Publication 1 explores the training and testing of a specific type of Artificial Neural Network for the prediction of the location and size of junctions and leaks in a numerical pipeline. 31
ADE
Chapter 4 โ€“ Synopsis of Publications A more complete approach is then described in Journal Publication 2, where a comprehensive methodology for the active inspection is presented with a novel training framework deploying stochastic resonance to allow for the location of leaks in pipelines where background pressure fluctuations are present and could interfere with the ANN performance (Aim 2.2).A technique for the passive inspection of pipelines for the detection of abnormal events (Aim 3) is included in Journal Publication 3. This publication includes a methodology for the interpretation of a continuously measured transient pressure signal (Aim 3.1) and a complete methodology for the detection, location and characterization of bursts (Aim 3.2). Finally, as can be seen in Figure 4-1, the three journal publications developed as part of this research contribute to the validation of the new techniques (Aim 4). Journal Publication 1 presents a numerical application of the active inspection methodology, while Journal Publication 2 is focused on the experimental application of this methodology. Regarding the passive inspection methodology, Journal Publication 3 addresses both the numerical and the experimental validation of this approach. A summary of each journal publication is now presented. Journal Publication 1 (Chapter 5) first describes the formulation of a framework to use the transient pressure response of a pipeline after the generation of a controlled small magnitude transient event in combination with ANNs for the detection of different features in a single pressurized pipeline. Different elements of this framework are described including the definition of an appropriate ANN architecture to be applied in the recognition of feature-induced transient wave reflections and a methodology for the generation of numerical transient pressure traces used as training and testing samples. This framework is then applied to two separate cases: 1) the location of a junction, defined as a change in the pipeline diameter and 2) the location and size of a leak in a single pipeline, as an example of a pipeline anomaly. A schematic representation of this framework applied to the active inspection of pipelines included in Journal Publication 1 is presented in Figure 4-2. A transient pressure trace signal is measured after the generation of a small magnitude controlled transient event such as the closure of a side discharge valve (represented in Figure 4-2 by the blue line at the top). This pressure trace is then downsampled (shown in the figure with the red circles on top of the original pressure trace) and used as the 33
ADE
Chapter 4 โ€“ Synopsis of Publications input of a particular ANN. Finally, the downsampled transient pressure trace is then processed through a particular ANN to obtain a prediction of the location and the size of the analyzed feature. Figure 4-2 Artificial Neural Networks used for active inspection of pressurized pipelines. Adapted from Figure 5-3 in this thesis. Results in this publication demonstrate that the trained ANNs are able to accurately predict the location of the junction or the leak along the pipeline when presented with numerical traces that have not been used for the training. The prediction of the size of the junction (representing the two diameters in the pipeline on either side of the junction) is almost perfect once a rounding process is conducted as in only one case (out of 2,500) the final prediction of the diameters was inaccurate. For the case of the leak, the size is on average predicted within 0.03 mm of its real size. The main contribution of Journal Publication 1 is that for the first time, numerical fluid transient traces obtained after the closure of a side discharge valve are interpreted by ANNs to accurately locate topological elements or anomalies in a pipeline. The developed framework and the results presented in this publication demonstrate that is possible to train an ANN with numerical transient pressure traces to identify the reflections caused by the presence of a junction or a leak in a single pipeline and accurately predict their characteristics. In addition, the results of this publication 34
ADE
Chapter 4 โ€“ Synopsis of Publications indicate that by combining knowledge of the propagation of the transient wave after a transient event (a key element in the definition of the framework), with the versatility of performance of an ANN, an accurate and fast pipe inspection technique can be developed. Journal Publication 2 (Chapter 6) presents a comprehensive methodology for the active inspection of pipelines based on the framework presented in Journal Publication 1. In cases where the transient pressure signal obtained from the analyzed pipeline contains background pressure fluctuations, the framework presented in Journal Publication 1 is not able to accurately locate anomalies such as leaks. This situation arises because the pressure fluctuations are not reproduced by numerical transient flow models affecting the accuracy of the anomaly location prediction of the ANNs. The methodology presented in Journal Publication 2 enhances the ANN performance in detection of leaks in pipelines via deployment of stochastic resonance. Stochastic resonance is a phenomenon where the performance of a non-linear system is optimally enhanced by the addition of a certain noise intensity (Harmer et al. 2002). This phenomenon is applied in the active inspection methodology presented in Journal Publication 2 through the creation of a set of ANNs that are trained with numerically generated transient pressure traces containing artificial noise with different intensities to determine the optimal noise intensity that enhances the 1D-convolutional neural networks performance. A diagram of a set of ANNs presented in this publication is shown in Figure 4-3. In addition to train multiple ANNs with transient pressure traces containing different noise intensities, multiple ANNs are trained with the same dataset to test the robustness of the selected ANN architecture considering that different training attempts using Stochastic Gradient Descent algorithms will produce a different set of weights in each ANN. From the results obtained from the training of these ANNs and its application to a pipeline, an optimum noise intensity has been determined. 35
ADE
Chapter 4 โ€“ Synopsis of Publications Figure 4-3. Set of ANNs used for active leak detection via deployment of stochastic resonance. This methodology has been applied in a real pipeline in the Robin Hydraulics Laboratory of the University of Adelaide where 14 transient tests were conducted. Results from the application of this methodology show that the addition of noise in the transient pressure samples is fundamental for the enhancement of ANN predictions for the location of a leak highlighting the existence of an optimum noise intensity to obtain accurate and reliable results. The application of this methodology has allowed for, the very accurate location and characterization of a leak in this laboratory pipeline. The main contribution of Journal Publication 2 is the development of a comprehensive methodology for the active inspection of water pipelines by adapting the framework proposed in Journal Publication 1 to accurately locate leaks in single pipelines under more realistic conditions where background pressure fluctuations are present in the pipeline. This publication demonstrates that the deployment of stochastic resonance assists in detecting leaks in water pipelines by showing the existence of an optimum intensity of noise to be added to the numerical pressure transient traces for the training of a set of ANNs. With the addition of noise in the training samples of an ANN, its performance is significantly improved, to the point that consistent and accurate predictions can be obtained. 36
ADE
Chapter 4 โ€“ Synopsis of Publications Journal Publication 3 (Chapter 7) describes a novel methodology for the identification, location and characterization of the occurrence of bursts in a single pipeline using 1D-convolutional neural networks for the interpretation of a continuous transient pressure signal measured at one point along the pipeline. The main difference of this methodology with the one presented in the previous publications is that given that no artificial transient event is induced in the pipeline, this methodology focuses on the passive and continuous inspection of the transient pressure signal. As shown in Section 2.3, the transient pressure traces caused by the occurrence of a burst are more prominent compared to the transient pressure traces obtained in the active inspection technique for a pipeline with a leak (Journal Publication 1 and 2). This characteristic makes these signals less sensitive to background pressure fluctuations and therefore stochastic resonance principles are not applied in the passive inspection methodology. However, background pressure in the pipeline is considered in this publication by modeling different sinusoidal background pressure fluctuations before the occurrence of a burst. A diagram of the use of two different ANNs for the passive detection and identification of a burst in a pipeline is presented in Figure 4-4. A sliding transient pressure time window analysis is used in this methodology to successively analyze one time window at a time. A burst detection ANN is used to classify each time window into three possible categories to determine whether a burst has occurred. Once the burst is detected, a burst identification ANN is able to predict its location and the size. Journal Publication 3 includes a numerical application of the methodology proposed where a sharp burst occurring along a 1000-m long numerical pipeline is considered. This publication also presents an experimental validation of the proposed technique in a real pipeline at the Robin Hydraulics Laboratory of the University of Adelaide. The results from this validation indicate that the prediction of the location of the burst is very accurate while the prediction of the burst size requires an additional step to ensure its accuracy. To obtain the final burst size prediction, Journal Publication 3 includes the application of a burst size adjustment procedure to obtain a more accurate final prediction. 37
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification Foreword This chapter presents the formulation of a framework to use the transient pressure response of a pipeline after the generation of a small magnitude controlled transient event in combination with ANNs for the detection of different features in a single pressurized pipeline. This framework is applied to two condition assessment problems: the location and characterization of a change in diameter in a single pipeline (referred to as a junction) and a leak. To complement the information presented in the publication and provide further context to this chapter, two elements are included here. The importance of the selection of an appropriate ANN architecture for the location of junctions is briefly described, followed by a description of the computational resources necessary for the training of the ANNs. The definition of an appropriate ANN architecture has proven to be a key consideration for the creation of the framework presented in this chapter. Two different ANN architectures were considered including a three-layer dense network and a 1D-convolutional neural network. The characteristics and differences between these two architectures have been discussed in Chapter 3 (Section 3.1) and in Section 5.3 of this chapter highlighting that while a dense network has been widely used in previous applications, it lacks robustness and versatility when complex problems are considered. To demonstrate this, Figure 5-1 presents the error for the ANN prediction of the location of 5,000 different junctions distributed along the total length of a numerically modeled pipeline for two ANNs: a dense network (with 88,113 weights to train) and a 1D-convolutional neural network (with 32,409 weights to train). This figure shows that selecting a dense network as an ANN architecture is not robust enough to accurately locate a junction in a numerical pipeline. Large errors are found for junctions located in both extremes for the pipeline and no consistency is found in the behavior of these predictions. This figure also shows that the junction location predictions of a 1D-convolutional network are more consistent along the pipeline in comparison to the predictions of the dense network and present fewer oscillations 41
ADE
Abstract Condition assessment of water pipelines using fluid transient waves is a noninvasive technique that has been investigated for the past 25 years. Approaches to identify different anomalies and to identify elements of the topology of a pipeline have been proposed but often require detailed modeling and knowledge of the system. On the other hand, artificial neural networks (ANN) have become a useful tool in a range of different fields by enabling a computer to solve a problem without being explicitly programmed to do so, but rather by learning from a series of known examples. This paper presents a new methodology that uses ANNs to predict the presence of features in a pipeline. First, the location and characteristics of a junction have been predicted as a way to identify elements of the topology of a pipeline followed by identification of the location and sizing of a leak. The ANN characteristics and training approaches have been determined for both the junction and the leak example. Results show that the ANN that has been designed for this research is able to accurately predict the location of a junction with an error in this estimation of 2.32 m (out of a 1,000 m long pipeline) or less in 95% of the tested cases. The prediction of the two different diameters on either side of the junction was extremely accurate with only one misidentification of one of the diameters in the 5,000 tested examples. When the ANN was trained and tested to locate and size a leak, the results were also successful. A total of 95% of the tested examples located the leak with an error equal or less than 3.0 m (out of a 1,000 m pipe length) and the leak size was predicted with an average absolute error of only 0.31 mm. The results presented in this paper demonstrate the potential of combining the use of both fluid transient pressure waves and ANNs for the detection of features in pipelines. 45
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification 5.1 Introduction Water is a vital resource to society and its continuous distribution for all types of use is becoming a challenge, including time and spatial inequality in its availability, and the lack of responsible management and poorly maintained infrastructure. In addition, pipes in water distribution system networks are often underground, which complicates their monitoring and maintenance. To overcome this, various noninvasive techniques have been developed to monitor and detect faults in pipelines for accomplishing an efficient and cost-effective maintenance. These methods include visual inspection (Guo et al. 2009), electromagnetic methods (Wang et al. 2012), acoustic methods (Juliano et al. 2013), ultrasonic, radiographic, thermographic methods (Zheng and Yehuda 2013), and more recently transient-based inspection (Lee et al. 2008; Gong et al. 2014a; Gong et al. 2018a). Of these different techniques, transient-based methods have received special attention in the past two decades given that they allow the inspection of large sections of a pipe with a relatively simple set up (Gong et al. 2013c), and results can be obtained quickly (Lee et al. 2006; Shi et al. 2017). These methods are based on the interpretation of the effect that any feature in a pipeline has on the transient head trace, when a small controlled artificial transient pressure event is generated. To detect faults by using transient pressure signals, several methods have been proposed and can be organized in three groups according to Colombo et al. (2009): (1) inverse transient techniques, (2) frequency domain techniques, and (3) direct transient methods. However, whereas each of these approaches has been moderately successful, they also have associated disadvantages in terms of processing time or required knowledge of the analyzed system. The current paper presents an innovative transient-based technique that uses artificial neural networks (ANNs) to identify topological elements such as junctions in water pipelines networks and to locate and characterize leaks. Unlike previous studies, the proposed technique is data-driven because it does not need any detailed information with regard to the analyzed water network system. When the ANN is tested, it gives successful results using just the transient head trace measured at the transient generation location. Previous techniques of transient-based pipe condition assessment 47
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification have been model driven because they have always had to prepare a detailed simulation model of the pipeline to be analyzed. The technique proposed in this paper uses transient head data for the training of the ANN that can be obtained either from historical data or from an available model and is data-driven in its application because it only requires measured transient head data to locate and characterize the desired features. In addition, the computational effort of the proposed technique is concentrated in the ANN training stage, but once this stage is complete, the technique can process and find leaks and/or topological features from different transient head traces almost immediately, without the need of retrain the ANN. Considering that this is the first reported joint application of fluid transients and ANNs, the examples and the functioning of the technique are demonstrated only with numerically derived data. However, the promising results of this first application prove the promising potential of this approach and offer insights for future validations (with experimental and field data) and applications in more complex systems. The methodology proposed in this paper is applied to the location and characterization of different features in a single pipeline. It is shown that the technique is successful in accurately predicting the location of the feature within the pipeline and its size, and it proves the potential of exploring the joint use of fluid transients and ANNs in more realistic scenarios. The ANNs were trained with numerical data generated using a method of characteristics (MOC) transient model and its performance has been tested also with different sets of numerical data showing that the ANN is able to identify new features that were not used in its training. Two hydraulic systems have been considered. The first one is a pipeline with two segment lengths of different diameter (referred to as a junction system), and the second one was a single pipeline with the presence of a leak. The junction system was used to determine the most appropriate structure and characteristics for the ANN given that is a simpler system and the response of the transient head trace is easier to identify in comparison to a leak in a pipeline. In addition, the identification of a junction was selected as an example of topology identification because its location and the diameters of the two segments are predicted. The present paper provides a background in transient-based methods for identifying topological elements and for locating leaks based on transient pressure traces, 48
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification highlighting certain limitations of each method that can potentially be overcome with the use of ANNs. A summary of the key elements of ANNs that were used for the present technique are then discussed, including the different configurations considered. The hydraulic systems selected are defined next, and the ANN training settings are described. Finally, results for the location and sizing of a junction (sizing referring to the determination of the two diameters at the junction in the pipeline) and for the location and sizing of a leak are presented. The proposed method is shown to be accurate and general for the considered systems; however, in addition to some concluding remarks, some challenges of the future application of this technique are briefly discussed. 5.2 Background Fluid transient waves are an interesting mechanism for detecting existing faults, features in pipelines, and different elements of the topology of a water system (Bohorquez et al. 2018). However, this technique is highly sensitive to multiple system characteristics, and understanding what the pressure signal response should look like when a specific fault is present in realistic cases is often challenging (Xu and Karney 2017). Different authors have applied techniques using fluid transients to detect topological elements and to locate leaks in pipelines. First, different techniques have been proposed to identify junctions, branches, and partially closed valves in pipelines. Brunone et al. (2008) applied time reflectometry to confirm the existence of a Y junction in a water main pipe in Italy. By interpreting the arrival of the transient wave reflection at the Y junction when it arrives at the measurement point, the precise position of the Y was computed accurately. Although successful, this technique requires the visual analysis of the transient pressure trace to determine the arrival of the reflected wave and depending on the system, can fail in terms of both precision and reproducibility. Meniconi et al. (2011b) developed a laboratory test to locate branches on a system using a wavelet analysis and a reflection coefficient for estimating the size of the branch. Their results showed that a visual inspection of the wavelet transform is a good mechanism to locate branches, but the damping of the transient pressure waves affected the use of the reflection coefficient due to the pipe viscoelasticity and unsteady friction. In addition, to determine the condition of the branch (active or 49
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification inactive), this approach used a MOC model to compare with the measured pressure traces. Second, detection of leaks has received special attention given that water losses affect the performance, diminishes the operational age of a water supply system, and represents economic and environmental losses for a water utility (AL-Washali et al. 2016). The possibility of detecting single and distributed leaks by analyzing a transient pressure trace has been analyzed by different authors that explored techniques that can be divided in three groups: (1) inverse transient techniques, (2) frequency domain techniques, and (3) direct transient methods (Colombo et al. 2009). Inverse transient analysis (ITA) techniques are based on the calibration of a numerical model in terms of the existence and characteristics of leaks to match the measured and the numerical transient pressure trace(Colombo et al. 2009). The first application of ITA and transient pressure was proposed by Liggett and Chen (1994) but a number of researchers have used ITA for detecting leaks in pipelines by modifying the optimization problem, the pressure measurements, and the selected algorithms (Covas et al. 2001; Vรญtkovskรฝ et al. 2003b; Soares et al. 2011; Kim 2014; Capponi et al. 2017). Despite the accuracy of ITA methods in the location of leaks under different scenarios, they require a detailed numerical model of the analyzed system, they can report discrepancies in leak size estimations (Covas et al. 2001), and an optimization model needs to be executed each time a transient pressure trace is analyzed. A second group of methods for locating leaks are the frequency domain techniques, which are often associated with determining the frequency response function of the system and comparing it with the one in a pipe without any anomalies(Gong et al. 2016a). A first numerical application of these techniques was proposed by Mpesha et al. (2001) and since then, different approaches have been developed emphasizing the theory, procedure, and application of this technique (Lee et al. 2005; Sattar and Chaudhry 2008; Duan et al. 2010; Ghazali et al. 2010; Gong et al. 2013a; Gong et al. 2016a; Duan 2017). However, frequency domain techniques require extensive measurements in the field and the frequency response function of the intact pipe, which can be obtained numerically using a detailed model (Colombo et al. 2009). A third group of methods has been defined by Colombo et al. (2009) as direct transient methods. These methods aim to identify special features in the transient pressure trace 50
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification that are induced by the presence of the leak. This group includes techniques such as time reflectometry (Brunone 1999; Lee et al. 2007a; Brunone et al. 2008; Guo et al. 2012; Lazhar et al. 2013), transient signal damping analysis (Wang et al. 2002; Nixon et al. 2006; Brunone et al. 2018), and wavelet analysis (Ferrante and Brunone 2003; Ferrante et al. 2007; Ferrante et al. 2009; Meniconi et al. 2011a; Brunone et al. 2013). These methods have been successful in the detection and characterization of leak in pipelines; however, the physical characteristics of the pipeline are required, and some approaches depend on knowing the transient pressure trace of an intact pipeline. In addition, experience is required to interpret the resulting pressure trace due to the existence of vibrations, background transients, and instrument noise (Colombo et al. 2009). Although the majority of previous techniques have achieved satisfactory results in the task of detecting elements of the system topology or locating a leak using pressure transients, these methods require information about the analyzed pipeline (physical characteristics and resulting transient pressure traces after installation) or a detailed numerical model (model-based techniques). In addition, to obtain results extensive field tests may be needed, or a significant computational time is required for the analysis of each transient pressure trace obtained from a test. Thus, there is an advantage in using data-driven techniques that can provide accurate results fast and with the potential of applications to different water pipelines configurations. ANNs have had a broad set of applications in different fields, and they have become a powerful tool in machine learning. The use of ANNs has proven to be effective, computationally efficient, and robust, provided enough information for its training exists (Caputo and Pelagagge 2003). In different applications, it has been demonstrated that results from ANNs are robust and are not sensitive to background noise in the analyzed system (Carlini and Wagner 2017; Mangal et al. 2019). In addition, ANNs have the ability to incorporate new information to previous training results provided that these results come from the same underlying distribution (Shamir et al. 2010). In water-related research, ANNs have been successfully applied to a variety of problems including water availability under climate change scenarios (Swain et al. 2017), asset failure prediction (Harvey et al. 2014), water demand prediction (Guo et al. 2018), cyber-physical attacks location (Taormina and Galelli 51
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification 2018), and burst detection in water distribution systems (Romano et al. 2014), among many others. Nonetheless, the use of ANNs for the identification of elements in the topology of a system, for leak detection and in general, for pipeline condition assessment using fluid transients, have not been previously explored to the knowledge of the authors. Only one application was reported by Belsito et al. (1998) where the location of leaks was predicted using ANNs in liquefied gas pipelines for different leak sizes. Pressure signals were used in their research as input information for the ANN, but transient waves were not considered. The results showed that the ANN was able to locate the leak accurately in more than 50% of the cases, for a leak size of 1% of the base flow. The research presented in the current paper is the first combined use of ANN and fluid transient waves to identify topological aspects and to detect and characterize leaks in water distribution system pipelines. 5.3 Artificial Neural Networks An ANN implements a mathematical function (model) from n inputs to m outputs, and this function is represented by a mathematical graph of connections and nodes linking the input to the output. An example network is shown in Figure 5-2. The inputs to the ANN are a vector of numerical values; these values are transmitted through the links of the graph to activation functions, which represent neurons. All links in the graph have an associated weight which is used to scale the value traveling on that link. Each activation function transforms the sum of the weighted values it receives, to an output value that is then propagated through the network. Thus, the input values are transformed by traversing the weighted links and the activation functions in the graph until they reach the output links. To produce the desired behavior, an ANN needs to be trained. The training process modifies the weights associated with each of the links in the network to improve the accuracy of the model represented by the network. In theory, through modification of weights alone it is possible for a network of at least three layers, with enough links, to approximate an arbitrary function (Cybenko 1989). However, deep networks (with more than three layers) tend to be more practical to train, more versatile, and less prone to over-fit (Urban et al. 2016). The extent to which this approximation succeeds is determined by the interaction between the network architecture and its training 52
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification process. In practice, training the network is a process of mathematical regression where a gradient search is used to adjust the weights in the network to minimize the error between the actual outputs of the network and the desired output. To be useful in the desired application domain, a network will approximate the required function to a high level of accuracy on both the data it was trained with and any new test data that it is presented with. Figure 5-2. Artificial neural networks (ANNs) overview. In the past decade, the technology used to train, specify, and implement ANNs has advanced rapidly. As a result, modern ANNs present the designer with a very broad range of design decisions for the ANN relating to topology, scale, activation functions, regularization strategies, and training methodology. As a general rule, the designer of an ANN has to use a network design that captures the behavior of the desired function without having so many weights (parameters) as to over-fit the data used in the training process. In the application described in this paper, the functions that are approximated by the ANNs transform an input in the form of a transient head time series into continuous scalar values representing the location and the sizes of features in a pipeline as the output, as shown in Figure 5-3. Thus, in this application, the input data (the transient head time series) may be quite large, and the resulting relationships to be learned are then quite complex. Two architectural options for the ANN have been explored in this paper. The most general available ANN structure was evaluated first, which corresponds to a fully connected dense network. Such networks are, in theory (Hornik et al. 1989), able to capture arbitrary functions. Subsequently, the use of a 1D- convolutional network was explored. A-priori convolutional networks are known to 53
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification be easier to train and capture structural invariants in their input signal more reliably than fully connected networks (Lecun et al. 1998). Figure 5-3. An ANN applied to pipe condition assessment. A dense network, an example of which is shown in Figure 5-4(a), connects each neuron in a layer to every neuron in the subsequent layer. Dense networks embed a lot of information in their weights and can express quite complex functions. However, the large number of weights in dense networks create the risk the network will over-fit the training data and not generalize adequately to new data. a) b) Figure 5-4. Architectural options of ANNs: (a) dense network; and (b) 1D- convolutional network. The second architectural option used in this paper is a 1D-convolutional network [Figure 5-4(b)]. These networks link each neuron in a layer to neurons in the corresponding neighborhood in the subsequent layer. Convolutional networks capture local interactions between data points and can work well in applications where there 54
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification is potential to exploit spatial locality of features in input data. For a given number of input nodes, convolutional networks have many less weights and thus are less prone to over-fitting. Additionally, these networks have been successful in problems that require a deep configuration with a faster and easier training when compared with a dense network. 5.4 Hydraulic Systems Configuration An ANN requires data as a training set to determine its characteristics and the functions behind its performance before being used for predicting a result. To generate the input data for detecting a junction or a leak (depending on the case), repetitive numerical simulations of the transient response of a system to a valve closure have been conducted using a MOC numerical simulation for transient behavior while changing the location and characteristics of the analyzed feature. This section describes the systems used for obtaining the input data for: (1) identifying junctions as a topological element, and (2) for detecting the presence of leaks. 5.4.1 Junction Model The system considered for applying an ANN to identify topological elements is a junction in a single pipeline with two different diameters as described in Figure 5-5. The pipeline is connected at the upstream end to a reservoir with a fixed head ๐ป and 0 on the downstream end to a side discharge valve. The length of the pipeline is fixed (๐ฟ ), the length of the upstream segment of the pipeline of diameter (๐ท ) is ๐‘‡ 1 defined as ๐‘ฅ, and the length of the downstream pipe segment of diameter (๐ท ) is 2 then (๐ฟ โˆ’๐‘ฅ). ๐‘‡ Figure 5-5. Junction system description. Steady-state conditions of the system were fixed for all the transient simulations. An initial head and an initial velocity in the pipeline (at the valve) were defined as ๐ป = 0 55
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification 70 m and ๐‘‰ = 0.15 m/s, respectively. Only steady-state friction was considered by 0 using a Darcyโ€“Weisbach friction factor, ๐‘“, with a pipeline roughness height of ๐œ€ = 0.01 mm. The total length of the pipe was as assumed to be ๐ฟ = 1,000 m. ๐‘‡ The detection of the junction includes the prediction of both its location (by predicting the length of the upstream pipe segment) and the combination of diameters on either side of the junction in the pipeline. To accomplish this using the ANN, input training data included simulations of 10 different combinations of diameters on either side of the junction. These combinations were defined according to the Australian/New Zealand standard for ductile iron pipes with cement mortar lining and are presented in Table 5-1. Different wall and cement mortar lining thicknesses were considered for the different diameters. It is important to highlight that in the 10 combinations of diameters, five correspond to flow going from a larger to a smaller (๐ท > ๐ท ) 1 2 diameter, whereas five correspond to flow going from a smaller to a larger diameter (๐ท < ๐ท ). 1 2 Table 5-1. Outer diameters combinations for detection of junctions (Standards Australia 2014). Combination ๐ท /๐ท ๐ท (๐‘š๐‘š) ๐ท (๐‘š๐‘š) 1 2 1 2 1 1.25 750 600 2 1.50 750 500 3 1.2 600 500 4 1.33 600 450 5 1.11 500 450 6 0.9 450 500 7 0.75 450 600 8 0.83 500 600 9 0.67 500 750 10 0.80 600 750 As it was mentioned previously, generation of the ANN input data (transient head traces at the valve after its closure) to train and test the ANN was accomplished by running multiple numerical simulations of the system using a conventional MOC. For each of the diameter combinations, the length of the upstream segment of the pipeline was changed along the complete length of the pipeline to simulate different locations of the junction. The number of generated locations, selection of these locations, the time step, and length of each reach used in the MOC are described later in this paper. 56
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification 5.4.2 Leak Model A single pipeline was also selected for locating and sizing a leak as is shown in Figure 5-6. The location of the leak is determined by a distance, ๐‘ฅ, measured from the upstream reservoir, and the total length of the pipe is defined as ๐ฟ . The diameter of ๐‘‡ the pipeline (๐ท) was fixed for all the numerical simulations, and the diameter of the leak was defined as ๐ท . ๐ฟ Figure 5-6. Leak system description. The steady-state head and velocity were the same as the junction system. A ductile iron pipe with cement mortar lining is considered with an internal pipe diameter of 727.5 mm, a ductile iron pipe wall thickness of 4.76 mm and a cement mortar lining thickness of 12.5 mm. A steady-state flow of 62.35 L/s results from the initial velocity of 0.15 m/s. The total length of the pipe is 1,000 m, and a steady-state Darcy- Weisbach friction factor was calculated for an assumed pipeline roughness height of ๐œ€ = 0.01 mm. Considering that detection of the leak includes its location and size, different leaks needed to be modeled. For all sizes, the leak was defined as a circular orifice with diameter (๐ท ) that varied in diameter between 13 and 58 mm. This diameter range was ๐ฟ selected to account for the flow through the leak in comparison with the steady-state flow in the pipeline. Table 5-2 shows the list of the circular orifice diameters considered to represent the leak including the ratio (as a percentage) of the diameter of the leak to the internal diameter of the pipeline (727.5 mm). Generation of the transient head trace variation data for the training and testing was conducted using a MOC by changing the size of the leak randomly with a precision of 1 mm. The location of the leak was also modified in each simulation, and a summary 57
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification of the approach for generating the locations of the leaks is explained in the next section. Table 5-2. Leak diameters considered for training and testing the ANN. D D /D D D /D D D /D D D /D L L L L L L L L (mm) (%) (mm) (%) (mm) (%) (mm) (%) 13 1.79% 25 3.44% 37 5.09% 49 6.74% 14 1.92% 26 3.57% 38 5.22% 50 6.87% 15 2.06% 27 3.71% 39 5.36% 51 7.01% 16 2.20% 28 3.85% 40 5.50% 52 7.15% 17 2.34% 29 3.99% 41 5.64% 53 7.29% 18 2.47% 30 4.12% 42 5.77% 54 7.42% 19 2.61% 31 4.26% 43 5.91% 55 7.56% 20 2.75% 32 4.40% 44 6.05% 56 7.70% 21 2.89% 33 4.54% 45 6.19% 57 7.84% 22 3.02% 34 4.67% 46 6.32% 58 7.97% 23 3.16% 35 4.81% 47 6.46% 24 3.30% 36 4.95% 48 6.60% From each training set of location and size, the transient head trace at the closed valve was obtained for a duration of 2.5 s in both hydraulic systems which corresponds to more than the first period of reflections for the pipeline system (2๐ฟ/๐‘Ž), and to less than the complete cycle of the transient pressure wave (4๐ฟ/๐‘Ž). The selection of this time corresponds to the fact that transient waves contain information on the complete pipeline and the different features in the first (2๐ฟ/๐‘Ž), and that energy dissipation effects are not significant. 5.5 Artificial Neural Network Training Settings This section summarizes the ANN and input dataset configuration that was required to develop a satisfactory application of ANNs for the location of junctions and leaks. Different settings needed to be defined including the type and characteristics of the ANN, and the characteristics of the input head data in terms of their nature, time resolution, and size. Two different ANN architectures were considered, a dense network and a 1D- convolutional network. Preliminary tests for the determination of the location of a junction, which are not included in this paper for brevity, showed that the prediction in the location of this feature with a 1D-convolutional network were smoother and more uniform for junctions located across the analyzed pipeline with an average error 58
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification of 1.14 m, whereas the results of the dense network predicted junction locations with errors up to 30 m. In addition, convolutional networks have shown successful performance in predicting multiple outputs in fields such as image segmentation (Raza et al. 2017). This ANN architecture was then used for both the location of the junction and the leak. The 1D-convolutional network used in this paper has been designed by defining a set of characteristics for it, by training the ANN for the location of a junction and by testing it to analyze its performance. These characteristics were defined to ensure that the final ANN was successful in finding the location of the junction, without over- fitting to the training data. The final set of characteristics of the 1D-convolutional network include a network with: (1) the use of leaky rectified linear unit (Leaky ReLU) as an activation function, (2) three convolutional layers of size 1,200, 600, and 300, (3) 10 filters in each layer, and (4) three dense layers of size 21, 9, and 2 (or 3 depending on the analyzed feature). With this configuration, 32,409 weights have been trained. To train and test the ANNs, multiple locations for the considered features (junction or leak, depending on the case) were selected for generating the input data. The number and the characteristics of these examples were defined in terms of the distribution of these locations (random or uniform locations along the pipeline), the time resolution of each transient head trace (original resolution or down sampled), and the number of locations along the pipeline (ANN input data size). To define these characteristics, preliminary training and testing runs were developed for the junction model and then applied to the leak model. For determining the junction locations distribution along the pipeline (to create the ANN input dataset of transient head traces), two options were considered: generating transient head traces for junctions at either uniform spacing or randomized spacing along the pipeline. A random distribution of the location of the junction proved to be more efficient when compared with a uniform distribution given that the ANN predictions of the preliminary tests were more accurate in terms of the median of the error and the maximum errors. On the other hand, depending on the number of junctions considered to generate the input transient head traces, the distance between locations varied between 0.1 and 2 m 59
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification and the numerical results of MOC needed to reflect different transient head traces for each location. To achieve this, the time resolution of the MOC is required to match the spatial separation of each location to apply the method along the characteristic lines. This implies that, for instance, for a spatial resolution of the junction location of 0.1 m and a total simulation time of 3 s, 10,000 junction locations would be necessary to cover a 1,000 m pipeline and each of these locations would have 20,000 head values. In this case, the complete input dataset would include 200 million head values. Considering the potential size of the ANN input dataset, a timewise down-sampling process was explored. To evaluate the performance of this process, two input datasets were created: one with transient head traces with 26,800 head values (for 10,000 different junction locations) and one with a uniform down sampling from the first dataset to 1,200 head values, for the same 10,000 different junction locations. This indicates that the down-sampled transient head traces preserve the information from the original junction location even though they only contain 1,200 head values. Two 1D-convolutional networks were then trained and tested 20 times, and the obtained results were analyzed in terms of the distribution of the average and the maximum absolute error for all the junctions across the pipeline. Results from this sensitivity analysis are presented in Figure 5-7. This figure shows that the median average absolute error is slightly larger for the down-sampled input dataset; however, the total variation of these errors is smaller. In addition, the maximum absolute error is notably better when the down-sampling process is carried out. This behavior is explained primarily because the training process of the ANN is easier when fewer weights are required to describe the same head variation traces. Therefore, by down sampling the transient head trace variation, the size of the input data decreases without significantly compromising the information contained within it. Finally, the number of training and testing examples (ANN input sample size) was defined. The selection of this parameter is directly involved with the computational effort required to generate the input data and subsequently, to train the ANN. The most convenient input sample size was determined separately for the location of the junction and the leak because the transient head deviations induced by the presence of a leak 60
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification are more subtle than for a junction, resulting in the necessity of using more training examples. Figure 5-7. Input data down sampling for junction location. Box whiskers plots of: (a) average absolute error; and (b) maximum absolute error. For the location of a junction, four different sample sizes were tested: 500, 1,000, 5,000, and 10,000 locations along the 1,000 m pipe. After performing the preliminary training and testing of the ANN, a sample size of 5,000 was selected as the most appropriate. It provided accurate results for the location of the junction with significantly less computational effort (the training process took 248 min) because the junction only needs to be located each 0.2 m for a sample size of 5,000 and not each 0.1 m as for a sample size of 10,000. Using a sample size of 5,000 indicated that to simulate 2.5 s, 13,400 head values would be calculated with a โˆ†t = 1.866ร—10โˆ’4 s. After the down-sampling process, 1,200 head values were obtained with a โˆ†t = 0.0021 s. For the location of a leak, more samples were required. Four different input data size sets were tested: 5,000, 10,000, 25,000 and 50,000. Results of preliminary predictions made with ANNs trained with 25,000 and 50,000 were significantly better than the first two sample sizes. However, given the results of these tests it was not possible to choose a preferred sample size; therefore, results are presented for two ANNs, one trained with 25,000 locations and the other with 50,000. In both of these sample sizes, the separation between leaks was 0.2 m (preserving the ฮ”t described above for the location of the junction). Therefore, five (or 10 depending on the case) different locations were randomly generated each 0.2 m. 61
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification 5.6 Results Once the different settings for training an ANN were defined as described above, results for the prediction of the location and size of a junction and a leak have been obtained. For both cases (junction location and leakage), the results are presented in terms of the training and testing location errors, followed by testing of the size errors (diameters of both pipes on either side of the junction in the first case and diameter of the leak in the second case). In addition, a distribution of the error, represented as a percentage exceedance plot, for the location of the features is presented. 5.6.1 Junction Location and Sizing Results for the topology identification application by locating and sizing a junction along a pipeline are presented first. Based on the hydraulic system configuration described in Figure 5-5, the location of a junction was predicted using the ANN by the length of the upstream segment of the pipe ๐‘ฅ. Sizing of pipes on either side of the junction model refers to the determination of the two diameters associated with the two segments of the pipe. Those diameters are included in the combinations described in Table 5-1. The ANN used was a 1D-convolutional network using a sample size of 5,000 (half for training and half for testing) with examples generated randomly (in 0.2 m intervals) and down sampled to 1,200 time steps. Location errors are shown in Figure 5-8(a) for the 2,500 examples used for the training stage of the application. The average absolute error for the training dataset was 0.79 m with a maximum error of 7.21 m when the junction is located at 987 m downstream (within 13 m of the end of the pipe) of the reservoir (the total length of the pipe is 1,000 m). From this figure, it is possible to observe that near the extreme ends of the pipe, results tend to present larger errors in comparison to the results in the central part of the pipe. This behavior is due to the effect that those extreme locations have on the transient head trace at the measurement point. When close by, the reflections from the junction interact with the reflection at the reservoir (if the junction is close to the upstream end) or with the initial transient head rise (if the junction is close to the downstream end of the pipe). For these locations, instead of having a head drop (or increase depending on the ratio of diameters ๐ท /๐ท ), the presence of the junction 1 2 causes a short spike at the beginning of the trace or close to a time of 2๐ฟ/๐‘Ž s that 62
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification makes it difficult for the ANN to use the same weights that represent this behavior in the rest of the pipeline. Figure 5-8. Location errors for junction location: (a) training dataset errors; and (b) testing dataset errors. On the other hand, testing location errors for the 2,500 examples used for this stage of the application are presented in Figure 5-8(b). By comparing this figure with Figure 5-8(a) it is possible to conclude that the ANN trained is not over-fitted because the error behavior is similar for the training and the testing datasets. Over-fitting is one of the key issues when working with ANNs because depending on its parameters and the input data, the ANN can perform satisfactorily for the training set but poorly for new unknown data as the test dataset. The testing dataset had an average absolute error of 0.81 m (slightly larger than the average absolute error for the training dataset) and a maximum error of 8.3 m when the junction was located at 420 m from the reservoir. Errors in the estimation of the values of both diameters of the pipe junction (๐ท and 1 ๐ท ) are shown in Figure 5-9. In general, errors in diameter were extremely small, 2 reaching a maximum of 27.1 mm for ๐ท and only 7.25 mm for ๐ท for the worst 1 2 estimation. Average absolute errors were 0.31 and 0.27 mm, respectively. However, when predicting diameters, it is important to consider that pipe diameters cannot take on continuous values due to commercial production restrictions; therefore, results from Figure 5-9(a) were rounded to the closest diameter in the list defined in Table 5-1 and are shown in Figure 5-9(b). By performing this rounding procedure, only in one diameter prediction case (out of the 5,000 diameter predictions, two per each testing example) was the diameter not correctly identified. 63
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification a) b) Figure 5-9. Junction diameter errors for testing dataset: (a) before rounding process; and (b) after rounding process. Finally, Figure 5-10 presents the percentage exceedance associated with the absolute error in the junction location prediction. This type of plot is useful to analyze the distribution of errors in detail. The percentage exceedance can be interpreted as the proportion of time that the junction location surpassed a certain error size. For instance, according to Figure 5-10, in 5% of the testing examples, the junction location was predicted with an error of 2.32 m or larger. For reference, the maximum location error for the training and the testing datasets is also shown in the figure. Figure 5-10. Percentage exceedance for absolute junction location error. The distribution of the errors shows that the extreme values of error (larger than 3 m) are relatively rare in occurrence, and these correspond to only 2% of the total testing 64
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification examples. In addition, the similarity in the distribution of error for the training and the testing datasets is validation of the adequate performance of the 1D-convolutional network to predict the location of a junction in a single pipeline. 5.6.2 Leak Location and Sizing Results for the prediction of the location and size of a leak are presented in this section. As described above, the preliminary tests developed for determining the most adequate input training sample size for the location of the leak were inconclusive between using 25,000 and 50,000 examples for the training and testing of the ANN. Therefore, results are presented for both input sample sizes in Figure 5-11. Figure 5-11. Location errors for leak location: (a) training dataset errors with 25,000 training examples; (b) testing dataset errors with 25,000 training examples; (c) training dataset errors with 50,000 training examples; and (d) testing dataset errors with 50,000 training examples. Training errors for an input sample size of 25,000 are shown in Figure 5-11(a), whereas the training errors for a sample size 50,000 are shown in Figure 5-11(c). The average absolute error for the ANN when the input sample size was 50,000 is 1.09 m in comparison with 1.24 m that was obtained when the input sample size is 25,000. In contrast, the maximum value for the error is smaller for 25,000 examples (10.13 m 65
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification compared with that of 32.29 m for the 50,000 sample size). In the training process, both sample sizes present reasonable results; however, when both ANNs are used for predicting, results differ for the two sample sizes. Figure 5-11(b) and Figure 5-11(d) present the leak location errors for the testing dataset obtained from the ANN trained with the considered input sample sizes. By comparing these two figures, it is possible to note that using an input sample size of 25,000 leads to larger errors both for the maximum and for the average absolute error. In addition, errors larger than 5 m, for example, are more frequent as seen in the figures. These results show that the ANN obtained with a sample size of 25,000 was over-fitting to the training examples because it is unable to predict correctly new data when more testing examples are used. Based on these findings, the ANN obtained from an input sample size of 50,000 was selected because it can predict the location of the leak with an average error of 1.15 m, and it shows a similar behavior when compared with the training errors (showing that less over-fitting issues are present). The maximum error for the 25,000 examples used for the testing (which corresponds to a total input dataset of 50,000 because half of the data is used for training) was 98.21 m; however, this misleading result was predicted for an example where the leak was located only 1.01 m from the reservoir. Those errors were expected given the fact that the effect on the transient head trace of a leak located close to either of the extreme ends of the pipe can be difficult to distinguish from the reflections at the boundary conditions. In addition, it was observed that for leaks close to the reservoir or close to the closed valve, the down- sampling process in time could cause the loss of information on the reflection from the leak. However, in a real application, if the leak was located close to either of the extremes, it would be manually detected in the process of obtaining the transient data. In general, the time down-sampling process does not affect the accuracy of the technique because even though some information is lost in this process, the ANN is sensitive to the changes in pressure that are not lost in the down sampling. Errors for the leak size are presented in Figure 5-12, only for the ANN obtained from an input sample size of 50,000. This figure shows that errors in the prediction of the leak size are highly satisfactory because most of them are within the range of โˆ’0.2, 0.2 mm. The maximum error is 1.11 mm when the leak is located only 61 cm away from 66
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification the reservoir, and the average absolute error is 0.03 mm. Considering that in a real pipeline, leak size could take any continuous value, a rounding process was not performed as was done for the diameter size in the junction sizing. In general, results from Figure 5-12 show that the prediction of the leak size using ANNs is successful. Figure 5-12. Leak size errors for testing dataset. Figure 5-13 presents the percentage exceedance for the absolute leak location error for both the training and the testing dataset. To improve the analysis of the data, the first and the last 12 m (which would correspond approximately to two segments of pipe in the field) were eliminated before compiling the figure because it allows us to see the behavior of the error once the extreme and unrealistic errors are discarded. By doing this, the maximum error for both the testing and the training is about 12 m, and errors larger than 4 m are only found in 1.89% of the examples. Likewise, in 95% of the examples, the ANN prediction for the location of the leak in the pipe is at least or more accurate than 3.0 m, which represents 0.3% of the total length of the 1,000-m-long analyzed pipe. Finally, a similar distribution of location errors for the training and the testing datasets demonstrate the adequate performance of the ANN when it is predicting locations in new examples. 67
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification Figure 5-13. Percentage exceedance for absolute leak location error 5.7 Conclusions A novel technique to identify topological elements such as junctions and to detect, locate, and size leaks has been proposed in this paper using ANNs as a tool based on the generation of a transient event. Two ANN architectures have been compared, and a 1D-convolutional network proved to predict more accurately the location of a pipeline junction in comparison with a dense network. The transient head data required for the training and testing of the designed ANNs have been obtained numerically using the MOC by changing the position of the analyzed feature randomly along the length of the pipeline. A time down-sampling process has been conducted to reduce the time resolution of the transient head traces, which reduced the computational time and enhanced the performance of the ANN in predicting the location of the features. The number of training examples required to obtain accurate results has been defined. For the location and sizing of a junction, 2,500 examples are enough to train an ANN with accurate results. However, for the location and sizing of a leak, 25,000 examples are necessary to train (in a 50,000 sample dataset for training and testing) the ANN because the effect of a leak in the transient head variation trace is more subtle and is more difficult for the ANN to learn from the input data. 68
ADE
Chapter 5 โ€“ Fluid transients and ANN for Leak Detection and Topology Identification The numerical application of the technique shows that an ANN can accurately predict the location of a junction with an error in the location smaller than 2.32 meters in 95% of the examples tested with a virtually perfect prediction of the diameter sizes on each side of the pipeline junction. In addition, for the location and sizing of a leak, the trained ANN can also accurately predict the leak location with an error smaller than 3.0 mm in 95% of the examples tested with an average absolute error of 0.03 mm in the prediction of the leak size. These results demonstrate the outstanding potential of using machine learning techniques and fluid transient waves for the location of topological elements and anomalies in pipelines. The approach proposed is fast, accurate, and data-driven because no previous information of the system or a hydraulic transient numerical model is required for the testing stage; only a transient head variation trace is needed. Considering that this is the first application of fluid transient waves and ANNs, the proposed approach has been tested in simple hydraulic systems with data obtained numerically; however, some challenges arise when the same technique is applied to more complex situations, and the impact of these challenges will be addressed in future field tests of the performance of this technique. Detection of topological elements and anomalies such as leaks is, in essence, a complex problem. Pipelines and water distribution systems have different elements that can affect the transient head signal obtained in the field, and changes in background conditions can make the detection of anomalies challenging. However, the background fluctuations are typically more gradual with lower frequency content allowing them to be differentiated from other anomalies. In addition, for subtle anomalies (such as small leaks), the deteriorating condition of the pipeline itself can hide the transient head response of the anomaly. Considering these challenges, it would be expected that the accuracy of the use of the proposed technique would be reduced when applied to real pipelines. Nonetheless, ANNs are highly amenable to retraining on real data as it is harvested, and ANNs are robust to noise. The results here offer promise that the use of ANNs can be extended to field settings. The application presented in this paper demonstrates the promising potential of the proposed technique, yet it should be expanded to the analysis of hydraulic systems with different dimensions and configurations, and validated with laboratory and field data to explore its usefulness and accuracy in comparison to other existing techniques. 69
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Foreword This chapter (Journal Publication 2) presents a comprehensive methodology for the active inspection of pipelines based on the framework presented in Chapter 5. There are cases where the transient pressure traces obtained from the analyzed pipeline contain background pressure fluctuations, where this framework is not able to accurately locate leaks. This is because these fluctuations are not reproduced by numerical transient flow models. To address this, the deployment of stochastic resonance is used to enhance ANN performance for leak detection. This chapter also presents the results of the application of this methodology to the detection of a leak in a pipeline in a laboratory setting. The principles of stochastic resonance are applied in this methodology are used for the ANN training datasets containing numerically generated transient pressure traces with the addition of different noise intensities. By training ANNs with these datasets, an optimal noise intensity can be determined. The deployment of stochastic resonance has proven to be fundamental to obtain more robust ANN predictions to accurately detect leaks in real pipelines. To complement the information presented in the publication and provide additional context for this chapter, two elements are included here. The importance of developing a more robust methodology to detect anomalies in pipelines is described by presenting the performance of the ANN proposed in Chapter 5 to interpret a transient pressure trace obtained in a laboratory setting. These results are compared with the leak location prediction of the final set of ANNs presented in this chapter. In addition, the computational resources required for the training of the ANNs used in this methodology are also reported. Following the framework proposed in Chapter 5, five ANNs were trained to predict the location of a leak in the laboratory pipeline described in Section 6.4.1. The distribution of the predicted locations for 14 experimental laboratory based conducted tests is presented in Figure 6-1 in purple. This figure shows that the use of the ANN architecture and the training framework described in Chapter 5 does not provide with 73
ADE
Abstract Water losses through leakage represent a significant problem for asset management in water distribution systems. The interpretation of fluid transient pressure waves after the generation of a transient event has been used as a technique to locate and characterize leaks for more than two decades but existing approaches are often both model-driven and limited to the existing knowledge of the system. A new, data-driven, technique using artificial neural networks (ANN) has recently been proposed to detect, locate and characterize anomalies in water pipelines by interpreting the patterns that different anomalies induce in transient pressure traces. However, the application of this technique in more realistic conditions (e.g. in the presence of background pressure fluctuations) has previously proven challenging because these conditions are not reproduced by the numerical models and affect the accuracy of the anomaly location prediction of the ANNs. To address this, one alternative to enhance the response of any non-linear system includes the introduction of artificial noise, a phenomenon known as stochastic resonance. This paper harnesses this approach by finding the optimal artificial noise intensity to be introduced into the training dataset for a set of convolutional neural networks. In this paper, the enhanced detection of leaks in pressurized pipelines via deployment of stochastic resonance is demonstrated. The methodology has been applied to a real pipeline in a laboratory at the University of Adelaide where 14 transient experimental tests were conducted. Results have shown that the addition of noise to the transient pressure head training samples significantly enhances the ANN predictions for the leak location highlighting the existence of an optimum noise intensity to obtain both accurate and reliable results. When trained with the optimum noise intensity, the ANNs were able to locate leaks with an average error of 0.59% in terms of the actual location (in a 37.24 m long pipeline) demonstrating the promising potential of developing techniques based on ANNs to detect leaks and anomalies in water pipelines. 77
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection 6.1 Introduction Population growth and urban expansion are a challenge for water distribution systems (WDSs) since these systems are responsible for the supply of a vital resource to society. In recent years, major cities have faced a serious water supply crisis(Ahmadi et al. 2020). One major challenge in addressing these crises is the detection of water losses and pipeline repair, which has received attention considering that the percentage of water losses can reach values of 35% in cities such as Kolkata (Mukherjee et al. 2018). Different methodologies have been used to estimate, monitor, detect and pinpoint the location of leaks as part of water losses management strategies (Mutikanga et al. 2013). One of these methodologies includes the use of fluid transients for leak detection that usually involves the generation of a transient event that travels along the pipeline allowing its inspection in a way similar to the functioning of radar and sonar techniques (Puust et al. 2010). Fluid transient based techniques have proven successful in the detection, location and characterization of leaks in pipelines using the information that can be retrieved from transient pressure data. However, in most cases, existing techniques are model-driven. Such model-driven approaches usually require extensive and accurate numerical modeling, a priori estimation of certain pipe parameters assuming an intact or original condition, or they require long processing times to obtain an estimate of the leak characteristics. These limitations motivate the need for data driven techniques that can quickly interpret transient pressure data obtained from a test and locate leaks accurately. A new technique merging the use of fluid transients and Artificial Neural Networks (ANNs) has recently been proposed to locate leaks and changes in pipeline diameters in pipelines following a transient event (Bohorquez et al. 2020a). In addition, this technique has also been adapted to detect the occurrence of bursts (Bohorquez et al. 2021). Although these applications have demonstrated the potential of using ANNs to interpret transient pressure traces, further experimental and field validation is needed to test the performance of this technique under more realistic conditions. This paper presents an important stepping-stone in developing a general technique to use ANNs for leak detection in pipelines using fluid transients. The performance of ANNs for the detection and location of leaks in water pipelines is shown to be 79
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection enhanced via deployment of stochastic resonance. In the following, a background in transient-based methods for leak detection is provided, focusing on recent applications. A summary of the new methodology for the detection of leaks in pipelines under more realistic conditions using a set of ANNs trained with different noise intensities is then presented. This methodology is split into two main stages: model development and model application. Finally, the proposed methodology is applied to a series of experimental transient tests conducted in a laboratory setting. The results demonstrate that, by training a group of ANNs with pressure transient traces with the optimum noise intensity, the accuracy of the leak location predictions can be significantly enhanced, thus providing more robust predictions. 6.2 Background Transient-based leak detection techniques have been in development for more than two decades (Jรถnsson and Larson 1992; Liggett and Chen 1994). Different approaches have been explored and can be classified into three main groups: inverse transient techniques, frequency response techniques and direct transient methods (Colombo et al. 2009). More recently, frequency response methods have been combined with enumeration techniques for leak detection in pipelines with branches and loops by separating the effect of these known elements on the frequency response of the system and employing a GA-based optimization to find the leak characteristics (Duan 2017). This method has proven successful for a numerical application and it has shown the potential of transient-based methods for operation in more complex systems. Meniconi et al. (2019) examined the influence of the pipeline initial flow conditions on transient pressure traces after the generation of a transient event for the visual detection of a leak in the pipeline (as an example of a direct transient technique). This study concluded that, depending on the location of the transient generator device, the transient measured signal can be more sensitive to the initial conditions. If the generator is located close to the water source, the transient pressure signals obtained are almost indistinguishable. In contrast, locating the generator close to the end of the pipeline can produce different transient traces for the same leak in terms of the initial pressure rise (Meniconi et al. 2019). Matched-field processing (MFP) has been explored as a frequency domain technique that can obtain satisfactory results even in noisy environments and it has been 80
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection developed for elastic (Wang and Ghidaoui 2018) and viscoelastic pipelines (Wang et al. 2019). Advantages of this method include its robustness under noisy conditions or uncertainty in the wave speed. It has proven effective in both numerical and experimental conditions when the noise has been assumed to be white noise with a zero-mean Gaussian distribution (Wang et al. 2019). Other recent applications have shown that frequency-based techniques can detect leaks under realistic background noise scenarios using the paired impulse response function obtained from two measurement points in the system (Zeng et al. 2020). Although significant advances have been achieved in transient-based methods in recent years, most of the existing techniques still require testing under perfect conditions (without any leaks), detailed numerical modeling, significant computer resources or extensive preprocessing of the signals. A different group of techniques for leak detection in pipelines has proposed the use of machine learning algorithms to process the available information from a particular pipeline system. Some of these techniques have used surrogate features of the pipeline to predict the most likely location of a leak (Geem et al. 2007) or to predict the remaining lifetime of a pipeline (Zangenehmadar and Moselhi 2016). However, more recent techniques have proposed the combined use of machine learning algorithms and hydraulic measurements in the pipeline. Romano et al. (2014) used different self- learning artificial intelligence, statistical analysis and Bayesian inference tools for the detection of burst at a DMA level in real water distribution systems using wavelets for the denoising of the obtained signal before its analysis. Roy (2017) proposed the use of pressure fluctuations with hybrid dense ANNs for the location of leaks by classifying the status of the system to characterize a normal and abnormal condition in the pipeline. Mujtaba et al. (2020) introduced the use of adaptive thresholds to detect the occurrence of leaks in gas pipelines using pressure and mass measurements at the beginning of the pipeline as inputs for the machine learning model and the potential mass flows at the end of the pipeline as the output of the model for the comparison with measured data. Bohorquez et al. (2020a) presented a methodology that uses the transient pressure trace after the generation of a transient event and convolutional neural networks (CNNs) to determine the location and the size of a leak in a water pipeline. This merging of pressure transient traces and CNNs has been demonstrated in a numerical application 81
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection and has great potential, given that this technique is data-driven and can provide immediate results for the characteristics of a given anomaly. Nonetheless, challenges can arise when pipelines under more realistic conditions are analyzed. Background pressure fluctuations due to system operations such as changes in demand or unknown system components, are not reproduced by numerical models but have an impact on the transient pressure traces. Although, to date, no applications using noise to improve ANN performance have been reported in assessing the condition of water pipelines, several related strategies have been applied in other fields. Previous approaches have proposed the introduction of noise during the ANN training in the ANN training samples (Rifai et al. 2011), in the activation functions (Ikemoto et al. 2018), in the ANN weights (Goodfellow et al. 2016), or in the direction of update of the ANN weights (Neelakantan et al. 2015). The most popular approach has been the introduction of noise directly into the ANN training samples to enhance modelsโ€™ robustness and reduce overfitting (Bishop 1995). Rifai et al. (2011) demonstrated that the error of a multilayer perceptron for document recognition can be reduced by adding a Gaussian distributed noise in the input layer regardless of the standard deviation of the noise. Fukami et al. (2020) applied the same concept to different ANN architectures that were trained to estimate laminar wakes in a fluid field from limited measurements demonstrating that for the analyzed architectures, the addition of noise in the training samples improved the performance of the ANNs when tested in noisy input measurement environments. Nonetheless, if the magnitude of the noise deviation was too big, the ANN performance was compromised. These past applications demonstrate the potential of the use of noise during the training of an ANN. However, few studies have identified the potential of using an organized framework to introduce noise in the training of an ANN. The phenomenon where the performance of a non-linear system (i.e. in this case an ANN) is optimally enhanced by the addition of a certain noise intensity is known as stochastic resonance. The concept was proposed for the first time by Benzi et al. (1981) as a non-linear cooperative effect in which periodic signals can be greatly amplified by large environmental fluctuations; however, other researchers rapidly extended this to include any non-periodic signals (Collins et al. 1995). In a non-linear system, it can be shown that there exists a nonzero value of noise that gives an optimal response to the 82
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection system (Harmer et al. 2002). Stochastic resonance has been observed and applied in multiple fields (Benzi et al. 1982; Luchinsky et al. 1999; Wang and Santamarina 2002; Cheng et al. 2020) with only a few applied to the training of an ANN. Ikemoto et al. (2018) introduced a noise-modulated neural network as an application of stochastic resonance by perturbing the threshold units in the activation functions with different noise intensities (described by its standard deviation). Their application in benchmark artificial problems demonstrated that by adding noise to the threshold units, the standard deviation of the mean squared error (MSE) decreased as the standard deviation of the noise increased regardless of the structure of the neural network in terms of the hidden units. The advantages of using stochastic resonance in areas related to the development of new technologies such as signal processing (Feng et al. 2019) or time series analysis (Falanga et al. 2020) is an active research area. However, previous applications using stochastic resonance in ANNs have been limited to artificial and numerical benchmark problems in computer science and no applications have been reported for anomaly detection problems in real infrastructure such as the detection of leaks in water pipelines. 6.3 Methodology The methodology developed in this research paper to detect leaks in pipelines using a set of ANNs is outlined in Figure 6-2. This methodology is divided into two stages: model development (Stage 1 in Figure 6-2) and model application (Stage 2 in Figure 6-2). The leak detection model development stage should be carried out first and can be repeated regularly to account for new transient pressure information data collected from the system. The model application stage comprises the processes required to analyze a transient pressure head trace to determine the location and the size of a leak in the pipeline. 83
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Figure 6-2. Model development and application of leak detection methodology. 6.3.1 Leak Detection Model Development (Stage 1) The first stage of the proposed methodology is the development of a leak detection model. This stage comprises the training of a set of ANNs that can locate and size a leak when the analyzed pipeline experiments background pressure fluctuations. An appropriate ANN architecture needs to be designed and transient pressure head traces are numerically generated for the training of these ANNs. The five steps presented in Stage 1 in Figure 6-2 summarize the development of the leak detection model. It is important to highlight that these ANNs do not constitute a metamodel of the transient flow pressure response to the closure of a valve in a pipeline with a leak. These ANNs are trained to identify the transient pressure wave reflections created by the existence of a leak in the pipeline. 6.3.1.1 ANN Architecture Definition The first step in the leak detection model development is the definition of an appropriate ANN architecture. Bohorquez et al. (2020a) concluded that 1-D convolutional networks with three convolutional layers, had the potential to identify leaks in numerically modeled pipelines. However, it has been found that a more robust architecture is required for an application of this technique in pipelines under more realistic conditions. The design of this new architecture considered different 84
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection alternatives, including variations from the architecture proposed in Bohorquez et al. (2020a) to a 1-D convolutional network with 5 layers and increasing filters in those layers. Results from this design process are not shown here for brevity but the resulting ANN architecture includes: a) four convolutional layers, b) use of a Leaky Rectified Linear Unit (Leaky ReLU) as the activation function, c) 20 filters that increase in the last convolutional layer and d) three dense layers of size 14, 6 and 2. The resulting number of weights for the 1-D convolutional networks used in this work depends on the size and number of filters, and the downsampling frequency selected in Step 1.3 in Figure 6-2. Eq. (1) presents the total number of weights for a 1-D convolutional network where the first term represents the weights in the convolutional layers (๐‘›) and the second term represents the weights in the dense layers (๐‘—) ๐‘› ๐‘— ๐‘Š = โˆ‘ [((๐‘ค ร—โ„Žร—๐‘“ )+1)ร—๐‘“ ]+โˆ‘ [(๐‘ ร—๐‘ )+๐‘ ]. (1) ๐‘›โˆ’1 ๐‘› ๐‘— ๐‘—โˆ’1 ๐‘— 1 1 In this equation, ๐‘ค and โ„Ž are the width and height of the filters, ๐‘“ is the number of ๐‘› filters in the convolutional layer ๐‘› and ๐‘ is the number of neurons in the dense layer ๐‘—. ๐‘— For the first dense layer (i.e. ๐‘— = 1), ๐‘ depends on the dimensions of the input layer ๐‘—โˆ’1 defined by the downsampling frequency thus affecting the total number of weights for the ANN to learn. In general, a larger input layer provides the ANN with more information regarding the transient pressure head trace, but the training of the ANN is harder because there are more weights to define. 6.3.1.2 Transient Pressure Head Samples Generation The leak detection model development stage includes the training and testing of a set array of ANNs (Step 1.2 in Figure 6-2). To train these ANNs, numerical transient pressure head data or available recorded transient data can be used. For the application presented in this paper, numerical transient pressure traces have been used for the ANN training. Figure 6-3 presents the hydraulic configuration of the single pipeline that has been used to generate the numerical transient pressure traces. The pipeline is supplied by a reservoir with an upstream head ๐ป , it has an internal diameter ๐ท and a 0 total length ๐ฟ . At the downstream end of the pipeline, there is a side discharge valve ๐‘‡ that is initially open with a flow ๐‘„ . The transient pressure head data is obtained from 0 85
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection a measurement point (๐‘€) at the same location as the side discharge valve. The specific characteristics of the pipeline that has been analyzed in this paper are presented in Table 6-1. Figure 6-3. Single pipeline with a leak system configuration. A leak, modelled as a circular orifice with a diameter ๐ท , could be present at any point ๐ฟ along this pipeline. As part of this step, a range of leak sizes must be defined for the generation of the training data. This range can be defined based only on the diameter of the leak, the flow that is going through the orifice when the leak is active, or previous knowledge of the system on past detected leaks. For the application shown in this paper, the leak size range was defined based on the available orifice diameters in the laboratory associated with the pipeline experimental apparatus and is presented in the Results section. Each sample of the ANN input dataset is a transient pressure head trace generated after the closure of the side discharge valve with a leak present at a specific point along the pipeline. To form the complete ANNs training and testing dataset, different leak locations and sizes were considered. A total of 50,000 different transient pressure head traces were generated using the Method of Characteristics (MOC) at randomly selected locations from 5,000 segments along the pipeline and a random leak size. The MOC can be applied by defining a spatial (โˆ†๐‘ฅ) and time (โˆ†๐‘ก) resolution that is consistent with the wave speed of the pipeline following Eq. (2). This means that for a desired spatial resolution, a specific time resolution needs to be selected for a pipeline with wave speed ๐‘Ž ๐‘Ž = โˆ†๐‘ฅโ„โˆ†๐‘ก. (2) For any pipeline that is analyzed using this methodology, leaks need to be generated at 5,000 different locations. Therefore, the time resolution required to guarantee that each transient pressure head trace is different would be very small. For instance, for a 86
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection pipeline that is 1,000 m long and has a wave speed of 1,000 m/s, the average separation between transient pressure head traces would be 0.2 m, resulting in a required time resolution of 0.2 ms. This means that to generate a transient pressure head trace for 2๐ฟ/๐‘Ž seconds, there would be 10,000 pressure head values per trace. If these complete traces were used for the training of the ANNs, the total required parameters to train one ANN (following the architecture defined in Step 1.1) would be 454,000 according to Eq. (1). The potential size of this input dataset shows that a downsampling process is necessary because for this example, the total input dataset would contain a total of 500 million pressure head values. For the application in a numerically modeled pipeline described in Bohorquez et al. (2020a), the transient pressure head traces were obtained after modelling the sudden closure of a side discharge valve. However, a more realistic approach should consider that regardless of the closure method (i.e. a mechanical actuator, a solenoid activated valve or any other device), the injected transient wave is not completely sharp. As part of Step 1.2 in the leak detection model development, the closure curve of the side discharge valve should be obtained and incorporated into the MOC modelling. This can be achieved by running preliminary tests in the analyzed pipeline to characterize this curve. 6.3.1.3 Transient Pressure Head Downsampling As was mentioned above, the potential size of the input dataset when using the MOC for the generation of the transient pressure head traces can be very large. Therefore, a time-wise downsampling process is conducted in Step 1.3 of Figure 6-2. Previous research has shown that ANNs trained with downsampled data have improved performance and are more computationally efficient (Bohorquez et al. 2020a). This is partially because ANNs trained on downsampled data have fewer weights and thus are less prone to overfitting. In addition, the use of downsampled data could potentially reduce data transfer requirements on applications of this methodology in the field. Depending on the analyzed pipeline, Step 1.3 includes the selection of the sampling frequency to which transient pressure head traces are going to be transformed into. This selected frequency will influence the final number of weights that the ANNs will be trained on as the frequency defines the size of the initial layer in the ANN. 87
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection 6.3.1.4 Noise Characteristics Definition and Application Bohorquez et al. (2020a) demonstrated the potential of using ANNs for leak detection in pipelines using fluid transient pressure waves. However, the application of this technique to pipelines under more realistic conditions such as those containing background pressure fluctuations, has proven a challenge because the generated numerical pressure transient head traces cannot replicate these conditions. To address this issue, this paper introduces the deployment of stochastic resonance applied to the training of a set of ANNs. The addition of multiple noise intensities to the transient pressure head input dataset enhances the robustness and the performance of the trained ANNs when the optimum noise intensity is applied. The addition of noise in training datasets has been explored in other numerical applications involving artificial intelligence in different fields. It has been found that the addition of a noise distribution to the input of a model can translate into a better response of the model output (Murray and Edwards 1994; Rifai et al. 2011; Fukami et al. 2020). Considering this, Step 1.4 of the leak detection model development comprises the definition of the noise distribution and the selection of noise intensities to be added to the numerical transient pressure head traces samples (obtained in Step 1.3). The transient pressure head noise has been characterized by a Gaussian distribution with zero mean and a standard deviation ๐œŽ, similar to the concept presented by Duan (2017). The magnitude of the standard deviation has been defined with respect to the magnitude of the pressure drop in the transient pressure head trace when the smallest leak (from the range defined in Step 1.2) is present in the pipeline. To illustrate this, Figure 6-4 presents a generic example of two transient pressure head traces. The continuous blue line represents the transient pressure head trace after the closure of a side discharge valve for an intact pipeline. The dash-dotted blue line denotes the transient pressure head trace when a leak is present in the pipeline and where a transient event has been generated. The initial pressure head increase after the closure of the valve is the same in both cases but differences arise when part of the transient wave reflects from the leak. The bigger the leak present in the pipeline, the bigger the drop in pressure will be (Bohorquez et al. 2018; Meniconi et al. 2019; Wang et al. 2019). A second y-axis is included on the right-hand side of Figure 6-4 to present the differences between both transient pressure head traces (red line). This line shows that 88
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection there is a difference โˆ†โ„Ž during the first 2๐ฟ/๐‘Ž seconds after the closure of the side discharge valve. Figure 6-4. Pressure head difference between transient pressure head trace for an intact pipeline and a pipeline with the smallest leak. Considering this, if the selected noise intensity has a standard deviation larger than this difference, it is expected that the ANNs will not perform well in identifying small leaks. In this case, the noise added to the transient pressure head trace would hide the transient wave reflections from the leak. A total of ๐‘› noise intensities are selected in Step 1.4 and the standard deviation for each intensity is defined in Eq. (3) as a proportion of โˆ†โ„Ž where ๐‘˜ is the multiplier for noise intensity ๐‘– โˆˆ {1,โ€ฆ,๐‘›} and ๐‘˜ can ๐‘– ๐‘– be any number larger than zero ๐œŽ = ๐‘˜ ร—โˆ†โ„Ž. (3) ๐‘– ๐‘– The selection of the number of noise intensities ๐‘› will depend on the knowledge of the background pressure fluctuations present in the analyzed pipeline. In addition, the computational resources available should be considered when selecting this variable because each additional noise intensity will represent more ANNs to be trained (as will be explained in Step 1.5). The array of multiplier values [๐‘˜ ,โ€ฆ,๐‘˜ ] depends on 1 ๐‘› the analyzed pipeline and the expected background pressure fluctuations, however, it is expected that if large values of ๐‘˜ are selected, the ability of the ANN to identify ๐‘– certain leak sizes will decrease. 89
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Once the number of noise intensities and the array of standard deviations ๐œŽ have been ๐‘– defined, multiple random transient pressure head traces are created. In this paper, five transient pressure head traces are created for each of the samples of the input dataset obtained from Step 1.3 by adding the noise to the original transient pressure head trace. This allows the ANNs to be exposed to different transient pressure head traces that correspond to the same leak location and size but with different values for the pressure noise. Thus, the input dataset for each noise intensity has 250,000 different transient pressure head samples. 6.3.1.5 Leak Detection ANNs Training and Testing The last step of the leak detection model development (Step 1.5 in Figure 6-2) is the training and testing of a set of ANNs with the architecture defined in Step 1.1 using the ๐‘›+1 input datasets obtained from Step 1.4 (including the original dataset without any noise in the samples). A diagram presenting the set of ANNs to be trained is shown in Figure 6-5. Each leak detection ANN receives as input one transient pressure head trace and should be able to predict the correct location and size of the leak only based on this information. Figure 6-5. Leak detection set of ANNs. Each group of ANNs are trained with samples with different noise intensities. 90
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection This diagram shows that for each noise intensity (๐œŽ ) including a no-noise ๐‘› scenario (๐œŽ ), ๐‘š leak detection ANNs are trained using its corresponding dataset. 0 Considering that the training of these ANNs is conducted using Stochastic Gradient Descent algorithms, every time the ANN is trained a different final set of weights is obtained. Similar to applying Genetic Algorithms starting from different random number seeds, training ๐‘š leak detection ANNs can assist in testing the consistency of the ANN predictions. A good set of ANNs should provide very similar results when testing with the same data despite having different ANN weights. The number of possible ANNs to train for each noise intensity will depend on the availability of computational resources. Each input dataset is then randomly divided into two groups of equal size: a training dataset and a testing dataset. For the training process, smaller groups of data are selected one at a time to find values for the ANN weights and then validated with the rest of the training data. This is known as batch training and it allows the ANN to learn from smaller groups of data to avoid overfitting (Nakama 2009). Considering that the separation of the input dataset into a training and a testing dataset is random and that batches for each training trial are different for each ANN, the resulting weights are different. Once the training process is complete, the ANNs are tested with transient pressure head traces that have not been exposed to. These predictions are then compared to the real location and sizes of the testing samples. An ANN that has been successfully trained should present with a similar distribution of errors in the training and the testing stages. 6.3.2 Leak Detection Model Application (Stage 2) The second stage of the methodology presented in this paper is the leak detection model application (Stage 2 in Figure 6-2). This stage includes a number of different steps that are necessary to process real measured transient pressure head data from a valve closure test in a pipeline with a leak to obtain a prediction of its location and size. A six-step process is described in Stage 2 in Figure 6-3 and it is divided into two sub-stages: pre-processing and analysis. This section explains how each step may be carried out for any analyzed pipeline when results from multiple valve closure tests 91
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection are available. However, the same procedure could be conducted if only one test result is available. 6.3.2.1 Generator Pressure Fluctuation Reduction The first part of the leak detection model application refers to the pre-processing of the tests that have been conducted. In this pre-processing stage, the first step corresponds to the reduction of pressure fluctuations caused by the transient generator device in the recorded transient pressure head signal (Step 2.1 in Figure 6-2). Preliminary applications of the leak detection model, not shown in the paper for brevity, demonstrated that the performance of the set of ANNs was not satisfactory for different transient tests under the same conditions. To understand the reasons for this apparent inconsistency in the leak detection model predictions, a vulnerable region detection analysis was conducted. Vulnerable region detection analysis has been previously used in computer science to evaluate the performance of a classifier machine learning model to small perturbations in different regions of an image. This type of analysis have shown that deep neural networks are vulnerable to changes around the object of interest (Shu and Zhu 2019). Vulnerable region detection analysis is closely related to the study of adversarial examples for deep neural networks where imperceptible perturbations (localized or distributed in the image) can disrupt the predictions of the models (Szegedy et al. 2013; Akhtar and Mian 2018). For the ANNs developed in this paper, this analysis included the successive testing of the ANNs with perturbed transient pressure head traces. These traces were obtained by applying different magnitudes of perturbation to each point along the original transient pressure head trace. Figure 6-6 presents the distribution of the predicted leak location error (at the top of Figure 6-6) after applying successively a single 0.1 m perturbation in turn along a transient pressure head trace measured in the laboratory (shown at the bottom of Figure 6-6). The distribution of errors was obtained after testing the perturbed samples with five ANNs trained with the same noise intensity. 92
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Figure 6-6. Leak location error when a perturbation of 0.1 m is applied at only one point along a laboratory transient pressure head trace. This figure shows that perturbations at the first 60 points of the transient pressure head trace induce a considerably larger error in the distribution of the leak location predictions. These 60 points correspond to the steady state pressure head before the valve closure. When the perturbation is applied after the valve closure, the ANN predictions are more consistent, although errors are also present. This analysis demonstrated that there are features in the steady state segment of a laboratory transient pressure head trace that induce errors in the ANN performance. Thus, a more in-depth analysis of measured transient pressure head traces has been conducted. Figure 6-7(a) presents an example of a transient pressure head trace obtained in the laboratory (with characteristics presented in Table 1 and equivalent to the system presented in Figure 6-3). In this figure, two segments of this trace are enlarged preserving the same scale. Subplot a) shows the background pressure fluctuations before the valve closure and subplot b) shows the background pressure fluctuations after the dissipation of the transient event created by the valve closure. Clear differences in these pressure fluctuations are visible before and after the transient event. The background pressure fluctuations before the transient event are more prominent in magnitude. This is due to the interaction that the transient generator (open valve) has with the pipeline itself that adds to the interaction that the leak orifice has with the pipeline. The background pressure fluctuations induced by the transient 93
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection generator have been reported by Gong et al. (2018b) where leaks were simulated in real pipelines with the opening of a standpipe connected to an air valve or a fire hydrant. A background pressure fluctuation reduction step has been included to reduce the background pressure fluctuations caused by the combined effect of the transient generator and the leak to only the fluctuations due to the presence of the leak. To accomplish this, the distribution of pressure fluctuations needs to be studied in more detail. Figure 6-7(b) presents the distribution of the pressure head for the segments of the complete transient trace highlighted in Figure 6-7(a). Step 2.1 in the proposed methodology includes fitting both pressure head series to a probabilistic distribution (in this case a normal distribution), which in the examples presented show a reasonable agreement. The distribution of pressure head after the transient test will normally have a larger mean value because there is a reduction in the total flow in the pipeline. The parameters of the normal distribution for the background pressure fluctuation before the transient generator closure are denoted with a ๐‘ as subscript and the fluctuations corresponding to the pressure after the transient generator closure are denoted with the subscript ๐‘Ž. a) b) Figure 6-7. Background pressure fluctuation analysis. a) Background pressure head fluctuation: i) before the transient event and ii) after the transient event. b) Distribution of pressure head before and after the transient event. The procedure for Step 2.1 consists of transforming the background pressure fluctuations before the transient event to have a similar distribution to the pressure 94
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection fluctuations after the generator closure. Based on the parameters of the distributions obtained, a new probability function can be defined as a normal distribution with mean ๐œ‡ and standard deviation ๐œŽ . This means that the new normal distribution preserves ๐‘ ๐‘Ž the mean value of the background pressure fluctuations before the transient test but its standard deviation is modified to match the background pressure fluctuations after the transient test. For any value of pressure from the measured transient pressure head trace before the transient event (โ„Ž ) a Z-score (๐‘ ) is computed using ๐œ‡ and ๐œŽ . With ๐‘ก ๐‘ ๐‘ ๐‘ this value, a modified value for the pressure (โ„Žโ€ฒ) is found using Eq. 4. This is then ๐‘ก repeated for each value of pressure before the generator closure to obtain a transient pressure head trace with reduced background pressure fluctuations โ„Žโ€ฒ = ๐‘ ร— ๐œŽ +๐œ‡ (4) ๐‘ก ๐‘ ๐‘Ž ๐‘. 6.3.2.2 Transient Pressure Head Traces Shifting and Trimming Once the background pressure fluctuations induced by the transient generator have been reduced, the transient pressure head traces are shifted and trimmed at Step 2.2 (see Figure 6-2). This is conducted to match the conditions used for the generation of the numerical transient pressure head samples at Step 1.2 of the model development stage. Vertical shifting of the transient pressure head traces obtained from measurements might also be required if the conducted tests had a different initial pressure. This shifting includes the computation of the difference between the mean pressure before the transient event and the steady state pressure used in the training of the ANNs and the transformation of the transient pressure head traces by adding or subtracting this difference. If the steady state pressure of the transient tests are significantly different, some variation in the transient response of the system can be expected, as reported by Meniconi et al. (2019). Trimming the time extent of the transient pressure head traces includes the selection of the length of interest from the complete trace. The specific length to trim the traces will depend on the selected characteristics in Step 1.2 but, in general, the objective is to include some pressure information before the transient event and at least 2๐ฟ/๐‘Ž seconds after the valve closure to cover the complete length of the pipeline. 95
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection 6.3.2.3 Transient Pressure Head Traces Downsampling To capture the reflections from anomalies such as leaks, high-frequency pressure transducers are required for realistic applications (Nguyen et al. 2018; Zeng et al. 2020). In addition, this sampling frequency will depend on the pipeline dimensions and material. Step 2.3 in Figure 6-2 includes the downsampling of the measured transient pressure head traces to the frequency selected in Step 1.3. This is necessary to match the measured transient pressure head trace with the input layer of the ANNs (as presented in Figure 6-5). This downsampling process has been applied in different fields as signature recognition and can be carried out using different interpolation methods including linear, polynomial or spline interpolation (Martinez-Diaz et al. 2007). 6.3.2.4 Leak Detection ANNs Application The reduction of background pressure fluctuations and the shifting, trimming and downsampling of the measured transient pressure head traces complete the pre- processing stage. A second stage comprises the following three steps: analysis of the measured transient pressure head traces using the available ANNs (Step 2.4 in Figure 6-2), selection of a final prediction for the leak location and size (Step 2.5 in Figure 6-2) and a verification process (Step 2.6 in Figure 6-2). The leak detection ANNs application step includes the analysis of all the recorded and pre-processed transient pressure head traces using the ANNs trained in Step 1.5. Therefore, multiple leak location and size predictions will be obtained from this step depending on the number of noise intensities (๐‘›) selected in Step 1.4, the number of ANNs trained per noise intensity (๐‘š) and the number of available transient tests results (๐‘ž). For each transient test (๐‘ž), a box whisker plot can be created that summarizes the distribution of the predicted leak locations. This distribution is created from the results of ๐‘š leak detection ANNs for each noise intensity (๐‘›) and the ANNs trained with transient pressure head samples without any added noise. The analysis of the transient tests through ANNs trained with different noise intensities constitutes the application of stochastic resonance. Therefore, it would be expected that an optimum noise intensity is identified and a final prediction is selected in the following step of the methodology. 96
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection 6.3.2.5 Leak Location Prediction Selection According to Harmer et al. (2002), the addition of some noise to a non-linear system can enhance its response. However, there is a point at which the addition of too much noise prevents further improvement. As mentioned above, this phenomenon is known as stochastic resonance. One of the objectives of this paper is to demonstrate the application of this concept to the use of ANNs to detect leaks in pipelines under more realistic conditions such as background pressure fluctuations. The selection of a leak location (and size) prediction is included as a separate step in Figure 6-2 (Step 2.5) because it involves the analysis of the distribution of predictions obtained in Step 2.4. The first part of this analysis is related to the scatter of the leak location predictions for the ANNs (๐‘š) of a particular noise intensity (๐‘›). If stochastic resonance is relevant, it would be expected that the predictions of the leak location in ANNs trained with larger noise intensities would be more consistent and closer to the real location of the leak until the optimum noise intensity is reached. To test this, box whisker plots can be created using the predictions from the available transient tests to evaluate the effect of adding noise to the training samples of the ANNs. On the other hand, it is expected that ANNs trained with noise intensities that are too large would not perform well on the training. This is because the reflections from small leaks would be combined with the added Gaussian noise and the overall performance of the ANNs would decrease. To measure this, for each group of ANNs corresponding to each noise intensity (๐‘›) including the ANNs trained without any noise, the root mean squared error (RMSE) is computed for both the ANN training and testing datasets. If the resulting RMSE for a particular noise intensity exceeds a predefined threshold or the training and testing RMSE are considerably different, this noise intensity would be considered too large. By analyzing the scatter of the leak location predictions and the ANN RMSE for training and testing, one group of ANNs (๐‘š) trained with the optimum noise intensity (๐‘› ) can be selected. Using these ANNs, a final prediction for the location and size opt of the leak in the pipeline using the ๐‘šร—๐‘ž available predictions can be obtained. This can be done by computing the median leak location for each transient test available and then analyzing the distribution of those predictions. If for each transient test the 97
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection median location predictions are clustered around one possible location, only that prediction will be assessed in the verification process. However, if two or more clusters are identified, the multiple leak location predictions would be used in the last step of the methodology. 6.3.2.6 Leak Detection Verification The last step of the application stage considers the use of a numerical transient model of the analyzed pipeline to verify if the predicted leak characteristics match the measured trace to a reasonable degree of accuracy (Step 2.6 in Figure 6-2). This does not represent a verification of the complete methodology but a confirmation step including a potential refinement of the ANN predictions for a particular pipeline. Using the same MOC numerical model used in Step 1.2 of the model development, new transient pressure head traces can be obtained using the predicted leak characteristics (size and location) obtained in Step 2.5. These numerically generated traces are then compared with the pressure head measured to assess its similarity using the normalized root mean squared error (NRMSE). Differences would be expected between these transient pressure head traces due to different elements present in the pipeline that are not included in the numerical model. In addition, the fact that the final prediction is obtained from a distribution of predictions can also cause differences between these pressure head traces. However, a threshold can be defined to decide if the ANNs predictions are accurate enough and a final prediction has been reached. Preliminary analysis showed that cases in which the ANNs predictions are not within the defined threshold are due to a discrepancy in the predicted leak size, in a similar way to what it has been reported by (Bohorquez et al. 2021) for the detection of bursts. Thus, a potential leak size correction has been considered in this methodology through the generation of additional numerical transient pressure head traces covering the range of possible leak sizes to find the one that produced a trace with the lowest NRMSE. 6.4 Results The proposed methodology for leak detection in pipelines as described above has been applied to a series of tests conducted in the Robin Hydraulics Laboratory of The University of Adelaide. The objective was to demonstrate the feasibility of using 98
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection ANNs to detect the location and size of leaks in pipelines under more realistic conditions. This section outlines the characteristics of the analyzed pipeline and the transient tests followed by a description of the application of the methodology for both stages following the steps presented in Figure 6-2. 6.4.1 Laboratory Tests The pipeline in the laboratory has the configuration shown in Figure 6-3. The pipeline is connected at both ends to pressurized tanks. An inline valve has been closed at the downstream of the pipeline to allow flow only through a solenoid valve installed right before the end of the pipeline. The characteristics of the pipeline are shown in Table 6-1. A circular orifice of size 2.2 mm has been installed located 28.52 m downstream of the source tank to simulate a leak. Table 6-1. Pipeline characteristics. Characteristic Units Value Length of pipe (๐ฟ ) (m) 37.24 ๐‘‡ Internal diameter of the pipe (๐ท) (mm) 22.14 Wave speed of pipe (๐‘Ž) (m/s) 1305 Wall thickness (๐‘’) (mm) 1.63 ๐ฟ /๐‘Ž time (s) 0.029 ๐‘‡ The transient event to detect the leak is generated by the fast closure of the solenoid valve with a closure time of 5 ms. The pressure has been measured with a PDCR 810 pressure transducer with a 10 kHz sampling rate. A total of 14 transient tests were conducted with the same configuration under similar initial conditions. The pressure head traces measured for the 14 tests at the downstream end of the pipeline are presented in Figure 6-8 where each line represents a different test. The initial pressure head at the end of the pipeline was set to between 20.0 and 23.9 m. The pressure head was measured from 0.2 s before the valve closure and for a total of 3 s (although Figure 6-8 shows the pressure changes only until 1 s). 99
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Figure 6-8. Laboratory transient pressure head traces. Each series represents a different test with a different initial pressure. Using the results from these 14 tests and the known characteristics of the pipeline, the ANN leak location methodology presented in Figure 6-2 has been applied to this system. 6.4.2 Model Development First, a leak detection model has been developed for the pipeline described in Table 1 following the steps described in Stage 1 of Figure 6-2. The 1-D convolutional ANNs that were created followed the architecture previously described with four convolutional layers, 20 filters and three dense layers (Step 1.1). A total of 50,000 numerical transient pressure head traces were generated with a MOC numerical model by modelling 10 leaks at random locations within each 7.45 mm interval along the pipeline. Each of these 10 transient pressure head traces had a different randomly selected diameter varying between 0.4 and 3.5 mm. The total simulation time was set as 0.09 s which corresponds to 3.15๐ฟ/๐‘Ž seconds, ๐ฟ/๐‘Ž seconds before the closure of the valve and 2.15๐ฟ/๐‘Ž seconds after to account for the effects of the valve closure curve in the computed pressure head. To obtain different transient pressure traces, the time resolution of the MOC numerical model needed to be at least 0.006 ms. Therefore, the total size of the ANNs input dataset before the downsampling process is 788 million transient pressure head values (Step 1.2) where each trace has almost 16,000 head values. 100
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection According to Step 1.3 in Figure 6-2, the obtained input dataset was then downsampled to a selected downsampling frequency of 5 kHz. This frequency has been selected considering the dimensions of the pipeline and the potential number of weights to train in the resulting ANNs. A smaller downsampling frequency would create a very small ANN that would not be able to learn enough information from the transient pressure head traces. Smaller downsampling frequencies can be selected for larger pipelines with larger ๐ฟ/๐‘Ž characteristics. The resulting number of weights for the leak detection ANNs following Eq. (1) is 13,868. After the downsampling process, the input dataset contains 8.55 million transient pressure head values for the 50,000 traces. This dataset was used in Step 1.4 to create additional ANN input datasets with the addition of noise in the transient pressure head traces. Following the definition of noise intensity presented above, the smallest leak drop (โˆ†โ„Ž in Eq. (3)) corresponding to the smallest leak considered was 0.1238 m. Six different noise intensities have been considered in this step and the selected values of ๐‘˜ and the derived standard deviations (๐œŽ ) are presented in Table 6-2. These noise ๐‘– ๐‘– intensities have been selected considering that the objective was to obtain ANNs with the ability to find leaks across the complete defined leak size range, without significantly decreasing performance with the addition of noise. Table 6-2. Selected Standard Deviation for Gaussian Noise Distribution Standard Resulting Standard Deviation Deviation ๐œŽ ๐‘– Multiplier ๐‘˜ ๐‘– 0.05 0.0062 0.10 0.0124 0.25 0.0310 0.50 0.0619 1.00 0.1238 1.50 0.1857 The information presented in Table 6-2 was used to generate six additional input datasets. Each dataset contains a total of 250,000 transient pressure head traces given that five traces have been created for each for the original numerical traces. Five ANNs were created for each defined noise intensity and five ANNs using the original training dataset, with no noise included. Each group of five ANNs have the same architecture but different resulting weights considering Stochastic Gradient Descent algorithms have been used in its training. As it was explained in Section 6.3.1.5, using these 101
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection training algorithms is similar to applying Genetic Algorithms using different random number seeds. The resulting set of 35 ANNs were trained and tested simultaneously using GPU computer cores on the University of Adelaideโ€™s High Performance Computer (HPC), Phoenix. The training process was conducted for a maximum of 24 hours or less if the desired threshold of accuracy had been achieved. Figure 6-9 presents the percentage exceedance associated with the absolute average error in the location of leaks. This plot summarizes the results of the training and the testing of seven of the 35 ANNs where each plot (a-g) corresponds to a different noise intensity ANN. Only one plot per noise intensity is included because the distribution of the errors obtained during training and testing was consistent across the five ANNs. Two series are included in each of the plots of Figure 6-9. The blue solid line corresponds to the distribution of the absolute average leak location error for the samples used for the ANN training. The pink dotted line presents the leak location error for the samples used during the ANN testing. The percentage exceedance can be interpreted as the proportion of the total trained or tested samples where the average leak location surpassed a certain error size. An average error in the predictions is presented because in some cases two or more traces with the same leak location and size have been used either for the training or the testing. It is important to observe that the maximum percentage shown in the figure is 10% (x- axis). This means that 90% of the time that these ANNs are used with numerical transient pressure head traces, the absolute average leak location error that is obtained is smaller than the minimum absolute average error visible in these plots. In addition, the y-axes in Figure 6-9(a-e) are presented at the same scale to facilitate its analysis. It can be seen that as the standard deviation for the Gaussian distributed noise increases, the absolute average leak location errors also increases due to the noise added to the training and testing samples. From this figure is also evident that the ANNs trained and tested with transient pressure head traces without any noise performed better than the rest. However, for all the considered noise intensities, 90% of the time the absolute average leak location error is 0.12 m or smaller which points to a successful result from the training of these ANNs. 102
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Figure 6-2). The pre-processing of the obtained transient pressure head traces (Steps 2.1-2.3 in Figure 6-2) started with the reduction of the background pressure fluctuations due to the flow through the solenoid valve installed at the end of the pipeline. Following the process described at Step 2.1, two 0.2-second segments were analyzed in each of the 14 measured pressure head traces before the solenoid valve closure and at the end of the 3-s recorded signal. Two normal distributions were obtained from the pressure fluctuations before and after the solenoid valve closure for each transient test. An average standard deviation before the transient test of 0.0392 m and an average standard deviation after the transient test of 0.0097 m were obtained. An example of the resulting transient pressure head traces after the background pressure fluctuation reduction step is presented in Figure 6-10. In this figure is possible to see that the background pressure fluctuation reduction process does not change the transient pressure head traces dramatically, as no differences are evident when a 20 m scale is used for the y-axis. However, when a different scale is analyzed (in the red subplot) clear differences in the pressure fluctuations are noticeable after the transformation of the pressure before the transient events. This step allows for a reduction in the background transient pressure head fluctuations allowing for an improved application of the leak detection ANNs. Figure 6-10. Results of background pressure fluctuation reduction. The resulting transient pressure head traces were further transformed to complete the pre-processing described in Figure 6-2. First, the 14 measured transient pressure head traces were shifted to be aligned to one initial average steady state pressure head. As 104
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection shown in Figure 6-8, the initial pressure head of each test was slightly different within a 3.9 m range. All traces were aligned to an average steady state pressure head of 21.16 m. This value corresponds to the initial pressure head considered for the generation of the numerical transient pressure head traces in Step 1.2. The resulting shifted traces were also trimmed to select only the segments of the transient pressure head of interest corresponding to ๐ฟ/๐‘Ž seconds before the closure of the solenoid valve and 2.15๐ฟ/๐‘Ž seconds after this closure. The resulting transient pressure head traces are presented in Figure 6-11. It is important to observe that since each transient test had a different steady state pressure head, the initial pressure head increase after the solenoid valve closure is also different in every test. This is due to the small differences in the resulting flow in the pipeline given different initial pressures, in a similar way as reported by Meniconi et al. (2019). However, the transient pressure head traces were not further transformed to test the leak detection ANNs performance to predict accurate leak locations under these conditions. The last step of the pre-processing stage included the downsampling of the measured transient pressure head traces to a 5 kHz frequency to match the traces to the dimensions of the input for the leak detection ANNs. Figure 6-11. Transient pressure head traces to process through leak detection ANN (each series corresponds to a laboratory test). The second part of the leak detection model application involved the analysis of the transient pressure head traces (Steps 2.4-2.6 in Figure 6-2). All the pre-processed 105
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection transient pressure head traces were analyzed using a total of 35 trained ANNs in Step 1.5 (five ANNs per noise intensity level including the ANNs trained with samples without any noise). The distribution of leak locations predictions is shown in Figure 6-12. A seven-color scale has been used in this figure to illustrate the distribution of leak location predictions on each noise intensity defined in Step 1.4 and the ANNs trained with samples without any noise. In addition, Figure 6-12 presents an indication of the end of the pipeline (37.24 m) and in light blue the location of the leak in the pipeline (at 28.05 m). This figure shows the very large range of the leak location predictions when the ANNs have been trained without any noise in the transient pressure head traces. Except for two outliers in the predictions for traces #13 and #14, none of the leak location predictions are within the physical limits of the pipeline. Therefore, these predictions are not visible in the figure. This result demonstrates the challenges of applying ANNs for the detection of anomalies in pipelines under more realistic conditions (Bohorquez et al. 2020a). Since these ANNs have been trained with theoretical numerical samples with perfect data, the predictions when the analyzed transient pressure head traces have background pressure fluctuations result in illogical predictions for the leak location. Figure 6-12. Predicted leak location for sets of ANNs trained with samples with different noise intensities. 106
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Figure 6-12 also presents the significant influence that the addition of noise in the numerical transient pressure head traces for the ANNs training has in the resulting distribution of leak location predictions. The addition of a Gaussian distributed noise with a standard deviation of 6.2 mm (๐œŽ ) has a significant effect in the resulting leak 1 location predictions. Most of these predictions can now be found within the physical limits of the pipeline (yellow series in Figure 6-12). It is important to note that a background pressure fluctuation with a standard deviation of 6.2 mm is significantly smaller in magnitude in comparison to the real background pressure fluctuations observed in this pipeline. However, its introduction in the ANN training dataset has proven to be highly effective in improving the obtained leak location predictions. This finding aligns with previous authors findings that state that the addition of noise can beneficial for ANN performance (Fukami et al. 2020). Despite the clear advantages of applying Gaussian distributed noise, the results presented in Figure 6-12 also demonstrate that the addition of noise with a very small standard deviation is not enough for a satisfactory prediction of the location of the leak. This highlights the importance of deploying stochastic resonance to determine the optimum noise intensity that should be introduced in the ANN training samples (Harmer et al. 2002). Figure 6-12 demonstrates that as the noise intensity (๐œŽ ) ๐‘– increases, the distribution of the leak locations are more compact and are, in general, closer to the real leak location. Predictions from ANNs trained with noise intensities ๐œŽ and ๐œŽ (see Table 6-2) are within the length of the pipeline but vary considerably 2 3 between the different transient tests conducted. Leak location prediction errors obtained from the last three noise intensities (๐œŽ ) range between 2 and 3.8 m with a 4โˆ’6 couple of predictions outside the physical length of the pipelines for ๐œŽ . 4 Although most of the transient tests allow for a similar distribution of predictions for a particular noise intensity, transient test #1 and #12 resulted in more scattered leak location predictions. Leak location predictions for transient test #1 are less satisfactory because this test had a more prominent difference in the steady state pressure head. Thus, the difference in the resulting initial pressure head increase after the closure of the solenoid valve is more prominent as can be seen in Figure 6-11. On the other hand, even though transient test #12 does not present with any particular differences in comparison with the other transient tests, it has produced less consistent results for all the noise intensities. These results point out that there might have been additional 107
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection background noise during this test. Considering this, conducting multiple tests provides more information that the ANNs can process instantaneously and allows for a more confident prediction of the leak location. A perfect distribution of leak location predictions would imply that all the ANNs trained for a particular noise intensity predict the correct leak location. However, given that each ANN has a different set of resulting weights after the training process, this result would be very hard to accomplish. Therefore, the effectiveness of ANNs should be measured on their ability to produce consistent predictions with a reasonable degree of accuracy for field applications of this technique. To further analyze the results obtained from the leak detection ANNs, Figure 6-13(a) presents the distribution of the absolute median error in the predicted leak location for each group of ANNs trained with different noise intensities. The median leak location prediction of each transient test in Figure 6-12 has been extracted and the error between this prediction and the real leak location has been computed. The distribution presented in blue in this box plot is obtained from the 14 median leak location errors. This distribution is presented as an absolute value to demonstrate the applicability of stochastic resonance as it has been reported previously (Ikemoto et al. 2018). The absolute median error in the leak location for the ANNs trained without any noise (i.e. noise standard deviation of zero in Figure 6-13(a)) is not visible in the scale of the plot because all of the predictions are outside the length of the pipeline. Similarly, this plot demonstrates that the addition of a very small noise distribution in the training samples (ฯƒ=6.2 mm) drastically improves the performance of the ANNs. The resulting distribution of absolute mean location errors oscillates between 1 and 8 m. However, an 8 m error is still not acceptable for the location of a leak in a 37.24 m long pipeline (which represents a 21.48% error). As the noise standard deviation increases, it is clear that the distribution of the absolute median error narrows, in concordance with the concept of stochastic resonance. Absolute mean location errors vary between 0.02 and 1.09 m (0.05โ€“2.93% error) for the largest noise standard deviation considered. 108
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Figure 6-13. Leak location prediction selection. a) Left axis: Absolute median predicted leak location error for different noise intensities (standard deviation) obtained from laboratory tests. The error value for standard deviation = 0 is well above the maximum extent of the vertical axis (234.27 m). Right axis: Training and testing ANNโ€™s root mean square error obtained using numerical samples. b) Leak location error range during training and testing using numerical samples. Analyzing only the distribution of the absolute median location errors in Figure 6-13(a), it would seem logical to select the predictions of the ANNs trained with the largest noise intensity. However, the optimum noise intensity should be selected also by consideration of the performance of the ANNs during training and testing. Figure 6-14(a) presents on the right-hand y-axis the distribution of the RMSE for the training (in light green) and the testing (in black) of the ANNs for each noise intensity (shown in Table 6-2). The RMSE has been computed using the leak location error of each of the 125,000 samples used for the training or testing of the ANNs (or 25,000 for the 109
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection case of the ANNs trained without any noise). A satisfactory ANN training process will have low values of RMSE and similar RMSE magnitudes in both the training and the testing. Figure 6-13(b) presents error plots of the RMSE (in circles) and the complete range of errors for the leak location prediction (whiskers). These figures show that ANNs trained with samples with large noise intensities result in larger values of RMSE and significantly larger ranges of possible leak location errors. Both of these metrics are considerably larger for the last two sets of ANNs (corresponding to ๐œŽ = 0.1238 and 0.1857) with significantly different results for the training and the testing of these ANNs. These results point to a certain level of overfitting in these ANNs that is also visible in Figure 6-9(f) and Figure 6-9(g). Although these results were presented as part of the model development stage (Step 1.5 in Figure 6-2), they are relevant in the model application stage for the leak location prediction selection step. The final leak location prediction should be a robust prediction (in terms of consistency amongst the conducted tests) and be the product of a reliable set of ANNs. For this reason, it can be concluded that the optimum noise intensity for this application of the proposed leak detection model is obtained when the noise has a Gaussian noise distribution with a standard deviation of 6.2 mm (๐œŽ ). 4 The median leak location prediction for this group of ANNs was 28.74 m and the median predicted leak size was 2.32 mm. These predictions represent a 0.58 % error in the location of the leak and a 5.52 % error in the size of the leak. The last step of the model application consists of verifying the accuracy of the obtained prediction. This step comprises the generation of a numerical transient pressure head trace with the characteristics of the final prediction obtained in the previous step and its comparison with the measured transient pressure head traces. This comparison is presented in Figure 6-14 using test #18 as an example. 110
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection Figure 6-14. Comparison between transient pressure trace numerically modelled from the selected ANN prediction and laboratory transient pressure trace. A reasonable match between these two traces is observed in this figure demonstrating the successful prediction of the location and size of the leak using a set of ANNs. The NMRSE has been computed between these two transient pressure head traces obtaining a value of 2.06% demonstrating again the accuracy of the methodology proposed. 6.5 Conclusions This paper has proposed a new comprehensive technique for the location and characterization of leaks in pipelines using fluid transients and ANNs. This methodology has proven successful when applied to pipelines under more realistic conditions in the presence of background pressure fluctuations. A full methodology that is divided into two stages (model development and model application) has been presented. The model development stage includes the design and training of ANNs capable of identifying leaks in transient pressure head traces with different noise intensities. The model application stage describes the pre-processing and analysis steps for any pressure transient measurements obtained from a transient event caused by the closure of a valve in a pipeline. 111
ADE
Chapter 6 โ€“ Fluid Transients, ANN and Stochastic Resonance for Leak Detection This technique has been applied to a laboratory pipeline where 14 transient events were generated with the closure of a side discharge solenoid valve. One circular orifice was installed in the pipeline to simulate a leak. A leak detection model with 35 different ANNs was developed for this pipeline where six different noise intensities were considered with standard deviations between 6.2 mm and 0.186 m. The application of the leak detection model to the available transient tests has demonstrated the significant importance that the addition of noise has in the performance of the ANNs for the prediction of the location of a leak in the pipeline. For the ANNs trained using numerical transient pressure head traces with no noise added, the distribution of the leak locations was beyond the actual extremities of the pipeline in most cases. However, as the noise intensity increases, the distribution of the leak location predictions narrows around the real leak location (as shown in Figure 6-12). The results obtained in this paper demonstrate that the deployment of stochastic resonance assists in detecting leaks in water pipelines. With the addition of noise in the training samples of an ANN, its performance is significantly improved, to the point that consistent and accurate predictions can be obtained. To select the optimum noise intensity for the presented laboratory application, a combined analysis of the distribution of the predicted leak locations and the RMSE of the training and testing of the ANNs has been conducted. Results from that analysis have shown that the optimum noise intensity was found when the standard deviation was 6.2 mm. The final leak prediction has been determined for the laboratory pipeline only 0.74 m away from the real leak location. This prediction corresponds to an error of 0.59% with a very accurate prediction of the leak size. The results obtained in this paper demonstrate that the use of ANNs trained with numerical samples with the addition of noise is a promising technique for leak detection in pipelines under more realistic conditions. Although expected differences are evident between the available numerical model and the measured transient tests, an accurate prediction of the location and size of the leak was obtained. This represents an important stepping-stone in developing a fully automated methodology for leak detection in pipelines using transient waves. However, more research is needed to analyze the performance of this technique under noisy conditions such as demand consumption and in more complex systems such as pipeline lopped networks. 112
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification processor and 16 GB of memory using the ANN training procedure described in Section 3.2 taking between 3 and 15 hours until the training threshold was met. The passive inspection methodology presented in this chapter relies on the identification of the negative transient pressure wave caused by the occurrence of a burst. Since the exact moment of the occurrence of this abnormal event is unknown, a methodology for the analysis of a continuous transient pressure trace is required. This chapter proposes a novel time window analysis that is incorporated in the proposed methodology and is presented in Figure 7-1. This analysis includes the processing of one time window at a time to determine if abnormal conditions are evident in the pipeline until time windows containing the complete set of reflection are found (time window 4). The classification of these time windows is carried out using a convolutional neural network incorporating the activation function Softmax (Goodfellow et al. 2016). Figure 7-1. Sliding time window analysis. To train an ANN to detect the occurrence of an abnormal events, multiple transient pressure traces representing different bursts have been numerically generated, processed and used. The total number of time windows obtained from this process can be very large. If this complete dataset of transient pressure time windows was used for the training of an ANN, this process would be too computationally expensive. Therefore, only a portion of this dataset needs to be selected. A preliminary analysis indicated that a careful selection of a fraction of the complete dataset is required. This demonstrates that the use of ANNs for the inspection of pipelines requires an understanding of the transient flow behavior in a pipeline to obtain satisfactory results. 116
ADE
Abstract The occurrence of bursts in water pipelines can not only prevent the system from functioning properly, but it can also produce significant water loss that disrupts activities in urban areas. Therefore, the detection and location of bursts in water distribution systems is a vital task for water utilities. Various techniques currently exist to detect the occurrence of these events, but there is a need for a permanent monitoring method that can detect and identify anomalous events quickly and accurately. This paper presents a new technique that uses artificial neural networks (ANNs) to detect and identify bursts in pipelines by interpreting the transient pressure waves that a burst causes along pipelines. The technique is divided into two stages: a model development stage and an application stage. The model development stage includes the generation of transient pressure traces and the training and testing of two different ANNs to (1) detect burst occurrence and (2) identify burst location and size. The application stage includes the processing of a potentially continuous transient pressure trace, analysis by the previously trained ANNs, and then the verification of the results using a transient flow forward numerical model. A numerical application demonstrates the principles of the technique and the potential for merging the use of fluid transient waves and ANNs. The technique has also been validated in the laboratory, indicating that the prediction of the location of the burst is very accurate while the prediction of the burst size requires an additional step to ensure its accuracy 119
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification 7.1 Introduction Water transmission and distribution pipelines are critical infrastructure for modern cities. Owing to the sheer size of these pipelines and the fact that most of them are buried underground, the health monitoring and maintenance of this infrastructure is challenging. In addition, some water transmission pipelines cover long distances through remote areas that are not easily inspected on a regular basis. To monitor these systems, different noninvasive techniques have been developed to identify events that may put the functioning of a pipeline at risk. These techniques include visual observations (Thomson and Wang 2009), acoustic monitoring (Shimanskiy et al. 2003; Muggleton et al. 2006; Juliano et al. 2013), thermographic infrared inspection methods (Fahmy and Moselhi 2010), ground-penetrating radar methods (Hunaidi and Giamou 1998), and remote sensing (Agapiou et al. 2016; Martins et al. 2019). However, these techniques are time-consuming, do not provide permanent monitoring of the pipelines, or have a short inspection range along a given pipeline. Therefore, there is a need for a permanent monitoring method capable of identifying anomalous events and, potentially, their associated characteristics in near real time. Hydraulic-based techniques have been developed based on the understanding of the movement of a fluid along a pipeline and are typically related to the measurement and analysis of two hydraulic variables: flow (or velocity) and pressure in the pipeline. These techniques can include volume-based methods coupled with alert systems (Mounce et al. 2003), pressure and flow analysis using statistical detection (Puust et al. 2008; Li et al. 2014; Lee et al. 2016; Wu et al. 2018b), system state estimation analysis (Andersen and Powell 2000), and transient-based methods (Misiunas et al. 2005). However, while each of these approaches has been moderately successful, they also have associated disadvantages. Some of these methods are only applicable for the detection of leaks, are not able to pinpoint the location of the abnormal event, or require an accurate numerical model of the pipeline, or the resolution of the data limits their ability to detect and locate anomalies in a timely manner. Among the hydraulic-based techniques, transient-based methods have received attention because they provide for the inspection of a long section of pipe using only pressure measurements (Wang et al. 2002; Brunone et al. 2013; Gong et al. 2014a). These methods are based on the interpretation of the effect that the occurrence of an 121
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification anomalous event has on a measured transient pressure trace. The interpretation of the transient pressure trace can be conducted by visual analysis or by processing the transient pressure trace to identify reflections and detect the occurrence of abnormal events (Misiunas et al. 2007; Srirangarajan et al. 2011; Rashid et al. 2014; Rathnayaka et al. 2016). Nonetheless, a visual analysis cannot be conducted in real time and the processing techniques available require extensive numerical processing that makes a real-time monitoring system difficult. This paper presents a new transient-based technique that employs artificial neural networks (ANNs) to interpret rapid changes in a transient head trace to identify, locate, and characterize bursts in water pipelines. Unlike current transient-based techniques, the proposed approach is data-driven and relies on no detailed information regarding the analyzed pipeline for the interpretation of the transient pressure trace in near real time. In addition, in contrast to many existing approaches, the proposed technique does not use an ANN as a metamodel of the transient phenomenon but instead uses an ANN as a tool to interpret the measured transient head traces to identify bursts. This technique analyzes short time segments of a potentially continuous transient head trace in previously trained ANNs through two different processes. A first ANN analysis detects whether a particular transient pressure head time window contains abnormal changes that could have been produced by the occurrence of a burst. This initial analysis also determines whether the information contained in the time window is enough to locate and characterize the potential burst. The second ANN analyzes the detected abnormal transient head time windows from the first ANN to predict the location and the characteristics of the occurring burst. Finally, the technique uses a transient flow numerical model to verify that the predictions of location and size of the burst are coherent and are similar to the measured transient head trace. The approach proposed in this paper works with transient pressure head data to carry out the training of the ANNs. These pressure head data may be obtained from recorded data, from an available numerical model, or from a combination of these two sources. Once the ANNs have been trained, the use of this technique is data-driven in that it only requires measured transient head data to detect and identify a burst (by determining its location and size). Additionally, it can be applied in near real time considering that the computationally expensive processes are concentrated in the 122
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification training of the ANNs and not in the processing of new transient pressure head traces, which can be tested almost immediately without retraining the ANNs. One example hydraulic system is considered in this paper to demonstrate the functioning and performance of the proposed technique. A single pipeline with the potential presence of a burst at any point along its length is analyzed. A numerical system with this configuration is used to present the operation of the technique and to train the ANNs. In addition, a laboratory validation is included to demonstrate the promising potential of the technique. This paper includes a background in hydraulic and transient-based methods for identifying and locating bursts in pipelines. The example hydraulic system is described next, and the methodology to apply the proposed technique is then presented by explaining the two stages involved in the process. The results for the training, testing, and application of the proposed technique are presented for the numerical system. Finally, the experimental validation is described. The proposed technique is shown to be successful in analyzing a potentially continuous transient head trace to identify, locate, and characterize the occurrence of a burst in a pipeline. 7.2 Background The detection and location of bursts in water distribution systems is a complex task for water utilities. Various authors have proposed techniques for locating bursts in water pipelines using hydraulic-based methods. A first group of techniques includes the use of flow and pressure measurements with statistical methods to detect the occurrence of abnormal behavior in a system (Wu and Liu 2017). Ye and Fenner (2011) proposed the use of an adaptive Kalman filtering process to predict flow (or pressure) in a system at a district meter area (DMA) level. This statistical characterization of a dynamic system is able to model the normal hydraulic parameters that are compared to measured data to detect the occurrence of bursts. Similarly, Ahn and Jung (2019) proposed a hybrid statistical model that combines statistical process control with two univariate methods to enhance the performance of the burst detection technique in terms of the detection probability, the rate of false alarms, and the average detection time. Other authors have proposed the use of statistical risk functions (Cheng et al. 2018) and principal component analysis (Palau et al. 2012) to detect bursts in transmission mains and in DMAs. A different approach was described in Wu et al. 123
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification (2018a), where a clustering-based method was used to identify bursts using only 1 day of historic measured data without using statistical methods to model the expected normal conditions of the system. Although these techniques are successful in detecting the occurrence of bursts, they are unable to accurately pinpoint the location of bursts and their range of effectiveness is often limited to a DMA level. A second group of techniques uses supervised learning techniques coupled with hydraulic measurements to send an alert regarding the occurrence of a burst. Mounce and Machell (2006) used two ANN architectures (static ANN and time delay ANN) to detect the occurrence of bursts using flow data at a DMA level. The use of ANNs showed potential for identifying changes in the flow that corresponded to unusual fluctuations of this hydraulic variable. Mounce et al. (2010) proposed the use of support vector regression models to predict time series data in a moving time window and compare these series with measured data for the detection of anomalies. The use of this supervised learning technique was applied to historical data proving that 78% of the alerts corresponded to actual abnormal events in the system. Similarly, Romano et al. (2014) proposed a fully automated data-driven methodology at a DMA level using all the pressure and flow measurements available. This approach combined the use of an ANN for the short-term forecasting of hydraulic values and statistical processes to determine whether an abnormal event had occurred. The results obtained showed the potential of data-driven technologies for near real-time incident management in water distribution systems. Other authors have proposed the use of artificial immune systems not only for detection but also for an approximate localization of a burst. Tao et al. (2014) proposed the use of pressure data every 10 min and was able to detect and localize a burst in 48% of the cases in a real network. More recently, Huang et al. (2018) proposed the use of a random forest classifier to detect bursts in real time by analyzing successive time windows (every 15 min) of flow data at a DMA level. These contributions demonstrate the use of a supervised learning technique for the detection of bursts in pipelines; however, all the applications to date have been focused at a DMA level and using SCADA flow (or pressure) data, which are often available in intervals between 1 and 15 min. 124
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification A different group of techniques involves the use of fluid transients to detect the occurrence of bursts in water systems. These techniques are able to detect and locate anomalies in pipelines such as (Wang et al. 2002; Lee et al. 2007a; Lee et al. 2007b; Capponi et al. 2017), blockages (Rubio Scola et al. 2017), or wall deterioration (Gong et al. 2013c) and have obtained accurate results. Liggett and Chen (1994) proposed an inverse transient algorithm to detect leaks using the method of characteristics (MOC) and the Levenberg-Marquardt method to find friction and leak parameters in a system. These authors proposed, for the first time, the use of transient pressure measurements to locate pipe ruptures using an event algorithm with the capacity to approximately pinpoint burst locations to locate additional nodes in the numerical model of systems and conduct inverse transient analysis. Misiunas et al. (2005) used the principles of time domain reflectometry for detecting and locating abrupt pipeline breaks using a single pressure measurement point in a pipeline. A system of continuous monitoring of the pressure at a high sampling frequency, coupled with a cumulative sum test and prefiltering techniques, was used to detect changes in the data. In addition, an offline analysis of a short time window was conducted to interpret the pressure changes to determine the burst location. The results of this research have demonstrated that transient pressure signals can be used to detect bursts in water systems. More recently, Srirangarajan et al. (2011) described the use of a wavelet-based multiscale analysis combined with a focusing algorithm and a graph-based search algorithm to detect and locate a burst event. This technique showed the potential for application of transient pressure techniques if the characteristics of the system are known and presented the first application in a network layout. Other authors have proposed the use of embedded and distributed event processing algorithms to detect transient events in a system and stroke-based transient recognition algorithms to classify transient events as bursts (Hoskins and Stoianov 2014). Although several authors have proposed techniques that use transient pressure signals to detect and localize bursts in pipelines, the existing techniques require offline processing that can delay the detection of bursts or require specific prior knowledge about the systems. The analysis of transient pressure signals using supervised learning algorithms has not been widely explored. Bohorquez et al. (2020a) presented a technique that uses ANNs to predict the presence of different features (leaks and junctions) in a pipeline after the generation of a controlled transient event. The obtained results demonstrated the 125
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification potential of combining the principles of transient-based techniques with ANNs to interpret the pressure traces. A similar application was proposed by Perera and Rajapakse (2011) for the identification of transient faults in power transmission networks using hidden Markov models and probabilistic neural networks (PNNs) to classify transients as faults of normal switching events. Considering the current literature, this paper presents a methodology that for the first time merges ANNs and fluid transient waves to detect, locate, and characterize bursts in water pipelines. 7.3 Hydraulic System Configuration The proposed methodology has been applied to a single pipeline under the assumption that a burst can occur at any point along its length. The pipeline, of diameter ๐ท, is connected at the upstream end to a reservoir, and at the downstream end there is a closed inline valve (Figure 7-2). The length of the pipeline is ๐ฟ , and the location of ๐‘‡ the burst is characterized by a distance ๐‘ฅ measured from the upstream end of the pipeline. The bursts are modeled as circular orifices of diameter ๐ท . ๐ต Figure 7-2. Single pipeline with a burst system description. Two pipelines with the configuration presented in Figure 7-2 were analyzed. A numerical pipeline was considered with the characteristics presented in Table 7-1. In this case, the head at the reservoir is defined as ๐ป = 55 m at the beginning of the 0 simulation, and a sinusoidal fluctuation of this head is considered to model gradual changes in pressure head that can be observed in pipeline systems. Steady-state friction was considered using a Darcy-Weisbach friction factor ๐‘“with a pipeline roughness of ๐œ€ = 0.01 mm. The different burst locations and sizes that have been considered are described in what follows, as part of the methodology (Steps A.2 and A.3 in Figure 7-3) of the proposed technique. 126
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification Table 7-1. Numerical pipeline characteristics. Characteristic Units Value Length of pipe (๐ฟ ) (m) 1,000 ๐‘‡ Internal diameter of pipe (๐ท) (mm) 587 Wave speed of pipe (๐‘Ž) (m/s) 1,111 ๐ฟ /๐‘Ž time (s) 0.9 ๐‘‡ A second pipeline was analyzed as part of the experimental verification of the proposed technique. The characteristics of this pipeline are shown in Table 7-2 and explained in detail in the experimental results section of this paper. Table 7-2. Experimental pipeline characteristics. Characteristic Units Value Length of pipe (๐ฟ) (m) 37.24 Internal diameter of pipe (๐ท) (mm) 22.14 Wave speed of pipe (๐‘Ž) (m/s) 1,290 Wall thickness (๐œ€) (mm) 1.63 ๐ฟ /๐‘Ž time (s) 0.029 ๐‘‡ 7.4 Methodology The effect that a burst has on a transient head trace is characterized by a sharp drop in the head that propagates in both directions away from the burst location (Misiunas et al. 2005; Bohorquez et al. 2018). The proposed methodology for detecting and identifying bursts is presented in Figure 7-3. Two stages have been included in this diagram. The first stage comprises the ANN model development (Stage A in Figure 7-3), which is carried out first and can be updated regularly depending on the availability of new pressure head data. The application stage (Stage B in Figure 7-3) includes the required steps to process and interpret a continuous transient pressure head trace using the ANNs for detecting, identifying, and verifying the occurrence of a burst. 127
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification Figure 7-3. Burst detection and identification methodology. 7.4.1 Model Development Stage To establish a near-real-time monitoring system for a pipeline, the first stage of the proposed methodology includes the development of the burst detection and identification model. This model is composed of two trained ANNs that can predict, first, whether a particular analyzed transient head trace contains abnormal head fluctuations corresponding to the occurrence of a burst in the pipeline and, second, the location and size of this burst. As explained in this section, this model does not represent a metamodel of the transient flow phenomenon that occurs in a pipeline after a burst. The design, training, and testing of these ANNs are focused on interpreting a measured transient head signal to detect the occurrence of a burst. The steps described in this stage are required only once to set up a monitoring system in a pipeline, which means that the computationally expensive processes are not required for the application stage. However, if new transient pressure head data become available (from numerical modeling or historical measured data), the ANNs can be retrained to include any new information regarding the transient behavior of the pipeline. 128
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification 7.4.1.1 ANN Architecture Definition The first step to developing a model capable of detecting and identifying bursts is the definition of the ANN architecture (Step A.1 in Figure 7-3). Previous applications of ANNs with transient fluid head traces have shown that a dense network (the most general and widely used ANN structure) is not able to adequately capture the changes in pressure due to the presence of different elements in a pipeline (Bohorquez et al. 2020a). Considering this, a one-dimensional (1D) convolutional network architecture was chosen since these networks have fewer weights and are less prone to overfitting. In addition, convolutional networks have shown successful performance in predicting multiple outputs in fields such as image segmentation (Raza et al. 2017). These 1D- convolutional networks are designed to perform satisfactorily both in the detection of the occurrence of a burst and in the identification of the burst location and size. This design was developed by modifying different characteristics of the ANN architecture, including the number of convolutional layers, type of activation function, number of filters in each layer, and training batch size. The final configuration of the designed 1D-convolutional networks includes (1) a maximum of seven convolutional layers, (2) the use of leaky rectified linear unit (Leaky ReLU) and Softmax as activation functions, (3) a maximum number of 12 filters that increase in each convolutional layer, (4) a training batch size of 50 samples, and (5) three dense layers of maximum sizes of 21, 9, and 3. With these characteristics, the designed ANNs have between 26,808 and 81,250 weights to be trained. 7.4.1.2 Transient Head Trace Sample Characteristic Definition The model development stage includes the training and testing of two different ANNs (Steps A.7 and A.8 in Figure 7-3). The data used for these processes are transient head data that can be obtained from recorded data, from an available numerical model, or from a combination of these two sources (Step A.2 in Figure 7-3). In this paper, numerically generated data were used for ANN training and testing to demonstrate the application of the proposed technique. In the context of this paper, a sample is the transient head trace that would be observed if a burst (with specific characteristics) occurred at a specific location along a pipeline. 129
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification To train and test the ANNs, the spatial distribution and the characteristics of the samples were defined to cover a range of values for the potential burst locations and sizes. For the pipeline described in Figure 7-2, the transient head traces were generated by modeling a burst located at random distances on average every 0.2 m along the pipeline. This spatial distribution of samples was selected considering that generating samples with a larger spacing decreases the effectiveness of the ANN training and choosing a smaller spacing does not provide significantly better results, but it does result in a larger computational effort (Bohorquez et al. 2020a). In addition, the use of random distances was introduced to avoid the risk that the ANNs would learn only from regularly spaced burst locations. Considering the previously described pipeline, if the burst location is changed every 0.2 m, the total number of samples is 5,000. Each one of these samples was assigned a random burst size. As was described in Figure 7-2, the burst was modeled as a circular orifice with a diameter ๐ท . The range ๐ต of possible burst sizes was defined considering the head drop that each burst size can cause in the transient head trace. The smallest burst size considered (๐ท = 17 mm) ๐ต causes a 1-m pressure head drop, and the largest burst (๐ท = 88 mm) causes a 20-m ๐ต pressure head drop at the burst location. 7.4.1.3 Transient Head Trace Sample Generation Various authors have proposed the use of numerically simulated data to train ANNs that may be used to analyze real-time data (Perera and Rajapakse 2011; Zhou et al. 2019). In this paper, the transient pressure head samples for the ANNs training (Steps A.7 and A.8) were generated using the Method of Characteristics (MOC). This transient fluid calculation method transforms the two hyperbolic partial differential equations that govern the behavior of unsteady flow into four ordinary differential equations in order to obtain the variation of flow and head at different points along a pipeline at a given time. Two of these ordinary differential equations describe the relation between the time step (โˆ†๐‘ก), the spatial resolution of the calculation (โˆ†๐‘ฅ), and the wave speed of the transient wave in the pipeline (๐‘Ž). Only steady-state friction was considered in the transient numerical modeling. The effects of unsteady friction were neglected because the transient head trace samples only cover a maximum of 3.5๐ฟ/๐‘Ž seconds after the occurrence of the burst, and during these first seconds, the 130
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification effect of unsteady friction is not significant, as has been previously reported (Gong et al. 2014a; Zhang et al. 2018). Considering that the selected spatial separation between bursts is on average only 0.2 m, the selected time step needs to match this spatial resolution. The wave speed in the selected pipeline is 1,111 m/s, therefore the required time step is at least โˆ†๐‘ก = 1.799ร— 10โˆ’4 s. The total simulation time included a period of time before the occurrence of the burst and at least 3.5๐ฟ/๐‘Ž seconds after the burst occurrence in order to capture the first cycle of reflections of the burst wave in the pipeline and to perform the burst occurrence consistency test (explained below at Step B.5). Thus, the total simulation time was 4.04 s. This means that each of the 5,000 generated transient head traces had more than 20,000 head values. 7.4.1.4 Downsampling and Processing The potential size of the input data for the ANN training and testing when the sample spatial distribution and the required time step are considered as described in the previous step is approximately 100 million head values. Considering this, a timewise downsampling (Step A.4 in Figure 7-3) was applied to the samples in the input dataset since this has proven successful in the training and testing of ANNs with the ability to interpret transient head traces (Bohorquez et al. 2020a). The downsampling frequency selected was 256 Hz to match the potential sampling frequency in the field considering existing technology. Further processing of the downsampled transient head trace is required because the proposed technique is intended to work in near real time. A sliding time window concept (Mounce et al. 2010; Huang et al. 2018) is applied by partitioning each transient head trace into time windows (moving one data point forward at a time) that could contain the first period of transient wave reflections of the occurrence of a burst. To accomplish this, the length of each time window must be at least 2๐ฟ/๐‘Ž seconds. In this paper, this length was selected as 2.5๐ฟ/๐‘Ž seconds. Considering the downsampling frequency, the length of each time window, and the total length of the transient head trace (8.5๐ฟ/๐‘Ž), each trace was transformed into 1,328 time windows. Therefore, the 5,000 transient head traces were transformed into 6.9 million time windows, each one with a length of 577 head values (corresponding to 2.25 s). 131
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification 7.4.1.5 Time Window Sample Classification and Selection Once the partitioning of the transient head traces is complete, the resulting time windows can be classified into three categories depending on the contained head information, as shown in Figure 7-4. The first category is defined as Normal Head Condition, or Category N, since these time windows only contain part of the assumed slow sinusoidal head variation before the burst. Figure 7-4(a) shows the variation of the head in two different scales to show the part of the sinusoidal head variation for this particular time window. The second category is defined as Abnormal Head Condition with Incomplete Information for Identification, or Category Ab-I. The time windows in this category capture the initial head drop due to the burst, but the burst wave reflection at the upstream reservoir is not included, as shown in Figure 7-4(b). The last category is defined as Abnormal Head Condition with Complete Information for Identification, or Category Ab-C. The time windows in this category [as presented in Figure 7-4(c)] contain a complete reflection of the transient wave created by the burst at the boundary conditions of the pipeline. Considering this, at Step A.5 of the model development stage, this classification is used to characterize the available time windows. For the pipeline described earlier, there are 3.5 million time windows in Category N, 1.1 million time windows in Category Ab-I, and 2.3 million time windows in Category Ab-C. It is important to recognize that the total number of available time windows in the three categories is very large. With the purpose of reducing the required time for the ANNs training and facilitating the data management, only 20 time windows per category were randomly selected for each of the 5,000 locations of the modeled bursts. By conducting this selection, the total number of time windows was reduced to approximately 300,000. Different numbers of selected time windows were assessed in terms of the final ANN performance, and it was found that 20 time windows per location provides good performance with a reasonable computational time. 132
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification Figure 7-4. Time window classification. 7.4.1.6 Burst Detection ANN Training and Testing The methodology of the proposed technique includes the use of two different ANNs. First, a burst detection ANN was trained to analyze each time window and allocate it to one of the three categories described previously (Step A.7). The input dataset for the training and testing of the burst detection ANN contains the 300,000 time windows selected at Step A.6. This input dataset is then randomly divided into two groups, one of which is used for ANN training and the other for ANN testing (50% training and 50% testing). As presented in Figure 7-5, the burst detection ANN receives as input one time window at a time with the information of the corresponding category and uses gradient search to find the best combination of weights to describe the training dataset. The output of the burst detection ANN is the probability of each time window 133
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification of belonging to each category and the final category for each time window is assigned as the category with the highest probability. This process is conducted using the Softmax activation function (Goodfellow et al. 2016) which returns three integers (two zeros and a one corresponding to the selected category). Once the training process is complete, the testing dataset is processed on the burst detection ANN to obtain a set of predicted categories, which can be compared to the correct category of each time window. 7.4.1.7 Burst Identification ANN Training and Testing The second ANN in the proposed methodology is referred to as the burst identification ANN. This ANN was trained to analyze only time windows previously classified as Category Ab-C. The training and testing of this ANN are included in Step A.8. The input dataset for this ANN was defined as half of the complete time window dataset allocated to the last category at Step A.5 (1.2 million time windows). Similarly to the burst detection ANN, the input dataset was randomly divided into two groups for the training and testing processes. The output of the burst identification ANN is the location and the size of a burst, based on the interpretation of a particular time window, as shown in Figure 7-5. Figure 7-5. Proposed ANNs (N = Normal, Ab-I = Abnormal Head Condition with Incomplete Information for Identification, and Ab-C = Abnormal Head Condition with Complete Information for Identification). 134
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification 7.4.2 Application Stage The second stage of the technique presented in this paper (Stage B in Figure 7-3) comprises the proposed steps that can be carried out to process and interpret a continuous transient head trace in order to detect and identify bursts. The steps presented in this section include the processing of a measured signal to be interpreted by the model created in the model development stage of the technique and could potentially be applied in near real time to a transient head measured signal. 7.4.2.1 Transient Pressure Head Data Retrieval Once the burst detection and identification model has been created and validated, it can be applied to a continuous transient head trace obtained from a given measurement source. This transient head trace can be obtained from new and different numerical simulations, measurements from a laboratory setup, or pressure head measurements in a real pipeline. In either of the last two cases, a high-frequency pressure transducer is required for capturing the head variations on a real-time basis. The selected sampling frequency depends on factors such as the pipeline wall properties, the wave speed, and the downsampling frequency selected at Step A.4. In general, the transient head measurements should have at least the same frequency that was selected for the training of the ANNs. The data retrieval system (Step B.1) should also include data acquisition, processing, and communication modules to process the initial data obtained from the pressure transducer. 7.4.2.2 Sliding Time Window Selection As presented in the model development stage, the analysis of the transient head trace is conducted by partitioning this trace into short time windows that are shifted one point at a time as the head measurements are obtained. A particular time window must be at least 2๐ฟ/๐‘Ž seconds long in order to capture the first set of wave reflections caused by the occurrence of the burst. Step B.2 comprises this partitioning and the isolation of one time window at a time to be analyzed following the subsequent steps of the application stage. 135
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification 7.4.2.3 Burst Detection Analysis Once one time window of the transient head trace has been isolated, it is necessary to determine whether this time window contains any abnormal head variation that could have been caused by a burst. This burst detection analysis is composed of two different steps. The first step (Step B.3 in Figure 7-3) includes the transformation of the current time window to match the sampling frequency that was selected for the training of the ANNs (Step A.4). As shown earlier, the downsampling frequency is selected based on the sampling frequency available for the head measurements or an estimation of the expected and required sampling frequency in the field. The downsampled time window obtained from the continuous transient head trace can then be analyzed in the burst detection ANN obtained in Step A.7 (at Step B.4). The result from this ANN is a prediction of a category to characterize the current time window. There are three possible results of this analysis. If the burst detection ANN predicts that the current time window only contains normal head fluctuations, it is not necessary to continue the analysis, and the next time window can be selected (returning to Step B.2). This condition is defined as โ€œNormal Conditionโ€ and in an alert system can be represented by the color green. If the burst detection ANN predicts that the current time window belongs to Category Ab-I, then the condition of the pipeline is now defined as abnormal and can be represented by the color orange. In this case, the analysis continues to the next time window because for the predicted category it is known that this time window does not contain enough information to locate and characterize the burst. Lastly, if the burst detection ANN predicts that the current time window belongs to Category Ab-C, the analysis process continues to the burst identification analysis module. In this case, the condition of the pipeline is changed to โ€œAbnormal Conditionโ€“Possible Burstโ€ and may be represented by the color red. 7.4.2.4 Burst Identification Analysis Of all the possible time windows analyzed in the application stage, the only ones that are analyzed in the burst identification module are those that are classified as Category Ab-C. The main objective of this module is to determine the location and size of the previously detected burst. 136
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification Once one time window has been defined in Category Ab-C, a consistency test is conducted (Step B.5 in Figure 7-3). This consistency test determines how many windows have been classified in this same category immediately before the current time window. The main objective of this step is to provide a technique with more robustness to possible misinterpretations from the burst detection ANN. For instance, a particular time window might have been classified as Category Ab-C owing to normal fluctuations of the head in the pipeline, but the following time windows are again classified as Category Ab-I. In this case, the process continues until an invariant classification in Category Ab-C is obtained. The consistency test is considered complete once at least ๐‘› time windows are continuously classified in this category, where ๐‘› corresponds to the number of time windows that cover ๐ฟ/๐‘Ž seconds for the analyzed pipeline. If the consistency test is completed, the analysis process continues to Step B.6, where the previously trained burst identification ANN (at Step A.8) is used to predict a possible location and size for the detected burst. It is important to mention that not just the last time window is used in this step, but the complete batch of time windows that have been included in the consistency test. Given that ๐‘› time windows are used to obtain a prediction for the location and characteristics of the burst, ๐‘› different combinations of predicted locations and sizes are obtained. Different statistical measures were considered to achieve a final prediction, and the median was selected because it is less sensitive to possible outliers in the prediction (potentially present due to misinterpretations of the burst identification ANN). 7.4.2.5 Burst Verification Analysis It is important to highlight that the proposed technique merges existing knowledge of the impact of bursts in the transient head traces in a pipeline with the use of ANNs to rapidly and more accurately interpret these traces. However, the use of ANNs is also complemented by the use of transient numerical forward models to reinforce the robustness to the predictions. This is the case for the burst verification analysis. This analysis is comprised of two steps: a comparison of the measured transient head trace and a numerical transient head trace generated using the burst identification ANN predictions, and then a potential burst size prediction adjustment. 137
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification At Step B.7 (Figure 7-3), a numerical simulation of the transient head trace caused by a burst with the predicted characteristics in the previous step is conducted. This transient head trace is then compared with the measured transient head trace using a metric such as the normalized root mean square error (NRMSE) to evaluate their match. If the prediction from the burst identification ANN is accurate enough, the NRMSE between both traces should be under a predefined threshold. In this case, an alert is raised for the pipeline, including the predicted location and size of the burst. For the examples presented in this paper the NRMSE threshold was defined as 2.0%. In cases where the NRMSE between the two obtained transient head traces is above the threshold, a potential correction in the burst size prediction is conducted. Multiple tests demonstrated that when the predictions of the burst identification ANN are not accurate, most of the time it is due to an error in the prediction of the burst size. To correct for this, at Step B.8 different transient head traces are generated covering the complete range of possible burst sizes to find the burst size that causes a transient pressure trace that is very similar to the analyzed transient head trace (using again NRMSE) and thus adjusts the final prediction. If the value of the comparison metric improves after Step B.8, an alert will be raised with the original burst location prediction and the adjusted burst size prediction. However, if after conducting the burst size adjustment the NRMSE is still large, this means that none of the burst characteristics was predicted accurately, and the analysis will continue with the next time window at Step B.2. The complete methodology described in this section was assessed using the numerical pipeline described earlier in this paper and was validated with experimental data. The results for these two applications are presented in the following sections. 7.5 Numerical Results The methodology presented in Figure 7-3 was applied to the system described in Figure 7-2 and Table 7-1. A burst detection ANN and a burst identification ANN were designed, trained, and tested to detect and identify bursts. This section presents the results for both the model development stage and the application stage. 138
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification 7.5.1 Model Development Stage Considering the multiple steps involved in the model development stage (Step A.8 in Figure 7-3), samples of numerical transient head traces were generated at random distances on average every 0.2 m along the pipeline to complete 5,000 transient head traces in total. Once all the transient head traces were generated, these were downsampled to a sampling frequency of 256 Hz and divided into time windows of length 2.5๐ฟ/๐‘Ž seconds. A total of 6.9 million time windows were obtained (from Step A.5) and 20 time windows per burst location were selected for the training and testing of the burst detection ANN. At Step A.7, a burst detection ANN was trained and tested using this input dataset. Figure 7-6 shows the classification performance of the burst detection ANN into two of the three possible categories. This accuracy is presented in terms of the percentage of time windows that are misclassified at each considered burst location. In each figure, the results are presented for the training and testing processes separately. It is important to note that the total accuracy of classification in Category Ab-I is 96.07% for the testing dataset and 99.17% for the classification in Category Ab-C. Figure 7-6. Percentage of misclassified time windows for (a) Category Ab-I (incomplete); and (b) Category Ab-C (complete) Figure 7-6(a) presents the percentage of time windows misclassified in Category Ab- I. As can be seen in this figure, the behavior of the results is similar in the training and testing of the burst detection ANN, showing that there is no overfitting of the ANN to the training data. In addition, it is possible to observe that when the burst is located very close to the upstream end of the pipeline, the burst detection ANN has difficulty 139
ADE
Chapter 7 โ€“ Fluid Transients and ANN for Burst Detection and Identification classifying a time window as Category Ab-I. This is explained by the fact that the transient head response of a burst located at this end only contains a quick head drop that, after which it almost immediately recovers. Figure 7-6(b) shows the percentage of misclassified time windows for Category Ab-C. This figure demonstrates that the burst detection ANN does not present any significant difficulties in correctly classifying a time window in this category in either the training or testing steps of the development of the ANN. Plots of the results of the accuracy in classifying a time window of Category N are not presented because, for the training and testing of the burst detection ANN, the accuracy in this category was 100%. At Step A.8, the burst identification ANN has now been trained and tested. Results for this step are presented in Figure 7-7. Figure 7-7 shows the median error in the estimation of the burst location [Figure 7-7(a)] and size [Figure 7-7(b)], depending on the actual location of the burst (burst position). The median error was selected to present these results because several time windows corresponding to the same burst location were used for the training and testing purposes, and the use of this metric makes it possible to analyze an estimation of the distribution of the predictions. Figure 7-7. Median error in estimation of (a) burst location; and (b) burst size along the pipeline. These two figures demonstrate that the burst identification ANN does not overfit to the training dataset given that the testing dataset predictions follow the same trend. The maximum median errors in the prediction of the burst location were found when the burst was located at end of the pipeline. However, 99% of the median location prediction errors are smaller than 6.33 m (0.63% of the pipeline length). On the other 140