Leak Location of Pipeline with Multibranch Based on a Cyber-Physical System

Xianming Lang 1 ID , Ping Li 2,* ID , Yan Li 1 and Hong Ren 3 1 School of Automation, Northwestern Polytechnical University, Xi’an 710072, China; langxianming@mail.nwpu.edu.cn (X.L.); liyan@nwpu.edu.cn (Y.L.) 2 School of Information and Control Engineering, Liaoning Shihua University, Fushun 113001, China 3 CNPC Northeast Refining & Chemical Engineering Co. Ltd. Shenyang Company, Shenyang 110167, China; renhong_64@163.com * Correspondence: liping@lnpu.edu.cn; Tel.: +86-24-5686-0588


Introduction
Pipeline transportation is widely used in oil and gas transportation because of its safety, reliability and economy [1,2].However, pipeline leakage can cause environment pollution and financial losses.Therefore it is important to detect and locate the leakage under pipeline working conditions [3].
Currently, most of the reports about leak detection systems based on data-driven techniques are directed at straight pipelines.According to data-driven methods, there are three main steps are necessary for leak detection and location based on signals analysis: feature extraction; feature selection, and; pattern recognition.Traditional feature extraction such as wavelet packet decomposition (WPD), empirical mode decomposition (EMD), and local mean decomposition (LMD) have been widely used in pipeline leak detection [4,5].Moreover, the detection performance depends on the quality of the selected features, and the feature selection depends largely on prior knowledge [6].Several research results have shown that pattern recognition such as support vector machine (SVM), least squares support vector machine (LSSVM), and least squares twin support vector machine (LSTSVM) have a powerful classification efficacy [7][8][9][10], and they are very suitable to effectively build the complex relationships in leak detection and location.Therefore, it is meaningful to establish twin support vector machine (TWSVM) for pipeline leak detection.
Pipelines with multibranch are quite common and leak detection for them is one of the most popular areas of research in this field [11].Recently, some studies have shown that leakage from water-filled systems, such as the leakage of pipelines, can be well identified and localized by acoustic waves [12].Acoustic leak detection methods have been studied, and their pipeline networks experiment has been presented [13,14].Conventional leak detection system needs to connect instruments with the laying of cables.However, the geographical environment of pipeline laying, sometimes, is extremely bad and it is difficult to install cables.Furthermore, factors such as aging and material defects could affect the stability of signal transmission and increase maintenance costs.Therefore, the combination with wire transmission and wireless transmission [15] is adopted in long-distance pipeline leak detection systems.
If the leak detection system is used for branch pipeline is different from the one used for the main pipeline, data cannot communicate among different leak detection systems.When adding new sensors, the data structure of the main program needs to be amended and the extensibility is poor.In addition, lacking real-time data structure and algorithm, the information delay is quite common and larger errors could be produced in locating leakages.The network of cyber-physical system (CPS) is heterogeneous network [16], in other words, the network can contain different attributes simultaneously, and the information range and form of communication are unrestricted.In order to transfer the information between layers smoothly to meet the real-time requirement and to make it possible to detect and locate leaks of the pipeline with multibranch, the leakage location method based on CPS is proposed.
When utilizing CPS framework to detect the leakage of a pipeline with multibranch, first, the wavelet packet analysis is used to extract the time of singular point of the measured pressure signal, and then the time feature samples are input into the improved twin support vector machine (ITWSVM) to locate the leakage position.
The rest of this paper is organized as follows.Section 2 introduces the cyber-physical system design of pipelines with multibranch.The leak location method of pipelines with multibranch is proposed in Section 3. In Section 4, the simulation results for pipelines with multibranch are analyzed and discussed.Finally, Section 5 draws the main conclusions and puts forward the plan of future work.

