# Application of Multiparameter Kalman Filter in Ultrasonic Water Meter

Authors: Fuqiang Zuo; Yu Liu
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

With the gradual development of the superior performance of the ultrasonic water meter, the use of the water meter gradually occupies most of the market due to its unique advantages. Through the analysis of the influencing factors of the ultrasonic water meter, the Kalman filter is used to analyze the influencing factors, and the differences are obtained. In this paper, combined with the application scope of the Kalman filter, it is introduced. Combined with the method of data fusion, the influencing factors of the ultrasonic water meter are analyzed. They are the flow rate, temperature, speed of sound, time difference, etc. The appropriate sensor is selected through the sensor selection method, and the corresponding data is obtained by the method of the corresponding sensor. We combine the data fusion method and use Kalman’s method to filter the data. By comparing the data before and after the processing, it is found that the data before and after the filtering of different influencing factors are small. Among them, the flow speed factor has the greatest impact on the accuracy of the ultrasonic water meter; temperature and sound velocity have little effect on the performance of the ultrasonic water meter. When designing an ultrasonic water meter, it is mainly necessary to consider the impact of flow rate and time difference on the performance of the ultrasonic water meter.


---

## Body

## 1. Introduction

The ultrasonic water meter is a new type of water meter that detects the time difference caused by the speed change when the ultrasonic sound beam propagates in the water upstream and downstream and analyzes and processes the water velocity to further calculate the water flow rate. It is characterized by a low starting flow rate, wide range ratio, high measurement accuracy, and stable work. There are no moving parts inside and no flow-blocking elements, and it is not affected by impurities in the water and has a long service life. The output communication function is complete, meeting all kinds of communication and wireless networking requirements. It has excellent small flow detection capabilities, can solve many traditional water meter problems, is more suitable for water fee gradient charging, is more suitable for water resource saving and rational use, and has broad market and application prospects. The ultrasonic water meter is a fully electronic water meter manufactured with industrial-grade electronic components using the principle of ultrasonic time difference. Compared with mechanical water meters, it has the characteristics of high accuracy, good reliability, wide range ratio, long service life, no moving parts, no need to set parameters, and installation at any angle.The Kalman filter is an algorithm that uses linear system state equations and system input and output observation data to optimally estimate the system state [1–4]. Since the observation data contains the influence of noise and interference in the system, the optimal estimation can also be regarded as a filtering process [5]. Data filtering is a data processing technique that removes noise and restores real data [6]. When the measurement variance is known, the Kalman filter can estimate the state of the dynamic system from a series of data containing measurement noise [7–10]. Kalman filtering is currently the most widely used filtering method because it is convenient for computer programming and can update and process the data collected on site in real time [11–13]. It has a wide range of applications in the fields of communication, navigation, guidance, and control [14–16]. In the process of Kalman filtering, the data is selected by sensors, combined with the data collected by the sensors and related algorithms; the Kalman filtering results are fused; and finally, data about four factors originating from the flow rate, temperature, sound velocity, and time difference are obtained [17–19].


## 2. Method

### 2.1. Kalman Principle

Kalman filtering is a recursive filtering method that does not need to save past historical information. The new data combines the estimated value obtained at the previous moment and the state equation of the system itself to obtain a new estimated value in a certain way. Kalman filtering does not require that the signal and noise are the assumptions of a stationary process. It is realized by computer programming and can update and process the data collected on the spot in real time. For the system disturbances and observation errors at each moment, some appropriate assumptions are made about their statistical properties. By processing the observation signal with noise, the estimated value of the real signal with the smallest error is obtained.


#### 2.1.1. Linear Kalman

Assuming that the state of the linear system isk, Kalman’s principle can be expressed by the following five formulas:
(1)Xk∣k−1=AXk−1∣k−1+BUk,(2)Pk∣k−1=APk−1∣k−1A′+Q,(3)Xk∣k=Xk∣k−1+KgkZk−HXk∣k−1,(4)Kgk=Pk∣k−1H′HPk∣k−1H′+R,(5)Pk∣k=I−KgkHPk∣k−1.In formula (1),Xk∣k−1is the result of the previous state prediction,Xk−1∣k−1is the optimal result of the previous state, andUkis the current state control quantity; in formula (2),Pk∣k−1is the covariance corresponding toXk∣k−1andPk−1∣k−1isXk−1∣k−1. The corresponding covariance,A′, represents the transposition matrix ofA, andQis the covariance of the system process; the optimal estimation value of the current state (k) isXk∣k;Kgis the Kalman gain.


#### 2.1.2. Extended Kalman

Actual systems always have different degrees of nonlinearity. For nonlinear system filtering problems, the commonly used method is to use linearization techniques to transform them into an approximate linear filtering problem. This is the extended Kalman filter method (extended Kalman filter, EKF). The extended Kalman filter is based on the linear Kalman filter. Its core is to expand the filter value nonlinear functions f (∗) and h∗ into a Taylor series for general nonlinear systems and omit the second-order and above terms. An approximate linearized model is obtained, and then, Kalman filtering is applied to complete the filtering and estimation of the target.


#### 2.1.3. Unscented Kalman

Extended Kalman filtering is to perform Taylor expansion on nonlinear system equations or observation equations and retain its first-order approximation terms, which inevitably introduces linearization errors. If the linearization assumption is not true, the use of this algorithm will cause the filter performance to degrade and cause divergence. Unscented Kalman filter (unscented Kalman filter, UKF) abandons the traditional approach of linearizing nonlinear functions, adopts the Kalman linear filter framework, and uses Unscented Transform (UT) to process the mean and covariance for prediction equations.


### 2.2. Data Fusion

#### 2.2.1. Sensor Selection

The sensor is the main design of the system. The quality of the sensor directly affects the subsequent data processing and whether the source of this data processing is correct. This is the most fundamental basis of a system, which is the acquisition of raw data. However, the sensor is the most important link in the acquisition of raw data. The sensor needs to convert the acquired signal into a transmittable electrical signal. The accuracy of this signal is related to the quality of the entire data.In the selection of sensors, there are a few basic requirements that need to be paid attention to.(1) Types of Sensors. We select the sensor type and select the correct sensor according to the types and functions of various sensors. Many sensors involved in this article are selected using this method. These sensors include pressure sensors and temperature changes mentioned in the influencing factors. These sensors include pressure sensors and temperature changes mentioned in the influencing factors, and temperature sensors affect pressure, etc.(2) The Number of Sensors. The selection of the number of sensors is mainly determined by the number of sensors needed, and the key position of the ultrasonic water meter is generally used as the criterion.(3) Selection of Range. The measurement range of the sensor is determined by the measurement range of the sensor when the measurement is finally required. The measured value is generally a value close to the range. The closer the value is, the higher the range obtained will be. Under normal circumstances, the working range of the sensor is within the working range to prevent damage or damage to the sensor.(4) Precision Selection. The selection of sensor measurement accuracy is a very important aspect of the measured data. Generally, it is sufficient to consider meeting the requirements of dynamic weight measurement. It is not appropriate to choose a sensor that is too large or too small. A sensor that is too large will increase the error, and a sensor that is too small may not be able to measure the required data. It may also cause damage to the sensor.(5) The Scope of Application of the Sensor. The scope of application of the sensor is mainly related to the size of the sensor and the size of the sensor installation location. To ensure that the sensor can work safely is the prerequisite for sensor installation. Combined with the environment in which the sensor is used, we ensure that the sensor will not be affected by the problem of the installation location.


