第14卷第5期 光学精密工程 Optics and Precision Engineering Vo1.14 No.5 0ct.2006 2006年1O月 Article ID 1004—924X(2006)05—0896-07 基于神经网络模型的传感器非线性校正 田社平,赵 阳,韦红雨,王志武 (上海交通大学电子信息与电气工程学院,上海200030) 摘要:讨论了BP神经网络模型在传感器非线性补偿中的应用。给出了相应的补偿方法.即采用两个相同的传感器对同 一被测量进行不同的测量,其测量结果作为神经网络模型的输入,经过补偿后的传感器具有线性的输入输出关系。采用 递推预报误差算法(PRE)训练神经网络,具有收敛速度快、收敛精度高的特点。以距离传感器为例,将基于BP神经网络 的校正方法应用于减少距离传感器的非线性输出误差。实验结果表明,将训练后的神经网络接人距离传感器可以得到 线性的输入一输出关系,增加神经网络隐层节点的数目可以提高校正精度。当隐层节点数取为4O时,用于距离传感器非 线性校正的神经网络模型在训练100步后的误差指数(E1)为9.6×10一。结果表明:本文提出的基于神经网络模型的传 感器非线性校正方法是行之有效的。 关键词:BP神经网络;RPE算法;传感器;非线性补偿 文献标识码:A 中图分类号:TP212;TP183 Nonlinear correction of sensors based on neural network TIAN She—ping,ZHAO Yang,WEI Hong—yu,WANG Zhi—WU (School of Electronics and Electric Engineering,Shanghai J iao Tong University,Shanghai 200240,Ch ina) Abstract:Back propagation(BP)neural network models are applied tO correct nonlinear characteristics of sensors in this paper.Two sensors of the same type are used tO measure two interrelated measurands and their outputs are put into the trained neural network model tO obtain linear input—output characteristics.A Recursive Prediction Error(RPE)algorithm, which converges fast,is applied tO train the neural network mode1.As an example,a correction method based on BP is applied tO reduce the nonlinear output errors of range sensors.Experimental results show that linear input—output charac— teristics can be obtained by connecting the trained neural network model with the range sensors.The correction precision increases with the increasing number of nodes in the hidden layer.When the number of nodes in the hidden layer is 40 and the neural network model converges in about 100 iterations,the Error Index(E1)iS 9.6×10一 . Key words:Back Propagation(BP)neural network;Recursive Prediction Error(RPE)algorithm;sensor;nonlinear correction plications in the industrial and automatic fields. 1 Introduction Sensors are reqaired to be accurate,steady and anti—。interferential because of their wider ap—— We need to design low—。cost and high—。accuracy sensors through theoretical research and experi— mental investigation[ .The main factors having effect on the characteristics of sensors are(1) Received date:2006-02-16;Revised date:2006-07-27. 维普资讯 http://www.cqvip.com
No.5 TIAN She-ping,et al:Nonlinear correction of sensors based on neural network model 897 inner nonlinear characteristics of sensors: (2) influences of outer measurement circumstances such as temperature and humidity;(3)dynamic characteristics such as bandwidth and response speed which are not perfect enough.Researchers concentrated on improving the measurement ac— curacy of sensors using advanced computer tech— nology[ ~ .A hopeful method is to apply two sensors of the same kind to sense the measur— ands and provide independent information.We can use the outputs of these two sensors to es— tablish an inverse nonlinear model to describe the overall influence of the inner nonlinear char— acteristics of sensors and outer circumstances. Several artificial neural network paradigms and neural learning schemes have been used in many dynamic system identification problems, and many promising results have been repor— tedl 51.This paper uses neural networks models to establish inverse models of nonlinear sensors to correct the nonlinear errors of sensors.Ex— perimental results show that the nonlinear cot- rection approach based on neural network model is effective. 2 Principle of nonlinear correction by neural network Assuming the model of a sensor can be ex- pressed as y=f(x, ), (1) where is the interfering parameter of outer measurement circumstances. and y are the in— put and output of the sensor respectively and f (.)is a unknown nonlinear function. From Eq.(1),we can solve the input through the inverse model —f (y, ), (2) where f (.)is the unknown inverse function of f(.). In order to utilize the neural network model to correct the nonlinearity of the sensor,we can take output Y of the sensor and interfering pa— rameter as two inputs of the neural network model,input of the sensor as the output.A nonlinear correction system is established as shown in Fig.1 below. Hg.1 One approach for nonlinear correction of sensors Another sensor should be used to measure environment parameter to feed the neural net— work mode1.One shortcoming of above mon— tioned approach is the complexity introduced by applying different types of sensors. In order to simplify the system design,we can establish such a model using two sensors of the same type with a constant S to measure two input values ,S— ,outputs Yl and y2 of these two sensors are independent.We can get the two outputs using Eq.(1) fY 一f(x, ) IY 一厂(s— , ), (3) Assuming yl and y2 are monotropic func~ tions of with respect to different ,we can get the following inverse function from the Eq.(3) f —f ( l, ) 【s— 一厂 ( 2, ), (4) 1"he equations above can be lumped together to get S=f一 ( , )+厂 ( , ), (5) From the Eq.(5),we can formally express as the function of Yl and y2,namely —fl(Yl,Y2), (6) where fl(.)is an unknown nonlinear function. By substituting in the first equation of Eq.(4) with Eq.(6),we get 一厂 [ l,厂l( ,Y2)], (7) From Eq.(7),the value of z can be ob— tained if yl,y2,f (.)and fl(.)are known. We cannot obtain an accurate mathematical form of f (.)and fl(.)because of the complexity 维普资讯 http://www.cqvip.com
898 Optics and Precision Engineering Vo114 .of sensors.One approach is to fit f ()and .tively, 。and l are the number of nodes in the input and hidden layers respectivelyThe excita— .(.)by neural network mode1s. Based on the above principle,we can obtain the schematic diagram of nonlinear correction u— tion function of the neural cell in the hidden 1ay— er is the sigmoid sing the neural network models as shown in Fig. 2.,j(.)and f一 (.)are approached separately by neural network model NNl and NN2,which )一 , (9) 3.2 BP neural network training method constitute the total neural network modeI NN. L…一~一~一~……一J Fig.2 Another approach for nonlinear correcti0n 0f sensors 3 Neural network model and its training 3.1 Representation of neural network mOde1 Many neural network model can be used to approach the NN in Fig.2.In this paper,a Back Propagation(BP)neural network mode1 shown in Fig.3 is used. Fig.3 BP neural network rn0de1 The output of BP neural network is 一 (8) where , , are the weight vector and thresholds of the neural network modeI respec— We must train the neural network mode1 to get an accurate model to represent the character— lStlCS of the sensor as close as possible.The BP training algorithm,used most common1y in mu1一 tilayer neural network,is essentially based on the steepest descent algorithm.It has the rate of linear 。n ergence at most because of only using the negative gradient information as the search direction.The training convergent speed is verv slow,usually need thousands of iterations or more. In this paper the recursion prediction er— ror(RPE)algorithm is applied to train the neu— ral network model_6].The basic princip1e of RPE is to update the unknown parameter vector a1ong the Gauss—Newton search direction of the obj ec— tlve cost function,so that the objective function can reach the minimum. The objective cost function is deftned as 1 N 一 ∑£ (1o) where N is the length of data;0 is the parameter vector,namely the weight vector and the thresh— old of the neural network roode1;£( ,O)一v一 (i, is the prediction error. The basic expression of parameter vector is: O( )一O( )q-s(i),u[O(i--1)], (11) where s(t)is the step size and (口)is Gauss— Newton search direction,which can be ex- pressed as (口)一~Eu(o)3一 J(口), (12) where ( )is the gradient of J(O)towards 0. H( )is the second deriVative of J(O),name1y the Hessian matrix of J(O). From equation(10),it can be derived 维普资讯 http://www.cqvip.com
No.5 TIAN She—ping,el al:Nonlinear correction of sensors based on neural network model 899 N 一 一一 , when 一 ,1 ≤n1 巧1(1一 1) 一 一 (13) where 一1 d0 when Of—m 1,1 ≤礼1 (1一 ) z [ … when 一 ,1≤ ≤n・,1≤走≤2,(18) (4)calculate prediction error e( )、P( )ma— trix and parameter sequence 9(i)according to Eq.(16). H(8)can be calculated using the following expression[。] H(0)一 The standar The steps(2)~(4)must be carried on un— til the convergence of parameter 9(i). described using following equations[ ’。] fe(i): (i)一 (i) 4 Numerical simulation results 4.1 Numerical simulation J P( )一 {P( 一1)一P( 一1) ( ) I[ ( )I+ ( )P(i-1) 、( )] l9( )一9(i一1)+P(i) (i)e(i) (16) (i)P(i--1)}, Numerical simulation is carried out to testi— fy the above mentioned method.The nonlinear function is expressed as where P(i)is called the middle matrix represen— ting the covariance matrix of parameters when i fy 一px 一∞.whose initial value P(0)is usually chosen from the range of 10 I to 10 I,where I is the i— 、 =p(12一z) , (19) In order to create the training data,suppose dentity matrix.A( )is called the forgetting fac— tor.It is required to set (i)<1 at the initial training stage so that rapid adaptation takes is E2,3,4,5,6,7,8,9,10] ,and P is 0.1、 0.15 and 0.2.Y1 and y2 are obtained using Eq. (19)and are the inputs of the neural network mode1.The number of nodes in the hidden layer place and then to let (i)一1 as 一∞.The fol— is supposed to be 1—1 0.The weighting vector lowing equation can meet the requirements a— and thresholds converge in about 200 iterations bove: while RPE algorithm is used.Fig.4(a)~(c) ( )一 ( 一1)+(1一 。), (17) show the simulation results when P is 0.1,0.15 where the initial value 0 and (0)are usually chosen as 0.99 and 0.95 respectively. The steps of training the neural network model by the RPE algorithm are as follows: and 0.2 and curves①and②represent the in— put—output functions before and after the nonlin— ear correction processes respectively.Obvious— ly,the corrected input—output relation is linear, and is not influenced by the variation of P. In order to evaluate the rationality of the (1)set the weight vector and threshold as small random values;set P(O)as a diagonal ma— trix,whose element in the diagonal line is 1 0 ; set 0 and (O)as the appropriate initial values ̄ the number of nodes in the hidden layer is 1; set no一2 and n2—1; neura1 network model and the convergence of the training algorithm,An Error Index(E1)is de— fined as follows: (2)calculate the output of the neural net— work model using Eq.(8). EI一 (20) (3)construct the g-matrix according to Eq. (14) Fig.5 shows the convergence curve of El versus training iterations,where 1—10.EI e— 维普资讯 http://www.cqvip.com
Optics and Precision Engineering (a) =0.1 (b) =0.15 (c) =2.0 Fig・4 Numerica1 simu1ation resuIts before(curves ①)and after(curves②)non1inear correction processes quals to 3.9×10一in 200 iterations. 1 he COrrected input—output relations are still lmear when P is in the range of 0.1~0.2. 1 his proves the generalization of the neura1 network mode1.Fig.6 shows the input—output re1at/on。 ve when p=0.175,and①is the uncor_ rected mput—output curve,while②is the cor_ rected input—output relation curve. 4・2 Nonlinear correction of range sens0rs We have applied the above mentioned neura1 network model for nonlinear eorrection of range Vo1.14 Iterations Fig.5 Convergence Curve of El Fig・6 Input一0utput relation when声:0.1 75 sensors. 1 WO range sensors of the same type are used to measure the distance and S— .The outPuts of these two sensors not only relate the measured physical quantity,but also the ambient mperature.The measurement data is hown in Tab.1,where z is the distance to be measured in mm and yl and y2 are the outDuts i 。m。ensors 1 and 2 respectively.The output is the magnitude of voltage in V.t is the ambient t mperature in℃.We can see from Tab.1 that the omputs of two sensors have some fluetuation with the change of ambient temperature,and display some nonlinearitv. Saturation exists in certain regions of the a bove data.In order tO prevent the matrix from becoming singular when the training neura1 net- work model is used,the values in these satura tlon eas are eliminated as shown in Tab.1 (with dashed lines). 上nere are two input nodes in the input 1aver ot the neural network,which correspond outDut Voltages Yl and yz of these two sensors.There is n omput node in the output layer,which corre— 维普资讯 http://www.cqvip.com
No.5 TIAN She—ping,etⅡ :Nonlinear correction of sensors based on neural network model sponds measured input value .The number of nodes in the hidden layer is,2l一40,and the neu— Tab.1 Input-output measuremerd data of two range sensors(S=8 mm) ral network model converges in about 100 itera— tions.Fig.7 shows the nonlinear correction re— suits when t is 7。C。12。C and 20 C,respectively and we can see that the input and output have fairly good linear relations after correction with EI=9.6×10~.Fig.8 shows the convergence curve of EI versus training iterations when,2l一 40,from which we can see the training conver— gence is extremely stable. 8 6 董 2 0 0 2 4 6 mm Fig.7 Nonlinear correction results of range sensors lterations Fig.8 Convergence curve of El when nl一40 The number of nodes in hidden layer,2 l has its influence on the correction precision of the neural network mode1.Fig.9 shows the curve of EI versus,2 after 100 iterations.We can see the precision of model increases with the number of nodes in the hidden layer.EI<0.08 if l>10; EI<10 if,2l>35.The correction precision is fairly high if,2l is about 25. Iterations Fig.9 Influence of nl on correction precision 5 Conclusions (1)This paper discusses the application of the neural network model to nonlinear correction of sensors.From the experimental results we can see that the compensated sensors have linear input—output relationship. (2)The training data must be typical if it is necessay to generalize the neural network model and to correct the nonlinear characteristics of sensors. (3)It is helpful to increncse the number of nodes in the hidden layer of the neural network model to enhance the compensatory precision, 维普资讯 http://www.cqvip.com
902 Optics and Precision Engineering V0I'14 but this increases the burden of training,too. (4)Nonlinear correction of sensors can be explained as a problem of approaching the in— verse model of sensors,and SO,the neural net— work models can also be taken other forms, which need further study. References: Eli xu K J,CHEN R B,ZHANG C W.Common techniques in automatic measurement and instrument[M].Beijing: Tsing Hua University Press.2000:26—27.(in Chinese) [2] KU C C,LEE K Y.Diagonal recurrent neural network for dynamic systems control[J].IEEE Trans.on NN 1995,6(1):144—155. [3]DAI X Z,YIN M,WANG Q.A novel dynamic compensating method based on ANN inverse system for sensors [J].Chinese Journal of ScientiSic Instrument,2004,25(5):593—594.(in Chinese) [4] HOU L Q,TONG W G,HE T X.The static errors comprehensive correcting method of sensors based on radial basis function neural network[J].Chinese Journal of Sensors and Actuators,2004,12(4):643—645.(in Chinese) [5] WANG Y J,TU J.The control oJ neural network[M].Beijing:Mechanic Industrial Publishing Company,1999: 1—10.(in Chinese) [6]LJUNG I .System identification:theoryfor the user[M].Beijing:Tsinghua University Press,2002:363—368 Brief professional biography of the author:TIAN She—ping(1967一),male,was born in Hubei Province,China.He is cur— rently a vice professor in Instrument Engineering at School of Electronics and E— lectric Engineering,Shanghai Jiao Tong University,China.His research inter— ests include biomechanism and dynamic measurement,etc. ZHAO Yang(1982一),male,was born in Henan Province,China.He is cur— rently a master in the School of Electronics and Electric Engineering,Shanghai Jiao Tong University.His research interest includes dynamic measurement.E- mail:snout@sjtu.edu.cn
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- 7swz.com 版权所有 赣ICP备2024042798号-8
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务