Kalman filtering parameter debugging method for ultrasonic water meter data filtering

文档序号:746994 发布日期:2021-04-23 浏览:19次 中文

阅读说明:本技术 一种用于超声波水表数据滤波的卡尔曼滤波参数调试方法 (Kalman filtering parameter debugging method for ultrasonic water meter data filtering ) 是由 付明磊 陈祥 荣泽坤 戎科臻 张文安 仇翔 郑乐进 吴德 郑剑锋 周力 于 2020-11-19 设计创作,主要内容包括:一种用于超声波水表数据滤波的卡尔曼滤波参数调试方法,首先在状态方程中引入这一时刻与上一时刻的变化,然后我们对各种温度、流速下的卡尔曼滤波最优参数进行非线性分析,进而提供了一种准确的描述超声波水表卡尔曼滤波最优参数的变化规律,寻找到超声波水表卡尔曼滤波最优参数的方法。本发明提升超声波水表的测量精度。(A Kalman filtering parameter debugging method for ultrasonic water meter data filtering is characterized in that firstly, the change of the moment and the last moment is introduced into a state equation, then nonlinear analysis is carried out on Kalman filtering optimal parameters under various temperatures and flow rates, and further, a method for accurately describing the change rule of the Kalman filtering optimal parameters of the ultrasonic water meter and finding the Kalman filtering optimal parameters of the ultrasonic water meter is provided. The invention improves the measurement precision of the ultrasonic water meter.)

1. A Kalman filtering parameter debugging method for data filtering of an ultrasonic water meter is characterized by comprising the following steps:

step 1: setting a sampling time TsCalculating the ultrasonic flight time difference through an ultrasonic water meter time chip to obtain the original data of the ultrasonic water meter time sequence, and selecting the obtained first row of data by the original data; then, acquiring the starting flow and the ending flow of the acquired data by using a meter calibrating platform to obtain the real flow of the corresponding time period;

step 2: obtaining data closer to real flow through Kalman filtering, introducing the change of the original data at the moment and the original data at the previous moment into a state equation, and obtaining the optimal parameter through parameter setting and effect debugging, wherein the process is as follows:

step 2.1: giving the initial values u (t), Q (t), R (t) corresponding to u (t)init、Qinit、RinitWherein u (t) represents the coefficient of the proportion of the time difference of flight in the equation of state at the moment and the last moment, Q (t) represents the variance of the estimation error, R (t) represents the variance of the measurement error, and the initial value is setAn expectation of an initial value being the value of the first time-of-flight difference obtained, and a variance of the initial value being set to Rinit

Step 2.2: updating the prior estimation;

step 2.3: calculating prior error covariance;

step 2.4: calculating a Kalman gain;

step 2.5: updating the posterior estimate;

step 2.6: updating the posterior error covariance;

step 2.7: outputting the predicted value;

step 2.8: repeating the steps 2.2 to 2.7 until all the test data run out, and obtaining the variance and the mean of the data before and after filtering;

step 2.9: by changing uinit、Qinit、RinitRepeating steps 2.2 to 2.8 to obtain different uinit、Qinit、RinitUnder the condition, the variance and the mean of the original data before and after Kalman filtering are finally determined to be corresponding data parameters uoptimal、Qoptimal、Roptimal

Wherein u isoptimal、Qoptimal、RoptimalRepresents an optimal parameter;

and step 3: obtaining u corresponding to each different data for a large amount of data through step 2optimal、Qoptimal、RoptimalObtaining a summary table of the values under different temperatures and different flow rates;

and 4, step 4: fitting by a formula to obtain uoptimal(T,F)、Qoptimal(T,F)、Roptimal(T, F) as a function of temperature T and flow rate F;

wherein u isoptimal(T,F)、Qoptimal(T,F)、Roptimal(T, F) is a function of the optimum parameter and the temperature T and the flow rate F.

2. The method for debugging kalman filtering parameters used for data filtering of an ultrasonic water meter according to claim 1, wherein in step 2.2, the prior estimation is updated by:

Xminus[i]=Xplus[i-1]+u(t)*(raw_data[i]-raw_data[i-1])

wherein i represents the ith moment, Xminus [ i ] is the prior estimation value of the ith moment, Xplus [ i-1] is the optimal value of the prediction result of the ith-1 moment, u (t) is the coefficient of the proportion of the flight time difference between the ith moment and the ith-1 moment in a state equation, raw _ data [ i ] is the original data of the ith moment, and raw _ data [ i-1] is the original data of the ith-1 moment;

in step 2.3, the prior error covariance is calculated:

Pminus[i]=Pplus[i-1]+Q(t)