Cyber-Physical Leak Location System Design
CPS is the integration of computation, communication, and a control loop, which improves the stability and reliability of physical applications [17].In order to solve the problems about signal transmission between heterogeneous networks, the leak location method of the pipeline with multibranch is proposed in this paper.Based on CPS, a schematic of the pipeline leak location system is shown in Figure 1.
The measurement layer consists of a number of instruments, which can measure the values of internal pressure, flow and temperature of the pipeline.It can communicate with other units through the network.
The communication layer contains various networks according to actual conditions, such as Wi-Fi, Zigbee, and 3G/4G, as well as communication between the base station and the network node.Moreover, the communication between database and data processing unit server is included in this layer as well.Furthermore, the layer is responsible for data storing and transmitting.
The signal processing layer aims to reprocess the measured signals, to extract and to select features.Then feature vectors are input into the decision application layer through the communication layer.
The main purpose of the decision application is to remotely and visually monitor the work conditions of multibranch pipelines.If a leak occurs, it will sound an alarm and locate the position.Consequently, the decision application layer mainly consists of a decision monitoring unit and a decision processing unit.The decision monitoring unit includes the feature vectors from the signal processing layer.In the decision processing unit, the operators analyze and locate the leak position with using the measured data, which is provided by the decision monitoring unit.
The control layer executes the instructions, which are produced from the decision application layer and transmitted through the communication layer.

Wavelet Packet Analysis
Wavelet packet analysis [18] is an effective time-frequency analysis technique for non-stationary signals.Multi-resolution analysis of wavelet packet transform decomposes signals into low frequency and high frequency.After that, the process continues to decompose the following layers until the preset level, thus the wavelet packet analysis has a better ability to make accurate local analysis.Moreover, wavelet packet analysis has better characteristics for furthering segmentation and refinement of the frequency band broadened with the increase of scale.Therefore, it is a precise analysis method with the characteristics of high frequency band width and low frequency band narrow.When the signal is decomposed by wavelet packets, a variety of wavelet basis functions can be adopted.For instance, the signal S is decomposed by wavelet packets in three layer decomposition, as shown in Figure 2.

Wavelet Packet Analysis
Wavelet packet analysis [18] is an effective time-frequency analysis technique for non-stationary signals.Multi-resolution analysis of wavelet packet transform decomposes signals into low frequency and high frequency.After that, the process continues to decompose the following layers until the preset level, thus the wavelet packet analysis has a better ability to make accurate local analysis.Moreover, wavelet packet analysis has better characteristics for furthering segmentation and refinement of the frequency band broadened with the increase of scale.Therefore, it is a precise analysis method with the characteristics of high frequency band width and low frequency band narrow.When the signal is decomposed by wavelet packets, a variety of wavelet basis functions can be adopted.For instance, the signal S is decomposed by wavelet packets in three layer decomposition, as shown in Figure 2.

Wavelet Packet Analysis
Wavelet packet analysis [18] is an effective time-frequency analysis technique for non-stationary signals.Multi-resolution analysis of wavelet packet transform decomposes signals into low frequency and high frequency.After that, the process continues to decompose the following layers until the preset level, thus the wavelet packet analysis has a better ability to make accurate local analysis.Moreover, wavelet packet analysis has better characteristics for furthering segmentation and refinement of the frequency band broadened with the increase of scale.Therefore, it is a precise analysis method with the characteristics of high frequency band width and low frequency band narrow.When the signal is decomposed by wavelet packets, a variety of wavelet basis functions can be adopted.For instance, the signal S is decomposed by wavelet packets in three layer decomposition, as shown in Figure 2.  The signal S is decomposed by wavelet packet decomposition tree and can be represented as