#### 2.2.2. Data Collection

Ultrasonic flow measurement is not only a simple data filter but also a complex nonlinear conversion process. Only the basic Kalman filter algorithm cannot solve the nonlinear problem, so this article also tries to use the extended EKF filter algorithm for derivation. Regarding the coefficients determined in the model analysis, the state of the system, and the observation equations and their corresponding correlation coefficients, I will not repeat them. The data to be filtered and the initial state used are the same as those in the previous section. Due to the addition of the observed state variables, the data are shown in the following Table1.Table 1
Influencing factors of ultrasonic flow data and sensor data collection.
Flow rateυ (m/s)1010.210.19.810.210.110.210.110TemperatureT (°C)2525.325.524.925.325.125.325.225Speed of soundC (m/s)1494.4631495.2341495.7441494.2041495.2341494.7201495.2341494.9771494.463Time differenceΔt (ns)895.4884912.4562902.8941877.8824912.4562904.1313912.4562903.8204895.4884


#### 2.2.3. Data Fusion Method

Multisource information fusion is to analyze the factors that affect the results of the target, obtain the data in a certain way, obtain the description and interpretation process of the required target, and achieve the mapping between the fused data and the target. According to the fusion level, the fusion model is usually divided into three levels: data, features, and decision-making for information fusion and processing. Then, according to the structure of information fusion, the data is fused in centralized, distributed, and hybrid fusion methods, and finally, combined with the data characteristics in the mapping relationship, the combination method is selected for data fusion, and the optimal fusion plan is obtained through error analysis.Information fusion is to simulate the real situation, ignore the less influential factors, determine the more influential factors, and combine the law of time and space to establish a mathematical model, describe and classify the information data, and use the subset data contained in it. We form a better information fusion system.(1) Information Fusion Level. Information fusion is usually divided into 4 stages, which are the information source collection and arrangement stage, the information source processing stage, the analysis and decision-making stage, and the fusion conclusion output stage. Information data is collected by sensors and then processed by algorithms after model conversion to determine the data fusion target at the decision-making level. After studying each level, the following analysis can be obtained.(1) Data layer fusion refers to the direct fusion of the original data. The source of the data is obtained through factor analysis using the corresponding sensor, and after correlation through the data model, data layer fusion is gradually carried out, and the data is extracted before the data processing result is judged. The advantage of data layer fusion is that the details of data extraction can be reduced through the fusion layer. When there are deficiencies, there are more calculation data and poor real-time calculation. The data layer fusion block diagram is shown in Figure1.Figure 1
Data layer fusion.Feature layer fusion refers to the feature analysis of data and the extraction of the same type of data. Then, we analyze and process through algorithms, retain the main component data, and provide support for the final result. The advantage of feature layer fusion is to reduce the amount of data processing and facilitate real-time data processing. The block diagram of feature layer fusion is shown in Figure2.Figure 2
Feature layer fusion.Decision-making fusion refers to high-level fusion, which is summarized and flexible in the data processing process. After preprocessing the data, a decision plan is obtained, and then, the plans are combined and compared to determine the final combination plan. The fusion block diagram of the decision-making layer is shown in Figure3.Figure 3
Decision-making.Through the introduction of information fusion levels, we can see that different information fusions have different characteristics and scope of application. When sensor data can be used in various information fusions, information fusion technology can be used directly. When the sensors do not match, the data needs to be fused by a specific method, and the enumeration method is selected to use various methods to fuse the data to determine the final data selection method.(2) Information Fusion Structure. The system structure of information fusion technology can generally be divided into centralized fusion, distributed fusion, and hybrid fusion architecture. We make the following discussions during the research:
(1)
Centralized fusion refers to sending the observation data of each sensor to the database, through the database to make preliminary judgments on the data fusion and determine the structural accuracy and information loss rate. In the transmission process, a good network speed is required to ensure the integrity of data transmission(2)
Distributed fusion refers to preprocessing the observed data through a specific mathematical model design algorithm through each sensor and then sending the partial processing results to the database after the initial conclusion is obtained. Compared with the centralized fusion structure, the processed data has a smaller data size, lower bandwidth requirements, and higher feasibility in actual operation(3)
Hybrid fusion is a combination of the advantages of centralized fusion and distributed fusion. But it has higher economic requirements and is generally used in dealing with more complex models(3) Information Fusion Algorithm. The information fusion algorithm is the basis and important content of fusion processing. The algorithm obtains the relationship between the data or the relationship between the data and the target through the actual situation by establishing a data analysis model and then combines the established model with the existing data processing model and achieves the purpose of data fusion through the computer. The algorithms that can be fused at this stage usually include fuzzy theory, D-S evidence theory, Bayes reasoning, and neural network algorithms. The analysis of different algorithms is as follows.Fuzzy theoretical value refers to determining the key factors of data fusion through the fusion process, gradually expanding through the key factors, and finally deriving the fuzzy method of target extraction gradually.D-S evidence theory adopts the method of probability theory. This theory can effectively solve the probability of position influencing factors and then integrate the data through the full probability formula to obtain the overall target result. Therefore, it is widely used.Bayes reasoning refers to the establishment of the relationship between the prior probability and the posterior probability through the Bayes rule, the overall probability analysis is carried out, the probability law of different factors is determined, and the overall probability analysis is obtained through the data. Due to the unknown probability, the error of this method is relatively large.Neural networks are essentially the process of simulating the human brain through deep learning, through the process of repeated repetition, to gain cognition of things and perform temporary human brain functions. Deep learning combines the data of multiple sensors on multisensor data fusion, and comprehensive deep learning acquires the data of each sensor for mapping and obtains the mapping relationship between the sensors. Then, according to repeated training, the error of the obtained prediction data is getting smaller and smaller. When the error reaches a certain accuracy, it can meet practicability.The corresponding initial state and coefficients are as follows:(6)x0=2510,P0=1001,L=0.1m.For the noise of the prediction process and the measurement process, there are adjustments for different variables, as follows:(7)Q=0.05000.5,R=200010.Due to the extended EKF filtering algorithm, the calculation and iteration of the Jacobian partial derivative matrix is added during the calculation process, which is the measurement matrix of the observation equation, as follows:(8)H=∂h1∂T∂h1∂υ∂h2∂T∂h2∂υ=0.0006⋅T2−0.1058⋅T+4.8520−4LvC−3109⋅0.0006⋅T2−0.1058⋅T+4.8522LC2109.According to the above measurement matrix and assuming other initial states, the initial value of the matrix can be obtained, as follows:(9)H0=2.58200−3.094389.5488.The iterative calculation process of the algorithm is detailed. Only when each step is carefully calculated can the calculation amount and complexity of the extended EKF filter algorithm be understood more deeply; the calculation is performed according to the following iterative process.(10)x^k-=Ax^k-1=10012510=2510,Zk=1495.234912.456,Pk-=APk-1AT+Q=100110011001T+0.05000.5=1.05001.5H0=2.58200-3.094389.5488K=Pk-HTHPk-HT+R-1=1.05001.52.58200-3.094389.5488T2.58200-3.094389.54881.05001.52.58200-3.094389.5488T+2.58200-3.094389.54882000102.58200-3.094389.5488T-1=2.7111-3.24900134.32322.58200-3.094389.548821.050011.52.58200-3.094389.5488T-1+2.58200-3.094389.54882000102.58200-3.094389.5488T-1=2.7111-3.24900134.32322.58200-3.094389.548821.050011.52.58200-3.094389.5488T-1=2.7111-3.24900134.3232140.3345-168.1786-168.178692419.90-1=2.7111-3.24900134.32320.0071410.0000130.0000130.000011=0.01931800.0017460.001478,x^k=x^k-+KZk-hx^k-=2510+0.01931800.0017460.0014781495.234912.456-1494.4625895.488=2510+0.01490.0264=25.014910.0264,Pk=I-KHPk-=1001-0.01931800.0017460.0014782.58200-3.094389.54881.05001.5=0.99762700.0000711.301470.The data is processed through the above algorithm combined with related software, and finally, the result after data fusion is obtained.The Kalman MATLAB code is shown as follows.Code 1
longitude_fil(1) = y(1);p_fil(1) = 1;for t = 2:nlongitude_pre(t) = a∗ longitude_fil(t-1);p_pre(t) = a∗ p_fil(t-1) + a’∗P;K(t) = p_pre(t)∗H’∗inv(H∗p_pre(t)∗H’ + Q);longitude_fil(t) = longitude_pre(t) + K(t)∗(longitude(t)-H∗longitude_pre(t));p_fil(t) = (1-K(t)∗H)∗p_pre(t);endfor i =1:nErr1(i) = RMS(y(i), longitude(i));Err2(i) = RMS(y(i), longitude_fil(i));end