wherein Pminus [ i ] is the covariance of the prior error at time i, Pplus [ i-1] is the covariance of the posterior error at time i-1, and Q (t) is model dependent;

in step 2.4, the kalman gain is calculated:

where Pminus [ i ] is the prior error covariance at time i, R (t) is measurement related, and K is the Kalman gain;

in step 2.5, the posterior estimate is updated:

Xplus[i]=Xminus[i]+K*(raw_data[i]-Xminus[i])

wherein Xplus [ i ] is the optimal value of the prediction result at the ith moment;

in step 2.6, the posterior error covariance is updated:

Pplus[i]=(1-K)*Pminus[i]

wherein Pplus [ i ] is the covariance of the posterior error at time i;

in said step 2.7, the current predicted value is stored in a variable of the list, so as to store the whole filtered data.

3. The method for debugging kalman filtering parameters used for filtering data of an ultrasonic water meter according to claim 1 or 2, wherein the processing procedure of the step 4 is as follows:

according to the collected different temperatures and the flows corresponding to uoptimal、Qoptimal、RoptimalAnd performing mathematical linear fitting to finally obtain a relational equation corresponding to the three parameters and the temperature flow, namely:

uoptimal(T,F)=a0+a1F+a2T+a3F2+a4FT+a5T2

Qoptimal(T,F)=b1+b2F+b3T+b4F2+b5FT+b6T2

Roptimal(T,F)=c1+c2F+c3T+c4F2+c5FT+c6T2

wherein T is a temperature value, F is a flow rate, a0~a5,b1~b6,c1~c6Is the relation coefficient between the parameter and the temperature and the flow.

Technical Field

The invention relates to the field of ultrasonic water meter metering data processing, and mainly relates to a Kalman filtering parameter debugging method for ultrasonic water meter data filtering.

Background

The ultrasonic measurement techniques used in ultrasonic water meters include various methods, and the commonly used measurement methods include a difference method, a correlation method, a noise method, a doppler method, a beam offset method, and the like. In recent years, researchers have conducted and made significant progress in ultrasonic technology-based flow meters and ultrasonic water meters.

The existing ultrasonic water meter implementation scheme generally has the functions of temperature compensation and the like, and the data filtering adopts a wavelet algorithm, a moving average algorithm and the like. The research results play an important role in improving the measurement precision of the ultrasonic water meter and promoting the practicability of the ultrasonic water meter.

However, in the aspect of the overall design of the system, the existing ultrasonic water meter design rarely has the functions of temperature compensation, low power consumption and high-precision filtering, and the precision of the low-region flow point after data filtering is still to be improved.

In order to further improve the comprehensive performance of the ultrasonic water meter, the novel ultrasonic water meter based on the time difference method and the data filtering is designed and realized, a high-precision data filtering algorithm combined with Kalman filtering is provided, the measurement performance is obviously improved, higher measurement precision is achieved particularly under low-zone flow, the hysteresis caused by median filtering is reduced, and the requirement of practical engineering application can be better met.

Disclosure of Invention

In order to solve the problem of the optimal parameter of Kalman filtering, the invention provides a method for searching the optimal parameter of Kalman filtering. Firstly, the change of the moment and the last moment is introduced into a state equation, then nonlinear analysis is carried out on the Kalman filtering optimal parameters under various temperatures and flow rates, so that a method for accurately describing the change rule of the Kalman filtering optimal parameters of the ultrasonic water meter is provided, the Kalman filtering optimal parameters of the ultrasonic water meter are found, and the measurement precision of the ultrasonic water meter is improved.

The technical scheme adopted by the invention for solving the technical problems is as follows:

a Kalman filtering parameter debugging method for ultrasonic water meter data filtering comprises the following steps:

step 1: setting a sampling time TsCalculating the ultrasonic flight time difference through an ultrasonic water meter time chip to obtain the original data of the ultrasonic water meter time sequence, and selecting the obtained first row of data by the original data; then, acquiring the starting flow and the ending flow of the acquired data by using a meter calibrating platform to obtain the real flow of the corresponding time period;

step 2: obtaining data closer to real flow through Kalman filtering, introducing the change of the original data at the moment and the original data at the previous moment into a state equation, and obtaining the optimal parameter through parameter setting and effect debugging, wherein the process is as follows:

step 2.1: giving the initial values u (t), Q (t), R (t) corresponding to u (t)init、Qinit、RinitWherein u (t) represents a coefficient of a proportion of the time difference of flight in the state equation at the moment and the last moment, Q (t) represents a variance of the estimation error, R (t) represents a variance of the measurement error, and an expectation and a variance of an initial value are set, the expectation of the initial value is a value of the first acquired time difference of flight, and the variance of the initial value is set as Rinit

