Fault Prediction of Online Power Metering Equipment Based on Hierarchical Bayesian Network

The failure rate assessment of online metering equipment is significant for power metering. For traditional methods, the performance of the model is not satisfactory especially in the case of small samples. In this paper, an online power measuring equipment fault evaluation method based on Weibull parameter hierarchical Bayesian model is proposed. Firstly, the z-score method is used to eliminate outliers in the raw failure data. Then, a generalized linear function with variable intercept is established according to the characteristics of failure data. The information of each region is merged using the characteristics of multi-layer Bayesian network uncertainty reasoning. The model parameters are updated based on the Markov chain Monte Carlo method. Thereafter, the trend of failure rate is provided with time-dependent. Finally, the proposed method is verified by the failure samples of the online measurement equipment in three typical environmental areas. The accuracy and validity of the hierarchical Bayesian model is verified by a series of experiments.


Introduction
Energy metering equipment, such as electric meters and collectors, have a large amount and wide distribution in the power grid. As the nerve endings of the smart grid, electricity meters play an irreplaceable role in electricity information collection and energy monitoring [1]. Meanwhile, the reliability of the metering equipment is also related to the safety of household electricity consumption. Inaccurate energy metering affects the strategic planning of power generation, transmission and use of electricity [2]. The failure rate evaluation of the metering device over time and the fault are limited because it is difficult to collect large amounts of sample information. Therefore, it is of great significant to establish a scientific and reliability evaluation scheme for the reliability design of metering equipment.
In recent decades, a large number of methods are applied to target prediction and fault analysis. Generally, these methods can be classified into two categories, namely deterministic method and probability method [3]. The Support Vector Regression (SVR) model is employed to identify fault and predict the remaining life of the reciprocating compressors based on the sensory data [4]. In addition, accurate bearing remaining useful life of machine's breakdown and maintenance's cost is proposed based on the artificial neural network [5]. These algorithms and methods achieve high precision prediction. However, enough samples are required to train the models before the effective prediction results is given. Moreover, the data is relatively simple, which limits its accuracy. The Principal Component Analysis (PCA) is utilized to select fault-relevant variable [6], so that a subset of variables based on training and validation data sets can be obtained to achieve better possible performance [7]. But this method has an unsatisfactory performance, especially in the absence of prior information. Consequently, the deterministic method lacks probability information for uncertain problems.
Probabilistic methods, one that can detect uncertainty in the data and provide more information, often used for failure analysis [8]. Fault Tree Analysis (FTA) is one of the most commonly used probabilistic methods. A system level electric field exposure assessment by FTA is proposed in [9]. However, the detailed system structure is needed for fault tree analysis. The Gaussian Process (GP) is another method for probability analysis [10]. The remaining useful life prediction for service units is used to improve the accuracy [11]. But the unexplained nature of this nonparametric model limits its application. Then, the Bayesian estimation is widely used in failure rate analysis [14]. For example, a Bayesian method is proposed for the hazard rate analysis of electronic devices [15]. Moreover, the fuzzy evidence theory, can be combined with Bayesian to solve the problem of insufficient samples [12] [13]. Intuitively, probability method can provide more information, such as confidence interval and quantile, and is more suitable for the processing of small sample data.
To achieve failure rate analysis of online metering equipment, a Hierarchical Bayesian Network (HBN) is proposed based on a small number of electrical meters fault samples. A segmented Weibull parameter model is introduced for failure rate analysis at different times to better fit the data. Considering the different environments in different regions, part of the information fusion method is used in measurement equipment. Moreover, the real fault samples in three typical environments are used to verify the validity of HBN. The reliability of the metering device is calculated, and the parameters of the model are interpretable compared to traditional FTA and GP models.
The remaining part of this paper is organized as follows: Section II describes the outlier detection method in sample data. The proposed Weibull hierarchical Bayesian model is presented in Section III. Thereafter, the fault data of electrical meters in different regions is analyzed in Section IV. Finally, the conclusion is presented in Section V.