### 2.3. Experimental Results and Analysis

From the above iterative calculation process, it can be seen that the extended EKF filtering algorithm is much more complicated than the basic KF filtering algorithm, the Jacobian matrix update is added in the calculation process, and the complexity of the vector is not a little bit higher than the scalar. If the variables are related and not independent, the amount of calculation will increase. In the above iterative calculation process, when initializing the covariance matrix, it is a diagonal matrix, and no cross-correlation is added; in the update process, it is also assumed that the noise covariance is a diagonal matrix and is not correlated. In the continuous iterative calculation, the variance value corresponding to the flow velocity in the covariance matrix is getting larger and larger, the discussion of its convergence should be strengthened in the follow-up, and programming calculation is easy to travel, which can be realized by MATLAB programming, which can be iterated more times and calculated. There is no error in the process; after the above filtering, it is found that the data filtering effect is good, with almost no fluctuations. The comparison table and analysis of the data before and after filtering are shown in the following Table2.Table 2
Data collation and analysis before and after filtering.
Before filteringFlow velocity (m/s)1010.210.19.810.210.110.210.110Temperature (°C)2525.325.524.925.325.125.325.225Speed of sound (m/s)1494.4631495.2341495.7441494.2041495.2341494.7201495.2341494.9771494.463Time difference (ns)895.4884912.4562902.8941877.8824912.4562904.1313912.4562903.8204895.4884After filteringFlow velocity (m/s)1010.026410.03489.995410.032210.044910.057910.066110.0531Temperature (°C)2525.014925.037725.030125.043525.046325.049125.056525.0537Speed of sound (m/s)1494.4631494.5011494.5601494.5401494.5751494.5821494.5891494.6081494.601Time difference (ns)895.4884897.806898.488894.983898.237899.365900.521901.232900.077From the table data, it is not very intuitive. The changes before and after the corresponding data filtering are drawn into graphs, and the filtering results of the four variables are compared. From Figures4–7, it can be very intuitive to see that the filtering effect is better.Figure 4
Comparison of flow rate data before and after filtering.Figure 5
Comparison of temperature data before and after filtering.Figure 6
Comparison of sound velocity data before and after filtering.Figure 7
Comparison of time difference data before and after filtering.It can also be seen from the above figure that the graphs in Figures5 and 6 have the same changes, because the propagation speed of ultrasonic waves in water is a function of temperature, so the law of change is the same. It shows that the effects of the two on ultrasound are the same. The graphs in Figure 4 are similar to those in Figure 7, but the fluctuation of Figure 4 is greater than that of Figure 7, indicating that there are certain influencing factors between the two.


## 2.1. Kalman Principle

Kalman filtering is a recursive filtering method that does not need to save past historical information. The new data combines the estimated value obtained at the previous moment and the state equation of the system itself to obtain a new estimated value in a certain way. Kalman filtering does not require that the signal and noise are the assumptions of a stationary process. It is realized by computer programming and can update and process the data collected on the spot in real time. For the system disturbances and observation errors at each moment, some appropriate assumptions are made about their statistical properties. By processing the observation signal with noise, the estimated value of the real signal with the smallest error is obtained.


### 2.1.1. Linear Kalman

Assuming that the state of the linear system isk, Kalman’s principle can be expressed by the following five formulas:
(1)Xk∣k−1=AXk−1∣k−1+BUk,(2)Pk∣k−1=APk−1∣k−1A′+Q,(3)Xk∣k=Xk∣k−1+KgkZk−HXk∣k−1,(4)Kgk=Pk∣k−1H′HPk∣k−1H′+R,(5)Pk∣k=I−KgkHPk∣k−1.In formula (1),Xk∣k−1is the result of the previous state prediction,Xk−1∣k−1is the optimal result of the previous state, andUkis the current state control quantity; in formula (2),Pk∣k−1is the covariance corresponding toXk∣k−1andPk−1∣k−1isXk−1∣k−1. The corresponding covariance,A′, represents the transposition matrix ofA, andQis the covariance of the system process; the optimal estimation value of the current state (k) isXk∣k;Kgis the Kalman gain.


### 2.1.2. Extended Kalman

Actual systems always have different degrees of nonlinearity. For nonlinear system filtering problems, the commonly used method is to use linearization techniques to transform them into an approximate linear filtering problem. This is the extended Kalman filter method (extended Kalman filter, EKF). The extended Kalman filter is based on the linear Kalman filter. Its core is to expand the filter value nonlinear functions f (∗) and h∗ into a Taylor series for general nonlinear systems and omit the second-order and above terms. An approximate linearized model is obtained, and then, Kalman filtering is applied to complete the filtering and estimation of the target.


### 2.1.3. Unscented Kalman

Extended Kalman filtering is to perform Taylor expansion on nonlinear system equations or observation equations and retain its first-order approximation terms, which inevitably introduces linearization errors. If the linearization assumption is not true, the use of this algorithm will cause the filter performance to degrade and cause divergence. Unscented Kalman filter (unscented Kalman filter, UKF) abandons the traditional approach of linearizing nonlinear functions, adopts the Kalman linear filter framework, and uses Unscented Transform (UT) to process the mean and covariance for prediction equations.