Step 2.2: updating the prior estimation;

step 2.3: calculating prior error covariance;

step 2.4: calculating a Kalman gain;

step 2.5: updating the posterior estimate;

step 2.6: updating the posterior error covariance;

step 2.7: outputting the predicted value;

step 2.8: repeating the steps 2.2 to 2.7 until all the test data run out, and obtaining the variance and the mean of the data before and after filtering;

step 2.9: by changing uinit、Qinit、RinitRepeating steps 2.2 to 2.8 to obtain different uinit、Qinit、RinitUnder the condition, the variance and the mean of the original data before and after Kalman filtering are finally determined to be corresponding data parameters uoptimal、Qoptimal、Roptimal

Wherein u isoptimal、Qoptimal、RoptimalRepresents an optimal parameter;

and step 3: obtaining u corresponding to each different data for a large amount of data through step 2optimal、Qoptimal、RoptimalObtaining a summary table of the values under different temperatures and different flow rates;

and 4, step 4: fitting by a formula to obtain uoptimal(T,F)、Qoptimal(T,F)、Roptimal(T, F) as a function of temperature T and flow rate F;

wherein u isoptimal(T,F)、Qoptimal(T,F)、Roptimal(T, F) is a function of the optimum parameter and the temperature T and the flow rate F.

Further, in step 2.2, the a priori estimates are updated:

Xminus[i]=Xplus[i-1]+u(t)*(raw_data[i]-raw_data[i-1])

wherein i represents the ith moment, Xplus [ i-1] is the optimal value of the prediction result at the ith-1 moment, Xminus [ i ] is the prior estimation value at the ith moment, u (t) is the coefficient of the proportion of the time difference between the ith moment and the ith-1 moment in the state equation, raw _ data [ i ] is the original data at the ith moment, and raw _ data [ i-1] is the original data at the ith-1 moment;

in step 2.3, the prior error covariance is calculated:

Pminus[i]=Pplus[i-1]+Q(t)

wherein Pminus [ i ] is the covariance of the prior error at time i, Pplus [ i-1] is the covariance of the posterior error at time i-1, and Q (t) is model dependent;

in step 2.4, the kalman gain is calculated:

where Pminus [ i ] is the prior error covariance at time i, R (t) is measurement related, and K is the Kalman gain;

in step 2.5, the posterior estimate is updated:

Xplus[i]=Xminus[i]+K*(raw_data[i]-Xminus[i])

wherein Xplus [ i ] is the optimal value of the prediction result at the ith moment;

in step 2.6, the posterior error covariance is updated:

Pplus[i]=(1-K)*Pminus[i]

wherein Pplus [ i ] is the covariance of the posterior error at time i;

in said step 2.7, the current predicted value is stored in a variable of the list, so as to store the whole filtered data.

Still further, the processing procedure of step 4 is as follows:

according to the collected u corresponding to different temperatures and different flow ratesoptimal、Qoptimal、RoptimalAnd performing mathematical linear fitting to finally obtain a relational equation corresponding to the three parameters and the temperature flow, namely:

uoptimal(T,F)=a0+a1F+a2T+a3F2+a4FT+a5T2

Qoptimal(T,F)=b1+b2F+b3T+b4F2+b5FT+b6T2

Roptimal(T,F)=c1+c2F+c3T+c4F2+c5FT+c6T2

wherein T is a temperature value, F is a flow rate, a0~a5,b1~b6,c1~c6Is the relation coefficient between the parameter and the temperature and the flow.

The invention has the following beneficial effects: according to the method, the difference between the change of the moment and the change of the last moment is introduced into the state equation of Kalman filtering, and the optimal parameters at different flow rates and different temperatures are obtained through parameter adjustment, so that the relation between the optimal parameters of Kalman filtering and the temperature and the flow rate can be accurately obtained through a fitting formula, the optimal parameters can be directly obtained when the temperature and the flow rate change, and the measurement precision of the ultrasonic water meter is improved.

Drawings

Fig. 1 is a flow chart of a method for debugging kalman filtering parameters for data filtering of an ultrasonic water meter.

FIG. 2 is a schematic of a Kalman filtering algorithm.

Detailed Description

The invention is further described below with reference to the accompanying drawings.

Referring to fig. 1 and 2, a kalman filtering parameter debugging method for ultrasonic water meter data filtering includes the following steps:

