Issue 
Int. J. Metrol. Qual. Eng.
Volume 15, 2024



Article Number  13  
Number of page(s)  8  
DOI  https://doi.org/10.1051/ijmqe/2024014  
Published online  13 August 2024 
Research article
Remote water meter calibration based on weighted least squares algorithm
^{1}
College of Quality and Safety Engineering, China Jiliang University, Hangzhou, PR China
^{2}
Ningbo Metrology and Testing Institute, Block E, Jiangnan Road, No.1588, 315048 Zhejiang, China
^{*} Corresponding author: zhoujuan@cjlu.edu.cn
Received:
18
July
2023
Accepted:
4
July
2024
In response to issues such as poorfitting accuracy in the remote water meter measurement curve, unsatisfactory fitting effects, and challenges in depicting real data characteristics, a weighted least squares algorithm is proposed based on the remote water meter measurement error curves. Firstly, we have combined the remote water meter measurement error formula with the traditional least squares algorithm to generate an integrated algorithm. Subsequently, the weighting theory is introduced into the integrated mathematical model. The polynomial fitting curve parameters are then calculated by assigning different weights to the data under various flow rates. Simulation experiments are also conducted, demonstrating that the proposed algorithm exhibits higher curve fitting accuracy compared to the conventional least square method. It can accurately analyze the metering performance of remote water under different working conditions and precisely measure its metering error.
Key words: Remote water meter / metrological verification / error of indication / weighted least squares algorithm
© J. Zhou et al., Published by EDP Sciences, 2024
This is an Open Access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
1 Introduction
Serving as a crucial element in modernized urban automated metering and charging systems, the remote water meter boasts advantages such as simplicity, speed, accuracy, and timeliness. It finds widespread application in the daily lives of residents. As a prerequisite before leaving the factory, the accuracy of the remote water meter measurement's error curve has become a crucial criterion for staff to analyze water meter performance and statistical flow data [1–3]. Remote water meter measurement errors are generated during the measurement process and are used to discuss the reliability, accuracy and calibration of water meters. Due to the nonlinear nature of the remote water measurement's metering error curve, which conventional mathematical formulas can’t express, staff can only conduct water meter calibration against the traditional metering error fitting curve during remote water measurement's metering error statistics. This leads to lower calibration accuracy and challenges in meeting the statistical requirements of daily water meter metering projects [4].
Presently, scholars have conducted extensive research on polynomial curve fitting methods. Zhou et al. [5] have proposed an empirical fitting formula for the water meter error curve, which is an effective solution to the problem of accurately estimating the water meter error when there are fewer flow points for verification. The result confirms that the formula can better restore the change of water meter error. Li et al. [6] propose a calibration scheme for chassis monitoring system based on polynomial curve fitting, and the results show that the proposed calibration scheme can effectively improve the accuracy of various monitoring circuits inside the chassis. Yao [7] uses the calibration method based on fitting linear equations, divides the flat part of the curve into a number of calibration segments, and fits them with the corresponding linear equations. This ensures that the water meter error curve is controlled within a small error range and that calibration efficiency is significantly improved. However, the above documented methods are not suitable and accurate for the calibration of remote water measurement. Literature [8–10] proposes an adaptive segmented curve fitting localization algorithm based on the influence of environmental factors to enhance curve fitting accuracy. Nevertheless, this algorithm tends to overlook data points with less impact on the fitted curves, resulting in a somewhat onesided consideration.
In literature [11–13], a polynomial algorithm based on weighted least squares is suggested by analyzing the characteristics of the target data to reduce error in the curve fitting process through assigning different weight ratios to the data. However, the precise size of the weights assigned to the data points is not explicitly defined in the modeling process, which makes the concept of weights somewhat ambiguous. Yin et al. [14] propose a binary amplitude calibration method based on least square method. The experimental results show that this method can accurately calculate the calibration coefficient and realize the calibration of the amplitude. Tao et al. [15] has achieved further calibration of the calibration system based on leastsquares fitting for environmental and component parameter deviations, enabling highprecision measurements in the voltage (0–10 V) and current (0–150 A) ranges. In order to solve the calibration problem of ultrashort baseline installation deviation, Zhao et al. [16] propose the constrained least square method. Wang et al. [17] use cubic curvefitting compensation curves to compensate the builtin realtime clock (RTC) module of the meter SoC chip to meet the required accuracy. Accurately characterizing the remote water measurement error curve using the conventional least squares method is challenging due to the influence of actual water meter calibration factors. Efficiently recovering remote water meter characterization error curves from limited calibration data is an urgent problem to be solved [18,19].
In this research, a novel weighted least squares algorithm based on the error curve of the remote water meter measurement is proposed. In the initial stage, the remote water used for the experiment is calibrated, and the error data at several experimental flow rates are calculated. Subsequently, the error data of these points is sorted, and the mathematical model is obtained by combining the water meter calibration formula with the conventional least square’s method. Then, the weighting theory is introduced to fit the error curve of the remote water meter measurement, resulting in the weighted least squares algorithm. Finally, several water meters are calibrated, and curve fitting of error data is carried out to simulate the experiments.
2 Curve fitting algorithms for remote water measurement errors
Despite the numerous studies on the characteristics of polynomial fitting curve changes, no effective curve fitting algorithm has been proposed to address the lack of accuracy in fitting the error curve of remote water measurement table values. This research proposes a novel weighted least squares algorithm based on the error curve. The curve fitting algorithm for the remote water measurement error is illustrated in Figure 1.
Fig. 1 Flowchart of curve fitting algorithm for remote water measurement error. 
2.1 Leastsquares model combined with the equation for the error of the indication
Assuming that the error data for remote water meter measurements is (x_{i}, y_{i})(i=0,1,2…,m), the least squares method is to consider the approximation function S(x_{i}) and the error between the indication of the value and the error (x_{i},y_{i}). The relationship is expressed in equation (1):
In equation (1), R_{i} represents the residuals in the least square’s framework, i.e., the fitting function S(x_{i}) for the actual observations y_{i} of the fitting error; S(∙) represents the approximation function;x_{i} (i=0,1,2,⋯,m) represents the experimental flow point; y_{i} represents the actual water volume corresponding to the experimental flow point, and y_{i} is a numerical value, which can be either positive, negative or zero; the values of i range from i=0,1,2,⋯,m, where m is the total number of experimental flow points.
In order to fit the experimental data using the polynomial P_{n} (Q) and solve the polynomial coefficients through the leastsquares method, aiming to establish an appropriate mathematical model for the error data in remote water meter measurement, the data (x_{i},y_{i}) is transformed into (Q_{i},D_{i})(i=0,1,⋯m), with Q_{i} denoting the experimental flow point x_{i} and D_{i} denoting the actual water volume corresponding to the experimental flow point. By solving P_{n} (Q)∈φ, where φ represents the set of functions consisting of all polynomials with degree not greater than n. The sum of squares of the errors P(Q_{i})D_{i} (i=0,1,⋯m), is minimized, namely:
In equation (2), P_{n} (∙) represents the fitting polynomial used for the experiment; a_{k} represents the correlation coefficient of the fitting polynomial; k represents the order of each term in the polynomial; Q^{k} represents the term to the kth power of Q in the fitted polynomial P_{n} (Q).
Integration of equation (2) under the preexisting conditions yields:
In equation (3), I represents the multivariate function of (a_{0}, a_{1}, ⋯, a_{n}), n represents the highest number of times we chose to fit the polynomial.
The above problem can be transformed into a problem of solving the extremum of I(a_{0}, a_{1}, ⋯, a_{n}) via taking a partial derivation of I:
In equation (4), j is an indicator that denotes the partial derivative of the objective function I with respect to the polynomial coefficients a_{j}; Q_{ij} represents the jth power of Q at the experimental flow point i.
Expressing equation (4):
Combining equation (5) with the flow points of the remote water meter, the corresponding improved system of linear equations, expressed as a matrix:
The matrix of equation (6) is changed to the form of equation with the expression is given below:
2.2 Improved weighted least squares algorithm modelling
After completing the calculation of the conventional least square’s method and the remote water meter measurement data along with the metering error, and through the analysis of the characteristics of the detected flow points, a higher weight is assigned based on higher measurement accuracy, and a lower weight is assigned to those with low measurement accuracy. A weighting operation is carried out on the measured value of each water meter.
To better assess the accuracy of the selection of weighting indicators, the mean value of the remote water metering error data corresponding to a number of experimental flow points obtained in the test process were calculated. The specific calculation formula is as follows:
In Equation (8), E_{i} (i=0,1,2…,n) represents the mean value of the remote water measurement error data corresponding to the experimental flow point.
After determining the mean value of the sample, the next step is calculating the variance of the metering error for each experimental flow point. The variance of the subsample of the remote hydrometer indication error is:
The coefficient of variation method is an objective assignment that uses the variability of the data points to determine the weights. The inverse of the coefficient of variation as a weight not only effectively reduces the impact of noise and outliers on the model (noise and outliers with large coefficients of variation will have correspondingly lower weights, and this weighting makes the model focus more on data points with high reliability, which enhances the robustness of the model), but also reduces the negative impact of heteroskedasticity on the fitted results by assigning higher weights to data points with low variability , thus reflecting the importance of more stable and reliable data points. The inverse of the coefficient of variation was selected to estimate the weights of the individual water measurement values, i.e.:
In equation (10), V_{i} represents the volume of increase (or decrease) recorded on the indicating device during the calibration time; C_{Vi} is the coefficient of variation of the subsample of remote water meter value errors at the corresponding experimental flow point i; ω_{i} represents the weight assigned to the water meter measurements at the experimental flow point i, which is estimated by the reciprocal of the coefficient of variation C_{Vi}.
After assigning different weights to the remote water meter measurement error data, the matrix of equation ( 6) is multiplied by the corresponding weights in order to obtain the following polynomial relationship matrix equation for the remote water measurement error:
Similarly, the matrix in equation (11) is transformed into the following representation:
In equation (12), the matrix W represents a diagonal array of i×i, and i represents each experimental flow point for the water meter.
The matrix W of equation (13) is shown below:
In equation (13), W=diag(ω_{1},ω_{2},⋯,ω_{i}).
Combined with the least square’s solution formula, the formula for the weighted least squares solution for equation (12) is determined as follows:
In equation (15), C=W^{T}W, which is the weight matrix.
By solving the matrix of computational equation (15), a_{k} is obtained to finalize the curve fitting and polynomial parameterization of the error in the value of the remote water meter measurement.
3 Experimental validation
3.1 Data acquisition
This experiment utilizes a sampling survey to analyze and screen the data from a water meter factory’s qualified remote water meter value, ensuring that the distribution of the randomly selected indication error data shows uniformity [20–22]. The remote water meter measurement verification site is shown in Figure 2.
According to the JJG 1622019 calibration specification, four groups of flow parameters are generally selected to characterize the data characteristics of the remote water meter measurement error, including: minimum flow rate Q_{1}, divided flow rate Q_{2}, Common flow Q_{3}, and overloaded flow Q_{4}. In this study, considering the larger data span between Q_{2} and Q_{3} in the actual water indication value verification, two additional flow points, 0.35（Q_{2} + Q_{3} ） and 0.7（Q_{2} + Q_{3} ）, are added to the original four flow points, recorded as Q_{5} and Q_{6} [23–25]. The range and meaning of each experimental flow point are shown in Table 1.
Fig. 2 Remote water meter verification site. 
Range and meaning of each experimental flow point.
3.2 Experimental design
The verification of remote water meter measurement and the calculation process of indication error were carried out under the experimental conditions of 2 5℃ and 0.3 MPa pressure, and the starting flow rate was set to –50% [26–28]. A number of remote water meters with a nominal diameter of DN15 of different service life were randomly selected as the verification water meters, and the volume method was used to check the remote water measurements. Firstly, install the remote water meter measurement on the water indication value verification device, and pass in the water flow for verification. In the process of eliminating the existence of air in the piping system of the test instrument, the impact of air on the water indicated value of the test is eliminated; then, let the remote water meter measurement operate smoothly at the specified test flow rate for a period of time, and then adjust the flow control valve to test the flow rate of the test point, so that the water flows through the remote water meter measurement for testing and then into the device's containers; and finally, determine the corresponding water volume, read and record the remote water meter measurement indication value and the volume of water flowing into the container. The remote water meter measurement verification process is shown in Figure 3.
According to the formula for calculating the value error of the water meter and the data from each experimental flow point, compute the metering error data at each experimental flow point for the remote water meter. The remote water measurement metering error calculation formula is:
In equation ( 15), E represents the relative display error of the test remote water meter measurement; V_{i} represents the volume of increase (or decrease) recorded on the indicating device during the test time in m^{3} or L; and V_{a} represents the volume of the actual water volume of the workload apparatus (or standard meter) during the test time in m^{3} or L.
Fig. 3 Remote water measurement verification process. 
3.3 Simulation experiment and result analysis
Based on the six experimental flow points Q_{1}, Q_{2}, Q_{3}, Q_{4}, Q_{5} and Q_{6} specified in subsection 3.1, the remote water meter indication values at the flow points of 0.025, 0.04, 0.9, 1.8, 2.5, and 3.125 (L)⁄(h) are verified. In accordance with JJG 1622019 calibration specification, three tests are carried out on the three flow points Q_{1}, Q_{2}, and Q_{3} with repeatability requirements, and two tests are carried out on the three additional flow points (repeatability is not required in the calibration specification) to derive the corresponding metrological errors, and the average value is calculated to ensure the accuracy and reliability of the experiment. Key parameters such as flow rate, number of tests, metrological error and average error is recorded in detail. The data obtained from the remote water meter calibration are shown in Table 2.
In the process of model order selection, if the order of fit is too low (e.g., 1st order, 2nd order), it will not capture the complexity of the data, resulting in underfitting. If the order is increased to 7, the flexibility of the model increases, but it leads to overfitting. An overfitted model performs well on training data but performs poorly on new data because it captures noise in the data rather than the true pattern of the data. During the simulation process of fitting the remote water meter measurement error curve, the fitted curve is smoother as the number of polynomial curve fitting increases. By utilizing the appropriateness degree to select the order of the fitting polynomial, the final weighted least squares algorithm for fartransmission water meter measurement error curve fitting under the sixthorder curve fitting condition is found to have a better effect on the smoothness and accuracy of the fitted curve. In this study, the sixthorder weighted curve fitting and the conventional least squares method are chosen to simulate the curve fitting of the experimentally obtained value error data. The comparison results of the simulated curve fitting between the proposed method and the conventional least squares method are shown in Figure 4.
According to the simulation experiment results in Figure 4, the sixthorder fitting curve results of the improved weighted least squares algorithm and those of the conventional least squares algorithm are analyzed. The two types of curvefitting error data are recorded at each flow point and compared with the correct error to derive the corresponding deviation value, so as to validate the curvefitting accuracy effect of the two methods. The comparison results are shown in Table 3.
The improved weighted least squares algorithm in Table 3 shows smaller deviation values across multiple experimental flow points, indicating more accurate fitting of the measurement error curve. Compared to the conventional least squares method, the proposed method demonstrates higher fitting accuracy for remote water measurement, effectively avoiding data offset problems during curve fitting and accurately reflecting the trend of the value error curve. This verifies the effectiveness and accuracy of the proposed method for evaluating remote water measurements.
Verification and error calculation data of remote water measurement value.
Fig. 4 Error curves for control fitting of remote water measurement error. 
Comparison of fitting curve errors between sixthorder weighted least squares fit and sixthorder least squares fit.
4 Conclusion
Aiming at the problems of low accuracy and long manual timeconsumption in the fitting curve of remote water meter measurement error, a weighted least squares algorithm based on the remote water meter measurement error curve is proposed. The water measurement error calculation formula and experimental flow points are combined with the least squares method to realize the enhancement of the conventional least squares method; then different weights are assigned to different experimental flow points, and the weighting operation is carried out on each experimental flow point, which results in the improved weighted least squares algorithm. After completing the construction of the model, the MATLAB simulation software is used to curvefit the improved weighted least squares algorithm and the conventional least squares algorithm respectively, and the deviation values of the fitting results of the two are compared with those of the actual metering error to verify that the proposed method has a higher curvefitting accuracy.
Funding
This work was supported by research on automatic straightening technology and equipment development for highprecision slender shafts (GG18E050045).
Conflicts of interest
The authors declare no conflict of interest.
Data availability statement
The data that have been used are confidential.
Author contributions statement
Data curation: Juan Zhou, Shengwei Zhou and Zhibo Cen; Methodology: Juan Zhou, Shengwei Zhou and Shun Zhang; Supervision: Juan Zhou; Writingoriginal draft: Juan Zhou and Shengwei Zhou; Writingrevised draft: Juan Zhou and Shengwei Zhou.
References
 Q. Fu, Research on the application of remote water meter in water supply and drainage engineering: taking the installation of remote water meter in No. 1 Plot of Zabei District as an example, Jiangxi Build. Mater. 21, 255–256 (2017) [Google Scholar]
 X. Feng, D. Zang, L. Yan et al., Design on smart[r1] water meter system based on Cloud Computing, E3S Web Conf. 237 (2021) [Google Scholar]
 A. Amir, R. Fauzi, Y. Arifin, Smart water meter for automatic meter reading, IOP Conf. Ser.: Mater. Sci. Eng. 1212 (2022) [Google Scholar]
 Y. Liu, H. Li, J. Chen, Development of intelligent remote water meter based on NBIoT, Electr. Manufactur. 07, 33–36+50 (2021) [Google Scholar]
 X. Zhou, S.M. Liu, C.Y. Wang, Typical residential water meter metering error curve fitting and performance analysis, Water Supply Drain. 58, 27–31 (2022) [Google Scholar]
 H.B. Li, J.H. Wang, K.Y. Liu et al., A calibration scheme for chassis monitoring system based on polynomial curve fitting, Inf. Technol. Inform. 06, 21–24 (2023) [Google Scholar]
 Y. Ling, Calibration method of water meter error curve based on fitting equation, Shanghai Measur. Test. 40, 2–4 (2013) [Google Scholar]
 F. Lin, M. Zhu, Adaptive segmented curve fitting indoor positioning algorithm based on RSSI, Sens. Microsyst. 34, 151–153 (2015) [Google Scholar]
 Z. Tao, Y. Jiang, Y. Cheng, An adaptive highorder piecewise polynomial based sparse grid collocation method with applications, J. Comput. Phys. 433 (2021) [Google Scholar]
 Z. Jiao, W. Xiong, L. Zhang et al., Target Location algorithm for wireless sensor networks based on Curve fitting, J. Southeast Univ. (Natural Science Edition). S1, 249–252 (2008) [Google Scholar]
 Y. Chen, G. Weng, An active contour model based on local prepiecewise fitting image, Optik 248 (2021) [Google Scholar]
 F. Wei, Y. Cai, J. Tang et al., Automatic identification method of low voltage distribution station topology based on weighted least square method, Power Capacitor Reactive Power Compens. 42, 122–129 (2021) [Google Scholar]
 B. Mischa, J. Dustin Roman, J. Philipp, Application of Taylor series combined with the weighted least square method to thermodynamic topology optimization, Comput. Methods Appl. Mech. Eng. 393 (2022) [Google Scholar]
 Z.Y. Yin, M.J. Zhang, X.R. Feng et al., An amplitude calibration method for broadband sampling oscilloscopes, J. Test Technol. 38, 203–209 (2024) [Google Scholar]
 W.Q. Tao, Y. Wu, J. Cao et al., Design of dualcalibration capacitive calibration system based on internet of things, Instrum. Technol. Sens. 01, 59–64 (2023) [Google Scholar]
 J.B. Zhao, X.Y. Ge, J. Li et al., Calibration of ultrashort baseline mounting deviation based on constrained least squares, Ship Sci. Technol. 43, 131–136 (2021) [Google Scholar]
 Y.P. Wang, D.Z. Zhang, Y.B. Qiu, Application of least squares curve fitting for RTC compensation in smart meters, Autom. Instrum. 38, 81–84+89 (2017) [Google Scholar]
 Q. Cheng, J. Hu, J. Wang et al., UAV weighted least squares positioning algorithm based on data driven, Command Inf. Syst. Technol. 11, 76–80 (2020) [Google Scholar]
 S. Xiong, J. Zhang, B. Zhang et al., Effects of environmental and electrical factors on metering error and consistency of smart electricity meters, Appl. Sci. 11 (2021) [Google Scholar]
 D. Lan, J. Zhu, Q. Luo et al., Research on the error analysis method of water supply overall measurement in water supply network, Water Supply Drain. 56, 125–131 (2020) [Google Scholar]
 X. Zhou, S.M. Liu, C.Y. Wang, Measurement error curve fitting and performance analysis of typical residential water meter, Water Supply Drain. 58, 27–31 (2022) [Google Scholar]
 X. Yin, G. Tian, Measurement error analysis of volumetric gas meter without temperature compensation, in 2021 6th Energy, Proceedings of the International Conference on Environmental and Geosciences, Shanghai Laixi Conference Service Co., Nanjing, China, 2021, pp. 51–56. [Google Scholar]
 L. Yao, Calibration method of water meter error curve based on fitting equation, Shanghai Metrol. Test. 40, 2–4 (2013) [Google Scholar]
 X. Kong, X. Zhang, N. Lu et al., Online smart meter measurement error estimation based on EKF and LMRLS method, IEEE Trans. Smart Grid. 12 (2021) [Google Scholar]
 E. Álvaro, V. Adriana. Determination of uncertainty in measuring instruments in electrical engineering programs, TecnoLógicas 22 (2019) [Google Scholar]
 J. Chen, Research on control strategy of apparent leakage in water supply pipe network system, North China University of Water Resources and Hydropower (2018) [Google Scholar]
 L. Yan, Analysis and prediction of water Supply Pipe network leakage, Hefei University of Technology (2009) [Google Scholar]
 L. Dai, Uncertainty evaluation of water meter, Ind. Metrol. 30, 74–75 (2020) [Google Scholar]
Cite this article as: Juan Zhou, Shengwei Zhou, Shun Zhang, Zhibo Cen, Remote water meter calibration based on weighted least squares algorithm, Int. J. Metrol. Qual. Eng. 15, 13 (2024)
All Tables
Comparison of fitting curve errors between sixthorder weighted least squares fit and sixthorder least squares fit.
All Figures
Fig. 1 Flowchart of curve fitting algorithm for remote water measurement error. 

In the text 
Fig. 2 Remote water meter verification site. 

In the text 
Fig. 3 Remote water measurement verification process. 

In the text 
Fig. 4 Error curves for control fitting of remote water measurement error. 

In the text 
Current usage metrics show cumulative count of Article Views (fulltext article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.
Data correspond to usage on the plateform after 2015. The current usage metrics is available 4896 hours after online publication and is updated daily on week days.
Initial download of the metrics may take a while.