Improved Twin Support Vector Machine
Considering the binary classification problem, this paper assumes the training set is T = {(x i , y i )}, i = 1, 2, • • • , l, and makes matrix A in R m 1 ×n represent the m 1 inputs of class y i = +1, and matrix B in R m 2 ×n represent the m 2 inputs of class y i = −1.It aims to find a decision function f (x) as the objective function, so that the new data x could be input into f (x) to get the output y, which could be regarded as data categories.
Lagrangian twin support vector machine (LTSVM) constructs a pair of primal problems [19], one primal problem corresponding to one non-parallel plane.It aims to make the same class data samples have the nearest distance to the relevant plane and have adequate distances to the other plane.
The pair of nonparallel hyper-planes is illustrated as follows: where The pair of optimization problem for TWSVM can be formulated as where c 1 > 0 and c 2 > 0 are parameters, are the slack vectors, and e is the proper dimension vector.
In order to get the solutions of optimization problems (3) and ( 4), this paper derives the dual problems as follows max and max where α and β are the Lagrangian multipliers, H = [A, e] and G = [B, e], and e is the proper dimension vector.
with satisfying the conditions of Karush-Kuhn-Tucker (KKT).Equations ( 5) and ( 6) are obtained as The new point x ∈ n is assigned to class i (i = +1, −1), which depends on Equations ( 7) and to which ( 8) is closer.
The decision function is shown as follows: where |•| is the absolute value.Equations ( 5) and ( 6) can be represented as follows: where Q is a positive definite matrix, when 10) is equal to Equation ( 6).There are many ways to deal with Equation (10).In this paper, the steepest descent algorithm is used to solve Equation (10).Equation ( 10) is transformed into an unconstrained optimization problem by using the complementary function [20].
is a sort of complementary function, and such that The Fischer-Burmeiste function is commonly used as a kind of complementary function and defined as φ FB : 2 → : are true.Let θ(u) = Qu − e, Equation ( 12) can be expressed as As a consequence, Equation ( 13) equals to an unconstrained minimization problem: The optimum solutions between complementary problem and the optimal problem are calculated by Equations ( 7) and (8).
Step 2: Calculate the search direction: Step 3: If p k := |d k | < epsilon (epsilon is the error requirement), the search will stop; otherwise, go to Step 4.
Step 4: Let k become the smallest nonnegative integer which satisfies the inequality as follows: The theorem proves the proposed algorithm see Appendix A.

Simulation and Analysis
All the methods are implemented in MATLAB R2014a and Flowmaster V7 environments on a PC with an Intel Pentium processor (2.90 GHz) and 6 GB RAM.
Leakage of the pipeline with the branch is simulated by Flowmaster software [21], and the establishment of the pipeline leak model is shown in Figure 3.According to the real pipeline environment, the elastic pipeline is applied to establish the pipeline leak model.The length of the main pipeline L A and the branch L B are 4000 m and 1000 m, respectively.The L A with outer diameter of 200 mm is used as the main pipeline, L B with outer diameter of 200 mm is connected to the larger one as the branch pipeline.The roughness of the inside pipeline wall is 0.025 mm.The oil reservoir height of constant head upstream, downstream and the branch are 300 m, 0 m and 0 m, respectively.The inlet volumetric flow rate is 0.1 m 3 /s.The pressure wave speed is 1000 m/s, and the external temperature is 20 degrees Celsius.To emulate leaks, flow ball valves are positioned at every 100 m from upstream, the leaking flow rate is 0.01 m 3 /s.Three pressure measure nodes are placed at node 1, node 2 and node 3.In addition, the pressure changes are calculated by the Flowmaster software.The sampling rate is 50 Hz, and the simulation time is 80 s.Next, the CPS is applied for locating leaks of the pipeline with the branch in a heterogeneous distribution environment.
Step 4: Let k ϖ become the smallest nonnegative integer which satisfies the inequality as follows: Step 5: Let 1 : ; go to step 2.

