Coal quality data anomaly detection method based on attention mechanism

By employing an attention-based coal quality data anomaly detection method, utilizing multi-sensor fusion technology and a feature extraction module, combined with an anomaly detection model, the problems of data noise interference and feature extraction difficulties in coal quality monitoring systems of coal-fired power plants are solved, enabling real-time and accurate coal quality monitoring and early warning.

CN120873902APending Publication Date: 2025-10-31NANJING GUODIAN ENVIRONMENTAL PROTECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510974003.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-15
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

Existing coal quality monitoring systems for coal-fired power plants suffer from problems such as data noise interference, difficulty in feature extraction, and low efficiency in anomaly detection when faced with complex and ever-changing coal quality data, making it difficult to achieve real-time and accurate coal quality monitoring.

Method used

An attention-based coal quality data anomaly detection method is adopted. Coal quality data is collected in real time through multi-sensor fusion technology, outliers are removed by combining Z-score and IQR methods, missing values ​​are processed by KNN-LSTM hybrid model, and key features are extracted through attention mechanism to construct an isolated forest model for anomaly detection, so as to realize real-time monitoring and early warning.

Benefits of technology

It significantly improves the accuracy and completeness of coal quality data, enhances the accuracy of feature extraction and the efficiency of anomaly detection, and enables real-time monitoring and early warning of coal quality data, ensuring that coal-fired power plants can promptly detect and handle coal quality anomalies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120873902A_ABST
    Figure CN120873902A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of coal quality monitoring and management of coal-fired power plants, and discloses a coal quality data anomaly detection method based on an attention mechanism, and the method comprises the following steps: S1, data collection and preprocessing: collecting and preprocessing coal quality data in real time; s2, attention mechanism feature extraction: constructing a feature extraction model based on an attention mechanism, and extracting key features of the coal quality data; and S3, constructing an anomaly detection model, wherein the anomaly detection model is constructed by using the extracted features. Through introduction of the feature extraction module, the template is divided into an input layer, an attention weight layer, an attention score calculation layer, an attention weight calculation layer and a context vector calculation layer, key features in coal quality data can be efficiently captured, different weights are given to different features through an attention mechanism, the accuracy of feature expression is remarkably improved, and the accuracy of coal quality data extraction is improved. Therefore, the model can identify abnormal data more accurately, and the detection efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of coal quality monitoring and management technology for coal-fired power plants, specifically to a coal quality data anomaly detection method based on an attention mechanism, which is used to improve the accuracy and efficiency of coal quality data monitoring in coal-fired power plants. Background Technology

[0002] Accurate monitoring of coal quality data is crucial for ensuring boiler combustion efficiency and reducing pollutant emissions during the operation of coal-fired power plants. Traditional coal quality monitoring methods mainly rely on manual sampling and laboratory analysis. This approach is not only time-consuming and labor-intensive, but also makes real-time monitoring difficult and fails to detect abnormal changes in coal quality in a timely manner.

[0003] With the development of IoT, big data, and AI technologies, coal-fired power plants have begun to introduce automated coal quality monitoring systems. These systems collect coal quality data in real time through online sensors and utilize data analysis techniques for anomaly detection. However, existing automated coal quality monitoring systems still have the following shortcomings when processing complex and variable coal quality data:

[0004] 1. Data noise interference: Coal quality data is easily affected by various noises during the acquisition and transmission process, which affects the accuracy of anomaly detection.

[0005] 2. Difficulty in feature extraction: Coal quality data contains multiple dimensions (such as ash content, volatile matter, calorific value, etc.), and the correlation between different dimensions is complex, making it difficult for traditional methods to effectively extract key features.

[0006] 3. Low efficiency of anomaly detection: When faced with large-scale, high-dimensional coal quality data, traditional anomaly detection algorithms have high computational complexity, making it difficult to meet the needs of real-time monitoring.

[0007] Therefore, developing an efficient and accurate method for detecting coal quality data anomalies is of great significance for improving the operating efficiency and environmental protection level of coal-fired power plants. Summary of the Invention

[0008] The purpose of this invention is to provide a coal quality data anomaly detection method based on an attention mechanism. By introducing an attention mechanism, the accuracy of coal quality data feature extraction and the efficiency of anomaly detection are improved, enabling real-time and accurate monitoring of coal quality data, thereby solving the problems mentioned in the background art.

[0009] To achieve the above objectives, the present invention provides the following technical solution: a coal quality data anomaly detection method based on an attention mechanism, comprising the following steps:

[0010] Step S1, data acquisition and preprocessing, is used to acquire coal quality data in real time and perform preprocessing.