## 2.1.1. Linear Kalman

Assuming that the state of the linear system isk, Kalman’s principle can be expressed by the following five formulas:
(1)Xk∣k−1=AXk−1∣k−1+BUk,(2)Pk∣k−1=APk−1∣k−1A′+Q,(3)Xk∣k=Xk∣k−1+KgkZk−HXk∣k−1,(4)Kgk=Pk∣k−1H′HPk∣k−1H′+R,(5)Pk∣k=I−KgkHPk∣k−1.In formula (1),Xk∣k−1is the result of the previous state prediction,Xk−1∣k−1is the optimal result of the previous state, andUkis the current state control quantity; in formula (2),Pk∣k−1is the covariance corresponding toXk∣k−1andPk−1∣k−1isXk−1∣k−1. The corresponding covariance,A′, represents the transposition matrix ofA, andQis the covariance of the system process; the optimal estimation value of the current state (k) isXk∣k;Kgis the Kalman gain.


## 2.1.2. Extended Kalman

Actual systems always have different degrees of nonlinearity. For nonlinear system filtering problems, the commonly used method is to use linearization techniques to transform them into an approximate linear filtering problem. This is the extended Kalman filter method (extended Kalman filter, EKF). The extended Kalman filter is based on the linear Kalman filter. Its core is to expand the filter value nonlinear functions f (∗) and h∗ into a Taylor series for general nonlinear systems and omit the second-order and above terms. An approximate linearized model is obtained, and then, Kalman filtering is applied to complete the filtering and estimation of the target.


## 2.1.3. Unscented Kalman

Extended Kalman filtering is to perform Taylor expansion on nonlinear system equations or observation equations and retain its first-order approximation terms, which inevitably introduces linearization errors. If the linearization assumption is not true, the use of this algorithm will cause the filter performance to degrade and cause divergence. Unscented Kalman filter (unscented Kalman filter, UKF) abandons the traditional approach of linearizing nonlinear functions, adopts the Kalman linear filter framework, and uses Unscented Transform (UT) to process the mean and covariance for prediction equations.


## 2.2. Data Fusion

### 2.2.1. Sensor Selection

The sensor is the main design of the system. The quality of the sensor directly affects the subsequent data processing and whether the source of this data processing is correct. This is the most fundamental basis of a system, which is the acquisition of raw data. However, the sensor is the most important link in the acquisition of raw data. The sensor needs to convert the acquired signal into a transmittable electrical signal. The accuracy of this signal is related to the quality of the entire data.In the selection of sensors, there are a few basic requirements that need to be paid attention to.(1) Types of Sensors. We select the sensor type and select the correct sensor according to the types and functions of various sensors. Many sensors involved in this article are selected using this method. These sensors include pressure sensors and temperature changes mentioned in the influencing factors. These sensors include pressure sensors and temperature changes mentioned in the influencing factors, and temperature sensors affect pressure, etc.(2) The Number of Sensors. The selection of the number of sensors is mainly determined by the number of sensors needed, and the key position of the ultrasonic water meter is generally used as the criterion.(3) Selection of Range. The measurement range of the sensor is determined by the measurement range of the sensor when the measurement is finally required. The measured value is generally a value close to the range. The closer the value is, the higher the range obtained will be. Under normal circumstances, the working range of the sensor is within the working range to prevent damage or damage to the sensor.(4) Precision Selection. The selection of sensor measurement accuracy is a very important aspect of the measured data. Generally, it is sufficient to consider meeting the requirements of dynamic weight measurement. It is not appropriate to choose a sensor that is too large or too small. A sensor that is too large will increase the error, and a sensor that is too small may not be able to measure the required data. It may also cause damage to the sensor.(5) The Scope of Application of the Sensor. The scope of application of the sensor is mainly related to the size of the sensor and the size of the sensor installation location. To ensure that the sensor can work safely is the prerequisite for sensor installation. Combined with the environment in which the sensor is used, we ensure that the sensor will not be affected by the problem of the installation location.


### 2.2.2. Data Collection

Ultrasonic flow measurement is not only a simple data filter but also a complex nonlinear conversion process. Only the basic Kalman filter algorithm cannot solve the nonlinear problem, so this article also tries to use the extended EKF filter algorithm for derivation. Regarding the coefficients determined in the model analysis, the state of the system, and the observation equations and their corresponding correlation coefficients, I will not repeat them. The data to be filtered and the initial state used are the same as those in the previous section. Due to the addition of the observed state variables, the data are shown in the following Table1.Table 1
Influencing factors of ultrasonic flow data and sensor data collection.
Flow rateυ (m/s)1010.210.19.810.210.110.210.110TemperatureT (°C)2525.325.524.925.325.125.325.225Speed of soundC (m/s)1494.4631495.2341495.7441494.2041495.2341494.7201495.2341494.9771494.463Time differenceΔt (ns)895.4884912.4562902.8941877.8824912.4562904.1313912.4562903.8204895.4884


### 2.2.3. Data Fusion Method

