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.

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 [14]. 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 [710]. 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 [1113]. It has a wide range of applications in the fields of communication, navigation, guidance, and control [1416]. 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 [1719].

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 is , Kalman’s principle can be expressed by the following five formulas:

In formula (1),is the result of the previous state prediction,is the optimal result of the previous state, andis the current state control quantity; in formula (2),is the covariance corresponding toandis. The corresponding covariance,, represents the transposition matrix of, andis the covariance of the system process; the optimal estimation value of the current state () is;is 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 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 Table 1.

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 Figure 1.

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 Figure 2.

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 Figure 3.

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:

For the noise of the prediction process and the measurement process, there are adjustments for different variables, as follows:

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:

According to the above measurement matrix and assuming other initial states, the initial value of the matrix can be obtained, as follows:

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.

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.

longitude_fil(1) = y(1);
p_fil(1) = 1;
for t = 2:n
longitude_pre(t) = a longitude_fil(t-1);
p_pre(t) = a p_fil(t-1) + a’P;
K(t) = p_pre(t)H’inv(Hp_pre(t)H’ + Q);
longitude_fil(t) = longitude_pre(t) + K(t)(longitude(t)-Hlongitude_pre(t));
p_fil(t) = (1-K(t)H)p_pre(t);
end
for i =1:n
Err1(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 Table 2.

From 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 Figures 47, it can be very intuitive to see that the filtering effect is better.

It can also be seen from the above figure that the graphs in Figures 5 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 Figures 811. 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.

3.1. Feasibility Verification of Proposed Algorithm

After processing the data in Table 2, 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.

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 Figures 811, 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 Figure 9 is obtained.

By analyzing the error trend of sound velocity, the sound velocity error analysis diagram shown in Figure 10 is obtained.

By analyzing the error trend of the time difference, the time difference error analysis chart shown in Figure 11 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 Figures 912, 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 Figure 13 is obtained.

It can be seen from Figure 13 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.

Data Availability

The labeled dataset used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare no competing interests.

Authors’ Contributions

Fuqiang Zuo and Yu Liu contributed equally to this work.

Acknowledgments

This research was funded by the special fund of the State Key Joint Laboratory of Environment Simulation and Pollution Control under grant number 18K07ESPCT.