Failure rate data outlier detection
In the actual process of data collection, abnormal values may exist in the raw failure rate data due to the operational errors of researchers. The outliers not only affect the model's evaluation of the power metering equipment reliability, but also easily cause the model to be overfitting [16]. Traditional failure assessment methods are difficult to balance in small sample, failure rate data with missing data and outliers.
In order to clean up the abnormal value of the raw failure rate data and reduce the information loss, the Zscore method is used to clean the outliers in the fault rate data. The Z-score method determines the outliers by solving the relative standard distance of the data from the mean, which is suitable for the outlier detection under small samples.
Let Y={y s,t,j }, where y s,t,j denotes the fault rate of the measuring device measured in the j th time, t=1,...,L, j=1 ,...,N, and in the s area at the measurement time t. The standard deviation σ t of the failure rate data for each measurement is: where N is the total number of failure rate data when the measurement time is t, u s,t,j is the average of the failure rate data for each measurement and y s,t,j denotes the fault rate of the measuring device measured in the jth time. Considering the discontinuity of the sample data and reducing the loss of valid data, a window of length three is used to analyze the outliers in failure rate data, and the window is composed of three measurements of [t, t+1, t+2]. That is, the standard deviation of three consecutive measurements is calculated each time, and the Z score Z j of each data point y s,t,j is calculated as , , , , where u ' s,t,j are the mean failure rate of three consecutive measurements, σ ' t is the standard deviation of u s,t,j = u ' s,t,j in equation (1), at which point Z j can be regarded as obeying the normal distribution N(0, 1). Finally, the threshold for determining the abnormal data is set to three times the standard deviation of N(0, 1). The outliers of the original failure rate data with the score |Z j | greater than the threshold is replaced by the mean u ' Then the failure rate data Y * = { y * s,t,j } without the outlier is obtained.
3 Weibull parameter model for metering equipment failure rate 3

.1 Other Recommendations
The commonly used online power metering equipment includes electrical meters, power quality detecting devices and concentrators, etc. This paper takes the electrical meter as the target to analyze. The electric energy metering equipment is a high-precision measuring instrument. The damage of the weakest link of the system will directly lead to the failure of the measuring equipment. The Weibull distribution is used as the fault description of the commonly used electronic instruments [17], so the Weibull distribution is used to fit the electric energy meter data, the probability density function of Weibull is where t is the fault time, λ is the scale parameter, α is the shape parameter, and χ is the location parameter. We set χ to 0 considering that the failure starts after t=0. Then the χ is reduced to a two-parameter Weibull distribution. When the Weibull distribution probability density function f(t) is integrated, the value is always not less than 0, which is consistent with the condition that the number of failures is not less than 0.
The observed data Y * obeys the Weibull regression model, which can be expressed as Generally, the change of the shape parameter α indicates that the failure mechanism changes. Therefore, the shape parameter α is set to obey the fixed distribution function. At this time, the regression model can be established by changing the scale parameter λ in the Weibull regression model.
When the observed data Y * is the metering device fault data, the fault number Y * will change according to the time variable x. Therefore, Weibull distribution function will change, and a regression model can be established based on λ where β k is the regression coefficient, x k is the covariate.
Considering the condition that the scale parameter λ is greater than 0, the value of the regression coefficient is limited. To select a wider distribution parameter as the prior distribution of β k , the log() correlation function is used to limit the range where w i is the measurement error when measuring the number of failures Y * , i is the number of sub-sample categories divided by the HBN model based on the total sample information. The log(λ) range becomes (−∞, +∞), and λ is inversely solved from equation (4).
At this time, there is no limit to the prior distribution of β k . When the covariate changes to ∆x, the contribution to the scale factor becomes exp(∆xβ).

