A Pipeline Leakage Signal Simulation and Generation System

. To test the effectiveness of the detection and positioning technology of the pipe leakage, the propagation law of pipeline leakage signal is studied in this paper, and a pipeline leakage signal simulation and generation system is proposed. It can simulate the leakage pressure wave signals at different positions of the pipeline. Changing pipe’s parameters though the computer, the simulation and output of the leakage signal under various working conditions can be realized. It can test the reliability and accuracy of the detection and location technology of the pipe leakage, and verify the applicability of the pipe leakage detection and location technology to different pipe structures. The results show that the output signal of system can replace the real signal, and located the pre-set leakage point by cross-correlation method. The purpose of studying the effectiveness and accuracy of the existing leak location algorithm base on large-scale complex pipe network system in laboratory conditions was realized.


Introduction
When the pipe network system is built, it will be used for a long time under harsh working environment. It is inevitable that various problems can happen in the pipeline system. Once leakage occurs in the pipe network system, it will cause significant economic loss and even casualties if it is not detected and maintained in time. On November 22, 2013, the oil pipeline of Huangwei Pipeline of Zhongshi Chemical Co., Ltd., Qingdao City, broke, resulting in a crude oil leak. A total of 136 people were injured and 62 were killed in the accident, which caught fire after a pipe burst. Therefore, it is necessary to carry out online leak detection for pipelines. However, in practice, the pipeline leak detection and positioning system cannot be directly developed and evaluated through the actual pipe network system, and there is a lack of effective reliability test. Therefore, there is in need to develop a simulation system that can simulate the leakage signal of sensors at different positions in the pipeline network. Such a system can bring high social and economic benefits.
There are a few studies on leakage signal simulation at home and abroad, which can be divided into two groups, building a real pipe network system for leakage signal acquisition and using signal simulation software to simulate the leakage signal of complex pipe network. In terms of actual pipeline construction, Guangmin Zhang [1]. proposed a pipeline leakage positioning method that can adjust the resolution in order to improve the resolution of the pipeline leakage positioning. In the corrosion test, Liang Ren [2] bonded several light sensors to the surface of the pipeline at the same interval to form a sensor array. Based on the sensor array, the hoop strain diagram is created to show the corrosion degree and corrosion location. Li Hongtao [3]. studied the propagation law of wellbore pressure under different fluid media conditions, and deeply analyzed the effects of angular frequency, solid content, particle size, solid density and two-phase fluid viscosity and other parameters on pressure wave propagation and attenuation coefficient.
In terms of software simulation, Guoxi He [4]. established three models to calculate the leakage flow rate and leakage volume for long-distance pressurized oil pipelines. Firstly, the negative pressure wave attenuation model was used to calculate the leakage diameter. Secondly, a transient oil leakage model composed of continuity, momentum conservation, energy conservation and throttle hole flow equations is established to calculate the leakage. Finally, a steadystate oil leakage model is established to calculate the leakage amount after the valve and oil pump are closed. Two kinds of leakage holes with different sizes were tested in Sinopec oil product pipeline. Fu Juntao [5]. used ANSYS and SYSNOISE software to simulate the propagation characteristics of leakage acoustic wave in special pipe fittings (bend, diameter change, branch), and used high-pressure gas pipeline leakage device to conduct experimental research, and analyzed the propagation law of leakage acoustic wave signal. Yang Fan [6]used TGNET simulation software to simulate and calculate the leakage conditions between two valve rooms with different pipe transport volume, pressure, pipe diameter and leakage equivalent diameter, and obtained the relationship between the pressure at the end of the pipeline and the pressure decline rate over time under different leakage conditions. Cao Jiahao [7]used the Flowmaster software to establish the corresponding bifurcation structure model, made a comparative analysis with the programming results and proposed a pipeline leakage detection and positioning method.
Based on the above research, a leakage pressure wave signal generation method for underground fluid pipeline network is proposed in this paper, set up by computer for leakage parameters using PSOC3 microcontrollers produce leakage signal of leakage points and analogue the pressure wave signal of each sensor, and through the 0 ~ 5V voltage signal and 4 ~ 20mA current signal output at the same time. The simulation of the leakage signal of the underground fluid pipeline network is realized. The leakage analogue signal generated can be collected by the leakage detection equipment, and the data collected can be analyzed and the positioning technology can be studied.  Figure 1 shows the diagram of the proposed pipeline leakage detection simulation system. The parameters of the simulated pipe network are configured through the computer in this paper to improve the flexibility of the leakage simulation system. Users can set the 6 parameters shown in the interface according to their own needs. After the configuration is completed, the configuration information is transmitted to the PSoC microcontroller by means of serial port communication.