Multisource information fusion is to analyze the factors that affect the results of the target, obtain the data in a certain way, obtain the description and interpretation process of the required target, and achieve the mapping between the fused data and the target. According to the fusion level, the fusion model is usually divided into three levels: data, features, and decision-making for information fusion and processing. Then, according to the structure of information fusion, the data is fused in centralized, distributed, and hybrid fusion methods, and finally, combined with the data characteristics in the mapping relationship, the combination method is selected for data fusion, and the optimal fusion plan is obtained through error analysis.Information fusion is to simulate the real situation, ignore the less influential factors, determine the more influential factors, and combine the law of time and space to establish a mathematical model, describe and classify the information data, and use the subset data contained in it. We form a better information fusion system.(1) Information Fusion Level. Information fusion is usually divided into 4 stages, which are the information source collection and arrangement stage, the information source processing stage, the analysis and decision-making stage, and the fusion conclusion output stage. Information data is collected by sensors and then processed by algorithms after model conversion to determine the data fusion target at the decision-making level. After studying each level, the following analysis can be obtained.(1) Data layer fusion refers to the direct fusion of the original data. The source of the data is obtained through factor analysis using the corresponding sensor, and after correlation through the data model, data layer fusion is gradually carried out, and the data is extracted before the data processing result is judged. The advantage of data layer fusion is that the details of data extraction can be reduced through the fusion layer. When there are deficiencies, there are more calculation data and poor real-time calculation. The data layer fusion block diagram is shown in Figure1.Figure 1
Data layer fusion.Feature layer fusion refers to the feature analysis of data and the extraction of the same type of data. Then, we analyze and process through algorithms, retain the main component data, and provide support for the final result. The advantage of feature layer fusion is to reduce the amount of data processing and facilitate real-time data processing. The block diagram of feature layer fusion is shown in Figure2.Figure 2
Feature layer fusion.Decision-making fusion refers to high-level fusion, which is summarized and flexible in the data processing process. After preprocessing the data, a decision plan is obtained, and then, the plans are combined and compared to determine the final combination plan. The fusion block diagram of the decision-making layer is shown in Figure3.Figure 3
Decision-making.Through the introduction of information fusion levels, we can see that different information fusions have different characteristics and scope of application. When sensor data can be used in various information fusions, information fusion technology can be used directly. When the sensors do not match, the data needs to be fused by a specific method, and the enumeration method is selected to use various methods to fuse the data to determine the final data selection method.(2) Information Fusion Structure. The system structure of information fusion technology can generally be divided into centralized fusion, distributed fusion, and hybrid fusion architecture. We make the following discussions during the research:
(1)
Centralized fusion refers to sending the observation data of each sensor to the database, through the database to make preliminary judgments on the data fusion and determine the structural accuracy and information loss rate. In the transmission process, a good network speed is required to ensure the integrity of data transmission(2)
Distributed fusion refers to preprocessing the observed data through a specific mathematical model design algorithm through each sensor and then sending the partial processing results to the database after the initial conclusion is obtained. Compared with the centralized fusion structure, the processed data has a smaller data size, lower bandwidth requirements, and higher feasibility in actual operation(3)
Hybrid fusion is a combination of the advantages of centralized fusion and distributed fusion. But it has higher economic requirements and is generally used in dealing with more complex models(3) Information Fusion Algorithm. The information fusion algorithm is the basis and important content of fusion processing. The algorithm obtains the relationship between the data or the relationship between the data and the target through the actual situation by establishing a data analysis model and then combines the established model with the existing data processing model and achieves the purpose of data fusion through the computer. The algorithms that can be fused at this stage usually include fuzzy theory, D-S evidence theory, Bayes reasoning, and neural network algorithms. The analysis of different algorithms is as follows.Fuzzy theoretical value refers to determining the key factors of data fusion through the fusion process, gradually expanding through the key factors, and finally deriving the fuzzy method of target extraction gradually.D-S evidence theory adopts the method of probability theory. This theory can effectively solve the probability of position influencing factors and then integrate the data through the full probability formula to obtain the overall target result. Therefore, it is widely used.Bayes reasoning refers to the establishment of the relationship between the prior probability and the posterior probability through the Bayes rule, the overall probability analysis is carried out, the probability law of different factors is determined, and the overall probability analysis is obtained through the data. Due to the unknown probability, the error of this method is relatively large.Neural networks are essentially the process of simulating the human brain through deep learning, through the process of repeated repetition, to gain cognition of things and perform temporary human brain functions. Deep learning combines the data of multiple sensors on multisensor data fusion, and comprehensive deep learning acquires the data of each sensor for mapping and obtains the mapping relationship between the sensors. Then, according to repeated training, the error of the obtained prediction data is getting smaller and smaller. When the error reaches a certain accuracy, it can meet practicability.The corresponding initial state and coefficients are as follows:(6)x0=2510,P0=1001,L=0.1m.For the noise of the prediction process and the measurement process, there are adjustments for different variables, as follows:(7)Q=0.05000.5,R=200010.Due to the extended EKF filtering algorithm, the calculation and iteration of the Jacobian partial derivative matrix is added during the calculation process, which is the measurement matrix of the observation equation, as follows:(8)H=∂h1∂T∂h1∂υ∂h2∂T∂h2∂υ=0.0006⋅T2−0.1058⋅T+4.8520−4LvC−3109⋅0.0006⋅T2−0.1058⋅T+4.8522LC2109.According to the above measurement matrix and assuming other initial states, the initial value of the matrix can be obtained, as follows:(9)H0=2.58200−3.094389.5488.The iterative calculation process of the algorithm is detailed. Only when each step is carefully calculated can the calculation amount and complexity of the extended EKF filter algorithm be understood more deeply; the calculation is performed according to the following iterative process.(10)x^k-=Ax^k-1=10012510=2510,Zk=1495.234912.456,Pk-=APk-1AT+Q=100110011001T+0.05000.5=1.05001.5H0=2.58200-3.094389.5488K=Pk-HTHPk-HT+R-1=1.05001.52.58200-3.094389.5488T2.58200-3.094389.54881.05001.52.58200-3.094389.5488T+2.58200-3.094389.54882000102.58200-3.094389.5488T-1=2.7111-3.24900134.32322.58200-3.094389.548821.050011.52.58200-3.094389.5488T-1+2.58200-3.094389.54882000102.58200-3.094389.5488T-1=2.7111-3.24900134.32322.58200-3.094389.548821.050011.52.58200-3.094389.5488T-1=2.7111-3.24900134.3232140.3345-168.1786-168.178692419.90-1=2.7111-3.24900134.32320.0071410.0000130.0000130.000011=0.01931800.0017460.001478,x^k=x^k-+KZk-hx^k-=2510+0.01931800.0017460.0014781495.234912.456-1494.4625895.488=2510+0.01490.0264=25.014910.0264,Pk=I-KHPk-=1001-0.01931800.0017460.0014782.58200-3.094389.54881.05001.5=0.99762700.0000711.301470.The data is processed through the above algorithm combined with related software, and finally, the result after data fusion is obtained.The Kalman MATLAB code is shown as follows.Code 1
longitude_fil(1) = y(1);p_fil(1) = 1;for t = 2:nlongitude_pre(t) = a∗ longitude_fil(t-1);p_pre(t) = a∗ p_fil(t-1) + a’∗P;K(t) = p_pre(t)∗H’∗inv(H∗p_pre(t)∗H’ + Q);longitude_fil(t) = longitude_pre(t) + K(t)∗(longitude(t)-H∗longitude_pre(t));p_fil(t) = (1-K(t)∗H)∗p_pre(t);endfor i =1:nErr1(i) = RMS(y(i), longitude(i));Err2(i) = RMS(y(i), longitude_fil(i));end


## 2.2.1. Sensor Selection

The sensor is the main design of the system. The quality of the sensor directly affects the subsequent data processing and whether the source of this data processing is correct. This is the most fundamental basis of a system, which is the acquisition of raw data. However, the sensor is the most important link in the acquisition of raw data. The sensor needs to convert the acquired signal into a transmittable electrical signal. The accuracy of this signal is related to the quality of the entire data.In the selection of sensors, there are a few basic requirements that need to be paid attention to.(1) Types of Sensors. We select the sensor type and select the correct sensor according to the types and functions of various sensors. Many sensors involved in this article are selected using this method. These sensors include pressure sensors and temperature changes mentioned in the influencing factors. These sensors include pressure sensors and temperature changes mentioned in the influencing factors, and temperature sensors affect pressure, etc.(2) The Number of Sensors. The selection of the number of sensors is mainly determined by the number of sensors needed, and the key position of the ultrasonic water meter is generally used as the criterion.(3) Selection of Range. The measurement range of the sensor is determined by the measurement range of the sensor when the measurement is finally required. The measured value is generally a value close to the range. The closer the value is, the higher the range obtained will be. Under normal circumstances, the working range of the sensor is within the working range to prevent damage or damage to the sensor.(4) Precision Selection. The selection of sensor measurement accuracy is a very important aspect of the measured data. Generally, it is sufficient to consider meeting the requirements of dynamic weight measurement. It is not appropriate to choose a sensor that is too large or too small. A sensor that is too large will increase the error, and a sensor that is too small may not be able to measure the required data. It may also cause damage to the sensor.(5) The Scope of Application of the Sensor. The scope of application of the sensor is mainly related to the size of the sensor and the size of the sensor installation location. To ensure that the sensor can work safely is the prerequisite for sensor installation. Combined with the environment in which the sensor is used, we ensure that the sensor will not be affected by the problem of the installation location.