step 1: the pipe section selected in the experiment is DN15 pipe section, the ultrasonic wave flight time difference is calculated through the ultrasonic water meter time chip, the original data of the ultrasonic water meter time sequence is obtained, the original data selects the first row of data obtained by GP22v19 software, and the sampling time T is sets0.1 second;

step 2: obtaining data closer to real flow through Kalman filtering, introducing the change of the original data at the moment and the original data at the previous moment into a state equation, and obtaining the optimal parameter through parameter setting and effect debugging, wherein the process is as follows:

step 2.1: giving the initial values u (t), Q (t), R (t) corresponding to u (t)init、Qinit、RinitWherein u (t) indicates that the flight is performed at the time and the previous timeA coefficient of the time difference in the proportion of the equation of state, Q (t) representing the variance of the estimation error, R (t) representing the variance of the measurement error, and setting an expectation of an initial value and a variance of the initial value, the expectation of the initial value being the value of the first acquired time difference of flight, the variance of the initial value being set as Rinit

Step 2.2: updating the prior estimation;

step 2.3: calculating prior error covariance;

step 2.4: calculating a Kalman gain;

step 2.5: updating the posterior estimate;

step 2.6: updating the posterior error covariance;

step 2.7: outputting the predicted value;

step 2.8: repeating the steps 2.2 to 2.7 until all the test data run out, and obtaining the variance and the mean of the data before and after filtering;

step 2.9: by changing uinit、Qinit、RinitRepeating steps 2.2 to 2.8 to obtain different uinit、Qinit、RinitUnder the condition, the variance and the mean of the original data before and after Kalman filtering are finally determined to be corresponding data parameters uoptimal、Qoptimal、Roptimal

Wherein u isoptimal、Qoptimal、RoptimalRepresenting the optimal parameters.

And step 3: obtaining u corresponding to each different data for a large amount of data through step 2optimal、Qoptimal、RoptimalObtaining a summary table of the values under different temperatures and different flow rates;

and 4, step 4: fitting by a formula to obtain uoptimal(T,F)、Qoptimal(T,F)、Roptimal(T, F) as a function of temperature T and flow rate F;

wherein u isoptimal(T,F)、Qoptimal(T,F)、Roptimal(T, F) is a function of the optimum parameter and the temperature T and the flow rate F.

In step 2.2, the prior estimate is updated:

Xminus[i]=Xplus[i-1]+u(t)*(raw_data[i]-raw_data[i-1])

wherein i represents the ith moment, Xplus [ i-1] is the optimal value of the prediction result at the ith-1 moment, Xminus [ i ] is the prior estimation value at the ith moment, u (t) is the coefficient of the proportion of the flight time difference between the ith moment and the ith-1 moment in the state equation, raw _ data [ i ] is the original data at the ith moment, and raw _ data [ i-1] is the original data at the ith-1 moment.

In step 2.3, the prior error covariance is calculated:

Pminus[i]=Pplus[i-1]+Q(t)

where Pminus [ i ] is the covariance of the prior error at time i, Pplus [ i-1] is the covariance of the posterior error at time i-1, and Q (t) is model dependent.

In step 2.4, a kalman gain is calculated:

where Pminus [ i ] is the prior error covariance at time i, R (t) is measurement related, and K is the Kalman gain.

In step 2.5, the posterior estimate is updated:

Xplus[i]=Xminus[i]+K*(raw_data[i]-Xminus[i])

where Xplus [ i ] is the optimal value of the prediction result at the ith time.

In step 2.6, the posterior error covariance is updated:

Pplus[i]=(1-K)*Pminus[i]

where Pplus [ i ] is the covariance of the posterior error at time i.

In said step 2.7, the current predicted value is stored in a variable of the list, so as to store the whole filtered data.

In the step 4, according to the collected u corresponding to different temperatures and different flow ratesoptimal、Qoptimal、RoptimalPerforming mathematical linear fitting to obtain a relation equation corresponding to the three parameters and the temperature and the flow, namely:

uoptimal(T,F)=0.3098+(-0.0828F)+0.01414T+0.001138F2+0.002904FT-0.001121T2

Qoptimal(T,F)=-0.001455+0.02654F-0.01253T-0.00004436F2--0.001265FT--0.00635T2

Roptimal(T,F)=121.4-5.879F-7.286T+0.09102F2+0.1624FT+1.075T2

Wherein T is a temperature value, and F is a flow rate.

The embodiments described in this specification are merely illustrative of implementations of the inventive concepts, which are intended for purposes of illustration only. The scope of the present invention should not be construed as being limited to the particular forms set forth in the examples, but rather as being defined by the claims and the equivalents thereof which can occur to those skilled in the art upon consideration of the present inventive concept.

9页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:燃油流速检测装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类