Structure of Hierarchical Bayesian Model
In order to realize the failure rate evaluation and prediction of the measuring equipment, Bayesian networks (BN) are used to fuse data from different regions. BN takes full advantage of early prior information and sample data information to achieve a full estimate of the latest events [18]. In particular, HBN takes advantage of information between levels to provide better data fitting capabilities [19].
For BN, the posterior probability density based on prior parameters θ is ( ) where f(Y * | θ) is the likelihood function of the Bayesian model, p(θ) is the model prior distribution. The HBN model refers to the different levels of data parameters elaborated by other layer parameters, which specifies another layer of prior knowledge for a layer of parameters.
The denominator in equation (8) is independent of the parameter θ. When the Weibull distribution is used as the likelihood function of the model, the parameter posterior distribution is proportional to the numerator of (8), and it can be further expressed as where p(θ|α, β, w i ) represents the prior distribution of the parameters α, β, w i .
In the Weibull distribution, the size of the parameter α determines the increase and decrease of the failure rate. When α>1, it indicates that the instrument is in the wear stage. And when α<1, which is suitable for the early failure stage of the instrument. Therefore, the parameter prior selection must meet certain conditions.
In the absence of any prior information α, according to the influence of α on the shape of Weibull distribution, the prior distribution f can be obtained by the HalfCauchy distribution.
where b is the scale parameter of the distribution, and equation (10) can be abbreviated as HalfCauchy(b).
For the regression coefficient β, the setting of the log correlation function avoids limiting the range of coefficient values, and the prior distribution f of the regression coefficient β can be set to normal distribution, which can be defined as where u is the normal distribution mean, 1/τ is the distribution variance. The measurement error w i value is small, so the prior distribution of w i may take a normal distribution with a small variance as well as the mean u = 0, and equation (11) can be abbreviated as N(u, 1/τ).
Substituting equation (10) and (11) into (7), the joint prior distribution of the parameters λ and α can be calculated as Similarly, substituting equation (12) and (3) into (9), the joint posterior distribution λ and α can be expressed as Then the posterior distributions of the parameters λ and α in the hierarchical Bayesian model are (15) After the parameter posterior distribution is obtained, the influence of the variation of the covariate x on the failure rate of the model can be reflected by the parameter mean value and the confidence interval. When the new covariate x changes to z, the fault value can be calculated based on the existing fault number Y * , and the posterior distribution of the parameter is ( )

Failure rate Prediction of Metering Equipment
When the equipment fails, the rate of failure change does not always obey the fixed distribution. At this time, the regression coefficient β can be segmented according to the trend of failures number x. Then β can be expressed as where σ is the time node at which the failure rate changes. Since only the trend of data can be observed, the failure rate change node cannot accurately specified. Thus, no information can be specified on the prior distribution σ where η 1 and η 2 are upper and lower limits of the density function. The regression model after segmentation can better follow the change of the failure rate of the metering equipment.   As we can see from Fig. 2 and 3, the failure rate increased in the first five years and decreased in the sixth year and the failure rate of XZ is slightly higher than XJ. Fig. 2-4 show that the failure rate of metering equipment varies in different provinces. Therefore, through modeling and analysis of this example, the reliability variation relationship of metering equipment in different provinces can be found and the accurate prediction results is given. In addition, the data of 2014 in

Model structure and experimental steps
The structure of the hierarchical Bayesian model for the failure rate of online power metering equipment is as follows: First floor: ~HalfCauchy α ( 10) Second floor: ~DiscreteUniform(3,6) σ According to the data of three provinces, the intercept i of formula (20) is set to 3 to reflect the difference of fault data of metering equipment in the three provinces. The covariant x takes one term, and the regression coefficient β x of the three provinces is set to the same value to reflect the commonness of the products produced by the same company. According to the change of data, the failure rate change node σ can be set be- Model solving: Combined simulation platform Pymc3, the MCMC posterior sampling method is used to get the target optimization parameter [21]. We use the NUTS sampling method to achieve fast convergence, where the HBN model sampling iterations are set to 10000, and the prefiring period is set to 2000. -Model verification: If the acceptance probability does not match the target, we than increase the number of samples or adjust the model prior distribution until it satisfies the acceptance probability.
In the process of establishing Markov chain by using MCMC sampling method to solve the Model, NUTS sampling has good effect on high-dimensional and long data, avoiding the influence of step size on sampling robustness and converges faster than Gibbs sampling method. Therefore, NUTS algorithm is used to sample the model to achieve fast convergence [22][23]. In order to verify the accuracy of the model, after solving the parameters of the prior distribution, the likelihood function is sampled to verify whether the posterior distribution of the failure rate conforms to the original failure rate data distribution. According to the posterior mean of the parameters, the prior parameters of the model are continuously adjusted to achieve the fitting of the model to the original failure rate data. Finally, the posterior distribution of linear function parameters with variable intercept is obtained, and the failure rate of metering equipment in the next year in three provinces is predicted respectively.