Simulation and Analysis
All the methods are implemented in MATLAB R2014a and Flowmaster V7 environments on a PC with an Intel Pentium processor (2.90 GHz) and 6 GB RAM.
Leakage of the pipeline with the branch is simulated by Flowmaster software [21], and the establishment of the pipeline leak model is shown in Figure 3.According to the real pipeline environment, the elastic pipeline is applied to establish the pipeline leak model.The length of the main pipeline LA and the branch LB are 4000 m and 1000 m, respectively.The LA with outer diameter of 200 mm is used as the main pipeline, LB with outer diameter of 200 mm is connected to the larger one as the branch pipeline.The roughness of the inside pipeline wall is 0.025 mm.The oil reservoir height of constant head upstream, downstream and the branch are 300 m, 0 m and 0 m, respectively.The inlet volumetric flow rate is 0.1 m 3 /s.The pressure wave speed is 1000 m/s, and the external temperature is 20 degrees Celsius.To emulate leaks, flow ball valves are positioned at every 100 m from upstream, the leaking flow rate is 0.01 m 3 /s.Three pressure measure nodes are placed at node 1, node 2 and node 3.In addition, the pressure changes are calculated by the Flowmaster software.The sampling rate is 50 Hz, and the simulation time is 80 s.Next, the CPS is applied for locating leaks of the pipeline with the branch in a heterogeneous distribution environment.Because the Flowmaster software generates noiseless pressure signals, in order to simulate the real working conditions, the standard normal distribution random number d = 0.003 * randn( ) is added to the pressure data collected at the boundary of the pipeline with the branch in the MATLAB experiment to approximate the actual conditions; thus, multiple simulation data is generated.There is a leakage at 20 s, whose aperture is 20 mm at 100 m from the pressure measure node 1.The waveform of the measured pressure is shown in Figure 4.
is a leakage at 20 s, whose aperture is 20 mm at 100 m from the pressure measure node 1.The waveform of the measured pressure is shown in Figure 4  According to the measured pressure signal at the boundary of the pipeline with the branch, they are decomposed by the WPD of the best tree structure with Daubechies 3 (db3) in three layers.Using the best tree structure, the time of singular point of pressure signal is extracted.In order to verify the validity of signal singular points which are extracted by wavelet packet, we chose four intrinsic mode functions (IMFs) after decomposition derived from EMD, and we also acquired three production functions (PFs) after the decomposition derived from LMD.The results of signal decomposition with EMD and LMD are respectively shown in Figures 5-7   According to the measured pressure signal at the boundary of the pipeline with the branch, they are decomposed by the WPD of the best tree structure with Daubechies 3 (db3) in three layers.Using the best tree structure, the time of singular point of pressure signal is extracted.In order to verify the validity of signal singular points which are extracted by wavelet packet, we chose four intrinsic mode functions (IMFs) after decomposition derived from EMD, and we also acquired three production functions (PFs) after the decomposition derived from LMD.The results of signal decomposition with EMD and LMD are respectively shown in Figures 5-7.
is a leakage at 20 s, whose aperture is 20 mm at 100 m from the pressure measure node 1.The waveform of the measured pressure is shown in Figure 4  According to the measured pressure signal at the boundary of the pipeline with the branch, they are decomposed by the WPD of the best tree structure with Daubechies 3 (db3) in three layers.Using the best tree structure, the time of singular point of pressure signal is extracted.In order to verify the validity of signal singular points which are extracted by wavelet packet, we chose four intrinsic mode functions (IMFs) after decomposition derived from EMD, and we also acquired three production functions (PFs) after the decomposition derived from LMD.The results of signal decomposition with EMD and LMD are respectively shown in Figures 5-7.According to the measured pressure signal at the boundary of the pipeline with the branch, they are decomposed by the WPD of the best tree structure with Daubechies 3 (db3) in three layers.Using the best tree structure, the time of singular point of pressure signal is extracted.In order to verify the validity of signal singular points which are extracted by wavelet packet, we chose four intrinsic mode functions (IMFs) after decomposition derived from EMD, and we also acquired three production functions (PFs) after the decomposition derived from LMD.The results of signal decomposition with EMD and LMD are respectively shown in Figures 5-7.From Figures 5-7, it can be shown that the wavelet packet analysis presents a powerful ability for extracting the signal singular point from measured pressure signals, compared with other methods like EMD and LMD.When the measured pressure signals are decomposed with EMD, due to the influence of the end effect, it is very difficult to accurately identify signal singular point.The LMD method is more relaxed than EMD in terms of decomposition conditions as the end effect is reduced and the over envelope phenomenon is avoided in the decomposition process.However, the end effect still affects the extraction for accurately signal singular point.
Thus, the wavelet packet analysis is used to extract pressure signal singular point at the boundary of the pipeline with the branch.The time of signal singular points of pressure of the 20-mm leakage aperture are collected at node 1, node 2, and node 3. Fifty cases are created, respectively.Sixty samples from each case are chosen for training the ITWSVM.Thus, 3000 samples of pressure singular point are selected.Moreover, 2500 samples are chosen as training samples and the others are using as testing samples.Partial samples are calculated and shown in Table 1.
In this simulation, three nodes (the time of signal singular point of pressure measure node 1, pressure measure node 2, and pressure measure node 3) are the inputs of the ITWSVM, and the output are different leakage locations.Therefore, different leakage locations can be identified according to the collected singular points of pressure signal via ITWSVM.In order to compare leak location accuracy, the input and output for back propagation neural network (BP), radial basis function neural network (RBF), and LTSVM are the same as those for ITWSVM.This paper chooses a three-layer BP neural network whose middle layer node number is 15, using 200 iterations, and for which the learning rate is 0.01, and the minimum error is  From Figures 5-7, it can be shown that the wavelet packet analysis presents a powerful ability for extracting the signal singular point from measured pressure signals, compared with other methods like EMD and LMD.When the measured pressure signals are decomposed with EMD, due to the influence of the end effect, it is very difficult to accurately identify signal singular point.The LMD method is more relaxed than EMD in terms of decomposition conditions as the end effect is reduced and the over envelope phenomenon is avoided in the decomposition process.However, the end effect still affects the extraction for accurately signal singular point.
Thus, the wavelet packet analysis is used to extract pressure signal singular point at the boundary of the pipeline with the branch.The time of signal singular points of pressure of the 20-mm leakage aperture are collected at node 1, node 2, and node 3. Fifty cases are created, respectively.Sixty samples from each case are chosen for training the ITWSVM.Thus, 3000 samples of pressure singular point are selected.Moreover, 2500 samples are chosen as training samples and the others are using as testing samples.Partial samples are calculated and shown in Table 1.
In this simulation, three nodes (the time of signal singular point of pressure measure node 1, pressure measure node 2, and pressure measure node 3) are the inputs of the ITWSVM, and the output are different leakage locations.Therefore, different leakage locations can be identified according to the collected singular points of pressure signal via ITWSVM.In order to compare leak location accuracy, the input and output for back propagation neural network (BP), radial basis function neural network (RBF), and LTSVM are the same as those for ITWSVM.This paper chooses a three-layer BP neural network whose middle layer node number is 15, using 200 iterations, and for which the learning rate is 0.01, and the minimum error is 4 × 10 −5 .In reference [19], the parameters are set to c 1 = c 2 = 0.1, and the parameter of LTSVM of is set to β = 0.2, error epsilon = 1 × 10 −5 .It chooses ITWSVM of which parameters are also set to c 1 = c 2 = 0.1, and the steepest descent method parameters are set to µ = 0.01 and σ = 0.01, error epsilon = 1 × 10 −5 .This paper adopts the "One-versus-Rest" algorithm of multi-classification. Figure 8 shows the accuracy of four methods in leak localization. .This paper adopts the "One-versus-Rest" algorithm of multi-classification. Figure 8 shows the accuracy of four methods in leak localization.From Figure 8, it can be seen that ITWSVM can achieve more accurate leak location, as the test accuracy (96.06%) is higher than the BP neural network (83.2%) and RBF neural network (88.4%).LTSVM and ITWSVM have the same objective function to achieve the same accuracy, but the computing time is different.The calculation time of four methods are separately shown in Table 2.It can be seen in Table 2 that the ITWSVM improves the solution speed over that of LTSVM, because when solving the double objective function, the ITWSVM algorithm transforms the objective function with upper and lower bound constraints to unconstrained solution.Each iteration requires no matrix inversion computation, thus it reduces the amount of calculation and improves the solution speed.