[0011] Step S2, attention mechanism feature extraction, is used to construct an attention mechanism-based feature extraction model to extract key features of coal quality data.

[0012] Step S3 is an anomaly detection model construction, which is used to construct an anomaly detection model using the extracted features;

[0013] Step S4, Real-time Monitoring and Early Warning, is used to apply the anomaly detection model to the real-time coal quality data stream to achieve real-time monitoring and early warning of coal quality data.

[0014] The data acquisition and preprocessing step S1 specifically includes:

[0015] S1.1 collects coal quality data in real time through online sensors, including multiple dimensions such as ash content, volatile matter, and calorific value;

[0016] S1.2 Preprocess the collected coal quality data, including cleaning the raw coal quality data and data normalization.

[0017] The attention mechanism feature extraction in step S2 is based on a self-attention mechanism feature extraction module. This module can automatically learn the correlation between different dimensions in coal quality data and assign different weights to different dimensions, thereby extracting key features.

[0018] The anomaly detection model construction in step S3 specifically includes:

[0019] S3.1 Anomaly Detection Model Selection

[0020] Using Isolation Forest as the anomaly detection model, the anomaly score is calculated using the following formula. Where s(x,n) is the anomaly score of sample x, Eh(x) is the average path length of sample x in multiple isolated trees, c(n) is the correction term for the average path length, and n is the number of samples.

[0021] S3.2 Model Training

[0022] S3.2.1 Data Preparation: Using coal quality data features extracted through the attention mechanism as the input to the model, the data is divided into training and test sets;

[0023] S3.2.2 Model Initialization: Initialize the isolated forest model and set model parameters, such as the number of trees and the pollution rate, which is the proportion of outliers in the dataset;

[0024] S3.2.3 Model Training: The isolated forest model is trained using the training set data. The model learns the distribution characteristics of the data by constructing multiple isolated trees.

[0025] S3.3 Model Prediction and Evaluation

[0026] S3.3.1 Model Prediction: The trained Isolation Forest model is used to predict the test set data. The model will output an anomaly score for each sample and mark the sample as normal or abnormal according to the set threshold.

[0027] S3.3.2 Model Evaluation: Use evaluation metrics (such as precision, recall, F1 score, etc.) to evaluate the model's performance. By comparing the model's prediction results with the true labels, we can understand the model's performance in the anomaly detection task.

[0028] The real-time monitoring and early warning step S4 specifically includes:

[0029] Access to S4.1 real-time data stream

[0030] S4.1.1 Data Source: Real-time coal quality data streams originate from sensor networks deployed in coal-fired power plants. These sensors collect coal quality data in real time, such as ash content, volatile matter, and calorific value.

[0031] S4.1.2 Access method: Real-time data stream access is achieved through message queues (such as Kafka, RabbitMQ, etc.) or real-time databases (such as Redis, InfluxDB, etc.) to ensure the real-time performance and reliability of the data;

[0032] Real-time application of the S4.2 anomaly detection model

[0033] S4.2.1 Model Deployment: Deploy the trained anomaly detection model to the real-time monitoring system to ensure that the model can receive and process data streams in real time;

[0034] S4.2.2 Online Prediction: Performs online prediction on real-time data streams, uses models to detect anomalies for each data point, and outputs anomaly scores;

[0035] Construction of S4.3 Early Warning Mechanism

[0036] S4.3.1 Warning threshold setting: Based on the actual application scenario and model output, set an appropriate warning threshold. The threshold setting needs to balance the false alarm rate and the false alarm rate.

[0037] S4.3.2 Warning Triggering and Transmission: When the abnormal score exceeds the set threshold, the warning mechanism is triggered.

[0038] Preferably, in step S1.1, a dual-energy gamma-ray transmission sensor (DE-GCA) is used for ash content detection. The ash content is calculated based on the attenuation difference between high and low energy rays, using the following formula:

[0039] In the formula, μH and μL are the mass attenuation coefficients of high / low energy rays, and I0initial and Ilower are the mass attenuation coefficients of high / low energy rays. H IL The intensity of high / low energy rays that initiate / penetrate.

[0040] Preferably, in step S1.1, a near-infrared spectral sensor (wavelength range 900-2500 nm) is used for volatile matter detection. The volatile matter content is analyzed through spectral absorption characteristics, using the following formula:

[0041] In the formula, w is the PLS regression coefficient, and R is the reflectance.

[0042] Preferably, in step S1.1, the calorific value detection uses a fusion system of a calorimeter and a thermal conductivity sensor. The calorific value is calculated by comprehensively considering thermal conductivity and temperature change, using the following formula:

[0043] Q net =337C+1442(HO / 8)+93S, where C / H / O / S are the results of elemental analysis;

