Electric power measurement intelligent laboratory equipment fault diagnosis method, equipment and medium
The fault diagnosis method for smart laboratory power metering equipment, which combines Transformer and LSTM models, solves the problem that traditional methods cannot integrate multidimensional data and capture time-series features, and achieves high-precision fault diagnosis of power metering equipment, especially in early fault identification.
Patent Information
- Application Number
- CN202511638903.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-10
- Publication Date
- 2026-02-17
AI Technical Summary
Traditional fault diagnosis methods for smart power metering laboratory equipment cannot effectively integrate multi-dimensional data and cannot capture the complex temporal characteristics and nonlinear relationships during equipment operation, resulting in low fault identification accuracy, especially in early fault diagnosis.
By combining the Transformer and LSTM models, a projected feature matrix is constructed. The Transformer's self-attention mechanism is used to analyze global relationships, and the LSTM's gating mechanism is used to process time-series data. The output encoded feature matrix and the hidden state matrix are fused to obtain fault feature vectors and identify fault categories.
It enables comprehensive analysis of multi-dimensional data from power metering equipment, captures complex temporal characteristics and nonlinear relationships during equipment operation, and improves the comprehensiveness and reliability of fault diagnosis, especially significantly improving accuracy in early fault identification.
Smart Images

Figure CN121542887A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a fault diagnosis method, equipment, and medium for intelligent power metering laboratory equipment, belonging to the field of power management technology. Background Technology
[0002] With the rapid development of smart grids and power metering technologies, smart power metering laboratories have become an important component of power system operation and management. In these laboratories, the stable operation of equipment directly affects the accuracy of power metering data and the safety of grid operation. However, in complex power environments, equipment in smart power metering laboratories (such as smart meters and voltage monitors) may experience various malfunctions due to aging, overload, and environmental interference, such as overvoltage, undervoltage, overcurrent, and overheating. These malfunctions not only affect the performance of the equipment itself but may also lead to distorted power metering data and even trigger larger grid safety issues.
[0003] To ensure the stable operation of the power system, timely and accurate diagnosis of faults in smart power metering laboratory equipment is crucial. Traditional fault diagnosis methods mainly rely on manual experience rules or simple statistical analysis methods, such as threshold-based alarm mechanisms and univariate statistical analysis. However, these methods have significant limitations: on the one hand, they can only process limited, single-dimensional operational data and cannot effectively integrate multi-dimensional data such as current, voltage, temperature, and power for comprehensive analysis; on the other hand, they cannot capture the complex temporal characteristics and nonlinear relationships during equipment operation, resulting in insufficient accuracy in fault identification, especially in early fault diagnosis. Summary of the Invention
[0004] To address the problems existing in the prior art, this invention proposes a fault diagnosis method, equipment, and medium for smart laboratory equipment for power metering.
[0005] The technical solution of the present invention is as follows: On the one hand, the present invention provides a fault diagnosis method for smart laboratory equipment for power metering, comprising the following steps: Obtain operational data from the smart power metering laboratory equipment, and construct a projection feature matrix based on the operational data; The projection feature matrix is used as input to the Transformer model to obtain the output encoded feature matrix; The output encoded feature matrix is used as the input to the LSTM model to obtain the hidden state matrix; The fault feature vector is obtained by fusing the output encoded feature matrix and the hidden state matrix; Based on the fault feature vector, a fault probability distribution vector is obtained, and the fault category of the smart power metering laboratory equipment is identified according to the fault probability distribution vector.
[0006] Preferably, the method further includes standardizing the running data, expressed by the formula: ; In the formula, express The first time after time standardization Types of runtime data, express Time of the first Types of runtime data, Indicates the first The average of the various types of running data. Indicates the first The standard deviation of the type of running data Indicates a preset constant; The types of operational data include current, voltage, temperature, and power.
[0007] Preferably, a projection feature matrix is constructed based on the operational data, and the specific steps are as follows: Based on standardized operational data Constructing a data matrix ; Based on the data matrix, a projection feature matrix is constructed, expressed by the formula: ; In the formula, Represents the projected feature matrix. Represents the projection weight matrix. This represents the projection bias vector.
[0008] Preferably, the projected feature matrix is used as input to the Transformer model, and the specific steps are as follows: Adding positional encoding to the projected feature matrix yields the encoding feature matrix of the Transformer model's encoding layer 1, expressed by the formula: ; In the formula, This represents the coding feature matrix of coding layer 1. Represents the position encoding matrix; Construct the Transformer model encoding layer based on the encoded feature matrix. The query matrix, key matrix, and value matrix for each attention head are expressed by the following formulas: ; ; ; ; In the formula, Represents the coding layer No. A query matrix with attention heads Represents the coding layer The encoding feature matrix, Represents the coding layer No. The query weight matrix for each attention head. Represents the coding layer No. The key matrix of each attention head. Represents the coding layer No. The key weight matrix of each attention head. Represents the coding layer No. The value matrix of each attention head, Represents the coding layer No. The value weight matrix of each attention head, Indicates the number of coding layers; The output matrix of each attention head is obtained based on the query matrix, key matrix, and value matrix, expressed by the formula: ; In the formula, Represents the coding layer No. The output matrix of each attention head, Key matrix transpose, Dimensions representing the attention head; The output matrices of each attention head are concatenated to obtain the multi-head output matrix, which can be expressed by the formula: ; In the formula, Represents the coding layer The multi-head output matrix This represents the concatenation operation function. Indicates the number of attention heads. Represents the coding layer The multi-head projection weight matrix; The multi-head output matrix is obtained by residual concatenating the multi-head output matrix with the encoded feature matrix, which is expressed by the formula: ; In the formula, Represents the coding layer The multi-head output matrix after layer normalization. Indicates the layer normalization operation function; The multi-head output matrix after layer normalization is used as the input to the feedforward neural network, and the output feedforward output matrix is expressed by the formula: ; In the formula, Represents the coding layer The feedforward output matrix, Represents the Gaussian error linear unit activation function. Represents the coding layer The weight matrix of the first layer of the feedforward network. Represents the coding layer The weight matrix of the second layer of the feedforward network. Represents the coding layer The bias vector of the first layer of the feedforward network Represents the coding layer The bias vector of the second layer of the feedforward network; The coding layer is obtained by residually concatenating the feedforward output matrix with the layer-normalized multi-head output matrix. The encoded feature matrix is expressed by the formula: ; In the formula, Represents the coding layer The encoded feature matrix; coding layer The encoded feature matrix is used as the output encoded feature matrix, expressed by the formula: ; In the formula, This represents the output encoded feature matrix. coding layer The encoding feature matrix.
[0009] Preferably, the output encoded feature matrix is used as the input to the LSTM model, and the specific steps are as follows: Output encoded feature matrix According to time Slice to obtain input feature vectors ; The input feature vector is used as the input to the LSTM model to obtain the hidden state vector, which is expressed by the formula: ; In the formula, express The activation vector of the input gate at each time step. This represents the Sigmoid activation function. This represents the input weight matrix of the input gate. express The input feature vector at time t, This represents the hidden state weight matrix of the input gate. express The hidden state vector at time step 1. This represents the bias vector of the input gate; ; In the formula, express The activation vector of the time-forget gate. This represents the input weight matrix of the forget gate. This represents the hidden state weight matrix of the forget gate. The bias vector representing the forget gate; ; In the formula, express The activation vector of the output gate is given at each time step. This represents the input weight matrix of the output gate. This represents the hidden state weight matrix of the output gate. This represents the bias vector of the output gate; ; In the formula, express The state of candidate cells at any given time. This represents the hyperbolic tangent activation function. The input weight matrix represents the candidate cell state. The hidden state weight matrix represents the candidate cell state. A bias vector representing the state of a candidate cell; ; In the formula, express Cellular state at any given moment express Cellular state at any given moment element-wise multiplication operator ; In the formula, express The hidden state vector at time step; Based on the hidden state vector, a hidden state matrix is constructed, which can be expressed by the formula: ; In the formula, Represents the hidden state matrix, This indicates the fault diagnosis cycle.
[0010] Preferably, the fault feature vector is obtained by fusing the output encoded feature matrix and the hidden state matrix. The specific steps are as follows: The fused feature matrix is obtained based on the output encoded feature matrix and the hidden state matrix, expressed by the formula: ; In the formula, Represents the fused feature matrix. This represents the encoded projection weight matrix. Represents the state projection weight matrix. Represents the feature fusion bias vector; Fuse feature matrix According to time Slice to obtain fusion feature vectors ; The attention score is obtained based on the fused feature vector, expressed by the formula: ; In the formula, express Attention score at any moment Represents the attention query vector transpose, Represents the attention weight matrix. This represents the attention bias vector. express The fused feature vector at each time step; right The attention scores are normalized to obtain the attention weight vector, which is expressed by the formula: ; In the formula, Represents the attention weight vector; The fault feature vector is obtained based on the attention weight vector, expressed by the formula: ; In the formula, Represents the fault feature vector. This represents the normalized value in the attention weight vector. Attention score at any given moment.
[0011] Preferably, the fault probability distribution vector is obtained based on the fault feature vector, expressed by the formula: ; In the formula, Represents the failure probability distribution vector. Represents the classifier weight matrix. This represents the classifier bias vector; The results of identifying the fault categories of the smart power metering laboratory equipment based on the fault probability distribution vector are expressed by the following formula: ; In the formula, This indicates the fault category results of the smart power metering laboratory equipment. Represents the failure probability distribution vector The Middle The probability of each fault category Indicates the number of fault categories. This indicates selecting the fault category with the highest probability. .
[0012] Preferably, the location coding matrix is expressed by the formula: ; ; In the formula, Represents the position encoding matrix OK Column elements, Represents the sine function. This represents the dimension of the hidden layers in the Transformer model. Represents the position encoding matrix OK Column elements, This represents the cosine function.
[0013] In another aspect, the present invention also provides an electronic device having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the fault diagnosis method for smart laboratory equipment for power metering as described in any embodiment of the present invention.
[0014] In another aspect, the present invention also provides a computer-readable storage medium for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the fault diagnosis method for smart laboratory equipment for power metering as described in any embodiment of the present invention.
[0015] The present invention has the following beneficial effects: 1. This invention integrates multi-dimensional data on equipment operation (such as current, voltage, temperature, power, etc.) to construct a projected feature matrix, and performs comprehensive analysis based on the Transformer model and the LSTM model. Compared with traditional single-dimensional diagnostic methods, this multi-dimensional data fusion approach can comprehensively capture the equipment's operating status, avoid misjudgments caused by single data anomalies, improve the comprehensiveness and reliability of fault diagnosis, and effectively identify potential equipment problems.
[0016] 2. This invention utilizes the self-attention mechanism of the Transformer model to analyze global relationships in time series data, capturing long-term dependency characteristics and early fault symptoms in equipment operation; simultaneously, it combines the gating mechanism of the LSTM model to handle long-term dependency issues in time series data and identify the temporal evolution patterns of faults. This dual-model collaborative mechanism can accurately capture complex temporal characteristics and nonlinear relationships in equipment operation. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the implementation of the method in an embodiment of the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.
[0020] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0021] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0022] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.
[0023] Example 1: See Figure 1This invention provides a fault diagnosis method for smart laboratory equipment for power metering, comprising the following steps: Obtain operational data from the smart power metering laboratory equipment, and construct a projection feature matrix based on the operational data; The projection feature matrix is used as input to the Transformer model to obtain the output encoded feature matrix; The output encoded feature matrix is used as the input to the LSTM model to obtain the hidden state matrix; The fault feature vector is obtained by fusing the output encoded feature matrix and the hidden state matrix; Based on the fault feature vector, a fault probability distribution vector is obtained, and the fault category of the smart power metering laboratory equipment is identified according to the fault probability distribution vector.
[0024] Preferably, the method further includes standardizing the running data, expressed by the formula: ; In the formula, express The first time after time standardization Types of runtime data, express Time of the first Types of runtime data, Indicates the first The average of the various types of running data. Indicates the first The standard deviation of the type of running data Indicates a preset constant; The types of operational data include current, voltage, temperature, and power.
[0025] The average value of the operational data is expressed by the formula: ; The standard deviation of the operational data is expressed by the formula: ; Standardization effectively eliminates the differences in units and magnitudes of operational data collected by different sensors, ensuring that all types of operational data fall within the same numerical range. This significantly improves the stability and convergence efficiency of subsequent model training. In power metering equipment monitoring, parameters such as voltage, current, and temperature originally have completely different physical meanings and numerical ranges. After standardization, these parameters can participate fairly in model calculations within the feature space, preventing certain sensor data with larger values from dominating the entire model learning process.
[0026] Preferably, a projection feature matrix is constructed based on the operational data, and the specific steps are as follows: Based on standardized operational data Constructing a data matrix Behavior Time The column indicates the type of running data. ; Based on the data matrix, a projection feature matrix is constructed, expressed by the formula: ; In the formula, Represents the projected feature matrix. Represents the projection weight matrix. This represents the projection bias vector.
[0027] Preferably, the projected feature matrix is used as input to the Transformer model, and the specific steps are as follows: Adding positional encoding to the projected feature matrix yields the encoding feature matrix of the Transformer model's encoding layer 1, expressed by the formula: ; In the formula, This represents the coding feature matrix of coding layer 1. Represents the position encoding matrix; Construct the Transformer model encoding layer based on the encoded feature matrix. The query matrix, key matrix, and value matrix for each attention head are expressed by the following formulas: ; ; ; ; In the formula, Represents the coding layer No. A query matrix with attention heads Represents the coding layer The encoding feature matrix, Represents the coding layer No. The query weight matrix for each attention head. Represents the coding layer No. The key matrix of each attention head. Represents the coding layer No. The key weight matrix of each attention head. Represents the coding layer No. The value matrix of each attention head, Represents the coding layer No. The value weight matrix of each attention head, Indicates the number of coding layers; The output matrix of each attention head is obtained based on the query matrix, key matrix, and value matrix, expressed by the formula: ; In the formula, Represents the coding layer No. The output matrix of each attention head, Key matrix transpose, Dimensions representing the attention head; The output matrices of each attention head are concatenated to obtain the multi-head output matrix, which can be expressed by the formula: ; In the formula, Represents the coding layer The multi-head output matrix This represents the concatenation operation function. Indicates the number of attention heads. Represents the coding layer The multi-head projection weight matrix; The multi-head output matrix is obtained by residual concatenating the multi-head output matrix with the encoded feature matrix, which is expressed by the formula: ; In the formula, Represents the coding layer The multi-head output matrix after layer normalization. Indicates the layer normalization operation function; The multi-head output matrix after layer normalization is used as the input to the feedforward neural network, and the output feedforward output matrix is expressed by the formula: ; In the formula, Represents the coding layer The feedforward output matrix, Represents the Gaussian error linear unit activation function. Represents the coding layer The weight matrix of the first layer of the feedforward network. Represents the coding layer The weight matrix of the second layer of the feedforward network. Represents the coding layer The bias vector of the first layer of the feedforward network Represents the coding layer The bias vector of the second layer of the feedforward network; The coding layer is obtained by residually concatenating the feedforward output matrix with the layer-normalized multi-head output matrix. The encoded feature matrix is expressed by the formula: ; In the formula, Represents the coding layer The encoded feature matrix; coding layer The encoded feature matrix is used as the output encoded feature matrix, expressed by the formula: ; In the formula, This represents the output encoded feature matrix. coding layer The encoding feature matrix.
[0028] The Transformer model analyzes the global relationships across the entire time series through a self-attention mechanism, capturing long-term dependency features. This mechanism can identify the intrinsic connection between early signs of failure and subsequent performance. The multi-head attention structure enables parallel learning of various failure modes, including periodic fluctuations, sudden anomalies, and trend changes. Positional encoding ensures the model understands the temporal order of the data, while residual connections guarantee the stability of deep network training, allowing the model to learn more complex failure features.
[0029] Preferably, the output encoded feature matrix is used as the input to the LSTM model, and the specific steps are as follows: Output encoded feature matrix According to time Slice to obtain input feature vectors ; The input feature vector is used as the input to the LSTM model to obtain the hidden state vector, which is expressed by the formula: ; In the formula, express The activation vector of the input gate at each time step. This represents the Sigmoid activation function. This represents the input weight matrix of the input gate. express The input feature vector at time t, This represents the hidden state weight matrix of the input gate. express The hidden state vector at time step 1. This represents the bias vector of the input gate; ; In the formula, express The activation vector of the time-forget gate. This represents the input weight matrix of the forget gate. This represents the hidden state weight matrix of the forget gate. The bias vector representing the forget gate; ; In the formula, express The activation vector of the output gate is given at each time step. This represents the input weight matrix of the output gate. This represents the hidden state weight matrix of the output gate. This represents the bias vector of the output gate; ; In the formula, express The state of candidate cells at any given time. This represents the hyperbolic tangent activation function. The input weight matrix represents the candidate cell state. The hidden state weight matrix represents the candidate cell state. A bias vector representing the state of a candidate cell; ; In the formula, express Cellular state at any given moment express Cellular state at any given moment element-wise multiplication operator ; In the formula, express The hidden state vector at time step; Based on the hidden state vector, a hidden state matrix is constructed, which can be expressed by the formula: ; In the formula, Represents the hidden state matrix, This indicates the fault diagnosis cycle.
[0030] LSTM manages information flow through gating mechanisms, effectively handling the temporal characteristics of power equipment faults. The input gates, forget gates, and output gates work together to maintain a memory of long-term fault trends while responding to short-term state changes. This structure is suitable for analyzing slowly developing faults such as equipment aging, and can also capture sudden anomalies such as voltage dips. The continuous transmission of cell states provides rich historical information, enhancing the reliability of diagnostic decisions.
[0031] Preferably, the fault feature vector is obtained by fusing the output encoded feature matrix and the hidden state matrix. The specific steps are as follows: The fused feature matrix is obtained based on the output encoded feature matrix and the hidden state matrix, expressed by the formula: ; In the formula, Represents the fused feature matrix. This represents the encoded projection weight matrix. Represents the state projection weight matrix. Represents the feature fusion bias vector; Fuse feature matrix According to time Slice to obtain fusion feature vectors ; The attention score is obtained based on the fused feature vector, expressed by the formula: ; In the formula, express Attention score at any moment Represents the attention query vector transpose, Represents the attention weight matrix. This represents the attention bias vector. express The fused feature vector at each time step; right The attention scores are normalized to obtain the attention weight vector, which is expressed by the formula: ; In the formula, Represents the attention weight vector; The fault feature vector is obtained based on the attention weight vector, expressed by the formula: ; In the formula, Represents the fault feature vector. This represents the normalized value in the attention weight vector. Attention score at any given moment.
[0032] Preferably, the fault probability distribution vector is obtained based on the fault feature vector, expressed by the formula: ; In the formula, Represents the failure probability distribution vector. Represents the classifier weight matrix. This represents the classifier bias vector; The results of identifying the fault categories of the smart power metering laboratory equipment based on the fault probability distribution vector are expressed by the following formula: ; In the formula, This indicates the fault category results of the smart power metering laboratory equipment. Represents the failure probability distribution vector The Middle The probability of each fault category Indicates the number of fault categories. This indicates selecting the fault category with the highest probability. .
[0033] Fault categories include normal state, overvoltage fault, undervoltage fault, overcurrent fault, and equipment overheating fault.
[0034] The probabilistic output provides a confidence assessment of the fault type. The softmax classifier gives the probability distribution of each fault category, providing a quantitative basis for operation and maintenance decisions.
[0035] Preferably, the location coding matrix is expressed by the formula: ; ; In the formula, Represents the position encoding matrix OK Column elements, Represents the sine function. This represents the dimension of the hidden layers in the Transformer model. Represents the position encoding matrix OK Column elements, This represents the cosine function.
[0036] Example 2: This embodiment provides an electronic device that stores a computer program, which, when executed by a processor, implements the fault diagnosis method for smart laboratory power metering equipment as described in any embodiment of the present invention.
[0037] Example 3: This embodiment provides a computer-readable storage medium for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the fault diagnosis method for smart laboratory equipment for power metering as described in any embodiment of the present invention.
[0038] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, A and B simultaneously, or B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of singular or plural items. For example, at least one of a, b, and c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0039] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0040] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0041] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0042] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A power metering smart laboratory equipment fault diagnosis method, characterized in that, The method comprises the following steps: obtaining operation data of the power metering smart laboratory equipment, and constructing a projection feature matrix based on the operation data; inputting the projection feature matrix into a Transformer model to obtain an output encoding feature matrix; inputting the output encoding feature matrix into an LSTM model to obtain a hidden state matrix; fusing the output encoding feature matrix and the hidden state matrix to obtain a fault feature vector; obtaining a fault probability distribution vector based on the fault feature vector, and identifying a fault category result of the power metering smart laboratory equipment according to the fault probability distribution vector. 2.The electric power metering smart lab equipment fault diagnosis method according to claim 1, characterized in that, The method further comprises standardizing the operation data, which is expressed by a formula as follows: ; In the formula, express The first time after time standardization Types of runtime data, express Time of the first Types of runtime data, Indicates the first The average of the various types of running data. Indicates the first The standard deviation of the type of running data Indicates a preset constant; The types of the operation data include current, voltage, temperature, and power. 3.The electric power metering smart lab equipment fault diagnosis method according to claim 2, characterized in that, The projection feature matrix is constructed based on the data matrix, which is expressed by a formula as follows: based on the standardized processed operation data constructing a data matrix ; The projection feature matrix is inputted into the Transformer model, and the specific steps are as follows: ; wherein denotes a projection feature matrix, denotes a projection weight matrix, denotes a projection bias vector. 4.The electric power metering smart lab equipment fault diagnosis method according to claim 3, characterized in that, The position encoding is added to the projection feature matrix to obtain an encoding feature matrix of a first encoding layer of the Transformer model, which is expressed by a formula as follows: The output matrix of each attention head is obtained based on the query matrix, the key matrix, and the value matrix, which is expressed by a formula as follows: ; In the formula, denotes the encoding feature matrix of the encoding layer 1, denotes the position encoding matrix; constructing a Transformer model coding layer based on the coding feature matrix The query matrix, the key matrix, and the value matrix of each attention head are expressed by formulas as follows: ; ; ; ; In the formula, denotes the encoding layer The first query matrix of the attention head, denotes the encoding layer the encoding feature matrix of, denotes the encoding layer The first query weight matrix of the attention head, denotes the encoding layer The first key matrix of the attention head, denotes the encoding layer The first key weight matrix of the attention head, denotes the encoding layer The first value matrix of the attention head, denotes the encoding layer The first value weight matrix of the attention head, denotes the number of encoding layers; The output matrices of the attention heads are spliced to obtain a multi-head output matrix, which is expressed by a formula as follows: ; wherein denotes the encoding layer the output matrix of the first attention head, denotes the key matrix the transpose of the denotes the dimension of the attention head; The multi-head output matrix is connected in residual to the encoding feature matrix to obtain a layer-normalized multi-head output matrix, which is expressed by a formula as follows: ; In the formula, denotes a multi-head output matrix of the encoding layer , denotes a concatenation operation function, denotes the number of attention heads, denotes a multi-head projection weight matrix of the encoding layer . The layer-normalized multi-head output matrix is inputted into a feedforward neural network as an input, and a feedforward output matrix is outputted, which is expressed by a formula as follows: ; In the formula, denotes the encoding layer layer normalized multi-head output matrix, denotes a layer normalization operation function; The output encoding feature matrix is inputted into the LSTM model, and the specific steps are as follows: ; wherein represents a feedforward output matrix of the encoding layer , represents a Gaussian error linear unit activation function, represents a feedforward network first layer weight matrix of the encoding layer , represents a feedforward network second layer weight matrix of the encoding layer , represents a feedforward network first layer bias vector of the encoding layer , represents a feedforward network second layer bias vector of the encoding layer ; The feedforward output matrix is residual connected with the multi-head output matrix after layer normalization to obtain an encoding layer The encoding feature matrix of the encoding layer is expressed by a formula as follows: ; In the formula, represents the encoding feature matrix of the encoding layer ; The encoding feature matrix of the encoding layer is taken as the output encoding feature matrix, expressed in a formula as: ; In the formula, represents an output encoding feature matrix, encoding layer encoding feature matrix. 5.The electric power metering smart lab equipment fault diagnosis method according to claim 4, characterized in that, The input feature vector is inputted into the LSTM model as an input to obtain a hidden state vector, which is expressed by a formula as follows: output encoding feature matrix according to time slicing to obtain input feature vector ; The hidden state matrix is constructed based on the hidden state vector, which is expressed by a formula as follows: ; wherein, denotes denotes the activation vector of the input gate at time step t, denotes the Sigmoid activation function, denotes the input weight matrix of the input gate, denotes denotes the input feature vector at time step t, denotes the hidden state weight matrix of the input gate, denotes denotes the hidden state vector at time step t, denotes the bias vector of the input gate; ; In the formula, denotes the activation vector of the forget gate at the moment, denotes the input weight matrix of the forget gate, denotes the hidden state weight matrix of the forget gate, denotes the bias vector of the forget gate; ; wherein denotes denotes the activation vector of the output gate at time t, denotes the input weight matrix of the output gate, denotes the hidden state weight matrix of the output gate, denotes the bias vector of the output gate; ; wherein denotes a candidate cell state at a time instant, denotes a hyperbolic tangent activation function, denotes an input weight matrix of the candidate cell state, denotes a hidden state weight matrix of the candidate cell state, denotes a bias vector of the candidate cell state; ; wherein represents cell state at a time instant, represents cell state at a time instant, represents an element-wise multiplication operator ; In the formula, represents the hidden state vector at the time instant The output encoding feature matrix and the hidden state matrix are fused to obtain the fault feature vector, and the specific steps are as follows: ; In the formula, denotes a hidden state matrix, denotes a fault diagnosis period. 6.The electric power metering smart lab equipment fault diagnosis method according to claim 5, characterized in that, The fusion feature matrix is obtained based on the output encoding feature matrix and the hidden state matrix, which is expressed by a formula as follows: The attention score is obtained based on the fusion feature vector, which is expressed by a formula as follows: ; In the formula, denotes a fusion feature matrix, denotes an encoding projection weight matrix, denotes a state projection weight matrix, denotes a feature fusion bias vector; The fusion feature matrix is obtained According to time Slicing is performed to obtain The fusion feature vector is obtained ; The fault feature vector is obtained based on the attention weight vector, which is expressed by a formula as follows: ; wherein, denotes the attention score at time step t, denotes the attention query vector the transpose of denotes the attention weight matrix, denotes the attention bias vector, denotes the fusion feature vector at time step t; right The attention scores are normalized to obtain the attention weight vector, which is expressed by the formula: ; In the formula, denotes the attention weight vector; The fault probability distribution vector is obtained based on the fault feature vector, which is expressed by a formula as follows: ; In the formula, represents a fault feature vector, represents the normalized processing of the attention weight vector attention score at the moment. 7.The electric power metering smart lab equipment fault diagnosis method according to claim 6, characterized in that, The fault category result of the power metering smart laboratory equipment is identified according to the fault probability distribution vector, which is expressed by a formula as follows: ; wherein represents a fault probability distribution vector, represents a classifier weight matrix, represents a classifier bias vector; The position encoding matrix is expressed by a formula as follows: ; wherein, represents the power metering smart laboratory equipment failure category result, represents the failure probability distribution vector the probability of the failure category in the failure category number, represents the failure category with the largest probability . 8.The electric power metering smart lab equipment fault diagnosis method according to claim 4, characterized in that, The processor implements the power metering smart laboratory equipment fault diagnosis method according to any one of claims 1 to 8 when executing the program. ; ; wherein, represents a position encoding matrix row element of a column, represents a sine function, represents a Transformer model hidden layer dimension, represents a position encoding matrix row element of a column, represents a cosine function.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The program is executed by the processor to implement the power metering smart laboratory equipment fault diagnosis method according to any one of claims 1 to 8.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that,