Conclusions and Future Work
The leakage location of pipelines with multibranch under the framework of CPS can solve the problem about no sharing of data and no locating leaks simultaneously among multiple pipeline leak detection systems.Wavelet packet analysis is more suitable for extracting signal singular point of non-stationary pressure signals than EMD and LMD, and the computing time of ITWSVM is faster compared with other methods (BP, RBF and LTSVM).However, in real operation conditions, there is some external low frequency signal interference in pressure signals, which can cause location errors when using wavelet packet analysis.Future work will involve carrying out signal de-noising effectively and to extract true signal singular point.In addition, when the leakage aperture is smaller, the inflection point of the waveform is not easily distinguished.Thus, the small leaks will be studied in the future.From Figure 8, it can be seen that ITWSVM can achieve more accurate leak location, as the test accuracy (96.06%) is higher than the BP neural network (83.2%) and RBF neural network (88.4%).LTSVM and ITWSVM have the same objective function to achieve the same accuracy, but the computing time is different.The calculation time of four methods are separately shown in Table 2.It can be seen in Table 2 that the ITWSVM improves the solution speed over that of LTSVM, because when solving the double objective function, the ITWSVM algorithm transforms the objective function with upper and lower bound constraints to unconstrained solution.Each iteration requires no matrix inversion computation, thus it reduces the amount of calculation and improves the solution speed.