Proposed Pipeline Leakage Detection Simulation System
PSoC calculates the pressure wave signals at various sensors according to the input parameters and the law of negative pressure wave propagation along the pipeline, and outputs 0-5V voltage signals through pulse width modulation (PWM). Finally, the voltage signal of 0~5V is converted into the current loop signal of 4~20mA by the voltage convert current circuit, which is consistent with the actual sensor's output.

Introduction of pipe network topology
Si-j represents the jth pressure sensor in Li pipe section In this paper, the network shown in Figure 2 is selected as the pipeline model to be simulated. This pipeline structure is typical and universal: it is a two-part structure and then two-part structure. It is divided into five branch pipes, and each branch pipe is equipped with a pressure sensor at the first and end of each branch pipe.
Represents the pressure wave signal collected here. Gas enters the network from L1 branch pipe. The branch point S1 represents that the front-end pipe has no branch point and the back-end pipe has two branches. The branch point S2 represents that the front-end pipe has branch points, and the back-end pipe has two-branch structure. These two types of branch structures can represent the vast majority of pipeline structures in the real coal mine pipeline network system, so the pipeline structure shown in Figure 2 is selected as the simulated coal mine pipeline structure in this paper.

Simulation of normal pressure signal
According to the study of Xu Hailiang [8], the larger the diameter of the pipeline, the smaller the pressure loss gradient, and the loss rate has a certain relationship with the pressure value in the pipeline. For the convenience of calculation, the gradient parameter of pressure loss was selected as 1000Pa/m, that is, the pressure loss was 0.1MPa for every 1000 meters. Leakage waveform simulation.

Leakage waveform simulation
Leakage types for sudden leakage, this article has simulated the waveform characteristics of just when the leaking pipe pressure, the pipe fluid leak speed and pressure drop speed, with the increase of leak time, the pressure inside the pipeline value decreases, the pipe fluid leakage rate gradually reduced, present the index decline leakage signal, this paper selected as shown in formula (1) function as a leak waveform of the main trend of [9], as shown in Figure 3.
In the formula, t is the continuous leakage time, unit is s; β is the leakage rate coefficient and represents the size of the leakage diameter.

Simulation of signal attenuation
The attenuation formula of the leakage signal amplitude along the pipeline [10] is: Where, p 0 is the signal amplitude of the leakage negative pressure wave at the leakage point, and the unit is MPa. α is the attenuation coefficient of pressure wave, and the unit is m -1 . X is the distance of pressure wave propagation in m.
According to the above negative pressure wave amplitude attenuation formula (3), the farther the sensor is from the leakage point, the smaller the amplitude of the leakage negative pressure wave signal at its location, and the attenuation rate of negative pressure wave amplitude conforms to the law of exponential decline [11]. Figure 4 shows the amplitude of the leakage negative pressure wave at each sensor. For the convenience of calculation, we choose p 0 is 0.2Mpa and α is 0.001 to conduct attenuation simulation for the leakage signal of the network structure shown in Figure  2.

Simulation of noise signal
As shown in Figure 5, the simulation effect chart of white noise is obtained through Matlab software simulation. Its amplitude is 0.005MPa, which is used to replace the conventional noise in the pipeline when there is no leakage in the pipeline., for the convenience of calculation, this paper uses the superposition of sinusoidwave signals with frequencies of 1 Hz and 1 kHz to simulate the noise signal in the pipeline when leakage occurs, and its amplitude is 0.01MPa.  Signals generated with different parameters The system described in this paper can flexibly change the pipeline parameters, as shown in the Figure 7 Leakage signals under different working conditions can be generated by setting different parameters.