## 2.2.2. Data Collection

Ultrasonic flow measurement is not only a simple data filter but also a complex nonlinear conversion process. Only the basic Kalman filter algorithm cannot solve the nonlinear problem, so this article also tries to use the extended EKF filter algorithm for derivation. Regarding the coefficients determined in the model analysis, the state of the system, and the observation equations and their corresponding correlation coefficients, I will not repeat them. The data to be filtered and the initial state used are the same as those in the previous section. Due to the addition of the observed state variables, the data are shown in the following Table1.Table 1
Influencing factors of ultrasonic flow data and sensor data collection.
Flow rateυ (m/s)1010.210.19.810.210.110.210.110TemperatureT (°C)2525.325.524.925.325.125.325.225Speed of soundC (m/s)1494.4631495.2341495.7441494.2041495.2341494.7201495.2341494.9771494.463Time differenceΔt (ns)895.4884912.4562902.8941877.8824912.4562904.1313912.4562903.8204895.4884


## 2.2.3. Data Fusion Method

Multisource information fusion is to analyze the factors that affect the results of the target, obtain the data in a certain way, obtain the description and interpretation process of the required target, and achieve the mapping between the fused data and the target. According to the fusion level, the fusion model is usually divided into three levels: data, features, and decision-making for information fusion and processing. Then, according to the structure of information fusion, the data is fused in centralized, distributed, and hybrid fusion methods, and finally, combined with the data characteristics in the mapping relationship, the combination method is selected for data fusion, and the optimal fusion plan is obtained through error analysis.Information fusion is to simulate the real situation, ignore the less influential factors, determine the more influential factors, and combine the law of time and space to establish a mathematical model, describe and classify the information data, and use the subset data contained in it. We form a better information fusion system.(1) Information Fusion Level. Information fusion is usually divided into 4 stages, which are the information source collection and arrangement stage, the information source processing stage, the analysis and decision-making stage, and the fusion conclusion output stage. Information data is collected by sensors and then processed by algorithms after model conversion to determine the data fusion target at the decision-making level. After studying each level, the following analysis can be obtained.(1) Data layer fusion refers to the direct fusion of the original data. The source of the data is obtained through factor analysis using the corresponding sensor, and after correlation through the data model, data layer fusion is gradually carried out, and the data is extracted before the data processing result is judged. The advantage of data layer fusion is that the details of data extraction can be reduced through the fusion layer. When there are deficiencies, there are more calculation data and poor real-time calculation. The data layer fusion block diagram is shown in Figure1.Figure 1
Data layer fusion.Feature layer fusion refers to the feature analysis of data and the extraction of the same type of data. Then, we analyze and process through algorithms, retain the main component data, and provide support for the final result. The advantage of feature layer fusion is to reduce the amount of data processing and facilitate real-time data processing. The block diagram of feature layer fusion is shown in Figure2.Figure 2
Feature layer fusion.Decision-making fusion refers to high-level fusion, which is summarized and flexible in the data processing process. After preprocessing the data, a decision plan is obtained, and then, the plans are combined and compared to determine the final combination plan. The fusion block diagram of the decision-making layer is shown in Figure3.Figure 3
Decision-making.Through the introduction of information fusion levels, we can see that different information fusions have different characteristics and scope of application. When sensor data can be used in various information fusions, information fusion technology can be used directly. When the sensors do not match, the data needs to be fused by a specific method, and the enumeration method is selected to use various methods to fuse the data to determine the final data selection method.(2) Information Fusion Structure. The system structure of information fusion technology can generally be divided into centralized fusion, distributed fusion, and hybrid fusion architecture. We make the following discussions during the research:
(1)
Centralized fusion refers to sending the observation data of each sensor to the database, through the database to make preliminary judgments on the data fusion and determine the structural accuracy and information loss rate. In the transmission process, a good network speed is required to ensure the integrity of data transmission(2)
Distributed fusion refers to preprocessing the observed data through a specific mathematical model design algorithm through each sensor and then sending the partial processing results to the database after the initial conclusion is obtained. Compared with the centralized fusion structure, the processed data has a smaller data size, lower bandwidth requirements, and higher feasibility in actual operation(3)
Hybrid fusion is a combination of the advantages of centralized fusion and distributed fusion. But it has higher economic requirements and is generally used in dealing with more complex models(3) Information Fusion Algorithm. The information fusion algorithm is the basis and important content of fusion processing. The algorithm obtains the relationship between the data or the relationship between the data and the target through the actual situation by establishing a data analysis model and then combines the established model with the existing data processing model and achieves the purpose of data fusion through the computer. The algorithms that can be fused at this stage usually include fuzzy theory, D-S evidence theory, Bayes reasoning, and neural network algorithms. The analysis of different algorithms is as follows.Fuzzy theoretical value refers to determining the key factors of data fusion through the fusion process, gradually expanding through the key factors, and finally deriving the fuzzy method of target extraction gradually.D-S evidence theory adopts the method of probability theory. This theory can effectively solve the probability of position influencing factors and then integrate the data through the full probability formula to obtain the overall target result. Therefore, it is widely used.Bayes reasoning refers to the establishment of the relationship between the prior probability and the posterior probability through the Bayes rule, the overall probability analysis is carried out, the probability law of different factors is determined, and the overall probability analysis is obtained through the data. Due to the unknown probability, the error of this method is relatively large.Neural networks are essentially the process of simulating the human brain through deep learning, through the process of repeated repetition, to gain cognition of things and perform temporary human brain functions. Deep learning combines the data of multiple sensors on multisensor data fusion, and comprehensive deep learning acquires the data of each sensor for mapping and obtains the mapping relationship between the sensors. Then, according to repeated training, the error of the obtained prediction data is getting smaller and smaller. When the error reaches a certain accuracy, it can meet practicability.The corresponding initial state and coefficients are as follows:(6)x0=2510,P0=1001,L=0.1m.For the noise of the prediction process and the measurement process, there are adjustments for different variables, as follows:(7)Q=0.05000.5,R=200010.Due to the extended EKF filtering algorithm, the calculation and iteration of the Jacobian partial derivative matrix is added during the calculation process, which is the measurement matrix of the observation equation, as follows:(8)H=∂h1∂T∂h1∂υ∂h2∂T∂h2∂υ=0.0006⋅T2−0.1058⋅T+4.8520−4LvC−3109⋅0.0006⋅T2−0.1058⋅T+4.8522LC2109.According to the above measurement matrix and assuming other initial states, the initial value of the matrix can be obtained, as follows:(9)H0=2.58200−3.094389.5488.The iterative calculation process of the algorithm is detailed. Only when each step is carefully calculated can the calculation amount and complexity of the extended EKF filter algorithm be understood more deeply; the calculation is performed according to the following iterative process.(10)x^k-=Ax^k-1=10012510=2510,Zk=1495.234912.456,Pk-=APk-1AT+Q=100110011001T+0.05000.5=1.05001.5H0=2.58200-3.094389.5488K=Pk-HTHPk-HT+R-1=1.05001.52.58200-3.094389.5488T2.58200-3.094389.54881.05001.52.58200-3.094389.5488T+2.58200-3.094389.54882000102.58200-3.094389.5488T-1=2.7111-3.24900134.32322.58200-3.094389.548821.050011.52.58200-3.094389.5488T-1+2.58200-3.094389.54882000102.58200-3.094389.5488T-1=2.7111-3.24900134.32322.58200-3.094389.548821.050011.52.58200-3.094389.5488T-1=2.7111-3.24900134.3232140.3345-168.1786-168.178692419.90-1=2.7111-3.24900134.32320.0071410.0000130.0000130.000011=0.01931800.0017460.001478,x^k=x^k-+KZk-hx^k-=2510+0.01931800.0017460.0014781495.234912.456-1494.4625895.488=2510+0.01490.0264=25.014910.0264,Pk=I-KHPk-=1001-0.01931800.0017460.0014782.58200-3.094389.54881.05001.5=0.99762700.0000711.301470.The data is processed through the above algorithm combined with related software, and finally, the result after data fusion is obtained.The Kalman MATLAB code is shown as follows.Code 1
longitude_fil(1) = y(1);p_fil(1) = 1;for t = 2:nlongitude_pre(t) = a∗ longitude_fil(t-1);p_pre(t) = a∗ p_fil(t-1) + a’∗P;K(t) = p_pre(t)∗H’∗inv(H∗p_pre(t)∗H’ + Q);longitude_fil(t) = longitude_pre(t) + K(t)∗(longitude(t)-H∗longitude_pre(t));p_fil(t) = (1-K(t)∗H)∗p_pre(t);endfor i =1:nErr1(i) = RMS(y(i), longitude(i));Err2(i) = RMS(y(i), longitude_fil(i));end