Conclusions and Future Work
The leakage location of pipelines with multibranch under the framework of CPS can solve the problem about no sharing of data and no locating leaks simultaneously among multiple pipeline leak detection systems.Wavelet packet analysis is more suitable for extracting signal singular point of non-stationary pressure signals than EMD and LMD, and the computing time of ITWSVM is faster compared with other methods (BP, RBF and LTSVM).However, in real operation conditions, there is some external low frequency signal interference in pressure signals, which can cause location errors when using wavelet packet analysis.Future work will involve carrying out signal de-noising effectively and to extract true signal singular point.In addition, when the leakage aperture is smaller, the inflection point of the waveform is not easily distinguished.Thus, the small leaks will be studied in the future.

Figure 1 .
Figure 1.Schematic of pipeline leak location system based on cyber-physical system.

Figure 2 .
Figure 2. Wavelet packet decomposition of the signal S. The signal S is decomposed by wavelet packet decomposition tree and can be represented as S = A1 + AAD3 + DAD3 + DD2

Figure 1 .
Figure 1.Schematic of pipeline leak location system based on cyber-physical system.

Figure 1 .
Figure 1.Schematic of pipeline leak location system based on cyber-physical system.

Figure 2 .
Figure 2. Wavelet packet decomposition of the signal S. The signal S is decomposed by wavelet packet decomposition tree and can be represented as S = A1 + AAD3 + DAD3 + DD2

Figure 2 .
Figure 2. Wavelet packet decomposition of the signal S.

Figure 3 .
Figure 3. Leak model of the pipeline with the branch realized in Flowmaster.

Figure 3 .
Figure 3. Leak model of the pipeline with the branch realized in Flowmaster.

Figure 4 .
Figure 4. Pressure original signal of 20-mm leakage aperture at 100 m from the measure node 1. .

Figure 4 .
Figure 4. Pressure original signal of 20-mm leakage aperture at 100 m from the measure node 1.

Figure 4 .
Figure 4. Pressure original signal of 20-mm leakage aperture at 100 m from the measure node 1.

Figure 4 .
Figure 4. Pressure original signal of 20-mm leakage aperture at 100 m from the measure node 1.

Figure 6 .
Figure 6.Empirical mode decomposition (EMD) for pipeline inlet pressure signal of 20-mm leakage aperture.Figure 6. Empirical mode decomposition (EMD) for pipeline inlet pressure signal of 20-mm leakage aperture.

Figure 7 .
Figure 7. Local mean decomposition (LMD) for pipeline inlet pressure signal of 20-mm leakage aperture.

Figure 7 .
Figure 7. Local mean decomposition (LMD) for pipeline inlet pressure signal of 20-mm leakage aperture.

Figure 8 .
Figure 8. Accuracy comparison of four methods in leakage localization.

Acknowledgments:
This work was supported by National Natural Science Foundation of China (61673199).

Figure 8 .
Figure 8. Accuracy comparison of four methods in leakage localization. . .
a leakage at 20 s, whose aperture is 20 mm at 100 m from the pressure measure node 1.The waveform of the measured pressure is shown in Figure4. is

Table 1 .
Partial data for the ends of pipeline with the branch under pressure singular value.

Table 1 .
Partial data for the ends of pipeline with the branch under pressure singular value.

Table 2 .
Computation time comparison of four methods for leakage location.Back propagation neural network (BP); radial basis function neural network (RBF); Lagrangian twin support vector machine (LTSVM).

Table 2 .
Computation time comparison of four methods for leakage location.Back propagation neural network (BP); radial basis function neural network (RBF); Lagrangian twin support vector machine (LTSVM).