The proposed methodology for leak detection in pipelines as previously described 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 CNNs 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. A description of the application of the methodology for both stages following the steps presented in Fig. 1 is then provided.Laboratory TestsThe pipeline in the laboratory has the configuration indicated in Fig. 2. The pipeline is connected at both ends to pressurized tanks. An inline valve was closed at the downstream end 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 provided in Table 1. A circular orifice of size 2.2 mm was installed 28.52 m downstream of the source tank to simulate a leak.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 was measured with a PDCR 810 pressure transducer (Druck, Leicester, UK) 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 Fig. 7, and 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 Fig. 7 indicates the pressure changes only until 1 s).Using the results from these 14 laboratory tests and the known characteristics of the pipeline, the CNN leak location methodology presented in Fig. 1 was applied to this system. Multiple tests were analyzed to study the robustness of the leak location predictions to small differences in testing conditions, such as the initial pressure and background pressure fluctuations.Model DevelopmentFirst, a leak detection model was developed for the pipeline described in Table 1 following the steps described in Stage 1 of Fig. 1. The 1D convolutional neural networks 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. Ten different leaks were modeled 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.15L/a seconds, L/a seconds before the closure of the valve, and 2.15L/a seconds after to account for the effects of the valve closure curve in the computed pressure head. To obtain different transient head pressure traces, the time resolution of the MOC numerical model needed to be at least 0.006 ms. Therefore, the total size of the CNNs’ input dataset before the downsampling process is 788 million transient pressure head values (Step 1.2), and each trace has almost 16,000 head values.According to Step 1.3 in Fig. 1, the obtained input dataset was then downsampled to a selected downsampling frequency of 5 kHz. This frequency was selected considering the dimensions of the pipeline and the potential number of weights to train in the resulting CNNs. A smaller downsampling frequency creates a very small CNN that cannot learn enough information from the transient pressure head traces. Smaller downsampling frequencies can be selected for larger pipelines with larger L/a characteristics. The resulting number of weights for the leak detection CNNs 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 CNN input datasets with the addition of noise in the transient pressure head traces. Following the definition of noise intensity previously presented, the smallest leak drop [Δh in Eq. (2)] corresponding to the smallest leak considered was 0.1238 m. Six different noise intensities were considered in this step, and the selected values of ki and the derived standard deviations (σi) are presented in Table 2. These noise intensities were selected considering that the objective was to obtain CNNs with the ability to find leaks across the complete defined leak size range without significantly decreasing performance with the addition of noise. Important to note is that the values for the noise intensities to be considered are independent of the background noise present in the analyzed pipeline and are defined only based on the definition provided in Eq. (2).Table 2. Selected standard deviation for gaussian noise distributionTable 2. Selected standard deviation for gaussian noise distributionStandard deviation multiplier, ki (%)Resulting standard deviation, σi (mm)56.191012.42531.05061.9100123.8150185.6The information presented in Table 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 were created for each for the original numerical traces. Five CNNs were created for each defined noise intensity and five CNNs using the original training dataset, with no noise included. Each group of five CNNs have the same architecture but different resulting weights considering that Stochastic Gradient Descent algorithms were used in its training. As was previously explained, using these training algorithms is similar to applying Genetic Algorithms using different random number seeds. The resulting set of 35 CNNs were trained and tested simultaneously using graphics processing units (GPUs) on the University of Adelaide’s High Performance Computer (HPC), Phoenix. The training process was conducted for a maximum of 24 h or less if the desired threshold of accuracy was achieved.Figs. 8(a–g) present the percentage exceedance associated with the absolute average error in the location of leaks. This plot summarizes the results of the training and testing of seven of the 35 CNNs, where each plot corresponds to a different noise intensity CNN. Only one plot per noise intensity is included because the distribution of the errors obtained during training and testing was consistent across the five CNNs.Two series are included in each of the plots of Fig. 8. The blue solid line corresponds to the distribution of the absolute average leak location error for the samples used for the CNN training. The pink dotted line presents the leak location error for the samples used during the CNN testing. The percentage exceedance can be interpreted as the proportion of the total trained or tested samples for which 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 were used for either the training or the testing.Important to observe is that the maximum percentage indicated in the figure is 10% (y-axis). This means that 90% of the time that these CNNs are used with numerical transient pressure head traces, the absolute average leak location error obtained is smaller than the minimum absolute average error visible in these plots. In addition, the x-axes in Figs. 8(a–e) are presented at the same scale to facilitate its analysis.As the standard deviation for the Gaussian distributed noise increases, the absolute average leak location error also increases due to the noise added to the training and testing samples. This figure also makes it evident that the CNNs trained and tested with transient pressure head traces without any noise performed better than the rest. However, for all of 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 CNNs.Model ApplicationWith the successful training and testing of the leak detection CNNs, the model development stage is completed. The leak detection model application stage is now applied to identify the leak present in a real pipeline in a laboratory setting (Stage 2 in Fig. 1). The preprocessing of the obtained transient pressure head traces (Steps 2.1–2.3 in Fig. 1) started with a 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 in Step 2.1, two 0.2-s 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. Average standard deviations before and after the transient test of 0.0392 m and 0.0097 m, respectively, were obtained. An example of the resulting transient pressure head traces after the background pressure fluctuation reduction step is presented in Fig. 9.This figure indicates that the background pressure fluctuation reduction process does not dramatically change the transient pressure head traces because 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 and an improved application of the leak detection CNNs.The resulting transient pressure head traces were further transformed to complete the preprocessing described in Fig. 1. First, the 14 measured transient pressure head traces were shifted to be aligned to one initial average steady-state pressure head. As indicated in Fig. 7, 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 L/a seconds before the closure of the solenoid valve and 2.15L/a seconds after this closure. The resulting transient pressure head traces are presented in Fig. 10.Important to observe is that because 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 difference is due to the small differences in the resulting flow in the pipeline given different initial pressures, in a similar manner as reported by Meniconi et al. (2019). However, the transient pressure head traces were not further transformed to test the leak detection CNNs’ performance to predict accurate leak locations under these conditions. The last step of the preprocessing 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 CNNs.The second part of the leak detection model application involved an analysis of the transient pressure head traces (Steps 2.4–2.6 in Fig. 1). All of the preprocessed transient pressure head traces were analyzed using a total of 35 trained CNNs in Step 1.5 (five CNNs per noise intensity level including the CNNs trained with samples without any noise). The distribution of leak locations predictions is indicated in Fig. 11. A seven-color scale was used in this figure to illustrate the distribution of leak location predictions on each noise intensity defined in Step 1.4 and the CNNs trained with samples without any noise. In addition, Fig. 11 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 indicates the very large range of the leak location predictions when the CNNs were 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. 2020). Because these CNNs were trained with theoretical numerical samples with perfect data, the predictions when the analyzed transient pressure head traces have background pressure fluctuations become illogical for the leak location.Fig. 11 also presents the significant influence that the addition of noise in the numerical transient pressure head traces for the CNNs’ 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 (σ1) has a significant effect on the resulting leak location predictions. Most of these predictions can now be found within the physical limits of the pipeline (orange series in Fig. 11). Important to note is that a background pressure fluctuation with a standard deviation of 6.2 mm is smaller in magnitude than the real background pressure fluctuations observed in this pipeline. However, its introduction in the CNN 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 benefit ANN performance (Fukami et al. 2020).Despite the clear advantages of applying Gaussian distributed noise, the results presented in Fig. 11 also demonstrate that the addition of noise with a very small standard deviation is not enough for a satisfactory prediction of the leak location. 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). Fig. 11 demonstrates that, as the noise intensity (σi) increases, the distribution of the leak locations is more compact, and the predictions are generally closer to the real leak location. Predictions from CNNs trained with noise intensities σ2 and σ3 (Table 2) are within the length of the pipeline but vary considerably between the different transient tests conducted. Leak location prediction errors obtained from the last three noise intensities (σ4−6) range between 2 and 3.8 m, with a 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 tests #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 is observed in Fig. 10. In contrast, even though transient test #12 does not present with any particular differences relative to the other transient tests, it produced less consistent results for all of the noise intensities. These results point out that additional background noise might have existed during this test. Considering this, conducting multiple tests in a range of similar initial conditions provides more information that the CNNs can process instantaneously and allows for a more confident prediction of the leak location. If only one test in the pipeline is used, the risk of considering an incorrect prediction as true information about an existing leak would exist.A perfect distribution of leak location predictions implies that all CNNs trained for a particular noise intensity predict the correct leak location. However, given that each CNN has a different set of resulting weights after the training process, this result is very difficult to accomplish. Therefore, the effectiveness of CNNs should be measured by 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 CNNs, Fig. 12(a) presents the distribution of the absolute median error in the predicted leak location for each group of CNNs trained with different noise intensities. The median leak location prediction of each transient test in Fig. 11 was extracted, and the error between this prediction and the real leak location was 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 was previously reported (Ikemoto et al. 2018).The absolute median error in the leak location for the CNNs trained without any noise [i.e., noise standard deviation of zero in Fig. 12(a)] is not visible in the scale of the plot because almost 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 (σ1=6.2 mm) drastically improves the performance of the CNNs. 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, the distribution of the absolute median error clearly 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.An analysis of only the distribution of the absolute median location errors in Fig. 12(a) indicates that selecting the predictions of the CNNs trained with the largest noise intensity seems logical. However, the optimum noise intensity should be selected also by consideration of the performance of the CNNs during training and testing. Fig. 12(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 CNNs for each noise intensity (indicated in Table 2). The RMSE was computed using the leak location error of each of the 125,000 samples used for the training or testing of the CNNs (or 25,000 for the case of the CNNs trained without any noise). A satisfactory CNN training process will have low RMSE values and similar RMSE magnitudes in both the training and the testing.Fig. 12(b) presents error plots of the RMSE (in circles) and the complete range of errors for the leak location prediction (whiskers). These figures indicate that CNNs 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 CNNs (corresponding to σ5=123.8 mm and σ6=185.7 mm) with significantly different results for the training and testing of these CNNs. These results point to a certain level of overfitting in these CNNs that is also visible in Figs. 8(f and g).Although these results were presented as part of the model development stage (Step 1.5 in Fig. 1), 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 among the conducted tests) and be the product of a reliable set of CNNs. 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 61.9 mm (σ4). The median leak location prediction for this group of CNNs 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. Important to state is that the obtained value for the optimal noise intensity characterized by the standard deviation of a Gaussian noise distribution is unique for this pipeline and this set of experimental tests.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 Fig. 13 using test #18 as an example.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 CNNs. The NRMSE was computed between these two transient pressure head traces to obtain a value of 2.06%, demonstrating again the accuracy of the methodology proposed.