[0044] Multi-sensor data are aligned using timestamps (error < 50ms) to construct a three-dimensional data matrix X(t) ∈ R. N×M×T Where N is the number of samples, M is the feature dimension, and T is the time window.

[0045] Preferably, in step S1.2, a combined Z-score and IQR method is used to remove outliers during the cleaning operation. The Z-score method can capture Gaussian distribution outliers, and the IQR method can handle asymmetric distribution outliers.

[0046] The Z-score method identifies outliers by calculating the deviation of each data point from the mean, expressed in standard deviation. It uses a formula... Where Z is the standard score, X is the original data point, μ is the mean of the dataset, and σ is the standard deviation of the dataset; the threshold is set to |Z|>3, which is considered an outlier and can be adjusted according to the actual situation.

[0047] The IQR method identifies and removes outliers exceeding 1.5 times the IQR range by calculating the interquartile range of the data. The threshold is set at... Adjustments can be made based on the actual situation.

[0048] Preferably, in step S1.2, a spatiotemporal correlation-based KNN-LSTM hybrid model is used to handle missing values ​​during the cleaning operation;

[0049] Based on spatial KNN interpolation, the KNN algorithm is used, and the formula is applied. To estimate missing values, where, It is a normalization coefficient to ensure that the sum of the weights is 1. W is the feature similarity weight. For each missing value position i, its similarity to its neighboring positions j (j∈N) is calculated. k The feature similarity between j (i.e., the set of k nearest neighbors belonging to i) and the weight W. ij This reflects the degree to which position j contributes to the estimation of the missing value at position i;

[0050] Based on time interpolation, a recursive prediction is performed using an LSTM model, with the following steps:

[0051] S1.2.1 Prepare time series data: Collect time series data containing missing values, ensuring that the data is arranged in chronological order;