## 2.3. Experimental Results and Analysis

From the above iterative calculation process, it can be seen that the extended EKF filtering algorithm is much more complicated than the basic KF filtering algorithm, the Jacobian matrix update is added in the calculation process, and the complexity of the vector is not a little bit higher than the scalar. If the variables are related and not independent, the amount of calculation will increase. In the above iterative calculation process, when initializing the covariance matrix, it is a diagonal matrix, and no cross-correlation is added; in the update process, it is also assumed that the noise covariance is a diagonal matrix and is not correlated. In the continuous iterative calculation, the variance value corresponding to the flow velocity in the covariance matrix is getting larger and larger, the discussion of its convergence should be strengthened in the follow-up, and programming calculation is easy to travel, which can be realized by MATLAB programming, which can be iterated more times and calculated. There is no error in the process; after the above filtering, it is found that the data filtering effect is good, with almost no fluctuations. The comparison table and analysis of the data before and after filtering are shown in the following Table2.Table 2
Data collation and analysis before and after filtering.
Before filteringFlow velocity (m/s)1010.210.19.810.210.110.210.110Temperature (°C)2525.325.524.925.325.125.325.225Speed of sound (m/s)1494.4631495.2341495.7441494.2041495.2341494.7201495.2341494.9771494.463Time difference (ns)895.4884912.4562902.8941877.8824912.4562904.1313912.4562903.8204895.4884After filteringFlow velocity (m/s)1010.026410.03489.995410.032210.044910.057910.066110.0531Temperature (°C)2525.014925.037725.030125.043525.046325.049125.056525.0537Speed of sound (m/s)1494.4631494.5011494.5601494.5401494.5751494.5821494.5891494.6081494.601Time difference (ns)895.4884897.806898.488894.983898.237899.365900.521901.232900.077From the table data, it is not very intuitive. The changes before and after the corresponding data filtering are drawn into graphs, and the filtering results of the four variables are compared. From Figures4–7, it can be very intuitive to see that the filtering effect is better.Figure 4
Comparison of flow rate data before and after filtering.Figure 5
Comparison of temperature data before and after filtering.Figure 6
Comparison of sound velocity data before and after filtering.Figure 7
Comparison of time difference data before and after filtering.It can also be seen from the above figure that the graphs in Figures5 and 6 have the same changes, because the propagation speed of ultrasonic waves in water is a function of temperature, so the law of change is the same. It shows that the effects of the two on ultrasound are the same. The graphs in Figure 4 are similar to those in Figure 7, but the fluctuation of Figure 4 is greater than that of Figure 7, indicating that there are certain influencing factors between the two.


## 3. Conclusion

This article analyzes the influencing factors of the accuracy of the ultrasonic water meter and consults relevant information to find that the influencing factors are mainly the flow rate, temperature, speed of sound, and time difference. The corresponding sensor method is used to obtain the corresponding data, and the Kalman method is used to carry out the data. With regard to filter processing, by comparing the data before and after processing, it is found that the data before and after filtering is relatively small for different influencing factors. The errors in the comparison are shown in the following Figures8–11. The comprehensive analysis of errors can be found in Figure 12. Flow speed factors have a greater impact on the accuracy of ultrasonic water meters. The speed of sound has a small influence on the ultrasonic water meter, so the data is in line with the actual situation, indicating that the accuracy of the data and the establishment of the data model are better.Figure 8
Flow velocity error analysis diagram.Figure 9
Temperature error analysis diagram.Figure 10
Sound velocity error analysis diagram.Figure 11
Time difference error analysis diagram.Figure 12
Overall analysis of flow velocity, temperature, sound velocity, and time difference error.


### 3.1. Feasibility Verification of Proposed Algorithm

After processing the data in Table2, the original data and error data in the following Tables 3 and 4 are obtained. From the data, it can be found that the absolute value of the error of the data is basically below 2%, and the error analysis of most of the data is around 1%. It shows that the error of the data satisfies the needs of the existing data analysis.Table 3
Comparison of flow velocity and temperature before and after filtering and error analysis.
Flow velocityTemperatureBefore filteringAfter filteringErrorError analysis (%)Before filteringAfter filteringErrorError analysis (%)10100.00025250.00010.210.02640.171.7025.325.01490.291.1310.110.03480.070.6525.525.03770.461.819.89.9954-0.20-1.9924.925.0301-0.13-0.5210.210.03220.171.6525.325.04350.261.0110.110.04490.060.5525.125.04630.050.2110.210.05790.141.3925.325.04910.250.9910.110.06610.030.3325.225.05650.140.571010.0531-0.05-0.532525.0537-0.05-0.21Table 4
Comparison of flow velocity and temperature before and after filtering and error analysis.
Speed of soundTime differenceBefore filteringAfter filteringErrorError analysis (%)Before filteringAfter filteringErrorError analysis (%)1494.4631494.4630.000895.4884895.48840.0001495.2341494.5010.730.05912.4562897.80614.651.611495.7441494.561.180.08902.8941898.4884.410.491494.2041494.54-0.34-0.02877.8824894.983-17.10-1.951495.2341494.5750.660.04912.4562898.23714.221.561494.721494.5820.140.01904.1313899.3654.770.531495.2341494.5890.640.04912.4562900.52111.941.311494.9771494.6080.370.02903.8204901.2322.590.291494.4631494.601-0.14-0.01895.4884900.077-4.59-0.51The Kalman method is used to filter the data. By comparing the data before and after the processing, it is found that the data before and after the filtering of different influencing factors are relatively small. The errors in the comparison are shown in the following Figures8–11, and there is a comprehensive analysis of the error. It can be found that by analyzing the error trend of the flow velocity, the flow velocity error analysis diagram shown in Figure 8 is obtained.Through the analysis of the temperature error trend, the temperature error analysis chart shown in Figure9 is obtained.By analyzing the error trend of sound velocity, the sound velocity error analysis diagram shown in Figure10 is obtained.By analyzing the error trend of the time difference, the time difference error analysis chart shown in Figure11 is obtained.It can be found from the data that the absolute value of the error of the data is basically below 2%, and the error analysis of most of the data is about 1%. It shows that the error of the data meets the needs of the existing data analysis.


