Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a stress error analysis method for an intelligent ammeter, which can reveal the internal relation between various stress factors and errors of the intelligent ammeter from the aspect of data by utilizing a Back-propagation error Back Propagation (BP) neural network optimized by an LM (Levenberg-Marquardt).
The invention also provides equipment and a storage medium with the intelligent ammeter stress error analysis method.
According to a first aspect of the invention, the method for analyzing the stress error of the intelligent ammeter is characterized by comprising the following steps:
acquiring stress data and error data of the intelligent electric meter;
determining typical stress data in the stress data of the intelligent ammeter;
sending the typical stress data and the error data thereof into a neural network for training to obtain a trained neural network;
and establishing error data relationships under different stress conditions by using the trained neural network.
The method for analyzing the stress error of the intelligent electric meter, provided by the embodiment of the invention, at least has the following beneficial effects: and (3) utilizing data acquired by the intelligent electric meter, and then sending the data into the BP neural network optimized by the LM for training, thereby obtaining the trained neural network for predicting the change relation of errors under different stress conditions.
According to some embodiments of the invention, the step of determining typical stresses in the stress data of the smart meter comprises:
carrying out standardization processing on the data;
calculating the contribution rate of each stress by using the data subjected to the standardization processing;
several stresses with relatively large contribution ratios are selected as typical stresses.
According to some embodiments of the invention, the typical stress comprises: temperature, humidity, air pressure, regional voltage conditions.
According to some embodiments of the invention, the sum of the typical stresses exceeds 95%.
According to some embodiments of the present invention, after the step of determining the typical stress in the stress data of the smart meter, the method further includes the steps of:
and processing the typical stress data and the error data thereof, and removing abnormal data to obtain processed data.
According to some embodiments of the invention, the step of processing the typical stress data and the error data thereof to remove the abnormal data to obtain processed data comprises:
arranging error data in the intelligent ammeter according to an acquisition time sequence to obtain x (t), and solving an average value mu and a standard deviation sigma;
rejecting abnormal data in the error data;
correcting sequence abnormality by utilizing average value interpolation;
and transforming the sample sequence of the stress by using a normalization method to obtain processed data.
According to some embodiments of the invention, the neural network used in the stress error analysis method of the smart meter is a BP neural network based on LM optimization.
According to some embodiments of the invention, the step of sending the processed data to a neural network for training to obtain a trained neural network comprises:
setting the stress parameters as input vectors;
setting the error of the intelligent ammeter as an output vector;
the actual error is set to the desired output vector.
According to some embodiments of the invention, the method further comprises:
predicting an estimation error by using the trained neural network;
and adding the estimated error to the reference error of the intelligent electric meter to be used as the error offset of the intelligent electric meter.
According to a second aspect of the invention, the stress error analysis device for the intelligent electric meter is characterized by comprising:
the data collection module can acquire stress data and error data of the intelligent ammeter;
the typical stress analysis module can determine typical stress data in the stress data of the intelligent ammeter;
the model training module can send the typical stress data and the error data thereof into a neural network for training to obtain a trained neural network;
and the relation analysis module can establish error data relation under different stress conditions by utilizing the trained neural network.
A terminal according to an embodiment of the third aspect of the present invention includes: the stress error analysis method for the intelligent electric meter is characterized by comprising a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the stress error analysis method for the intelligent electric meter.
The computer-readable medium according to the fourth aspect of the present invention is characterized in that computer software is stored in the computer medium, and when the software is executed, the method for analyzing the stress error of the smart meter can be implemented.
According to the stress error analysis method for the intelligent electric meter, disclosed by the invention, the relevance of various stresses and errors is analyzed by using a BP neural network algorithm optimized by an LM (Linear modeling). An additional error is introduced during error modeling, so that error model correction of the intelligent electric energy meter is realized. The method of the invention does not need excessive error calculation and error fitting in the past error analysis. By adopting the PCA idea, the phenomena of over-fitting and under-fitting are not easy to occur, the error analysis efficiency is improved, and higher reliability can be ensured. Therefore, the method of the invention can lead the error predicted value of the intelligent electric energy meter to have a higher confidence interval under certain conditions and lay a foundation for the error correction work of the intelligent electric energy meter.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, it should be understood that the orientation or positional relationship referred to in the description of the orientation, such as the upper, lower, front, rear, left, right, etc., is based on the orientation or positional relationship shown in the drawings, and is only for convenience of description and simplification of description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus, should not be construed as limiting the present invention.
In the description of the present invention, the meaning of a plurality of means is one or more, the meaning of a plurality of means is two or more, and larger, smaller, larger, etc. are understood as excluding the number, and larger, smaller, inner, etc. are understood as including the number. If the first and second are described for the purpose of distinguishing technical features, they are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
In the description of the present invention, unless otherwise explicitly limited, terms such as arrangement, installation, connection and the like should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific contents of the technical solutions.
As shown in fig. 1, fig. 1 illustrates the metering principle of a smart meter, in which the variation of the error is complicated under the influence of various factors, it is currently difficult to design a method capable of determining the meter error through a theoretical calculation. Most of the existing electric energy meter error analysis methods cannot consider the influence of the actual working environment and working conditions on the errors, so that the method has limitations.
In the analysis method, the data of various influence errors are abstracted into various stresses, the relation between the errors and the stresses is analyzed by an artificial intelligence method, the accuracy of error analysis can be improved, and a foundation is laid for the error compensation and correction work of the electric energy meter later. The details are as follows.
The first embodiment,
Referring to fig. 2, an embodiment of the present application provides a method for analyzing stress error of a smart meter, including the following steps:
and S100, acquiring stress data and error data of the intelligent electric meter.
When the data of the intelligent electric meter is acquired, the data need to be continuously acquired within a long period of time, and as much data as possible are acquired, so that the number of training sets of the model can be increased, and the accuracy of the result is increased.
Preferably, the electricity meter itself is capable of recording electricity usage data, stress data, and error data. When sampling is carried out at a certain moment, all the stress condition data X corresponding to the stress condition data are taken out i The stress data at time i can be expressed as:
X i =[X 1 ,X 2 ,…,X m ] (1)
wherein m isThe number of stresses. Error data at time i is Y i 。
If n sets of data are acquired within a sufficiently long time, the n sets of data can be represented as a stress data matrix as follows:
the corresponding error vector in n sets of data can be expressed as:
Y=[Y 1 ,Y 2 ,…,Y n ] T (3)
and S200, determining typical stress in the stress data of the intelligent electric meter.
The stress data collected in step S100 is usually large in quantity, and some data have very small influence, and if these data are taken into consideration, not only the speed of the subsequent training model is influenced, but also errors are caused by these low-influence data, and the attention is distracted. Only the stress with larger occupation is selected for research.
In order to find a plurality of stresses most closely related to errors of the electric energy meter, an improved Principal Component Analysis (PCA) idea is adopted, a group of orthogonal vectors of a sample space is found, and the group of orthogonal vectors is used for representing the whole situation, so that the original high-dimensional data is described by a few principal components, and the information of the original data is kept to the maximum extent.
In n effective data samples obtained by experiments, each sample has m sampling data, and a sample data matrix X can be obtained n×m With 1 observation data sample x per row vector i Wherein i is more than 0 and less than or equal to n; each column vector is the characteristic quantity xj of the corresponding observation sample, wherein j is more than 0 and less than or equal to m.
Step S201 normalizes the data.
The formula used for the normalization process is as follows:
in the formula (I), the compound is shown in the specification,
for the purpose of the feature quantity after the normalization,
is the mean value of the characteristic quantities, s (x)
j ) Is the standard deviation of the characteristic quantity.
In step S202, the contribution ratio of each stress is calculated using the normalized data.
Setting the matrix after standardization as
The covariance matrix is obtained as P, i.e.:
then, the eigenvalue lambda of the covariance matrix P is calculated i And its feature vector e i . By the similarity diagonalization of the matrix, a similar diagonal matrix D with P is obtained, the elements on the diagonal in D are arranged in descending order of eigenvalue size, namely D ═ diag (lambda) 1 ,λ 2 ,…,λ n ) Then P is EDE T Wherein E is a characteristic value λ i Corresponding to a set of eigenvectors ei, and E is an orthonormal matrix, i.e., E ═ diag (E) 1 ,e 2 ,…,e n ) The principal component vectors m are obtained by linear variation of the formula (6) 1 ,m 2 ,…,m n 。
Wherein, the contribution rate corresponding to the kth principal component is expressed as:
λ k representing the characteristic value of the k-th principal component, λ i Corresponding feature vector e i 。
In step S203, a plurality of stresses having relatively large contribution ratios are selected as typical stresses.
And sorting the contribution rates from high to low, and selecting a plurality of principal components which are sorted at the top as typical stress.
According to a large number of experiments, the cumulative contribution rate of the first three or the first four main components can reach more than 95%, so that the main influence factors can be analyzed by only selecting three or four stresses when taking the typical stress. These stresses include: temperature, humidity, air pressure, regional voltage.
And step S300, processing the typical stress data and the error data, and removing abnormal data to obtain processed data. The accuracy of training data in the subsequent process can be improved, and data which are obviously unreasonable in sampling can be eliminated.
According to some preferred embodiments of the present application, the steps specifically include:
step S301, arranging error data in the intelligent ammeter according to a collecting time sequence to obtain x (t), and calculating an average value mu and a standard deviation sigma;
and step S302, eliminating abnormal data in the error data.
And (3) determining data points which are not in the range of [ mu-3 sigma, mu +3 sigma ] in the data segment as abnormal values by using a3 sigma criterion commonly used in statistics, and removing the abnormal values.
Step S303, sequence abnormality correction is performed by mean value interpolation.
The removed data can leave a position, and the data before and after the position are averaged to fill the original position. The formula is as follows:
step S304, a sample sequence of the stress is transformed using a normalization method.
Sample series x of stress using z-score method (normalization method) 1 ,x 2 ,......,x n The transformation is performed, the formula is as follows:
the transformed sequence is y 1 ,y 2 ,......,y n The sequence mean is 0 and the variance is 1, dimensionless. Resulting in processed data.
And S400, sending the processed data to a neural network for training.
Under the three-layer neural network structure, setting the preprocessed typical stress y ═ y 1 ,y 2 ,…,y n ]For input vector, the error z of the intelligent electric energy meter is [ z ═ z% 1 ,z 2 ,…,z m ]And outputting the vector, wherein the actual error t is an expected output vector, w is a connection weight of the neural network, and a sigmoid function is used as an activation function in the middle layer and the output layer.
When the network output result, namely the error z of the intelligent electric energy meter, does not meet the set requirement, the data processing of the network enters a back propagation link, at the moment, the weighted value and the threshold value of each layer of unit are modified by the error signal from back to front, and the back propagation process is completed according to the principle of a gradient descent method. The error function of the output layer is set as E, and the expression is as follows:
w is all the weights, tk is the actual value of the error of the intelligent electric energy meter during the k iteration, zk is the estimated value of the error of the intelligent electric energy meter after the k iteration, t is the actual value of the error of the intelligent electric energy meter, and z is the estimated error of the intelligent electric energy meter.
According to some preferred embodiments of the present application, the actual value t of the error of the smart meter is an accurate error obtained from a large amount of experimental data, and may be considered as the corresponding error of the smart meter under the stress condition.
In the initial stage of the model, the initial value of the weight is set as a random value within a certain range. Decomposing the Hessian matrix into the product of Jacobians matrices, and then solving the inverse matrix of the Jacobians matrices, thereby reducing the complexity of calculation and updating the weight value more quickly, wherein the calculation formula is as follows:
in the formula, Δ W is the variation of the network weight; h is the number of iterations; j. the design is a square h Is the h iteration error function Jacobians matrix; mu.s h Is a constant greater than zero; e is an identity matrix; e.g. of the type h Is the h-th return error.
The process of model training is to reduce the error value through multiple iterations, and the weight vector is updated as:
w (i+1) =w (i) +Δw (i) (12)
when the output error function value satisfies the following formula:
E(h)≤e m (13)
wherein e is m And (3) setting a preset termination criterion according to the precision requirement, and stopping iterative computation and finishing the training of the neural network model when the formula (13) is satisfied and the termination condition is met.
That is, when the difference between the estimation error k trained by the model and the actual smart meter error t is small enough, the model has a relatively high accuracy when trained.
The trained model can be used for mining the nonlinear relation between the stress characteristic value acting on the electric energy meter and the error value, and can accurately predict the error under a certain condition.
According to some preferred embodiments of the present application, the present application can predict error conditions under different stress conditions by means of the model, and then perform error correction on the electric meter according to the error conditions, which can be specifically described as:
and S500, estimating the error offset according to the environment and the working condition of the intelligent electric energy meter.
When the method provided by the invention is used for analyzing the error of the intelligent electric energy meter, the influence of various stresses on the error in actual use is fully considered, and the additional error caused by various stresses is considered, so that the error of the intelligent electric energy meter is corrected.
The method specifically comprises the following steps:
and step S501, predicting an estimation error by using the trained neural network.
And predicting an estimation error z generated by the stress error of the intelligent electric meter in the current operation state through the model. And the estimation error z generated by the stress error is the final output of the model after multiple parameter iterative optimization and meeting the termination criterion.
And step S502, adding the estimated error to the reference error of the intelligent ammeter to serve as the error offset of the ammeter.
The estimation error z obtained in the step S501 and the reference error delta e of the electric energy meter under the standard condition are used 0 And adding to obtain the error offset delta e of the electric energy meter. The formula can be expressed as:
Δe=z+Δe 0 (14)
reference error delta e of electric energy meter 0 Is the statistical error under ideal conditions, the reference error Δ e 0 The error is also a random error, is a rated error of a certain electric energy meter under a standard condition, and is an accuracy level substantially. Because the errors of different electric energy meters are not necessarily the same under the same working conditions, the random errors of the electric energy meters need to be considered.
The estimation error z generated by the stress error under the actual condition is caused by the fact that the stress condition of the working environment is inconsistent with the ideal condition, according to the model in the scheme, the stress condition of the electric energy meter to be measured is used as an input variable, the estimation error z under the environment can be obtained, and the error offset delta e of the electric energy meter is obtained through calculation according to the formula 14.
And S600, establishing a relation of error offsets under different stress conditions by using the trained neural network.
The trained neural network model can establish the relation between the error offset delta e and the stress condition, and the relation is expressed by drawing, so that the change trend can be visually seen.
Example II,
In order to verify the effectiveness of the above embodiments, on the basis of the first embodiment, the following data is taken:
step A100, stress data and error data of the intelligent electric meter are obtained.
In line with the method described in embodiment one, this is omitted here.
And step A200, determining typical stress in stress data of the smart meter.
In a certain experiment, 60725 effective data samples are obtained, each sample has 8 sampling data, and a sample data matrix X can be obtained 60725×8 With 1 observation data sample x per row vector i Wherein i is more than 0 and less than or equal to 60725; each column vector is the characteristic quantity xj of the corresponding observation sample, wherein j is more than 0 and less than or equal to 8.
Step a201, standardizes the data.
The formula is as follows:
in the formula (I), the compound is shown in the specification,
for the purpose of the feature quantity after the normalization,
is the mean value of the characteristic quantities, s (x)
j ) Is the standard deviation of the characteristic quantity.
Step a202 calculates the contribution ratio of each stress using the normalized data.
Setting the matrix after standardization as
The covariance matrix is obtained as P, i.e.:
calculating an eigenvalue λ of the covariance matrix P i And its feature vector e i I.e. P ═ EDE T Wherein D is a diagonal matrix arranged in descending order according to the size of the characteristic value, and D is diag (lambda) 1 ,λ 2 ,…,λ 60725 ) E is a characteristic value λ i Corresponding feature vector e i And E is an orthonormal matrix, E ═ diag (E) 1 ,e 2 ,…,e 60725 ) Each principal component vector m is obtained by linear change of the formula (17) 1 ,m 2 ,…,m 60725 。
The contribution rate corresponding to the kth principal component is:
step A203, selecting a plurality of stresses with the largest contribution ratio as typical stresses.
And sorting the contribution rates from high to low, and selecting a plurality of principal components which are sorted at the top as typical stress.
Experiments show that the cumulative contribution rate of the first 4 main components reaches 95%, and the 4 main components are temperature, humidity, air pressure and voltage stress respectively and serve as the input variables of the following model.
And step A300, processing the typical stress data and the error data, and removing abnormal data to obtain processed data.
Step A301, arranging error data in the intelligent ammeter according to an acquisition time sequence to obtain x (t), and calculating an average value mu and a standard deviation sigma;
step A302, setting a rejection threshold.
And (3) determining data points which are not in the range of [ mu-3 sigma, mu +3 sigma ] in the data segment as abnormal values by using a3 sigma criterion commonly used in statistics, and removing the abnormal values.
Step A303, sequence abnormality correction is performed by mean value interpolation.
The removed data can leave a position, and the data before and after the position are averaged to fill the original position. The formula is as follows:
step A304, transforming the sample sequence using a normalization method
Using the z-score method (normalization method), a sequence of samples x is normalized 1 ,x 2 ,......,x n The transformation is performed, the formula is as follows:
the transformed sequence is y 1 ,y 2 ,......,y n The sequence mean is 0 and the variance is 1, dimensionless.
Resulting in processed data.
And A400, sending the processed data to a neural network for training.
The same procedure as in the first embodiment is omitted here.
And A500, calculating the error offset according to the environment and the working condition of the intelligent electric energy meter.
The same procedure as in the first embodiment is omitted here.
Step A600, establishing the relation of error offset under different stress conditions by using the trained neural network.
The invention takes a stress error curve obtained by one experiment as an example, and respectively is a curve (shown in figure 3) of the influence of temperature on the error of an ammeter; humidity versus meter error effect curve (as shown in fig. 4); the influence curve of the air pressure on the electric meter error (shown in figure 5) and the influence of the voltage of different areas on the electric meter error (shown in figure 6).
The method utilizes the trained neural network to establish the relation between the typical stress and the error, and the relation is displayed in an image mode, so that the errors caused by different stresses can be analyzed visually.
An embodiment of the second aspect of the present invention provides a smart meter stress error analysis device, including:
the data collection system can acquire stress data and error data of the intelligent electric meter;
the typical stress analysis system can determine typical stress in the stress data of the intelligent electric meter;
the model training module can send the processed data into a neural network for training to obtain a trained neural network;
and the relation analysis module can establish error data relation under different stress conditions by utilizing the trained neural network.
The stress error analysis method for the intelligent electric meter described in the first embodiment is presented in the form of computer equipment, the corresponding relation between the stress and the error in the intelligent electric meter can be analyzed by using the BP neural network optimized by the LM, and a change curve is drawn, so that the corresponding relation between the stress and the error is established by means of the method, and the effect of the error analysis of the intelligent electric meter is achieved.
Another embodiment of the present application provides a terminal, including: the stress error analysis method for the intelligent electric meter comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the stress error analysis method for the intelligent electric meter.
In particular, the processor may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. A processor may also be a combination of computing functions, e.g., comprising one or more microprocessors, a DSP and a microprocessor, or the like.
In particular, the processor is coupled to the memory via a bus, which may include a path for communicating information. The bus may be a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
The memory may be, but is not limited to, a ROM or other type of static storage device that can store static information and instructions, a RAM or other type of dynamic storage device that can store information and instructions, an EEPROM, a CD-ROM or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
Optionally, the memory is used for storing codes of computer programs for executing the scheme of the application, and the processor is used for controlling the execution.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.