Chemical process fault detection method based on attention mechanism LSTM network
By introducing the LSTM network with an attention mechanism, the problem of insufficient capture of key information by traditional LSTM models in chemical processes is solved, the accuracy and stability of fault detection are improved, and the effective capture of long-term dependencies and dynamic change characteristics is achieved.
Patent Information
- Application Number
- CN202510713194.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-09-16
AI Technical Summary
When processing long sequence data of chemical processes, traditional LSTM models have the problem of insufficient capture of key information, affecting the accuracy and real-time performance of fault detection.
The LSTM network based on the attention mechanism is adopted, combined with the long short-term memory network and the self-attention mechanism, to give the model different weights for important time steps or features, thereby enhancing its sensitivity and recognition ability to key information.
It improves the accuracy and robustness of chemical process fault detection, enhances the ability to capture long-term dependencies and dynamic change characteristics, and enhances the accuracy and response speed of fault identification.
Smart Images

Figure CN120654387A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of chemical process fault diagnosis, and in particular to a chemical process fault detection method based on an attention mechanism LSTM network. Background Art
[0002] With the rapid development of modern chemical industry, chemical processes are becoming increasingly automated and complex. With large-scale and highly coupled systems, even the slightest anomaly or failure can lead to serious safety incidents and economic losses. Therefore, fault detection technology for chemical processes has become a crucial tool for ensuring production safety and improving system reliability and stability. Traditional fault detection methods primarily include model-based, knowledge-based, and data-based approaches. However, model-based and knowledge-based approaches face modeling difficulties and insufficient knowledge accumulation in complex dynamic systems, making them difficult to meet practical needs.
[0003] In recent years, advances in sensor and data acquisition technologies have generated a vast amount of high-dimensional, multivariate monitoring data from chemical processes, spurring the development of data-driven fault detection methods. Deep learning, a powerful feature extraction and pattern recognition tool, has garnered widespread attention due to its advantages in processing nonlinear and time-series data. In particular, recurrent neural networks (RNNs) and their variant, long short-term memory (LSTM) networks, excel at capturing the dynamic characteristics of time series and have been applied to fault detection and diagnosis in chemical processes. However, traditional LSTM models can struggle to capture critical information when processing long sequences of data, impacting the accuracy and real-time nature of fault detection. Against this backdrop, the present invention proposes a chemical process fault detection method based on an LSTM network with an attention mechanism. This method combines a LSTM network with a self-attention mechanism. By assigning different weights to important time steps or features, it effectively enhances the model's sensitivity to and ability to identify key fault signals. This allows the model to cope with the nonlinear, time-varying, and high-dimensional characteristics of chemical systems, improving the accuracy and robustness of chemical process fault detection. Summary of the Invention
[0004] In response to the shortcomings of the existing technology, the present invention proposes a chemical process fault detection method based on the attention mechanism LSTM network, which improves the accuracy of chemical process fault diagnosis.
[0005] The present invention is achieved by adopting the following technical solutions:
[0006] A chemical process fault detection method based on an attention mechanism LSTM network is implemented using the following steps:
[0007] Step 1: Use MATLAB software to simulate the Tennessee Eastman Chemical process data, preprocess the data, and perform normalization and sliding window processing;
[0008] Step 2: Establish a chemical process data set, label the chemical process data obtained by simulation, and divide the chemical process data into training set and test set according to the proportion;
[0009] Step 3: Construct an attention mechanism LSTM network model, which is composed of the following processing layers connected in sequence: LSTM layer, self-attention mechanism layer, fully connected layer, and Softmax layer;
[0010] Step 4: Use the constructed network model to train the chemical process data training set and save the network model with the trained parameters;
[0011] Step 5: Use the saved network model to perform fault detection on the chemical process data test set to obtain the fault classification results of the chemical process data.
[0012] The beneficial effects of the present invention are:
[0013] The LSTM network proposed in this invention can effectively solve the gradient vanishing and gradient exploding problems that traditional recurrent neural networks face when processing long sequences of data, and possesses powerful temporal information modeling capabilities. It can capture long-term dependencies and dynamic change characteristics in chemical processes, thereby improving the accuracy and stability of fault detection. The present invention introduces a self-attention mechanism that enables the model to automatically focus on the time steps and features in the input sequence that are most critical for fault detection. By assigning different weights to different time points and variables, the self-attention mechanism enhances the model's sensitivity to important information, further improving the accuracy and response speed of fault identification. At the same time, this mechanism enhances the model's interpretability, making it easier to analyze and locate the cause of faults. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 Schematic diagram of the overall process of the present invention
[0015] Figure 2 Network model architecture diagram of the present invention
[0016] Figure 3 TEP simulation system structure diagram DETAILED DESCRIPTION
[0017] The present invention is described in detail below with reference to specific embodiments.
[0018] A chemical process fault detection method based on an attention mechanism LSTM network is implemented using the following steps:
[0019] Step 1: Use MATLAB software to simulate the Tennessee Eastman Chemical process data, preprocess the data, and perform normalization and sliding window processing;
[0020] Step 2: Establish a chemical process data set, label the chemical process data obtained by simulation, and divide the chemical process data into training set and test set according to the proportion;
[0021] Step 3: Construct an attention mechanism LSTM network model, which is composed of the following processing layers connected in sequence: LSTM layer, self-attention mechanism layer, fully connected layer, and Softmax layer;
[0022] Step 4: Use the constructed network model to train the chemical process data training dataset and save the network model with the trained parameters;
[0023] Step 5: Use the saved network model to perform fault detection on the chemical process data test set to obtain the fault classification results of the chemical process data.
[0024] In the step 1, the specific steps include:
[0025] (1) Obtain chemical process data under different faults in MATLAB software, and obtain 20 different fault data sets and normal state data sets.
[0026] (2) All the above data sets are normalized. In this implementation, the function expression of the normalization process is shown in formula (1-1):
[0027]
[0028] In the above formula, x scale is the data after the chemical process data x is standardized, x mean is the mean value of the chemical process data x, and std is the standard deviation of the chemical process data x.
[0029] (3) Sliding window processing is performed on each data set under different fault conditions and normal conditions. Assume that the chemical process data x=[x1,x2,x3,…,x n ], where x i The shape of the sliding window is (1,50), the sliding window length is 50, and the sliding step size is 1. The data processed by the sliding window is d1=[x1,x2,…,x 50 ],d2=[x2,x3,…,x 51 ],…,d n =[x n-49 x n-48 …x n ], that is, after the sliding window is processed, x iThe shape is (50,50).
[0030] In the step 2, the specific steps include:
[0031] (1) All data sets obtained in step 1 are labeled according to the One-Hot encoding rule.
[0032] (2) Then divide the dataset into test set and training set in a 3:7 ratio.
[0033] In the step three, the specific steps include:
[0034] (1) Construct an attention mechanism LSTM network model. The constructed network model structure is as follows Figure 2 As shown in the figure, it is first processed by a long short-term memory network (LSTM) layer, then passes through the self-attention mechanism layer, and then is sent to the fully connected layer, and finally passes through the Softmax layer to obtain the probability of the fault category.
[0035] In the step 4, the specific steps include:
[0036] (1) After the network model of step 3 is constructed, the mean square error function is selected as the loss function in the present invention. The expression of the mean square error function is shown in formula (1-2):
[0037]
[0038] Where N is the number of samples, y i is the true value of the i-th sample, is the predicted value of the i-th sample.
[0039] (2) In the present invention, Adam is selected as the optimizer, the learning rate parameter is set to 0.00001, the BatchSize is set to 128, the number of iterations is 500, and the shape of the input chemical process data is [128, 50, 50].
[0040] (3) Once the loss function, optimizer, and parameters are set, the training set data can be fed into the constructed network model for training. During the training process, backpropagation is used to adjust and update the entire network parameters, thereby reducing the loss function value and improving the model accuracy. Finally, the network model with the trained parameters is saved.
[0041] In the step 5, the specific steps include:
[0042] (1) Load the network model saved in step 4, then send the test set data into the loaded network model for fault detection, and finally generate the fault detection classification results.
[0043] In this experiment, the Tennessee Eastman Chemical Process (TEP) data was selected as the data to verify the effect of the chemical process fault diagnosis model of the present invention. The data set used in the present invention was obtained by simulation using matlab software. The simulated TEP data includes normal data and 20 types of fault data. Each type of fault sample and normal sample involves 53 process parameters, including 22 process measurement variables, 19 component analysis variables and 12 operation variables. Since 3 of the 53 process parameters of the simulated data set are constants, these three variables have been deleted in the preprocessing. The shape of each sample in the preprocessed data set is (50, 50). The TEP data set was obtained by the TEP simulation model under 200h simulation, with sampling once every 3 minutes. The fault sample was introduced after 10h of simulation. The structure diagram of the TEP simulation system is shown in the figure. Figure 3 Finally, through comparative analysis of experimental results, it is concluded that the present invention has achieved a good fault classification accuracy in chemical process fault diagnosis.
Claims
1. A chemical process fault detection method based on an attention mechanism LSTM network, characterized in that: The following steps are involved: Step 1: Use MATLAB software to simulate the Tennessee Eastman Chemical process data, preprocess the data, and perform normalization and sliding window processing; Step 2: Create a chemical process data set, label the simulated chemical process data, and divide the chemical process data into training and test sets according to the proportion; Step 3: Construct an attention mechanism LSTM network model, which is composed of the following processing layers connected in sequence: LSTM layer, self-attention mechanism layer, fully connected layer, and Softmax layer; Step 4: Use the constructed network model to train the chemical process data training set and save the network model with the trained parameters; Step 5: Use the saved network model to perform fault detection on the chemical process data test set to obtain the fault classification results of the chemical process data.
2. The chemical process fault detection method based on the attention mechanism LSTM network according to claim 1 is characterized by: In the step 1, the specific steps include: (1) Obtain chemical process data under different faults in MATLAB software, and obtain 20 different fault data sets and normal state data sets. (2) All the above data sets are normalized. In this implementation, the function expression of the normalization process is shown in formula (1-1): In the above formula, x scale is the data after the chemical process data x is standardized, x mean is the mean value of the chemical process data x, and std is the standard deviation of the chemical process data x. (3) Sliding window processing is performed on each data set under different fault conditions and normal conditions. Assume that the chemical process data x=[x1,x2,x3,…,x n ], where x i The shape of the sliding window is (1,50), the sliding window length is 50, and the sliding step size is 1. The data processed by the sliding window is d1=[x1,x2,…,x 50 ],d2=[x2,x3,…,x 51 ],…,d n =[x n-49 x n-48 …x n ], that is, the data x after the sliding window is processed i The shape is (50,50).
3. The chemical process fault detection method based on the attention mechanism LSTM network according to claim 1 is characterized in that: In the step 2, the specific steps include: (1) All data sets obtained in step 1 are labeled according to the One-Hot encoding rule. (2) Then divide the dataset into test set and training set in a 3:7 ratio.
4. The chemical process fault detection method based on the attention mechanism LSTM network according to claim 1 is characterized in that: In the step three, the specific steps include: (1) Construct an attention mechanism LSTM network model. The constructed network model structure is shown in Figure 2. It is first processed by a long short-term memory network (LSTM) layer, then passes through the self-attention mechanism layer, and then is sent to the fully connected layer. Finally, it passes through the Softmax layer to obtain the probability of the fault category.
5. The chemical process fault detection method based on the attention mechanism LSTM network according to claim 1 is characterized in that: In the step 4, the specific steps include: (1) After the network model of step 3 is constructed, the mean square error function is selected as the loss function in the present invention. The expression of the mean square error function is shown in formula (1-2): Where N is the number of samples, y i is the true value of the i-th sample, is the predicted value of the i-th sample. (2) In the present invention, Adam is selected as the optimizer, the learning rate parameter is set to 0.00001, the BatchSize is set to 128, the number of iterations is 500, and the shape of the input chemical process data is [128, 50, 50]. (3) Once the loss function, optimizer, and parameters are set, the training set data can be fed into the constructed network model for training. During the training process, backpropagation is used to adjust and update the entire network parameters, thereby reducing the loss function value and improving the model accuracy. Finally, the network model with the trained parameters is saved.
6. The chemical process fault detection method based on the attention mechanism LSTM network according to claim 1 is characterized in that: In the step 5, the specific steps include: (1) Load the network model saved in step 4, then send the test set data into the loaded network model for fault detection, and finally generate the fault detection classification results.