### 3.2. Actual Experimental Results and Analysis

The Kalman method is used to filter the data. By comparing the data before and after the processing, it is found that the data before and after the filtering of different influencing factors are relatively small. The errors in the comparison are shown in the following Figures9–12, and there is a comprehensive analysis of the error. It can be found that the flow speed factor has a greater impact on the accuracy of the ultrasonic water meter in Figure 12. The speed of sound has a small influence on the ultrasonic water meter, so the data is in line with the actual situation, indicating that the accuracy of the data and the establishment of the data model are better. During the application of the ultrasonic water meter, it is necessary to strengthen the control of the flow speed to prevent the change of the flow speed of the ultrasonic water meter from causing a large change in the performance of the ultrasonic water meter, which will affect the application of the water meter. Through the comparison of four factors, it can be found that the error analysis data of the speed of sound before and after filtering is about 0.04%, and the impact on the ultrasonic water meter can be neglected. If necessary, it can reduce the influence of factor propagation on the ultrasonic water meter to achieve the purpose of increasing the performance of the water meter.By comparing the error before and after filtering the four factors of flow velocity, temperature, sound velocity, and time difference, it can be found that there are negative numbers among them. After correcting the data, the following Figure13 is obtained.Figure 13
The corrected error analysis diagram.It can be seen from Figure13 that the main impact on the ultrasonic water meter is the difference in flow rate and time. Temperature and sound velocity have little effect on the performance of the ultrasonic water meter. When designing an ultrasonic water meter, it is mainly necessary to consider the impact of flow rate and time difference on the performance of the ultrasonic water meter. Secondly, we consider the influence of temperature on the performance of ultrasonic water meters. The effect of sound velocity on ultrasonic water meters can basically be ignored.


## 3.1. Feasibility Verification of Proposed Algorithm

After processing the data in Table2, the original data and error data in the following Tables 3 and 4 are obtained. From the data, it can be found that the absolute value of the error of the data is basically below 2%, and the error analysis of most of the data is around 1%. It shows that the error of the data satisfies the needs of the existing data analysis.Table 3
Comparison of flow velocity and temperature before and after filtering and error analysis.
Flow velocityTemperatureBefore filteringAfter filteringErrorError analysis (%)Before filteringAfter filteringErrorError analysis (%)10100.00025250.00010.210.02640.171.7025.325.01490.291.1310.110.03480.070.6525.525.03770.461.819.89.9954-0.20-1.9924.925.0301-0.13-0.5210.210.03220.171.6525.325.04350.261.0110.110.04490.060.5525.125.04630.050.2110.210.05790.141.3925.325.04910.250.9910.110.06610.030.3325.225.05650.140.571010.0531-0.05-0.532525.0537-0.05-0.21Table 4
Comparison of flow velocity and temperature before and after filtering and error analysis.
Speed of soundTime differenceBefore filteringAfter filteringErrorError analysis (%)Before filteringAfter filteringErrorError analysis (%)1494.4631494.4630.000895.4884895.48840.0001495.2341494.5010.730.05912.4562897.80614.651.611495.7441494.561.180.08902.8941898.4884.410.491494.2041494.54-0.34-0.02877.8824894.983-17.10-1.951495.2341494.5750.660.04912.4562898.23714.221.561494.721494.5820.140.01904.1313899.3654.770.531495.2341494.5890.640.04912.4562900.52111.941.311494.9771494.6080.370.02903.8204901.2322.590.291494.4631494.601-0.14-0.01895.4884900.077-4.59-0.51The Kalman method is used to filter the data. By comparing the data before and after the processing, it is found that the data before and after the filtering of different influencing factors are relatively small. The errors in the comparison are shown in the following Figures8–11, and there is a comprehensive analysis of the error. It can be found that by analyzing the error trend of the flow velocity, the flow velocity error analysis diagram shown in Figure 8 is obtained.Through the analysis of the temperature error trend, the temperature error analysis chart shown in Figure9 is obtained.By analyzing the error trend of sound velocity, the sound velocity error analysis diagram shown in Figure10 is obtained.By analyzing the error trend of the time difference, the time difference error analysis chart shown in Figure11 is obtained.It can be found from the data that the absolute value of the error of the data is basically below 2%, and the error analysis of most of the data is about 1%. It shows that the error of the data meets the needs of the existing data analysis.


## 3.2. Actual Experimental Results and Analysis

The Kalman method is used to filter the data. By comparing the data before and after the processing, it is found that the data before and after the filtering of different influencing factors are relatively small. The errors in the comparison are shown in the following Figures9–12, and there is a comprehensive analysis of the error. It can be found that the flow speed factor has a greater impact on the accuracy of the ultrasonic water meter in Figure 12. The speed of sound has a small influence on the ultrasonic water meter, so the data is in line with the actual situation, indicating that the accuracy of the data and the establishment of the data model are better. During the application of the ultrasonic water meter, it is necessary to strengthen the control of the flow speed to prevent the change of the flow speed of the ultrasonic water meter from causing a large change in the performance of the ultrasonic water meter, which will affect the application of the water meter. Through the comparison of four factors, it can be found that the error analysis data of the speed of sound before and after filtering is about 0.04%, and the impact on the ultrasonic water meter can be neglected. If necessary, it can reduce the influence of factor propagation on the ultrasonic water meter to achieve the purpose of increasing the performance of the water meter.By comparing the error before and after filtering the four factors of flow velocity, temperature, sound velocity, and time difference, it can be found that there are negative numbers among them. After correcting the data, the following Figure13 is obtained.Figure 13
The corrected error analysis diagram.It can be seen from Figure13 that the main impact on the ultrasonic water meter is the difference in flow rate and time. Temperature and sound velocity have little effect on the performance of the ultrasonic water meter. When designing an ultrasonic water meter, it is mainly necessary to consider the impact of flow rate and time difference on the performance of the ultrasonic water meter. Secondly, we consider the influence of temperature on the performance of ultrasonic water meters. The effect of sound velocity on ultrasonic water meters can basically be ignored.



---

*Source: 3580376-2022-01-06.xml*