Experimental results analysis
The HBN model sampling iterations are set to 10, 000, and the pre-firing period is set to 2, 000. In order to verify the accuracy of the parameter results of the HBN model, the Maximum a Posteriori (MAP) estimate of the optimal solution is compared with the results of the HBN model. And Table I shows the results of the HBN model and the parameters calculated by MAP.
It can be seen from Table I that the intercept β difference of linear function is about 1, indicating that there is a certain difference in metering equipment in the three provinces, and this difference is related to the province. The difference of time coefficient early_β and late_β indicates that the increasing trend of failure rate has changed. In 2014, the change trend of failure rate of metering equipment changed, and the failure rate showed a downward trend before 2015. The value of measurement error w is small, which indicates indicating that the error in the measurement process has little influence on the failure rate of metering equipment. The error between the mean value of the HBN model and that of the MAP model is small, which indicates the validity of the HBN model.   Moreover, all the other methods only have good performance on partial data. For example, the Poisson model can follow the trend of the data in XZ and HLJ. However, it have poor performance in XZ, which has a lower failure rate. At the same time, the pooling HBN cannot follow the trend of failure rate in XJ due to the model assumes the same trend for data in all regions.
In order to accurately predict the failure rate of measuring equipment, the time data is set to 7, which means the failure rate in 2018. After the model is substituted, the mean value of the failure rate in 2018 can be predicted as follows: the average failure rate of measurement equipment in XZ is 2.531, the average failure rate in XJ is 0.778 and the HLJ is 2.546. The predicted failure rate is within the confidence interval of 2017, which indicates that the model has the ability of short-term prediction. In order to evaluate the effect of partial information fusion of HBN model and realize the evaluation of different models, the Widely Available Information Criterion (WAIC) is more accurate than the traditional DIC when considering the whole posteriori distribution of the model [24]. Table II gives the WAIC calculation values of the four models under the same linear function condition and the same observation data. and the weight of model is 0.95, which is much larger than the rest models. The SE of the proposed method (HBN) is slightly larger than other models. HBN has better and the smallest WAIC value, which means that its uncertainty is consistent with its accuracy. Thus the effectiveness of partial information fusion HBN model is demonstrated. Conversely, the rest of the models have higher WAIC values, including that the models cannot effectively fit the raw data. When the new electric energy meter equipment is put into use in the region, the failure rate of the electric energy metering equipment can be calculated according to equation (16). The reliability of the short-term prediction result of the new electric energy meter equipment is shown in Fig. 10. Fig. 10 shows that the reliability of the failure rate of the energy metering equipment decreases with time. After 6 years of operation, the reliability of the energy metering equipment is about 0.93, indicating that the type of energy metering equipment has a higher reliability under the three regional environmental conditions. In addition, the reliability curve approximates a straight line, indicating that the failure rate trend of the energy metering equipment is relatively flat in the short term. Moreover, the confidence interval of the reliability of the energy metering equipment is gradually increased, indicating that the uncertainty becomes large. Overall, the operation strategy does not need to change greatly.

Conclusion
By analyzing the fault data characteristics of online power metering equipment in different regions, a multi-bass Bayesian-based Weibull parameter regression model is established. Firstly, the Z-score method is used to clean the data outliers to reduce the interference of the outliers on the model. Then, according to the fault Reliability of electrical me 97.5% quantile Mean of reliability 2.5% quantile data of the three regions, the intercept variable regression model of partial information fusion is established, and the failure rate data change node is fully considered. In the case, the influence of time factor on the failure rate of metering equipment in the three regions is obtained, and the average forecasting rate of the metering equipment failure rate in the seventh year is given. The example results verify that the method can effectively evaluate the failure rate relationship between the measuring equipment and different areas, and prove the feasibility of the scheme. Prior selection in small samples remains a challenge, and future work will focus on parameter settings for small sample models.

Acknowledgment
This paper is supported by Research on influence and evaluation of key components on relay protection performance.