基于广义回归神经网络的管道泄漏精确定位方法
陈琦,林伟国
(北京化工大学 信息科学与技术学院,北京,100029)
摘要:针对复杂工况下管道泄漏定位不准问题,提出2种改进方法。提出移动窗相关定位算法,以一定步长在固定长度上下游信号中移动提取一定跨度信号做相关计算,取相关系数最大的位移作为泄漏信号的时间差,以克服干扰信号引起的定位不准问题。根据实测介质出站、入站的温度和流量,结合管道参数和定位机理模型,得到管道沿途的温度、声速、介质流速和理论时间差分布。以理论时间差为模型输入,以对应的管道各点位置为期望输出,实时建立基于广义回归神经网络的管道泄漏定位模型,结合实测信号时间差,实现泄漏点的精确定位。实际应用结果表明:该方法定位精度高,计算速度快,能够实时、可靠地解决泄漏定位问题。
关键词:管道泄漏;精确定位;移动窗相关分析;广义回归神经网络
中图分类号:TP183 文献标志码:A 文章编号:1672-7207(2011)S1-0943-06
Pipeline leak accurate positioning method based on generalized regression neural network
CHEN Qi, LIN Wei-guo
(School of Information Science and Technology, Beijing University of Chemical Technology, Beijing 100029, China)
Abstract: Two modified approaches for solving inaccurate problem of pipeline leak location in complex conditions were introduced. A locating approach based on moving-window correlation analysis was proposed, which extracted appropriate span signals from a fixed size upstream and downstream signals by adequate steps for correlation analysis and took the displacement with the maximal correlation coefficient as time difference of leak signals to overcome inaccurate locating problem caused by interference signals. According to the temperatures and flows of upstream and downstream which were measured online, combining with the parameters of pipeline and the model of locating mechanisms, the distribution of temperature, speed of sound, flow rate of transmission and time difference in theory along the pipeline were acquired. Taking the time difference in theory as input, and the corresponding locations of pipeline as output, the model based on generalized regression neural network (GRNN) real-timely was established. Combining with the time difference of leak signals acquired online, accurate leak location can be implemented. Actual application results show accuracy and effectiveness of the proposed approaches, which enables real-timely and reliably solve the leak locating problems.
Key words: pipeline leak; accurate locating; moving-window correlation analysis; generalized regression neural network (GRNN)
随着我国的长输管道建设的不断发展,管道输送己经成为当前油气的主要输送方式[1-3]。但是,随着管线的增多、管龄的增长、管道的老化以及施工缺陷腐蚀等问题和人为破坏的存在,管道事故频频发生,给人们的生命、财产和生存环境造成了巨大的危害[4-6]。目前基于软件的管道泄漏检测和定位方法有很多[4-7],其中基于质量/流量平衡的方法需要高精度、价格昂贵的质量流量计,因此,受到流量计精度的限制,不能对泄漏点进行定位[8]。采用动态模型的方法进行泄漏定位,由于根据瞬变流的水力模型和热力模型及沿程摩阻的达西公式建立的实时模型受到管道动态仿真计算精度的众多因素的影响,因此,定位难度很大[9]。使用BP神经网络可以实现对管道的泄漏状况进行分析诊断与定位,但只能定位到管段[10]。相关分析法定位泄漏是一种较好的方法,张建利等[11]介绍了对固定长度的泄漏信号进行相关分析定位的方法;崔谦等[12]通过将小波变换的多尺度分析方法与动态系统模型相结合,实现了泄漏信号的准确定位。
基于声波的管道泄漏检测与定位的方法具有较高的灵敏度和定位精度。本文作者针对声波法中提高定位精度的关键问题提出了新方法,分别介绍精确定位中的关键技术、基于广义回归神经网络的定位方法以及该方法在实际输油管道泄漏定位中的应用。
1 精确定位中的关键技术
1.1 相关分析计算时间差的改进方法
对于管道泄漏精确定位而言,由泄漏产生的泄漏信号传播到上、下游动态压力变送器的时间差是否精准直接影响定位结果。为了提高时间差的精确度,一般采用全球定位系统GPS来同步上、下游管道泄漏监测RTU的系统时间,同时以整分整秒为条件触发上、下游RTU采集数据,以此作为给管道动态压力数据打时间标签的基准,从而提高定位精度。
本文采用对上、下游RTU采集到的信号进行相关分析计算时间差的方法。此方法是基于上、下测点接收到的泄漏信号的相关性,以互相关系数最大时的位移表征产生的泄漏信号传播到上、下游测点的时间差。由文献[11-12]可知,2个离散信号x(n)和y(n)的互相关函数定义为:
(1)
其中:N为数据长度,m为互相关系数rxy(m)最大时的位移。但由于时域相关运算耗时太长,对信号进行处理的实时性比较差,利用快速傅里叶变换(FFT)进行快速相关计算,提高信号处理的实时性。利用FFT进行快速相关计算过程如图1所示。
离散信号 x(n)和y(n)先各自经过快速傅里叶变换,然后将x(n)的变换结果与y(n)的变换结果取共轭做序列相乘,最后将所得结果经反快速傅里叶变换,就可以得到序列形式的互相关函数。
由于实际信号中存在不可预料的干扰,从而导致用固定长度信号进行相关计算时,时间差计算不准确,因此,对相关定位方法进行了改进。
图1 基于FFT算法的快速相关计算原理
Fig.1 Calculating principle of fast correlation based on FFT algorithm
为了保证泄漏信号的完整性,避免泄漏信号出现在数据序列末尾的情况发生,选取3 min长度(9 000点)的数据进行相关计算(每1 min处理1次,其中前 6 000点数据为历史数据),然后在3 min长度的数据内,以2 min长度(6 000点)为跨度,以100点为平移步长进行移动相关计算,取相关系数最大的位移为时间差。固定相关和移动相关的计算结果如表1所示。由表1可见,移动相关法计算得到的时间差波动更小,得到的定位误差更小。
表1 时间差对比
Table 1 Comparison of Δt s
1.2 泄漏定位模型的修正
1.2.1 声波法定位原理
当管道发生泄漏时,会在泄漏处形成一个由压力突降引起的泄漏声波,该泄漏声波以一定的波速从泄漏点向管道的首末两端传播。此时,安装在上、下游的RTU将监测到的动态压力信号传送到监控机,由监控机实现泄漏的诊断,并根据上、下游接收到该声波的时间差以及该声波在管道介质中的传播速度来进行定位,如图2所示。
声波定位公式为:
(2)
式中:站间管道总长为L(m);泄漏点与上游之间的距离为xL(m);Δt为泄漏声波传播到上、下测点的时间差;u为管道内传输介质流速;v为泄漏声波在管道内传输介质中的传播速度,通常忽略u的影响,并把v作为定值来处理,一般取均值。而实际上v并非常数,利用上述方法进行定位必然带来较大定位误差。为了提高定位精度,考虑了u对定位精度的影响以及温度对v的影响。
图2 泄漏定位原理框图
Fig.2 Schematic of leak location
1.2.2 管道内介质流速和声波速度的确定
管道内介质流速与质量流量、管道内传输介质的密度以及管道横截面积有关。
(3)
式中:G为质量流量,kg/s;S为管道横截面积,mm2;D为管道内径,mm;ρ为管道内介质密度,kg·m3;u为管段中介质流动速度,m/s。
输油管道内产生的声波传播速度v取决于液体的弹性、液体的密度和管材的弹性[13]。
(4)
式中:v为声波传播速度(m/s);K为流体的体积弹性系数(Pa);ρ为流体密度(kg/m 3);E为管材的弹性模量(Pa-1);D为管道直径(m);e为管壁厚度(m);C1为与管道的修正参数有关的修正系数(C1=1-μ2,μ为泊松比,取值为0.3)。
液体体积弹性系数K的值等于压缩系数的倒数,即K=1/F,其中,F为压缩系数(Pa-1),其计算公式如下[13]:
(5)
式中:ρ0为标准密度(kg/m3),t为温度(℃)。
温度对原油的密度有一定的影响:
(6)
式中:ρ(t)为t ℃时原油的密度;ρ20为20 ℃时原油的密度(kg/m3);ξ为原油体积膨胀系数(kg/(m3·℃)),其计算公式如下:
(7)
管道中任意位置处原油温度为[13]:
(8)
其中:TLx为原油流过xL长的管道后的温度值, ℃;Ts为出站的原油温度, ℃;Tg为管道周围介质的温度, ℃;K为原油周围介质总传热系数(W/(m2·K));D为管道直径, m;G为原油的质量流量, kg/h;C为原油的比热容, kJ/(kg·K)。
由公式(3)和(4)可知,管道内声波的传播速度和介质流速是变化的,从泄漏点xL处产生的泄漏声波传播到上、下游测点的理论时间差的计算公式[13]如下:
(9)
如果式(3)~(8)可以精准地描述声波在整条管道中的传播以及管道内传输介质的传送过程,那么根据1.1节计算得到的实际时间差应该与式(9)计算的理论时间差一致。
2 基于广义回归神经网络的定位方法
2.1 广义回归神经网络模型分析
广义回归神经网络(generalized regression neural network, GRNN) 包括输入层、隐含层、输出层,其中隐含层为径向基层,输出层为线性层。GRNN网络模型具有很强的非线性映射能力和柔性网络结构,以及高度的容错性和鲁棒性,常用于函数的逼近。而且与其他网络模型相比具有训练时间短、仿真精度高等特点[14]。GRNN网络结构如图3所示。
图3 广义回归神经网络结构
Fig.3 Architecture of general regression neural network(GRNN)
第一层为输入层,神经元个数等于输入参数的个数;第二层为径向基层,神经元个数等于训练样本数,隐含层的传递函数为径向基函数,通常采用高斯函数作为网络的传递函数;第三层为简单的线性输出 层[15]。
2.2 广义回归神经网定位方法
根据式(8)可知,温度T与泄漏点的位置xL有关,由式(3)、(4)可知,声波的传播速度v和管道内传输介质流速u都是温度T的函数(与密度有关)。在实际应用中,整条管线上的温度除了站内可测其余几乎不可测,而且如果在管道某处发生泄漏,泄漏位置事先未知。因此,为了解决上述矛盾并实现精确定位,本文作者提出利用广义回归神经网进行定位的方法。
(1) 先假设泄漏发生在距离上游测点xL处,从首站开始,以step为步长递增,到末站为止(全长为L)。构造模拟泄漏位置序列xL[0,step,2*step,…,L]。
(2) 根据定位机理模型(式(2)~(9))计算与模拟泄漏位置对应的理论时间差序列t[Δt(0),Δt(step),Δt(2*step),…,Δt(L)]。
(3) 以t作为广义回归神经网络建的输入,xL作为期望输出。建立时间差和泄漏位置的黑箱模型,即:
(10)
(4) 通过时间差和泄漏位置的对应关系,根据1.1节计算的实际时间差,代入到式(10)进行泄漏定位。
3 广义回归神经网络在泄漏定位中的应用
本文实验的对象是湖南岳阳巴陵石化的一条实际输油管道,管道全长为L =15.6 km,管径d 250 mm× 7 mm,原油在20 ℃时的密度为845 kg/m3,原油的比热容C=2.2 kJ/(kg·K),钢管的弹性模量E=2 069 Pa,模拟泄漏点位置与首站(码头)的距离为X = 6.042 km。模拟泄漏时,管道参数如表2所列。
本文以2011年1月25日14:28的模拟泄漏事件为例,说明广义回归神经网络在泄漏定位中的应用。
3.1 广义回归神经网定位方法的实现
(1) 产生广义回归神经网络输入输出数据。根据管道参数,并结合定位机理模型(公式(2)~(9))得到管道沿线温度、声波速度、管道内传输介质流速以及理论时间差分布曲线,如图5所示。
(2) 广义回归神经网络训练。将产生的理论时间差序列t作为神经网络的输入, 模拟泄漏位置序列xL作为期望输出,开始训练网络,建立如式(10)的对应关系。
表2 管道参数
Table 2 Parameters of pipeline
(3) 计算实际时间差。对上、下游测点检测到的泄漏信号采用1.1节介绍的方法计算出实际时间差。
(4) 定位。将计算得到的实际时间差作为输入代入到训练好的广义回归神经网定位模型中,给出定位结果。
3.2 泄漏定位结果分析
表3针对表2所示2011年1月25日的模拟泄漏信号,分别对2种定位方法(基于广义回归神经网络的精确定位算法和采用平均速度定位的方法)的定位结果和完成定位消耗的时间进行了对比。
(1) 耗时:本文提出的基于广义回归神经网络的精确定位方法,在耗时上虽然比采用平均速度定位的方法高一倍,但是,完成一次定位耗时仅为0.08 s左右,运算速度较快,能够满足实时监控、在线定位的需求。
(2) 定位精度:基于广义回归神经网络的精确定位算法定位精度高于后者,且采用移动相关法得到的定位精度较直接采用单一信号的固定相关法得到的定位精度要高。
4 结论
分析了管道泄漏精确定位中的关键技术,以快速移动相关计算的方法快速而准确地计算时间差为前提,通过分析声波法泄漏定位中声波速度的各种影响因素,将泄漏定位问题转化为函数逼近问题,提出基于广义回归神经网络的精确定位方法,运算速度快,能够在线训练定位,定位精度高。在实际管道泄漏定位中,取得了良好的效果。
图5 构造广义回归神经网络训练数据
Fig.5 Great training data for GRNN
表3 定位结果和效率比较
Table 3 Comparison of location results and efficiency
参考文献:
[1] Abhulimen K E, Susu A A. Liquid pipeline leak detection system: Model development and numerical simulation [J]. Chemical Engineering Journal, 2004, 97(1): 47-67.
[2] WANG Gui-zeng. A fast leak locating method based on wavelet transform [J]. Tsinghua Science and Technology, 2009, 14(5): 551-555.
[3] ZHANG Lai-bin, QIN Xian-yong, WANG Zhao-hui, LIANG Wei. Designing a reliable leak detection system for west products pipeline [J]. Journal of Loss Prevention in the Process Industries, 2009, 22(6): 981-989.
[4] 靳世久, 唐秀家, 王立宁, 等. 原油管道泄漏检测与定位[J]. 仪器仪表学报, 1997, 18(4): 343-347.
JIN Shi-jiu, TANG Xiu-jia, WANG Ling, et al. Detection and location of leakage in crude petroleum pipeline [J]. Chinese Journal of Scientific Instrument, 1997, 18(4): 343-347.
[5] Verde C. Accommodation of multi-leak location in a pipeline [J]. Control Engineering Practice, 2005, 13(8): 673-682.
[6] GE Chuan-hu, WANG Gui-zeng, YE Hao. Analysis of the smallest detectable leakage flow rate of negative pressure wave-based leak detection systems for liquid pipelines [J]. Computers and Chemical Engineering, 2008, 32(8): 1669-1680.
[7] 李文军, 王学英. 油气管道泄漏检测与定位技术的现状及展望[J]. 炼油技术与工程, 2005, 35(9): 49-52.
LI Wen-jun, WANG Xue-yin. Status quo and prospects of detection and location technology for oil & gas pipeline leak [J]. Petroleum Refinery Engineering, 2005, 35(9): 49-52.
[8] HU Qiong, FAN Shi-dong. Pipeline leak detection testing system based on negative pressure wave and flow [J]. Journal of Wuhan University of Technology: Transportation Science and Engineering, 2009, 33(2): 402-406.
[9] 崔谦. 油气管道泄漏检测方法的研究及应用[D]. 天津: 天津大学, 2005.
CUI Qian. Study on oil and gas pipeline leak detection methods and their applications[D]. Tianjin: Tianjin University, 2005.
[10] 黄文, 毛汉领, 包家福, 等. 管道泄漏检测用人工神经网络技术[J]. 无损检测, 2002, 24(8): 328-321.
HUANG Wen, MAO Han-ling, BAO Jia-fu, et al. Artificial neural network method for leakage detection of pipelines [J]. NDT, 2002, 24(8): 328-321.
[11] 张建利, 佟凯, 马放. 相关分析法管道漏点定位系统的试验研究[J]. 哈尔滨工业大学学报, 2007, 39(6): 875-878.
ZHANG Jian-li, TONG Kai, MA Fang. Experimental research on correlation analysis in pipe leakage point location system [J]. Journal of Harbin Institute of Technology, 2007, 39(6): 875-878.
[12] 崔谦, 靳世久, 王立坤. 多尺度相关分析在管道泄漏检测中的应用[J]. 电子检测与仪器学报, 2005, 19(5): 51-53.
CUI Qian, JIN Shi-jiu, WANG Li-ku. A new method of leak detection based on multiscale correlation [J]. Journal of Electronic Measurement and Instrument, 2005, 19(5): 51-53.
[13] 任伟建, 孙勤江, 林百松, 等. 基于自适应免疫算法的输油管道泄漏定位研究[J]. 信息与控制, 2007, 36(5): 634-638.
REN Wei-jian, SUN Qin-jiang, LIN Bai-song, et al. Research on pipeline leak positioning based on adaptive immune algorithm [J]. Information and Control, 2007, 36(5): 634-638.
[14] Chen Tien-Chi, Yu Chih-Hsien. Motion control with deadzone estimation and compensation using GRNN for TWUSM drive system [J]. Expert Systems with Applications, 2009, 36(8): 10931-10941.
[15] 徐富强, 郑婷婷, 方葆青. 基于广义回归神经网络(GRNN)的函数逼近[J]. 巢湖学院学报, 2010, 6(12): 11-15.
XU Fu-qiang, ZHENG Ting-ting, FANG Bao-qing. Function approximation based on general regression neural network (GRNN)[J]. Journal of Chaohu College, 2010, 6(12): 11-15.
(编辑 李向群)
收稿日期:2011-04-15;修回日期:2011-06-15
通信作者:林伟国(1968-),男,浙江宁波人,教授,从事生产过程智能监测与安全预警技术研究;电话:13552520057; E-mail:linwg@mail.buct.edu.cn