A stochastic material balance model for leak location in oil pipelines

. The material balance method, being the basic algorithm of leak detection systems (LDS), is discussed. A criterion for making a decision concerning a leak is substantiated; the issue of determining the sensitivity limit of the material balance algorithm is discussed.


Introduction
The problem of leak detection in main oil pipelines still remains topical [1][2][3][4][5][6][7]. One of the control tasks is oil and product leakage monitoring and prevention. Oil transport process control algorithms continuously monitor multiple measurements. The basic task for a leak detection system (LDS) is to establish a set of admissible values for the monitored parameters, so that the algorithm would detect system upset when the actual values fall outside this set. This paper discusses the known method of material balance [4][5][6][7]. Deviations from the law of conservation of matter that are identified as a result of direct measurements, are called imbalance. It is reasonable to assume that imbalance represents a random process   i t  (random function) [8], with the expected value being zero. The problem of leak detection is defined as searching for the point of change in probabilistic characteristics of the random process under examination, which is the imbalance in this case. This is a problem of probabilistic diagnostics, known in statistics as the problem of change in a time series [9,10].
The method of control charts [11], as proposed by W. Shewart [12], is used traditionally. The method's essence is clear: the process under examination is being observed for a certain time period to draw a chart of admissible values for the controlled parameters.
It should be noted that the methods [ 10 12] do not account for some properties of random functions. It is known [8] that adjacent time marks in a random function may be dependent, which requires caution in the course of analysis [13,14].
It is important to note that issues of field application remain the engineer's responsibility. The algorithms described above contain numerical parameters to be determined during the commissioning on site. The issue of their quantification is one of the most important practical problems.

Stochastic balance model
Let us consider a random process [8] is a steady-state ergodic process with zero expectation and some correlation function where t1-t2 is the difference between the adjacent points in time t1 and t2. The variance of a random process is by definition Let us consider a random variable: where is considered a parameter. The expectation of the variable ( ) also equals zero, the physical significance of ( ) being a sliding average. Representing ( ) as a spectral expansion [8], ( The correlation function can be represented as follows [8]: where 2 1 t t    ,   y K  is the correlation function of sliding average, and   S  is the spectrum of the correlation function of a "raw" random process   t  . Since   y K  only depends on the difference between the arguments 2 1 t t    , ( ) is a steady-state random process. The variance of the sliding average is as follows:   k  shows how independent adjacent time marks are. If there exists a certain timewe will call it the correlation time of the random process   t  , after which random variables are no longer related to each other, the following is valid:  . At the same time, the spectral density function is bounded, so the integral in (6) is majorized by the following value: The spectral density reaches its maximum at zero Taking into account properties of the correlation function [8], (3) can be written as below for times longer than the correlation time in   0 .
The following estimate is eventually obtained for the upper boundary of the variance of ( ):

Leak detection algorithm
The relationship (9) gives understanding of how the range of imbalance averaged over the time decreases with increase in the averaging time. The three-sigma criterion is traditionally used to solve practical problems: where   is the standard deviation (SD) of the original random process. If the imbalance averaged over the time period has deviated from zero by more than (10), it can be stated that a change has occurred. The imbalance has deviated from its expected value by more than 3 SDs, the estimated probability of such an event being less than 0,003. Thus, three characteristics of the original random process are necessary to confirm the fact of a suspected leak: average value, SD, and correlation time.
Due to the influence of external factors not taken into account and to the existence of bias of the pressure instruments, the actual expected value of imbalance will not equal zero. Practice shows that a stationary time interval of around 5 to 10 minutes, containing several thousand of measured imbalance values, is enough to calculated the SD and the sample average with sufficient accuracy. Unfortunately, the amount of data necessary to calculate the correlation function is higher by an order of magnitude. This is not the only difficulty. The numerically obtained correlation function will always have non-zero values, even for quite long times. Therefore, it is not clear how to strictly define the correlation time determination algorithm.

Validation of a stochastic balance model
The model formulated above was checked against real data. Several pipeline sections varying in length were analyzed. The diagrams below show a relationship of the dimensionless range of the sliding average of imbalance (1) ∆=1/σξ*max[y(τ)], where τ=Δt/tk. The dashed line shows a curve calculated from the formula (10): ∆max=3/√τ. All the results are presented in dimensionless form to facilitate analysis of results related to pipeline sections with different pipe sizes and lengths. A detail review of the experimental data related to the curve 3 ( Fig. 1) can better demonstrate how the leak detection works. The following figure shows several diagrams for different averaging intervals. The dashed line in the diagrams shows the detectability threshold (10).
Let us consider how the leak detection algorithm works in an example (Fig. 2.). It is not possible to come to a clear conclusion by observing the raw measurement data (curve 1). Yes, the threshold is exceeded in some places, but that is a random event with the probability of 0,003. In order to make a substantiated statement that these overshoots are statistically significant, an investigation has to be carried out. Looking at the results, it can be asserted that the thresholds based on the 3 criterion for a raw series are clearly undervalued and would cause frequent false alarms. Filtering with a small sliding average window of 60 sec hardly changed the situation with leak detection, the situation with potential false alarms already being substantially better. A reliable confirmation of a leak can be given based on the curves 3 and 4, with the averaging windows of 120 and 300 sec. This can lead to a conclusion that there is no qualitative difference in the mere fact of leak detection (exceeded boundary) for 120-and 300-second averaging windows.

Discussion
The results of experimental data processing need to be analyzed. The obtained estimate of the upper boundary of variance of the sliding average is generally well consistent with experimental data. As it is seen in the figure (Figure 1), the experimental data is well approximated by the relationship C/√τ, which supports the conclusions (7) (9). Thus, it can be stated that the created model is adequate and the measured imbalance may be considered an approximately steady-state ergodic random process.
The method of correlation time determination, as proposed in this paper, is of estimating type and requires human involvement in setting up the leak detection system at a particular facility.

Conclusion
A stochastic material balance model has been developed in the work. A relationship between the leak detection time and leak intensity has been established. The obtained results have been validated through the analysis of field test results.