[0052] S1.2.2 Training the LSTM model: Train the LSTM network using complete historical data to enable it to learn long-term dependencies in the time series; the LSTM model can receive data from the previous n time steps (x... t-1 ,x t-2 ,...,x t-n () as input, and predict the value at the next time step;

[0053] S1.2.3 Perform imputation prediction: For each missing time point t, input the previous n known data points into the LSTM model; the model outputs the predicted value. Used to fill in missing values ​​at that time point;

[0054] By combining spatial KNN interpolation with temporal LSTM interpolation, a comprehensive interpolation strategy is formed, using the following formula: in, The value is obtained through KNN spatial interpolation. The value is obtained through LSTM time interpolation. α is a weighting parameter used to control the relative importance of the two interpolation results. Usually, α = 0.6, which is adjusted according to the actual data distribution and missing data to ensure that the interpolation result reflects both spatial characteristics and captures the time trend, thereby improving the overall estimation accuracy.

[0055] Preferably, in step S1.2, during data normalization, a feature-level normalization method is first used to linearly map the data to the range [0,1], eliminating the influence of different feature dimensions and making the data comparable. The formula expression is as follows:

[0056] Among them, X normalized The data is normalized, and X is the original data. min Let X be the minimum value in X. max Let X be the maximum value; then, use sample-level standardization to standardize the data to a standard normal distribution with a mean of 0 and a standard deviation of 1, ensuring the stability of the batch data distribution, using the formula:

[0057] in, For the standardized i-th sample, x i Let be the original i-th sample, and μB be the mean of the most recent 100 samples. γ is the variance of the most recent 100 samples, γ is the scaling factor, which is set to 1.2 here (empirical coefficient), β is the offset factor, and ∈ is a very small value (such as 10-5) to ensure that division by zero does not occur when calculating the variance.

[0058] Preferably, the feature extraction module is structured as follows:

[0059] Input layer: Receives preprocessed coal quality data, with data shape including batch size, time series length, and feature dimensions (ash content, volatile matter, calorific value);

[0060] Attention weight layer: Contains a learnable attention weight matrix, which is used to calculate the importance score for each feature dimension;

[0061] Attention Score Calculation Layer: This layer calculates the scores of input features and attention weights using matrix multiplication to obtain the attention score matrix, expressed as S = X × W. a In the formula, S is the attention score, X is the input feature matrix, and W is the input feature matrix. a It is a learnable attention weight matrix;

[0062] Attention weight calculation layer: The attention score is normalized by the Softmax function to obtain the attention weight matrix, using the formula A = Softmax(S), where A is the attention weight and S is the attention score;

[0063] Context vector computation layer: This layer aggregates input features into a context vector through weighted summation, using the formula C = A. T ×X, where C is the context vector, A is the attention weight, and X is the input feature matrix.

[0064] This invention provides a method for detecting anomalies in coal quality data based on an attention mechanism. It has the following beneficial effects:

[0065] (1) This invention uses multi-sensor fusion technology, which can collect data on multiple key dimensions of coal quality in real time, including ash content, volatile matter and calorific value, ensuring the comprehensiveness of the data. In the data acquisition and preprocessing process, the Z-score and IQR joint judgment method is adopted to effectively remove outliers in the data. At the same time, the KNN-LSTM hybrid model with spatiotemporal correlation is used to process missing values, which significantly improves the accuracy and completeness of the data. The data normalization operation eliminates the influence of different feature dimensions, making the data comparable and further improving the data quality, providing a reliable foundation for subsequent feature extraction and anomaly detection.

[0066] (2) By introducing a feature extraction module, the present invention is divided into an input layer, an attention weight layer, an attention score calculation layer, an attention weight calculation layer and a context vector calculation layer. This module can efficiently capture key features in coal quality data. By assigning different weights to different features through the attention mechanism, the accuracy of feature expression is significantly improved, enabling the model to more accurately identify abnormal data and improve detection efficiency and accuracy.

[0067] (3) By constructing an anomaly detection model, the present invention deploys the trained anomaly detection model into a real-time monitoring system. This method can realize real-time monitoring and online prediction of coal quality data. When abnormal data is detected, the system can immediately trigger an early warning mechanism. The system determines whether to trigger an early warning based on the anomaly score and the set threshold, thus realizing the real-time monitoring and early warning function of coal quality data and ensuring that coal-fired power plants can promptly detect and handle coal quality anomalies. Attached Figure Description

[0068] Figure 1 This is a schematic diagram of the method steps of the present invention;

[0069] Figure 2 This is a schematic diagram of the data acquisition and preprocessing steps of the present invention;

[0070] Figure 3 This is a structural view of the feature extraction module of the present invention;

[0071] Figure 4 This is a schematic diagram of the steps involved in constructing the anomaly detection model of the present invention;

[0072] Figure 5 This is a schematic diagram of the real-time monitoring and early warning process of the present invention. Detailed Implementation

[0073] 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.

[0074] Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the invention, and should not be construed as limiting the invention.

[0075] A preferred embodiment of the coal quality data anomaly detection method based on the attention mechanism provided by the present invention is as follows: Figure 1-5 As shown: A coal quality data anomaly detection method based on attention mechanism includes the following steps:

[0076] Step S1, data acquisition and preprocessing, is used to acquire coal quality data in real time and perform preprocessing.

[0077] Step S1, data acquisition and preprocessing, specifically includes:

[0078] S1.1 Real-time coal quality data is collected via online sensors, including multiple dimensions such as ash content, volatile matter, and calorific value. For ash content detection, a dual-energy gamma-ray transmission sensor (DE-GCA) is used. The ash content is calculated based on the attenuation difference between high and low energy rays, using the following formula:

[0079] In the formula, μH and μL are the mass attenuation coefficients of high / low energy rays, and I0initial and Ilower are the mass attenuation coefficients of high / low energy rays. H I L The intensity of the initial / penetrating high / low energy rays;

[0080] For volatile matter detection, a near-infrared spectral sensor (wavelength range 900-2500nm) is used. The volatile matter content is analyzed through spectral absorption characteristics, using the following formula:

[0081] In the formula, w is the PLS regression coefficient and R is the reflectance;

[0082] For calorific value detection, a fusion system of a calorimeter and a thermal conductivity sensor is used. The calorific value is calculated by comprehensively considering thermal conductivity and temperature change, using the following formula:

[0083] Q net =337C+1442(HO / 8)+93S, where C / H / O / S are the results of elemental analysis;

[0084] Multi-sensor data are aligned using timestamps (error < 50ms) to construct a three-dimensional data matrix X(t) ∈ R. N×M×T Where N is the number of samples, M is the feature dimension, and T is the time window;

[0085] S1.2 Preprocess the collected coal quality data, including cleaning the raw coal quality data and data normalization.

[0086] For cleaning operations, a combined Z-score and IQR method is used to remove outliers. The Z-score method can capture Gaussian distribution outliers, while the IQR method can handle asymmetric distribution outliers.

[0087] The Z-score method identifies outliers by calculating the deviation of each data point from the mean, expressed in standard deviation. It uses a formula... Where Z is the standard score, X is the original data point, μ is the mean of the dataset, and σ is the standard deviation of the dataset; the threshold is set to |Z|>3, which is considered an outlier and can be adjusted according to the actual situation.

[0088] The IQR method identifies and removes outliers exceeding 1.5 times the IQR range by calculating the interquartile range of the data. The threshold is set at... Adjustments can be made based on the actual situation;

[0089] For cleaning operations, a spatiotemporal correlation-based KNN-LSTM hybrid model is used to handle missing values;

[0090] Based on spatial KNN interpolation, the KNN algorithm is used, and the formula is applied. To estimate missing values, where, It is a normalization coefficient to ensure that the sum of the weights is 1. W is the feature similarity weight. For each missing value position i, its similarity to its neighboring positions j (j∈N) is calculated. k The feature similarity between j (i.e., the set of k nearest neighbors belonging to i) and the weight W. ij This reflects the degree to which position j contributes to the estimation of the missing value at position i;

[0091] Based on time interpolation, a recursive prediction is performed using an LSTM model, with the following steps:

[0092] S1.2.1 Prepare time series data: Collect time series data containing missing values, ensuring that the data is arranged in chronological order;

[0093] S1.2.2 Training the LSTM model: Train the LSTM network using complete historical data to enable it to learn long-term dependencies in the time series; the LSTM model can receive data from the previous n time steps (x... t-1 ,xt-2 ,...,x t-n () as input, and predict the value at the next time step;

[0094] S1.2.3 Perform imputation prediction: For each missing time point t, input the previous n known data points into the LSTM model; the model outputs the predicted value. Used to fill in missing values ​​at that time point;

[0095] By combining spatial KNN interpolation with temporal LSTM interpolation, a comprehensive interpolation strategy is formed, using the following formula: in, The value is obtained through KNN spatial interpolation. The value is obtained through LSTM time interpolation. α is a weighting parameter used to control the relative importance of the two interpolation results. Usually, α = 0.6, which is adjusted according to the actual data distribution and missing data to ensure that the interpolation results reflect both spatial characteristics and capture time trends, thereby improving the overall estimation accuracy.

[0096] When performing data normalization, feature-level normalization is first used to linearly map the data to the range [0,1], eliminating the influence of different feature dimensions and making the data comparable. This is achieved using a formula expression:

[0097] Among them, X normalized The data is normalized, and X is the original data. min Let X be the minimum value in X. max Let X be the maximum value; then, use sample-level standardization to standardize the data to a standard normal distribution with a mean of 0 and a standard deviation of 1, ensuring the stability of the batch data distribution, using the formula:

[0098] in, For the standardized i-th sample, x i Let be the original i-th sample, and μB be the mean of the most recent 100 samples. Here, γ is the variance of the most recent 100 samples, γ is the scaling factor, which is set to 1.2 here (empirical coefficient), β is the offset factor, and ∈ is a very small value (such as 10-5) to ensure that division by zero does not occur when calculating the variance;

[0099] Furthermore, data cleaning removes noise and invalid data, improving data accuracy; data normalization eliminates dimensional differences, improving data comparability. Together, these two processes ensure data quality and usability, laying the foundation for subsequent attention mechanism feature extraction and anomaly detection, and ensuring the accuracy and efficiency of coal quality data anomaly detection methods.

[0100] Step S2, attention mechanism feature extraction, is used to construct an attention mechanism-based feature extraction model to extract key features of coal quality data.

[0101] Step S2: Feature extraction based on attention mechanism. This module can automatically learn the correlation between different dimensions in coal quality data and assign different weights to different dimensions, thereby extracting key features.

[0102] The feature extraction module is structured as follows:

[0103] Input layer: Receives preprocessed coal quality data, with data shape including batch size, time series length, and feature dimensions (ash content, volatile matter, calorific value);

[0104] Attention weight layer: Contains a learnable attention weight matrix, which is used to calculate the importance score for each feature dimension;

[0105] Attention Score Calculation Layer: This layer calculates the scores of input features and attention weights using matrix multiplication to obtain the attention score matrix, expressed as S = X × W. a In the formula, S is the attention score, X is the input feature matrix, and W is the input feature matrix. a It is a learnable attention weight matrix;

[0106] Attention weight calculation layer: The attention score is normalized by the Softmax function to obtain the attention weight matrix, using the formula A = Softmax(S), where A is the attention weight and S is the attention score;

[0107] Context vector computation layer: This layer aggregates input features into a context vector through weighted summation, using the formula C = A. T ×X, where C is the context vector, A is the attention weight, and X is the input feature matrix;

[0108] Furthermore, the core process of the attention mechanism is comprised of attention score calculation, attention weight calculation, and context vector calculation, which together extract key features from coal quality data. Through this attention mechanism, the model can automatically learn the correlations between different dimensions of coal quality data and focus on the feature dimensions more critical for anomaly detection, thereby improving the accuracy of feature extraction and the efficiency of anomaly detection.

[0109] Step S3 is an anomaly detection model construction, which is used to construct an anomaly detection model using the extracted features;

[0110] The construction of the S3 anomaly detection model specifically includes:

[0111] S3.1 Anomaly Detection Model Selection

[0112] Using Isolation Forest as the anomaly detection model, the anomaly score is calculated using the following formula. Where s(x,n) is the anomaly score of sample x, Eh(x) is the average path length of sample x in multiple isolated trees, c(n) is the correction term for the average path length, and n is the number of samples.

[0113] Furthermore, the outlier score calculation formula quantifies the difficulty of a sample being isolated. The shorter the path length Eh(x), the easier it is for sample x to be isolated, and therefore the more likely it is to be an outlier. The correction term c(n) is used to normalize the average path length so that the outlier score s(x,n) falls within a reasonable range. The closer the outlier score s(x,n) is to 1, the greater the probability that the sample is an outlier; the closer it is to 0, the greater the probability that the sample is normal.

[0114] S3.2 Model Training

[0115] S3.2.1 Data Preparation: Using coal quality data features extracted through the attention mechanism as the input to the model, the data is divided into training and test sets;

[0116] S3.2.2 Model Initialization: Initialize the isolated forest model and set model parameters, such as the number of trees and the pollution rate, which is the proportion of outliers in the dataset;

[0117] S3.2.3 Model Training: The isolated forest model is trained using the training set data. The model learns the distribution characteristics of the data by constructing multiple isolated trees.

[0118] S3.3 Model Prediction and Evaluation

[0119] S3.3.1 Model Prediction: The trained Isolation Forest model is used to predict the test set data. The model will output an anomaly score for each sample and mark the sample as normal or abnormal according to the set threshold.

[0120] S3.3.2 Model Evaluation: Use evaluation metrics (such as precision, recall, F1 score, etc.) to evaluate the model's performance. By comparing the model's prediction results with the true labels, we can understand the model's performance in the anomaly detection task.

[0121] Furthermore, by optimizing and refining the steps for building the anomaly detection model, and clarifying the formulas involved and their logical relationships, we can gain a clearer understanding of how to use extracted features to build anomaly detection models and how the models work to identify anomalies in coal quality data.

[0122] Step S4, Real-time Monitoring and Early Warning, is used to apply the anomaly detection model to the real-time coal quality data stream to achieve real-time monitoring and early warning of coal quality data.

[0123] Step S4, real-time monitoring and early warning, specifically includes:

[0124] Access to S4.1 real-time data stream

[0125] S4.1.1 Data Source: Real-time coal quality data streams originate from sensor networks deployed in coal-fired power plants. These sensors collect coal quality data in real time, such as ash content, volatile matter, and calorific value.

[0126] S4.1.2 Access method: Real-time data stream access is achieved through message queues (such as Kafka, RabbitMQ, etc.) or real-time databases (such as Redis, InfluxDB, etc.) to ensure the real-time performance and reliability of the data;

[0127] Real-time application of the S4.2 anomaly detection model

[0128] S4.2.1 Model Deployment: Deploy the trained anomaly detection model to the real-time monitoring system to ensure that the model can receive and process data streams in real time;

[0129] S4.2.2 Online Prediction: Performs online prediction on real-time data streams, using a model to detect anomalies for each data point and outputting anomaly scores. By simplifying the calculation of anomaly scores, the prediction results of the Isolation Forest model are directly used (1 indicates normal, -1 indicates anomaly), and converted to 1 and 0 (1 indicates anomaly, 0 indicates normal) for comparison with thresholds;

[0130] Construction of S4.3 Early Warning Mechanism

[0131] S4.3.1 Warning Threshold Setting: Based on the actual application scenario and model output, set an appropriate warning threshold. The threshold setting needs to balance the false alarm rate and the false negative rate. If the threshold is too high, the false negative rate will increase, meaning that actual anomalies will be missed; if the threshold is too low, the false alarm rate will increase, meaning that normal data will be falsely reported as anomalies. Therefore, the warning threshold can be set to 0.5. When the anomaly score is 1, it indicates that an anomaly has been detected, and a warning is triggered.

[0132] S4.3.2 Early Warning Triggering and Transmission: When the abnormal score exceeds the set threshold, the early warning mechanism is triggered. Early warning information can be transmitted through various means, such as email, SMS, and audible alarms, ensuring that relevant personnel receive the warning in a timely manner and take appropriate measures.

[0133] Furthermore, the real-time monitoring and early warning process primarily relies on the prediction results of the anomaly detection model and the setting of early warning thresholds. The anomaly detection model performs online predictions on the real-time data stream and outputs anomaly scores. The early warning mechanism determines whether to trigger an early warning based on the anomaly scores and the set thresholds. Together, these two mechanisms achieve real-time monitoring and early warning functions for coal quality data, ensuring that coal-fired power plants can promptly detect and address coal quality anomalies.

[0134] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0135] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for detecting anomalies in coal quality data based on an attention mechanism, characterized in that, Includes the following steps: Step S1, data acquisition and preprocessing, is used to acquire coal quality data in real time and perform preprocessing. Step S2, attention mechanism feature extraction, is used to construct an attention mechanism-based feature extraction model to extract key features of coal quality data. Step S3 is an anomaly detection model construction, which is used to construct an anomaly detection model using the extracted features; Step S4, Real-time Monitoring and Early Warning, is used to apply the anomaly detection model to the real-time coal quality data stream to achieve real-time monitoring and early warning of coal quality data. The data acquisition and preprocessing step S1 specifically includes: S1.1 collects coal quality data in real time through online sensors, including multiple dimensions such as ash content, volatile matter, and calorific value; S1.2 Preprocess the collected coal quality data, including cleaning the raw coal quality data and data normalization. The attention mechanism feature extraction in step S2 is based on a self-attention mechanism feature extraction module. This module can automatically learn the correlation between different dimensions in coal quality data and assign different weights to different dimensions, thereby extracting key features. The anomaly detection model construction in step S3 specifically includes: S3.1 Anomaly Detection Model Selection Using Isolation Forest as the anomaly detection model, the anomaly score is calculated using the following formula. Where s(x,n) is the anomaly score of sample x, Eh(x) is the average path length of sample x in multiple isolated trees, c(n) is the correction term for the average path length, and n is the number of samples. S3.2 Model Training S3.2.1 Data Preparation: Using coal quality data features extracted through the attention mechanism as the input to the model, the data is divided into training and test sets; S3.2.2 Model Initialization: Initialize the isolated forest model and set model parameters, such as the number of trees and the pollution rate, which is the proportion of outliers in the dataset; S3.2.3 Model Training: The isolated forest model is trained using the training set data. The model learns the distribution characteristics of the data by constructing multiple isolated trees. S3.3 Model Prediction and Evaluation S3.3.1 Model Prediction: The trained Isolation Forest model is used to predict the test set data. The model will output an anomaly score for each sample and mark the sample as normal or abnormal according to the set threshold. S3.3.2 Model Evaluation: Use evaluation metrics (such as precision, recall, F1 score, etc.) to evaluate the model's performance. By comparing the model's prediction results with the true labels, we can understand the model's performance in the anomaly detection task. The real-time monitoring and early warning step S4 specifically includes: Access to S4.1 real-time data stream S4.1.1 Data Source: Real-time coal quality data streams originate from sensor networks deployed in coal-fired power plants. These sensors collect coal quality data in real time, such as ash content, volatile matter, and calorific value. S4.1.2 Access method: Real-time data stream access is achieved through message queues (such as Kafka, RabbitMQ, etc.) or real-time databases (such as Redis, InfluxDB, etc.) to ensure the real-time performance and reliability of the data; Real-time application of the S4.2 anomaly detection model S4.2.1 Model Deployment: Deploy the trained anomaly detection model to the real-time monitoring system to ensure that the model can receive and process data streams in real time; S4.2.2 Online Prediction: Performs online prediction on real-time data streams, uses models to detect anomalies for each data point, and outputs anomaly scores; Construction of S4.3 Early Warning Mechanism S4.3.1 Warning threshold setting: Based on the actual application scenario and model output, set an appropriate warning threshold. The threshold setting needs to balance the false alarm rate and the false alarm rate. S4.3.2 Warning Triggering and Transmission: When the abnormal score exceeds the set threshold, the warning mechanism is triggered.

2. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: In step S1.1, a dual-energy gamma-ray transmission sensor (DE-GCA) is used for ash content detection. The ash content is calculated based on the difference in attenuation between high and low energy rays, using the following formula: In the formula, μH and μL are the mass attenuation coefficients of high / low energy rays, and I0initial and Ilower are the mass attenuation coefficients of high / low energy rays. H I L The intensity of high / low energy rays that initiate / penetrate.

3. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: In step S1.1, a near-infrared spectral sensor (wavelength range 900-2500 nm) is used for volatile matter detection. The volatile matter content is analyzed through spectral absorption characteristics, using the following formula: In the formula, w is the PLS regression coefficient, and R is the reflectance.

4. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: In step S1.1, the calorific value is detected using a fusion system of a calorimeter and a thermal conductivity sensor. The calorific value is calculated by comprehensively considering thermal conductivity and temperature change, using the following formula: Q net =337C+1442(HO / 8)+93S, where C / H / O / S are the results of elemental analysis; Multi-sensor data are aligned using timestamps (error < 50ms) to construct a three-dimensional data matrix X(t) ∈ R. N×M×T Where N is the number of samples, M is the feature dimension, and T is the time window.

5. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: In step S1.2, the Z-score and IQR combined judgment method is used to remove outliers during the cleaning operation. The Z-score method can capture Gaussian distribution outliers, and the IQR method can handle asymmetric distribution outliers. The Z-score method identifies outliers by calculating the deviation of each data point from the mean, expressed in standard deviation. It uses a formula... Where Z is the standard score, X is the original data point, μ is the mean of the dataset, and σ is the standard deviation of the dataset; the threshold is set to |Z|>3, which is considered an outlier and can be adjusted according to the actual situation; The IQR method identifies and removes outliers exceeding 1.5 times the IQR range by calculating the interquartile range of the data. The threshold is set at... Adjustments can be made based on the actual situation.

6. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: In step S1.2, a spatiotemporal correlation-based KNN-LSTM hybrid model is used to handle missing values ​​during the cleaning operation; Based on spatial KNN interpolation, the KNN algorithm is used, and the formula is applied. To estimate missing values, where, It is a normalization coefficient to ensure that the sum of the weights is 1. W is the feature similarity weight. For each missing value position i, its similarity to its neighboring positions j (j∈N) is calculated. k The feature similarity between j (i.e., the set of k nearest neighbors belonging to i) and the weight W. ij This reflects the degree to which position j contributes to the estimation of missing values ​​at position i.

7. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: Based on time interpolation, a recursive prediction is performed using an LSTM model, with the following steps: S1.2.1 Prepare time series data: Collect time series data containing missing values, ensuring that the data is arranged in chronological order; S1.2.2 Training the LSTM model: Train the LSTM network using complete historical data to enable it to learn long-term dependencies in the time series; the LSTM model can receive data from the previous n time steps (x... t-1 ,x t-2 ,...,x t-n () as input, and predict the value at the next time step; S1.2.3 Perform imputation prediction: For each missing time point t, input the previous n known data points into the LSTM model; the model outputs the predicted value. Used to fill in missing values ​​at that time point.

8. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: By combining spatial KNN interpolation with temporal LSTM interpolation, a comprehensive interpolation strategy is formed, using the following formula: in, The value is obtained through KNN spatial interpolation. The value is obtained through LSTM time interpolation. α is a weighting parameter used to control the relative importance of the two interpolation results. Usually, α = 0.6, which is adjusted according to the actual data distribution and missing data to ensure that the interpolation result reflects both spatial characteristics and captures the time trend, thereby improving the overall estimation accuracy.

9. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: In step S1.2, during data normalization, a feature-level normalization method is first used to linearly map the data to the range [0,1], eliminating the influence of different feature dimensions and making the data comparable. The formula expression is as follows: Among them, X normalized The data is normalized, and X is the original data. min Let X be the minimum value in X. max Let X be the maximum value; then, use sample-level standardization to standardize the data to a standard normal distribution with a mean of 0 and a standard deviation of 1, ensuring the stability of the batch data distribution, using the formula: in, For the standardized i-th sample, x i Let be the original i-th sample, and μB be the mean of the most recent 100 samples. γ is the variance of the most recent 100 samples, γ is the scaling factor, which is set to 1.2 here (empirical coefficient), β is the offset factor, and ∈ is a very small value (such as 10-5) to ensure that division by zero does not occur when calculating the variance.

10. The coal quality data anomaly detection method based on attention mechanism according to claim 1, characterized in that: The feature extraction module is structured as follows: Input layer: Receives preprocessed coal quality data, with data shape including batch size, time series length, and feature dimensions (ash content, volatile matter, calorific value); Attention weight layer: Contains a learnable attention weight matrix, which is used to calculate the importance score for each feature dimension; Attention Score Calculation Layer: This layer calculates the scores of input features and attention weights using matrix multiplication to obtain the attention score matrix, expressed as S = X × W. a In the formula, S is the attention score, X is the input feature matrix, and W is the input feature matrix. a It is a learnable attention weight matrix; Attention weight calculation layer: The attention score is normalized by the Softmax function to obtain the attention weight matrix, using the formula A = Softmax(S), where A is the attention weight and S is the attention score; Context vector computation layer: This layer aggregates input features into a context vector through weighted summation, using the formula C = A. T ×X, where C is the context vector, A is the attention weight, and X is the input feature matrix.