A method for generating equipment fault detection model based on state data analysis
Patent Information
- Application Number
- CN202410756001.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-13
Smart Images

Figure CN118332477B
Abstract
Description
Technical Field
[0001] The invention relates to a method for generating an equipment fault detection model, in particular to a method for generating an equipment fault detection model based on state data analysis, and belongs to the technical field of aircraft fault diagnosis. Background Art
[0002] Early maintenance and support usually adopts scheduled support, which easily leads to excessive maintenance, increased maintenance costs and reduced system operation efficiency. Nowadays, driven by data, intelligent fault warning monitoring methods such as deep learning-based models can be used to carry out situation-based maintenance and predictive maintenance. Equipment fault detection based on condition monitoring data is a deepening application of data accumulation to a certain extent, which obtains useful information from diverse and massive system monitoring data, explores complex time series relationships, reveals regularity and correlation in data, and discovers faults, providing effective technical means for fault detection and condition assessment, which is of great significance for ensuring safety and avoiding economic losses.
[0003] Equipment status monitoring data refers to the performance monitoring data of components such as engines during equipment operation using various types of sensors. It is a typical multi-dimensional time series. There are complex coupling relationships between parameters, and the time series relationship in the monitoring data is complex. The flight parameter recording data of an aircraft is a typical example.
[0004] The key to unsupervised time series anomaly detection is to learn information representation and find distinguishable criteria. Deep learning-based methods can autonomously extract effective features from raw signals without relying on manual feature extraction, but conventional neural networks find it difficult to do this.
[0005] Currently, the commonly used methods mainly include reconstruction-based methods, autoregression-based methods, clustering-based methods, and density estimation methods. Reconstruction-based methods, such as LSTM-VAE and InterFusion, detect anomalies through reconstruction errors. These models use recurrent neural networks such as LSTM for time modeling and use variational autoencoder VAE for reconstruction. Autoregression-based models such as VAR detect anomalies through prediction errors. Clustering-based methods formalize anomaly scores as distances to cluster centers. These models collect representations of normal data into a compact cluster. In addition, there are some methods that attempt to detect anomalies through explicit association modeling. For example, graph neural networks GNN are used to learn dynamic graphs between multiple variables in multivariate time series, but these methods still face some challenges, such as the inability to capture the fine-grained temporal association between each time point and the entire series.
[0006] At present, the existing technology still has the following technical problems:
[0007] (1) Due to the rarity of anomalies, point-by-point representation is less informative for complex temporal patterns and may be dominated by normal time points, making anomalies difficult to distinguish;
[0008] (2) Traditional methods such as graph neural networks (GNNs) and subsequence-based methods can capture certain temporal associations, but they can only capture the associations between a single time point or local time points. These methods are often unable to effectively capture the fine-grained temporal associations between each time point and all other time points in the entire time series.
[0009] (3) When dealing with time series anomaly detection tasks, due to the rarity of abnormal phenomena and the fact that they are masked by a large number of normal points, the model needs to have strong robustness and the ability to estimate prediction uncertainty. It should be able to effectively estimate the uncertainty of the prediction results so as to make more reliable anomaly judgments in the presence of noise and outliers. Summary of the invention
[0010] The purpose of the present invention is to solve the above-mentioned problems existing in the prior art and to provide a method for generating an equipment fault detection model based on state data analysis. The model generated by this method has higher fault detection accuracy and faster detection speed, and the robustness of the model is enhanced and has stronger generalization ability.
[0011] In order to solve the above problems, the equipment fault detection model generation method based on state data analysis of the present application is implemented by the following technical solutions:
[0012] A method for generating an equipment fault detection model based on state data analysis is special in that the method comprises the following steps:
[0013] Step S1, data collection:
[0014] Screen out status data records potentially associated with faults from equipment status monitoring systems and quality control systems, and sort out typical fault modes; record status monitoring system parameters in normal mode and construct status data sets;
[0015] The parameters recorded by the equipment status monitoring system involve multiple subsystems, with hundreds of parameters. The relevant parameters are selected according to the fault diagnosis requirements. The quality control system records the maintenance and support records of the equipment during its service.
[0016] Step S2: Data preprocessing:
[0017] Perform Gaussian normalization on the non-angular data in the state data set of step S1, and convert the data into a standard normal distribution with a mean of 0 and a standard deviation of 1;
[0018] Furthermore, the specific processing steps of the non-angle data are:
[0019] For the original data point x, that is, the status information of the equipment at a single time node, calculate the mean μ of the data set, calculate the standard deviation σ of the data set, and perform normalization transformation on each data point as follows: x'=(x-μ) / σ. The range of the processed values is theoretically from negative infinity to positive infinity, because the range of the standard normal distribution is infinite; the actual data is usually concentrated in a smaller range, approximately between -3 and 3, but it does not rule out the existence of extreme values; ensure that the data has the same scale;
[0020] The angle data in the state data set of step S1 are respectively subjected to sin and cos operations to become two trigonometric function parameters. For example, the angle parameter a is subjected to sin(a) and cos(a) operations respectively.
[0021] After processing, the data will be saved as multiple CSV files, each with annotated labels, such as "Normal" and specific "Fault Type". The data points with the "Normal" label are the parameter values recorded when the equipment is operating normally, and the data points with the "Fault Type" label are the parameter values recorded when the equipment is operating normally.
[0022] Step S3: Dataset division:
[0023] Load the CSV data file and divide the data preprocessed in step S2 into a training set and a test set; the ratio of training samples is 80%, the ratio of verification samples is 10%, and the ratio of test samples is 10%. Ensure that in the training set and the test set, the ratio of the number of files of "normal" data to each "fault type" data is 3:1;
[0024] Specifically, in the training set and test set, the number of normal data is three times the number of fault type data. Such a distribution helps the model better learn and distinguish different types of data. In addition, the label of the test set is constructed to evaluate the effect during testing.
[0025] Step S4: Establish a transformer-based equipment fault detection model:
[0026] Furthermore, the transformer-based equipment fault detection model includes a data embedding layer, a dual-branch multi-head attention layer, a dual residual layer, and a Bayesian linear layer in sequence;
[0027] The dual-branch multi-head attention layer and the dual residual layer are respectively provided with three layers, and the two are alternately superimposed. The alternating superposition of the two specifically refers to that the output end of the first dual-branch multi-head attention layer is the first dual residual layer, the output end of the first dual residual layer is the second dual-branch multi-head attention layer, the output end of the second dual-branch multi-head attention layer is the second dual residual layer, the output end of the second dual residual layer is the third dual-branch multi-head attention layer, and the output end of the third dual-branch multi-head attention layer is the third dual residual layer;
[0028] The data embedding layer embeds the input time series data x into a higher dimensional space.
[0029] Add position information to the sequence x, that is, the time point of the time series data; standardize the embedded vector to help model training. The feature mapping dimension of the data embedding layer is ( , , );
[0030] The dual-branch multi-head attention layer simultaneously focuses on the prior association and sequence association of the sequence through two different branches; the output feature dimension of the dual-branch multi-head attention layer is ( , , );
[0031] The dual residual layer uses a residual connection to add the input x directly to the output processed by the dual-branch multi-head attention layer, so that the gradient flows in the network, avoiding the gradient vanishing problem in deep network training; the dual residual layer uses a feedforward neural network to process the output of the multi-head attention, and its output dimension is ( , , );
[0032] The Bayesian linear layer introduces uncertainty in weights and biases based on the traditional linear layer. In the forward propagation, weights and biases are sampled from their posterior distributions. The model learns the uncertainty of these parameters during training to improve the uncertainty estimation of model predictions. Its output dimension is ( , , );
[0033] Furthermore, the input of the data embedding layer is the time series data processed in step S3, which is sliced by a sliding window method, and the sequence data within a period of time is selected and embedded into a vector space of uniform dimension, and the operation is as follows:
[0034] (1) For long-term data series, sort them by time and slice the data using a sliding window. Set it to 100, which means selecting equipment status data at 100 time points;
[0035] (2) Time point information embedding: The time point information of the equipment status data is generated using sine and cosine functions. The vector represents the time point of the data in the sequence, so that the model can better understand the importance and relationship of different time points in the sequence.
[0036] The specific formula is as follows: , , where pos represents the time point of the equipment status data, starting from 0 and increasing; represents the dimension index in the embedding vector. In the experiment, the dimension value is , that is, 512; by calculating the odd-numbered dimension (1, 3...511) value of the equipment state at that time point and even-numbered dimensions (0, 2, ... 512) Get the final time point position encoding; (3) State information embedding: Use convolution operation to map the equipment state sequence to a dimension of The high-dimensional space enables the model to better understand the semantic information of equipment status data in time series;
[0037] (4) Equipment status feature embedding: The equipment status feature embedding is calculated based on the acquired equipment status information embedding and equipment status time point information embedding. The specific formula is as follows: ,
[0038] in, It is the state information embedding, which represents the semantic information of the equipment state data in the time series; It is the time point information embedding, which represents the time point information of the equipment status in the time series; It is feature embedding, which represents the characteristics of the equipment status obtained after processing the time series data, that is, it includes status information and time point information;
[0039] Furthermore, when the dual-branch multi-head attention layer performs feature processing, the transformer parameters are first Embedded into the same feature dimension space, initialized by the following formula: , where Represents the query, key, value and learning scale of self-attention respectively;
[0040] Represents the number of layers of dual-branch multi-head attention, in the experiment The maximum value is 3, because the model has a total of 3 layers of dual-branch multi-head attention layers, and the initial input Represents the original sequence of embedding, i.e., the output of the data embedding layer, and Embedding is a function of the embedding operation of the data embedding layer;
[0041] A. Converting prior association weights into discrete distributions: For prior associations , use a learnable Gaussian kernel to calculate the similarity between different time points, as follows;
[0042] Designing learnable scale parameters , the prior associations adapt to various time series patterns; , among which, for the The equipment status characteristics at each time point, we arbitrarily select other time points The equipment status features are obtained by Gaussian kernel Calculate time points With The correlation distance of the points is then used Dividing by the row sum converts the association weights into a discrete distribution, i.e., time points and The correlation of the equipment status, from which we get the similarity between time points not based on equipment status features;
[0043] B. Find the most effective sequence association pattern: Prior association obtains the similarity between each time point based on the time point, but it is not based on the specific equipment status characteristics, so it has certain limitations. It learns associations from equipment status characteristics and adaptively finds the most effective and important associations in status features; these associations reflect the correlation or importance between equipment status features in the time series;
[0044] ,in, Normalize the attention map along the last dimension;
[0045] Based on the obtained sequence association pattern, we can obtain the correlation between the equipment status features at a single time point and the equipment status features at other time points, and transfer features based on the correlation; the purpose is to increase the similarity between nodes of the same type to help subsequent anomaly classification detection;
[0046] Specifically, The multi-branch attention layer The output of each branch is: ;
[0047] in, and are the mth attention heads respectively. and Vector, dual-branch multi-head attention obtains the final output by connecting multiple branches: ;
[0048] in, It is through The equipment status features obtained by the double-branch multi-head attention layer, is the total number of multi-head attention heads, but it still needs to be further processed; when the double residual layer performs feature processing, it includes a feedforward layer, and the first double residual layer input is the output of the feedforward layer,
[0049] No. The first residual of the layer is formalized as:
[0050] ;
[0051] in, is a feedforward neural network, The second residual of the layer is formalized as:
[0052] ;
[0053] in, is the layer normalization operation, It is the equipment status feature obtained after the first residual processing;
[0054] The output of the third layer double residual Will be used as input to the Bayesian linear layer;
[0055] Furthermore, in the Bayesian linear layer, the prior means of weights and biases are and are randomly initialized from a uniform distribution, and the logarithmic variance of weights and biases is and is initialized to zero;
[0056] In the forward pass, weights and biases are sampled as follows: , ,in, and is random noise sampled from a standard normal distribution;
[0057] Get the Bayesian linear layer formula: ;
[0058] Step S5, model training: using the training data set to train the equipment fault detection model of step S3 using a small batch gradient descent method until the training stop condition is met;
[0059] Furthermore, in step S5, the model training includes the following steps:
[0060] (1) Setting the sliding window , , hidden layer dimension , Multi-head attention and learning rate;
[0061] (2) The training samples are fed into the transformer-based equipment fault detection model established in step S4 to calculate the anomaly detection score;
[0062] The specific formula is as follows:
[0063] ,
[0064] where ⊙ is element-wise multiplication;
[0065] Indicates the equipment status at that time abnormal judgment;
[0066] It's time point Equipment status characteristics Prior association Related to series The specific calculation formula for the similarity difference between them is as follows:
[0067] ,
[0068] is corresponding to and The KL divergence calculated between the two discrete distributions of each row of , we need to minimize the difference in similarity between the prior association and the series association; by averaging the association differences of the attention heads, the associations of multi-level features can be combined into a more informative metric;
[0069] (3) Update network parameters using gradient descent method based on anomaly detection scores;
[0070] (4) Determine whether an iteration is completed. If not, return to step (2); if so, go to step (5);
[0071] (5) Determine whether the early stopping condition is met or the maximum number of iterations is reached. If not, return to step (2); if so, complete the network training.
[0072] Step S6, verify the training results: Use the test set to verify the trained equipment fault detection model, and judge the recognition accuracy of the model according to the recognition result; if the recognition accuracy reaches more than 80%, the trained equipment fault detection model is used for fault detection, otherwise return to step S3 for further training.
[0073] Compared with the prior art, the beneficial effects of the present application are: the present application designs a dual-branch attention layer to discover more information associations, and learns association differences to distinguish anomalies; the dual-branch multi-head attention layer and the dual residual layer are alternately superimposed and organically integrated with the Bayesian inference method, and the generated transformer model can learn potential associations from deep multi-level features, thereby enhancing the model's ability to capture long-term dependencies, and also improving the model's sensitivity to small changes, thereby improving the accuracy and reliability of fault detection; the robustness of the model is enhanced, and it has strong generalization ability, thereby improving the model performance and fault detection efficiency; it has important practical significance for improving the equipment's availability and attendance rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 : Flow chart of the method of the present invention;
[0075] Figure 2 : Schematic diagram of the model structure;
[0076] Figure 3 : Framework diagram of the model;
[0077] Figure 4 : Data processing flow chart. DETAILED DESCRIPTION
[0078] The following is a specific implementation of the present invention with reference to the accompanying drawings to further illustrate the composition of the present invention.
[0079] Example 1. A method for generating an equipment fault detection model based on state data analysis, the process of which is as follows: Figure 1 The specific data processing flow is as shown in Figure 4 As shown, the method comprises the following steps:
[0080] Step S1, data collection:
[0081] Screen out status data records potentially associated with faults from equipment status monitoring systems and quality control systems, and sort out typical fault modes; record status monitoring system parameters in normal mode and construct status data sets;
[0082] The parameters recorded by the equipment status monitoring system involve multiple subsystems, with hundreds of parameters. The relevant parameters are selected according to the fault diagnosis requirements. The quality control system records the maintenance and support records of the equipment during its service.
[0083] Step S2: Data preprocessing:
[0084] Perform Gaussian normalization on the non-angular data in the state data set of step S1, and convert the data into a standard normal distribution with a mean of 0 and a standard deviation of 1;
[0085] The specific processing steps of the non-angle data are as follows:
[0086] For the original data point x, that is, the status information of the equipment at a single time node, calculate the mean μ of the data set, calculate the standard deviation σ of the data set, and perform normalization transformation on each data point as follows: x'=(x-μ) / σ. The range of the processed values is theoretically from negative infinity to positive infinity, because the range of the standard normal distribution is infinite; the actual data is usually concentrated in a smaller range, approximately between -3 and 3, but it does not rule out the existence of extreme values; ensure that the data has the same scale;
[0087] The angle data in the state data set of step S1 are respectively subjected to sin and cos operations to become two trigonometric function parameters. For example, the angle parameter a is subjected to sin(a) and cos(a) operations respectively.
[0088] After processing, the data will be saved as multiple CSV files, each with annotated labels, such as "Normal" and specific "Fault Type". The data points with the "Normal" label are the parameter values recorded when the equipment is operating normally, and the data points with the "Fault Type" label are the parameter values recorded when the equipment is operating normally.
[0089] Step S3: Dataset division:
[0090] Load the CSV data file and divide the data preprocessed in step S2 into a training set and a test set; the ratio of training samples is 80%, the ratio of verification samples is 10%, and the ratio of test samples is 10%. Ensure that in the training set and the test set, the number of files of "normal" data and each "fault type" data maintains a ratio of 3:1;
[0091] Specifically, in the training set and test set, the number of normal data is three times the number of fault type data. Such a distribution helps the model better learn and distinguish different types of data. In addition, the label of the test set is constructed to evaluate the effect during testing.
[0092] Step S4: Establish a transformer-based equipment fault detection model:
[0093] The transformer-based equipment fault detection model includes a data embedding layer, a dual-branch multi-head attention layer, a dual residual layer, and a Bayesian linear layer. Figure 2-Figure 3 ;
[0094] The dual-branch multi-head attention layer and the dual residual layer are respectively provided with three layers, and the two are alternately superimposed. The alternating superposition of the two specifically refers to that the output end of the first dual-branch multi-head attention layer is the first dual residual layer, the output end of the first dual residual layer is the second dual-branch multi-head attention layer, the output end of the second dual-branch multi-head attention layer is the second dual residual layer, the output end of the second dual residual layer is the third dual-branch multi-head attention layer, and the output end of the third dual residual layer is the third dual residual layer;
[0095] The data embedding layer embeds the input time series data x into a higher-dimensional space, adds position information to the sequence x, that is, the time point where the time series data is located; and normalizes the embedded vector to help model training.
[0096] The feature map dimension of the embedding layer is ( , , );
[0097] The dual-branch multi-head attention layer simultaneously focuses on the prior association and sequence association of the sequence through two different branches; the output feature dimension of the dual-branch multi-head attention layer is ( , , );
[0098] The dual residual layer uses a residual connection to add the input x directly to the output processed by the dual-branch multi-head attention layer, so that the gradient flows in the network, avoiding the gradient vanishing problem in deep network training; the dual residual layer uses a feedforward neural network to process the output of the multi-head attention, and its output dimension is ( , , );
[0099] The Bayesian linear layer introduces uncertainty in weights and biases based on the traditional linear layer. In the forward propagation, weights and biases are sampled from their posterior distributions. The model learns the uncertainty of these parameters during training to improve the uncertainty estimation of model predictions. Its output dimension is ( , , );
[0100] Furthermore, the input of the data embedding layer is the time series data processed in step S3, which is sliced by a sliding window method, and the sequence data within a period of time is selected and embedded into a vector space of uniform dimension, and the operation is as follows:
[0101] (1) For long-term data series, sort them by time and slice the data using a sliding window. Set it to 100, which means selecting equipment status data at 100 time points;
[0102] (2) Time point information embedding: The time point information of the equipment status data is generated using sine and cosine functions. The vector represents the time point of the data in the sequence, so that the model can better understand the importance and relationship of different time points in the sequence.
[0103] The specific formula is as follows: , , where pos represents the time point of the equipment status data, starting from 0 and increasing; represents the dimension index in the embedding vector. In the experiment, the dimension value is , that is, 512; by calculating the odd-numbered dimension (1, 3...511) value of the equipment state at that time point and even-numbered dimensions (0, 2, ... 512) Get the final time point position code;
[0104] (3) State information embedding: Use convolution operation to map the equipment state sequence to a dimension of The high-dimensional space enables the model to better understand the semantic information of equipment status data in time series;
[0105] (4) Equipment status feature embedding: The equipment status feature embedding is calculated based on the acquired equipment status information embedding and equipment status time point information embedding. The specific formula is as follows: ,in, It is the state information embedding, which represents the semantic information of the equipment state data in the time series; It is the time point information embedding, which represents the time point information of the equipment status in the time series; It is feature embedding, which represents the characteristics of the equipment status obtained after processing the time series data, that is, it includes status information and time point information;
[0106] Furthermore, when the dual-branch multi-head attention layer performs feature processing, the transformer parameters are first Embedded into the same feature dimension space, initialized by the following formula: , where Represents the query, key, value and learning scale of self-attention respectively; Represents the number of layers of dual-branch multi-head attention, in the experiment The maximum value is 3, because the model has a total of 3 layers of dual-branch multi-head attention layers, and the initial input Represents the original sequence of embedding, i.e., the output of the data embedding layer, and Embedding is a function of the embedding operation of the data embedding layer;
[0107] A. Converting prior association weights into discrete distributions: For prior associations , use a learnable Gaussian kernel to calculate the similarity between different time points, as follows;
[0108] Designing learnable scale parameters , the prior associations adapt to various time series patterns; , among which, for the The equipment status characteristics at each time point, we arbitrarily select other time points The equipment status features are obtained by Gaussian kernel Calculate time points With The correlation distance of the points is then used Dividing by the row sum converts the association weights into a discrete distribution, i.e., time points and The correlation of the equipment status, from which we get the similarity between time points not based on equipment status features;
[0109] B. Find the most effective sequence association pattern: Prior association obtains the similarity between each time point based on the time point, but it is not based on the specific equipment status characteristics, so it has certain limitations. It learns associations from equipment status characteristics and adaptively finds the most effective and important associations in status features; these associations reflect the correlation or importance between equipment status features in the time series;
[0110] ,in, Normalize the attention map along the last dimension;
[0111] Based on the obtained sequence association pattern, we can obtain the correlation between the equipment status features at a single time point and the equipment status features at other time points, and transfer features based on the correlation; the purpose is to increase the similarity between nodes of the same type to help subsequent anomaly classification detection;
[0112] Specifically,
[0113] No. The multi-branch attention layer The output of each branch is: ;
[0114] in, and are the mth attention heads respectively. and Vector, dual-branch multi-head attention obtains the final output by connecting multiple branches:
[0115] ;
[0116] in, It is through The equipment status features obtained by the double-branch multi-head attention layer, is the total number of multi-head attention heads, but it still needs to be further processed; when the double residual layer performs feature processing, it includes a feedforward layer, and the first double residual layer input is the output of the feedforward layer,
[0117] No. The first residual of the layer is formalized as: ,in
[0118] is a feedforward neural network, The second residual of the layer is formalized as:
[0119] ;
[0120] in, is the layer normalization operation, It is the equipment status feature obtained after the first residual processing;
[0121] The output of the third layer double residual Will be used as input to the Bayesian linear layer;
[0122] Furthermore, in the Bayesian linear layer, the prior means of weights and biases are and are randomly initialized from a uniform distribution, and the logarithmic variance of weights and biases is and is initialized to zero;
[0123] In the forward pass, weights and biases are sampled as follows: , ,in, and is random noise sampled from a standard normal distribution;
[0124] Get the Bayesian linear layer formula: ;
[0125] Step S5, model training: using the training data set to train the equipment fault detection model of step S3 using a small batch gradient descent method until the training stop condition is met;
[0126] Furthermore, in step S5, the model training includes the following steps:
[0127] (1) Setting the sliding window , , hidden layer dimension , Multi-head attention and learning rate;
[0128] (2) The training samples are fed into the transformer-based equipment fault detection model established in step S4 to calculate the anomaly detection score;
[0129] The specific formula is as follows: ,
[0130] where ⊙ is element-wise multiplication;
[0131] Indicates the equipment status at that time abnormal judgment;
[0132] It's time point Equipment status characteristics Prior association Related to series The specific calculation formula for the similarity difference between them is as follows: ,
[0133] is corresponding to and The KL divergence calculated between the two discrete distributions of each row of , we need to minimize the difference in similarity between the prior association and the series association; by averaging the association differences of the attention heads, the associations of multi-level features can be combined into a more informative metric;
[0134] (3) Update network parameters using gradient descent method based on anomaly detection scores;
[0135] (4) Determine whether an iteration is completed. If not, return to step (2); if so, go to step (5);
[0136] (5) Determine whether the early stopping condition is met or the maximum number of iterations is reached. If not, return to step (2); if so, complete the network training.
[0137] Step S6, verify the training results: Use the test set to verify the trained equipment fault detection model, and judge the recognition accuracy of the model according to the recognition result; if the recognition accuracy reaches more than 80%, the trained equipment fault detection model is used for fault detection, otherwise return to step S3 for further training.
[0138] The above is only a specific embodiment of the present invention, and the present invention is described in detail. The unexplained part is a conventional technology. However, the protection scope of the present invention is not limited to this. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. The protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for generating an equipment fault detection model based on state data analysis, characterized in that: The method comprises the following steps: Step S1, data collection: screen out status data records potentially associated with faults from equipment status monitoring systems and quality control systems, sort out status monitoring system parameter records under typical fault modes and normal modes, and construct status data sets; Step S2, data preprocessing: perform Gaussian normalization on the non-angular data in the state data set of step S1, and convert the data into a standard normal distribution with a mean of 0 and a standard deviation of 1; perform sin and cos operations on the angular data in the state data set of step S1, respectively, and convert them into two trigonometric function parameters; After processing, the data will be saved as multiple CSV files, each with annotated labels; Step S3, data set division: load the CSV data file and divide the data preprocessed in step S2 into a training set and a test set; Step S4: Establish a transformer-based equipment fault detection model: The transformer-based equipment fault detection model includes a data embedding layer, a dual-branch multi-head attention layer, a dual residual layer and a Bayesian linear layer in sequence, wherein the dual-branch multi-head attention layer and the dual residual layer are respectively provided with three layers, and the two are alternately superimposed; The data embedding layer embeds the input time series data x into a higher dimensional space, adding position information to the sequence x, that is, the time point where the time series data is located; by standardizing the embedded vector, the model training is helped. The feature mapping dimension of the data embedding layer is ( , , ); The dual-branch multi-head attention layer simultaneously focuses on the prior association and sequence association of the sequence through two different branches; the output feature dimension of the dual-branch multi-head attention layer is ( , , ); The dual residual layer uses a residual connection to add the input x directly to the output processed by the dual-branch multi-head attention layer, so that the gradient flows in the network. The dual residual layer uses a feedforward neural network to process the output of the multi-head attention, and its output dimension is ( , , ); The Bayesian linear layer introduces uncertainty in weights and biases based on the traditional linear layer. In the forward propagation, weights and biases are sampled from their posterior distributions. The model learns the uncertainty of these parameters during training to improve the uncertainty estimation of model predictions. Its output dimension is ( , , ); Step S5, model training: using the training set to train the equipment fault detection model of step S4 using a small batch gradient descent method until the training stop condition is met; Step S6, verify the training results: Use the test set to verify the trained equipment fault detection model, and judge the recognition accuracy of the model according to the recognition result; if the recognition accuracy reaches more than 80%, the trained equipment fault detection model is used for fault detection, otherwise return to step S3 for further training.
2. The method for generating an equipment fault detection model based on state data analysis according to claim 1, characterized in that: The specific processing steps of the non-angle data in step S1 are: For the original data point x, that is, the status information of the equipment at a single time node, the mean μ of the data set is calculated, the standard deviation σ of the data set is calculated, and each data point is normalized as follows: x'=(x-μ) / σ.
3. A method for generating an equipment fault detection model based on state data analysis according to claim 1 or 2, characterized in that: In step S3, the proportion of training samples is 80%, the proportion of verification samples is 10%, and the proportion of test samples is 10%, ensuring that they are in the training set and the test set.
4. The method for generating an equipment fault detection model based on state data analysis according to claim 1, characterized in that: The input of the data embedding layer is the time series data processed in step S3. The data is sliced by the sliding window method, and the sequence data within a period of time is embedded into the vector space of uniform dimension. The operation is as follows: (1) For long-term data series, sort them by time and slice the data using a sliding window. Set it to 100, which means selecting equipment status data at 100 time points; (2) Time point information embedding: The time point information of the equipment status data is generated using sine and cosine functions. The vector represents the time point of the data in the sequence, so that the model can better understand the importance and relationship of different time points in the sequence. The specific formula is as follows: , , Among them, pos represents the time point of the equipment status data, starting from 0 and increasing; represents the dimension index in the embedding vector. In the experiment, the dimension value is , that is, 512; By calculating the odd-numbered dimension (1, 3, ... 511) value of the equipment status at that time point and even-numbered dimensions (0, 2, ... 512) Get the final time point position code; (3) State information embedding: Use convolution operation to map the equipment state sequence to a dimension of The high-dimensional space enables the model to better understand the semantic information of equipment status data in time series; (4) Equipment status feature embedding: The equipment status feature embedding is calculated based on the acquired equipment status information embedding and equipment status time point information embedding. The specific formula is as follows: ,in, It is the state information embedding, which represents the semantic information of the equipment state data in the time series; It is the time point information embedding, which represents the time point information of the equipment status in the time series; It is feature embedding, which represents the characteristics of the equipment status obtained after processing the time series data, that is, it includes status information and time point information.
5. The method for generating an equipment fault detection model based on state data analysis according to claim 1, characterized in that: When the dual-branch multi-head attention layer performs feature processing, the transformer parameters are first Embedded into the same feature dimension space, initialized by the following formula: , In the formula, Represents the query, key, value and learning scale of self-attention respectively; Represents the number of layers of dual-branch multi-head attention, in the experiment The maximum value is 3, because the model has a total of 3 layers of dual-branch multi-head attention layers, and the initial input Represents the original sequence of embedding, i.e., the output of the data embedding layer, and Embedding is a function of the embedding operation of the data embedding layer; A. Converting prior association weights into discrete distributions: For prior associations , use a learnable Gaussian kernel to calculate the similarity between different time points, as follows; Designing learnable scale parameters , the prior associations adapt to various time series patterns; , Among them, for the Equipment status characteristics at a time point, any other time point can be selected The equipment status features are obtained by Gaussian kernel Calculate time points With The correlation distance of the points is then used Dividing by the row sum converts the association weights into a discrete distribution, i.e., time points and The correlation of the equipment status of the equipment is obtained, thereby obtaining the similarity between the time points not based on the equipment status characteristics; B. Find the most effective sequence association pattern: Prior association obtains the similarity between each time point based on the time point, but it is not based on the specific equipment status characteristics and has certain limitations. It learns associations from equipment status characteristics and adaptively finds the most effective and important associations in status features; these associations reflect the correlation or importance between equipment status features in the time series; ,in, Normalize the attention map along the last dimension; Based on the obtained sequence association pattern, the correlation between the equipment status features at a single time point and the equipment status features at other time points can be obtained, and feature transfer can be performed based on the correlation; the similarity between nodes of the same type is increased to help subsequent abnormal classification detection; No. The multi-branch attention layer The output of each branch is: ; in, and are the mth attention heads respectively. and Vector, dual-branch multi-head attention obtains the final output by connecting multiple branches: ; in, It is through The equipment status features obtained by the double-branch multi-head attention layer, is the total number of multi-head attention heads, but it still needs to be further processed; when the double residual layer performs feature processing, it includes a feedforward layer, and the input of the first double residual layer is the output of the feedforward layer.
6. The method for generating an equipment fault detection model based on state data analysis according to claim 1, characterized in that: The double residual layer The first residual of the layer is formalized as: ; in, is a feed-forward neural network, No. The second residual of the layer is formalized as: ; in, is the layer normalization operation, It is the equipment status feature obtained after the first residual processing; The output of the third layer double residual Will be used as input to the Bayesian linear layer.
7. The method for generating an equipment fault detection model based on state data analysis according to claim 1, characterized in that: In the Bayesian linear layer, the prior means of weights and biases are and are randomly initialized from a uniform distribution, and the logarithmic variance of weights and biases is and is initialized to zero; In the forward pass, weights and biases are sampled as follows: , ,in, and is random noise sampled from a standard normal distribution; Get the Bayesian linear layer formula: .
8. The method for generating an equipment fault detection model based on state data analysis according to claim 1 or 2, characterized in that: In step S5, model training includes the following steps: (1) Setting the sliding window , , hidden layer dimension , Multi-head attention and learning rate; (2) The training samples are fed into the transformer-based equipment fault detection model established in step S4 to calculate the anomaly detection score; The specific formula is as follows: , where ⊙ is element-wise multiplication; Indicates the equipment status at that time abnormal judgment; It's time point Equipment status characteristics Prior association Related to series The specific calculation formula for the similarity difference between them is as follows: , is corresponding to and The KL divergence calculated between the two discrete distributions of each row of minimizes the difference in similarity between the prior association and the series association; the association of multi-level features is combined into a more informative metric by averaging the association differences of the attention heads; (3) Update network parameters using gradient descent method based on anomaly detection scores; (4) Determine whether an iteration is completed. If not, return to step (2); if so, go to step (5); (5) Determine whether the early stopping condition is met or the maximum number of iterations is reached. If not, return to step (2); if so, complete the network training.