Experimental Verification
PSoC is a programmable mixed signal array architecture, its advantage is that it supports many different low power consumption modes, and the chip itself is a minimum system which the development and debugging is very convenient. The main function of the simulation system is to calculate the leakage pressure value of different pipelines, output the current signal that can be collected by the monitoring equipment through the microcontroller, and assess the accuracy of the detection and location algorithm by locating the leakage point of the output signal. In order to verify the authenticity and validity of the analogue signal, this paper set up leak signal simulation system, as shown in Figure 8, through PSOC3 microcontroller generates the leak signal of each sensor and by controlling the duty of the PWM control output voltage value.

Pressure wave signal output at each sensor
During PSOC programming completed, the location of the leakage point is determined by the parameters transmitted by the computer, and the relative distance between each sensor and the leakage point is calculated. When leakage occurs, the time delay, attenuation and other parameters are calculated according to the distance, and finally the leakage signal at each sensor is generated. When there is no leakage, the range of pipeline pressure loss is calculated according to the distance between the sensor and the head end of the pipeline, and the pressure signal of the sensor is generated when there is no leakage. Finally, the generated signal is output by changing the duty of PWM, and the signal is converted into 4~20mA current signal by filtering circuit and current loop circuit.

Analog signal leakage location verification
In order to verify the correctness of the leakage signal simulation method proposed in this paper, after data collected of the analogue signals generated by PSOC, the cross-correlation method [13] was used to locate the leakage points of the collected data. As shown in Figure  9, data at sensors on both ends of L3 pipeline as shown in Figure 2 are collected. It can be seen from the figure that there is an obvious time delay between the two sensors. The generalized cross-correlation method used in this paper is developed from the correlation analysis of the signals. It calculates the mutual power spectrum of the pressure wave signals received by the two sensors. After the weighted processing of the mutual power spectrum, the cross-correlation function of the two signals is obtained by inverse Fourier transform. Suppose the pressure wave signals collected by two sensors at different positions are X 1 (t)and X 2 (t) respectively, and the mutual power spectrum of the two signals is obtained.
Wherein, X 1 (ω) and X 2 * (ω) represent the Fourier transform and the conjugate function of the Fourier transform of the signals X 1 (t) and X 2 (t), respectively. The generalized cross-correlation function of the signals X 1 (t) and X 2 (t) is obtained by weighting and inverse Fourier transform of the cross-power spectrum. 12 12 Wherein, W(ω) represents the weighting function, and no weighting is carried out at 1, while R 12 (τ) represents the Fourier transform form of the fundamental cross-correlation method.
The distance between the simulated leakage point X 3 and the sensor S 3-1 in this paper is 300m, the above two sensors of leakage signal delay calculation using crosscorrelation method, can be seen from the Figure 10, the time delay between the two group of signal is 0.2s, through the formula (4) and formula (5), the time delay can be calculated,, the distance between the leakage point and the sensor S 3-1 is 300m, in accordance with the pre-set by the leakage point location. Figure 10. The cross-correlation method is used to locate the collected leakage signals As shown in Table 1, multiple groups of tests were carried out in this paper by setting the position of the X 3 leakage point on the computer, so as to verify that the leakage signal simulated by the system in this paper can be located by positioning technology. A total of four tests were carried out in the table, and the distance between the X 3 leakage point and the sensor S 3-1 was respectively set at 100m~400m. The test results show that there is little difference between the leakage point position established and that calculated by the positioning technology, and the method described in this paper can realize the simulation of pipeline network leakage signal.

Conclusions
In this paper, the simulated leakage pressure wave signal of the coal mine pipe network system is output through the 4-20mA current loop signal by the PSoC microcontroller, which avoids the shortcomings of the traditional leakage signal simulation method which cannot reflect the authenticity of the signal, the difficulty of the test, and the low flexibility. It combines the advantages of software simulation and the construction of the actual pipeline. Through experiments, the correctness of the leakage signal simulation method proposed in this paper is verified, and the purpose of accurate and efficient evaluation of the reliability and accuracy of detection and positioning technology can be realized without the need of field tests.