Normal pressure tower top corrosion rate prediction method and system based on time sequence prediction
Through the method based on timing prediction, the corrosion rate of the atmospheric pressure tower is processed and predicted using the CNN-LSTM-Attention model, the problem of ignoring corrosion rate hysteresis and data nonlinear relationship in the prior art is solved, and more accurate corrosion prediction and more effective control are achieved.
Patent Information
- Application Number
- CN202411984904.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
AI Technical Summary
The prior art is difficult to solve the problem of hysteresis of corrosion rate, and traditional methods ignore the impact of data nonlinear relationships and time changes on corrosion, resulting in inaccurate corrosion prediction.
The corrosion rate prediction method of the atmospheric tower overhead based on timing prediction is adopted, and data preprocessing and model construction is carried out through the CNN-LSTM-Attention composite model, data is collected and preprocessed in real time, outliers and missing values are identified, and important information of the time series is captured through an adaptive attention mechanism.
Accurate prediction of the corrosion rate of the atmospheric pressure tower top is achieved, reducing the impact of corrosion on the equipment, extending the service life of the equipment, and improving production efficiency and system stability.
Smart Images

Figure CN119918733A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of corrosion prediction and control of atmospheric top systems, and in particular to a method and system for predicting atmospheric top corrosion rate based on time series prediction. Background Art
[0002] In recent years, domestic refining and chemical companies have faced challenges from the deterioration of crude oil and the increase of corrosive media. These media, such as sulfur, chlorine, nitrogen, and acid, cause serious corrosion to refining equipment, especially the top system. The complexity of crude oil types and the update of upstream mining technology have increased the uncertainty of corrosive media, making corrosion prediction difficult. The "NACE TR34109" standard points out that there are dozens of media factors that affect the corrosion of the tower top system. Traditional corrosion prediction methods are inaccurate and inefficient due to limited data processing capabilities, and the differences in different refinery units lead to poor model generalization capabilities.
[0003] Existing technical solutions include empirical formula calculation, numerical simulation equilibrium model and traditional model algorithm. Patent 1-CN112782378A-System and method for predicting the risk of nitride salt scaling at the top of the atmospheric and vacuum unit The disclosed scaling prediction model relies on empirical formulas, but has too many parameters and lacks correlation analysis, and has low reliability. Patent 2-CN113537653A-Method, system and machine-readable storage medium for assessing the risk of corrosion at the top of atmospheric pressure tower The disclosed theoretical modeling method is cumbersome and easily introduces inaccuracies or ignores important parameters. Patent 3-CN114911279A-Memory, distillation unit top pH value control method, device and equipment discloses combined measurement and model prediction, but the neural network lacks stability and generalization. Patent 4-CN109669017A-Deep learning-based method for predicting the water cut ion concentration at the top of a refinery distillation tower The disclosed deep belief network may overfit due to the small amount of data and the complexity of the model. Patent 5-CN117587411A-A method for controlling the dosage of a drug based on big data technology The disclosed big data technology method is conventional and does not take into account time delays and method limitations. Patent 6-CN110564442A-A distillation tower top process corrosion prevention automatic control system The disclosed automatic control system has high requirements for data collection and is prone to deviations. Patent 7-CN105629930A-A method for real-time prediction of dew point corrosion at the top of an atmospheric tower The disclosed real-time prediction method causes deviations due to simplification and assumptions. Patent 8-CN109813782A-A self-diagnostic PH online monitoring system and method The disclosed PH monitoring system relies on a large amount of historical data and has a large workload.
[0004] In general, existing technologies are mostly based on formula calculations, ignoring the impact of nonlinear data relationships and time changes on corrosion, failing to solve the lag problem of corrosion rate, and putting forward higher requirements for the accurate prediction and prevention of corrosion. Summary of the invention
[0005] In order to more accurately predict and prevent corrosion, the present application provides a method and system for predicting the corrosion rate of an atmospheric tower top based on time series prediction.
[0006] In the first aspect, the present application provides a method for predicting atmospheric tower top corrosion rate based on time series prediction, which adopts the following technical solution:
[0007] A method for predicting atmospheric tower top corrosion rate based on time series prediction comprises the following steps:
[0008] S1, real-time data collection: real-time collection of various input parameters and corresponding output parameters of crude oil evaluation data, DCS system, LIMS analysis data and online monitoring data to form a data set;
[0009] S2, data preprocessing, including:
[0010] S21, outlier processing, uses the isolation forest-based outlier detection algorithm to identify and remove outliers in the data set;
[0011] S22, missing value processing, using linear interpolation to replace missing values in the data set;
[0012] S23, data standardization, the data set was standardized using the min-max method;
[0013] S24, input data. After the data is processed by S21 to S23, each data record contains n time slices. In each time interval, three data of the accelerometer x-axis, y-axis and z-axis are stored and transmitted to the neural network with a vector length of n×3;
[0014] S3, model construction, adopts the CNN-LSTM-Attention composite model, captures the spatial features of the input sequence through the CNN layer, captures the temporal correlation through the LSTM layer, and strengthens the understanding of the internal correlation of the sequence through the Self-Attention layer; the framework structure of the model includes:
[0015] (1) Input layer: specifies the format of input data; the format includes batch size, time steps and feature dimension; the batch size is set to 1 by default, the time step is t, and the feature dimension is n; then a sample can be represented as a real number sequence matrix R t×n , remember x i For R t×n The vector representation of the i-th time step data in ;
[0016] (2) One-dimensional convolutional neural network layer: feature extraction; the number of convolution kernels is r, and the size is set to k, then x i:i+k-1 For R t×nThe real number matrix from the i-th time step to the i+k-1-th time step in the sliding step is 1; the weight matrix w1 is a k×n real number matrix; a feature extraction is performed on the sequence vector of each k time step to obtain a feature o i , the calculation formula is as follows:
[0017]
[0018] Among them, f is a nonlinear activation function, b1∈R is a bias; when a convolution kernel extracts the sequence data of a sample, a feature map o of (t-k+1)×1 shape will be obtained;
[0019] The tensor to be processed is composed of three components: I, convolution kernel k, and output tensor S. (i, j) is the coordinate of the tensor, (m, n) is the coordinate of the convolution kernel, and each convolution operation can be expressed as:
[0020]
[0021] Among them, I×k represents the convolution operation, M and N represent the length and width of the convolution kernel respectively; i and j represent the coordinate position of the tensor I to be processed, which is also the position where the upper left corner of the convolution kernel is aligned;
[0022] (3) Maximum pooling layer: Select a pooling layer of size 3; for the sequence x, repeat the maximum pooling operation on each continuous vector with a window of r to obtain the maximum feature sequence:
[0023]
[0024] (4) The third 1D CNN layer: The output matrix is the input matrix of the average pooling layer;
[0025] (5) Average pooling layer: This pooling selects the average of the two weights in the neural network, and each feature detector has only one weight left in this layer;
[0026] (6) Flattening layer: converts multidimensional data into one-dimensional data. The result of this layer is also used as the input layer of the next layer.
[0027] (7) LSTM hidden layer: Two hidden layers are set in this layer, which is a bidirectional recurrent neural network. The feature dimensions of the hidden layers are all defined as 5. The core formula of this layer is as follows:
[0028] f t =o(W f ·[h t-1 , x t ]+b f )
[0029] i t =σ(W i·[h t-1 , x t ]+b i )
[0030]
[0031] O t =σ(W o ·[h t-1 ,x t ]+b o )
[0032] h t =O t ×tanh(C t )
[0033] Among them, σ is the sigmoid activation function, which takes values between 0 and 1; tanh is the activation function, which takes values between -1 and 1; x t is the input vector at time t, which is the historical influencing factor sequence or daily load sequence; h t is the hidden layer state vector output at time t; c t is the state unit vector at time t; is the candidate state vector at time t; W is the weight coefficient; b is the constant bias;
[0034] (8) Attention layer: Calculate the weighted average sum of the output vectors of the last layer of LSTM;
[0035] (9) Fully connected layer: The input of the fully connected layer is normalized using the softmax function to obtain the assigned weight of each hidden layer vector;
[0036] (10) Output layer: specifies the prediction time step O t , output O t The prediction results of the step;
[0037] S4, model training and tuning: including:
[0038] S41, select an optimizer and use the stochastic gradient descent (Adam) algorithm to update the weights of the neural network;
[0039] S42, learning rate adjustment, using equal intervals to adjust the learning rate;
[0040] S43, select the loss function, use the mean square error (MSE) as the loss metric, and the calculation formula is:
[0041]
[0042] Where: n represents the number of samples; y i is the true target value; y predTo predict the target value; S44, perform training, according to the network structure and parameter settings, perform network training until the maximum number of iterations is reached or the loss function value meets the set requirements;
[0043] S5, model deployment: packaging the model and integrating it into the corrosion integrity management system;
[0044] S6, precise corrosion control:
[0045] S61, setting the normal range of output parameters;
[0046] S62, when the output parameters deviate, the water injection amount, neutralization dosage and corrosion inhibition dosage of the tower top are adjusted according to the control logic;
[0047] S63, hardware deployment;
[0048] S64, build PID control system and adjust controller parameters;
[0049] S65, processing the feedback signal from the pH sensor according to the control algorithm, comparing it with the normal pH range, and generating a control signal to drive the valve.
[0050] By adopting the above technical solutions, the time series prediction method can effectively predict the corrosion rate, help operators take timely measures to reduce the impact of corrosion on equipment, extend the service life of equipment, and improve production efficiency. Through real-time monitoring and intelligent control, unexpected downtime and maintenance costs caused by corrosion can be minimized.
[0051] Optionally, the outlier processing in S21 uses an isolation forest outlier detection algorithm to identify and remove outliers in the data set, specifically including:
[0052] Extracting some samples from the original data: adjusting the frequency and quantity of extraction according to the last PID control result; the larger the last PID control result, the higher the extraction frequency and the greater the number of extractions; the smaller the last PID control result, the lower the extraction frequency and the smaller the number of extractions;
[0053] Select some features from some of the extracted samples to build a binary tree; use the idea of ensemble learning to extract samples and features multiple times until the data cannot be divided any further, and complete the tree construction; the path length calculation formula is as follows:
[0054] h(x)=e+c(T.size)
[0055] Among them, e represents the number of edges that the sample experiences from the root node to the leaf node of the tree, that is, the number of classifications; T.size represents the number of samples in the same leaf node as sample x, c(T.size) is a correction value, which represents the average path length of T.size samples to construct a binary tree, and c(b) is calculated as follows:
[0056]
[0057] The outlier calculation formula is as follows:
[0058]
[0059] Among them, h(x) is the path length of the sample, E(h(x)) is the mean path length of the sample, and c(b) is the average path length of n samples to construct a binary search tree;
[0060] When the score of s(x, n) is close to 1, the sample is judged as an outlier and will be removed from the data set.
[0061] By adopting the above technical solutions, outliers in the data set can be effectively identified and eliminated, and data quality can be improved, thereby providing a more accurate data basis for subsequent model training and prediction.
[0062] Optionally, the step of performing data standardization using the min-max method in step S23 specifically includes: performing data standardization using the min-max method on the data set, and the standardization formula is as follows:
[0063]
[0064] Among them, y1, y2, ..., y n ∈[0, 1] and dimensionless.
[0065] 4. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1 is characterized in that the attention layer calculates the weighted average sum of the output vectors of the last layer of LSTM, and the specific steps include:
[0066] For each time step t, Q is the Query vector, K is the Key matrix, and V is the Value matrix. The formula of the attention model is as follows:
[0067]
[0068] Among them, dk is the dimension of the Key vector, and the output of each time step is the weighted sum of the interaction between the corresponding Query position and other positions in the entire sequence.
[0069] By adopting the above technical solution, the dependencies between different time steps in the sequence data can be effectively captured, and the most important information for the prediction of the current time step can be identified.
[0070] Optionally, the fully connected layer uses a softmax function to normalize the input of the fully connected layer to obtain the distribution weight of each hidden layer vector, and the weight training process is as follows:
[0071] S i =tanh(WH i +b i )
[0072] a i =softmax(S i )
[0073] Then use the trained weights to calculate the weighted average sum of the hidden layer output vectors. The calculation results are as follows:
[0074]
[0075] Among them, H i is the output of the last LSTM hidden layer, S i For each hidden layer output score, a i is the weight coefficient.
[0076] By adopting the above technical solution, the fully connected layer and softmax normalization can be effectively integrated into the model, so that the model can not only learn the weights of the hidden layer outputs, but also synthesize these outputs by weighted averaging, thereby improving the performance and accuracy of the model in time series prediction tasks.
[0077] Optionally, the step S41, selecting an optimizer and using a stochastic gradient descent (Adam) algorithm to update the weights of the neural network, specifically comprises the following steps:
[0078] The stochastic gradient descent (Adam) algorithm is chosen to update the weights of the neural network during training; the update formula is:
[0079]
[0080] Among them: θ represents the model parameters, t represents the number of iterations, η represents the learning rate, f i is the loss function for the i-th data point; in each iteration, the current parameter θ is calculated t The gradient below
[0081] The parameters are then updated in the opposite direction of the gradient to reduce the value of the loss function.
[0082] By adopting the above technical solution, the Adam optimizer can be effectively used to update weights during the neural network training process, which helps to improve the learning efficiency of the model, accelerate the convergence speed, and ultimately improve the performance and accuracy of the model in time series prediction tasks.
[0083] Optionally, the steps of S61 and S62 include:
[0084] The normal range of output parameters is set as follows: pH = [5.5, 6.5], iron ion content = (-∞, 3], corrosion rate = (-∞, 0.2];
[0085] When the output parameters deviate, the water injection amount, neutralization dosage and corrosion inhibitor dosage at the top of the tower are adjusted. The control logic is:
[0086] When the pH deviates from the index range, adjust the injection amount of the neutralizer; when the pH is lower than the corresponding normal range, increase the injection amount of the neutralizer to increase the pH value; when the pH is higher than the corresponding normal range, reduce the injection amount of the neutralizer to lower the pH value;
[0087] When the iron ion content deviates from the index range, adjust the injection amount of the corrosion inhibitor; when the iron ion content is lower than the corresponding normal range, increase the injection amount of the corrosion inhibitor to reduce the iron ion content; when the iron ion content is higher than the corresponding normal range, reduce the injection amount of the corrosion inhibitor to reduce the iron ion content;
[0088] When the corrosion rate deviates from the index range, adjust the water injection volume; when the corrosion rate is higher than the set range, increase the water injection volume to reduce the corrosion rate;
[0089] Alternatively, the control logic is:
[0090] When any of the pH, iron ion content or corrosion rate deviates from the specified range,
[0091] Updated neutralizer injection amount = e1×neutralizer injection amount + e2×corrosion inhibitor injection amount + e3×water injection amount, where e1, e2 and e3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water, respectively;
[0092] Updated corrosion inhibitor injection amount = f1 × neutralizer injection amount + f2 × corrosion inhibitor injection amount + f3 × water injection amount, where f1, f2 and f3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water respectively;
[0093] Updated water injection amount = g1×neutralizer injection amount + g2×corrosion inhibitor injection amount + g3×water injection amount, where g1, g2 and g3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water, respectively;
[0094] According to the range of pH, iron ion content or corrosion rate, the size of the corresponding weight parameter is obtained by looking up a table.
[0095] By adopting the above technical solution, the output parameters (such as pH value, iron ion content and corrosion rate) are controlled by adjusting the input parameters (such as neutralization dosage, corrosion inhibitor dosage and water injection volume) to keep them within the set normal range. This control method helps to improve the stability and response speed of the system while reducing unnecessary energy consumption and material waste.
[0096] Optionally, in S65, the specific steps include:
[0097] Get pH value in real time;
[0098] Calculate the deviation between the actual pH value and the set value;
[0099] Calculate the PID control signal based on the deviation, the formula is:
[0100]
[0101] Among them, K p , K i , K d They are proportional, integral and differential coefficients respectively.
[0102] By adopting the above technical solution, the PID controller calculates the control signal by calculating the weighted sum of three parameters: proportional (P), integral (I) and differential (D) to reduce system deviation and improve control accuracy.
[0103] Optionally, the S65 further includes adjusting parameters in the PID:
[0104] Proportional P coefficient adjustment: adjust the proportional coefficient of PID according to the anti-correlation of water injection volume; when the water injection volume is more, the P coefficient is smaller; when the water injection volume is less, the P coefficient is larger;
[0105] Integral I coefficient adjustment: adjust the integral coefficient of PID inversely according to the injection amount of corrosion inhibitor; when the injection amount of corrosion inhibitor is larger, the I coefficient is smaller; when the injection amount of corrosion inhibitor is smaller, the I coefficient is larger;
[0106] Differential D coefficient adjustment: The differential coefficient of PID is adjusted according to the positive correlation between the change in the water injection volume and the injection volume of the corrosion inhibitor; when the change is more severe, the D coefficient is larger; when the change is less severe, the D coefficient is smaller.
[0107] By adopting the above technical solution and adjusting the PID coefficient, the pH value can be effectively and accurately controlled to ensure that the system operates in the optimal state.
[0108] In the second aspect, the present application provides a system for predicting atmospheric tower top corrosion rate based on time series prediction, which adopts the following technical solution:
[0109] A system for predicting atmospheric tower top corrosion rate based on time series prediction comprises a processor, wherein the processor executes the steps of any one of the above-mentioned methods for predicting atmospheric tower top corrosion rate based on time series prediction.
[0110] In summary, the present application includes at least one of the following beneficial technical effects:
[0111] This application uses the data analysis and pattern recognition capabilities of big data to efficiently solve the problems of capturing data features and data time series change features, and enhances the reliability of the corrosion rate prediction model through online training, accurately predicts the pH value, iron ion content and corrosion rate that characterize the corrosion risk of the atmospheric tower top system, and achieves more effective corrosion control by real-time regulation of the three injection volumes at the top of the tower. It has the following advantages:
[0112] (1) Using CNN convolutional neural network structure and neural network algorithm based on attention mechanism. These algorithms can capture nonlinear relationships in data, remember the sequence order of long time series, and improve the prediction accuracy of the model;
[0113] (2) Using the LSTM-Attention model to capture temporal correlation, while ensuring prediction accuracy, saving computing power and costs;
[0114] (3) Build a large server to complete the real-time online training model, establish a precise corrosion control system for the tower top system through corrosion rate prediction, use characteristic parameters to predict the output target variables, combine the variables with the logical association of the three injection systems, and realize automatic and precise injection control of the system to avoid equipment failure and safety accidents;
[0115] (4) In the filling control, the segmented limiting PID control algorithm is adopted. By increasing the weight of the integral and differential terms, the PID controller's ability to adjust the system's dynamic response can be enhanced. This can help reduce the lag between the control operation and the result, so that the system can reach a stable state more quickly;
[0116] (5) For refining and chemical plants, their input and output data are obtained in real time through interfaces, and the data collection frequency is high. Compared with the empirical method obtained by traditional big data statistical analysis, the data obtained by fixed devices, fixed parts and fixed interfaces can reduce a large amount of external factors and reduce variables, thereby ensuring the accuracy of the prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0117] Figure 1 This is the system architecture diagram of this application.
[0118] Figure 2 This is the workflow diagram of this application system.
[0119] Figure 3 It is the framework diagram of the model. DETAILED DESCRIPTION
[0120] Embodiments of the present application are described in detail below, examples of which are shown in the accompanying drawings.
[0121] In the description of this specification, the description with reference to the terms "certain embodiments", "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0122] The present application embodiment discloses a method for predicting the corrosion rate of atmospheric tower top based on time series prediction, referring to Figure 1 and Figure 2 , the method comprises the following steps:
[0123] S1: Real-time data collection:
[0124] The corrosion control system includes a data acquisition module strategically deployed throughout the structure to obtain relevant data points. Data sources include: crude oil evaluation data, DCS system, LIMS laboratory analysis data, and online monitoring data. These data are transmitted to the central processing unit for further analysis. Through the data acquisition system, various input characteristic parameters and corresponding output characteristic parameters related to the corrosion of the tower top system are collected in real time. The input characteristic parameters can be numerical, discrete or text, and the output characteristic parameters can be numerical or discrete, forming the data set required for big data analysis. Through the empirical analysis of the corrosion risk of the atmospheric tower top system, there are more than 20 main influencing factors. For a specific refinery, the equipment specifications are fixed; therefore, the atmospheric tower height, tower diameter, and number of trays that affect the corrosion risk can be used as constant values and do not need to participate in data training. In addition, there are nearly 20 other types, and all characteristic parameters are digital.
[0125] S2: Data preprocessing:
[0126] S21: Outlier processing: Considering the large amount of industrial data and the high efficiency requirements of the algorithm. Therefore, the present invention adopts an outlier detection algorithm based on an isolation forest to identify outliers. The specific method is: extract some samples from the original data: adjust the frequency and quantity of extraction according to the last PID control result; the larger the last PID control result, the higher the extraction frequency and the more the extraction; the smaller the last PID control result, the lower the extraction frequency and the fewer the extraction.
[0127] For example, the extraction frequency range is f min , f max , assuming the PID output range is -100 to 100, and the extraction quantity range is n min ,n max The decimation frequency f and number n can be adjusted using the following formula:
[0128]
[0129] When the PID output is negative (the system is below the set value) or positive (the system is above the set value), the frequency and quantity are adjusted linearly between the minimum and maximum values according to the absolute value of the output. For example, if the PID output is 0, it means that the system is in an ideal state and the minimum frequency f is adjusted. min and the minimum number n min Take samples; if the PID output is the maximum value 100, according to the maximum frequency f max and the maximum number n max Draw a sample.
[0130] Extract some samples from the original data, select some features, and build a binary tree; use the idea of ensemble learning to extract samples and features multiple times until the data cannot be divided any more, and complete the tree construction. The path length calculation formula is as follows:
[0131] h(x)=e+c(T.size)
[0132] Among them, e represents the number of edges that the sample goes through from the root node to the leaf node of the tree, that is, the number of classifications. T.size represents the number of samples in the same leaf node as sample x. c(T.size) can be regarded as a correction value, which represents the average path length of T.size samples to construct a binary tree. The calculation formula of c(n) is as follows:
[0133]
[0134] The outlier calculation formula is as follows:
[0135]
[0136] Among them, h(x) is the path length of the sample, E(h(x)) is the mean path length of the sample, and c(n) is the average path length of n samples to construct a binary search tree.
[0137] When the score of s(x, n) is close to 1, the sample is judged as an outlier and will be removed from the data set.
[0138] S22: Missing value processing: For missing values in the data set, considering the density of data acquisition, its short-term fluctuation is very small, and the goal can be achieved by using linear interpolation, that is, identifying the average of the nearest non-missing values before and after the missing value to replace the missing value.
[0139] S23: Data standardization: The data set is standardized using the min-max method. The standardization formula is as follows:
[0140]
[0141] Among them, y1, y2, ..., y n ∈[0, 1] and dimensionless.
[0142] S24: Input data: After the data is preprocessed, each data record contains n time slices. In each time interval, three data of the accelerometer x-axis, y-axis and z-axis are stored. The data is passed into the neural network with a vector length of n×3.
[0143] S3: Model building
[0144] This paper adopts a composite model composed of CNN-LSTM-Attention. First, the spatial features of the input sequence are captured by the CNN layer, the temporal correlation is captured by the LSTM layer, and finally the understanding of the internal correlation of the sequence is enhanced by the Self-Attention layer. The framework structure of the model is as follows Figure 3 As shown:
[0145] (1) Input layer: Specify the format of input data (batch size, time steps, feature dimension). The batch size is set to 1 by default, the time step is t, and the feature dimension is n. Then a sample can be represented as a real number sequence matrix R t×n , remember x i For R t×n The vector representation of the i-th time step data in ;
[0146] (2) One-dimensional convolutional neural network layer, the number of convolution kernels is r, and the size is set to k, then x i:i+k-1 For R t×nThe real number matrix from the i-th time step to the i+k-1-th time step in the weight matrix w1 is a k×n real number matrix; a feature extraction is performed on the sequence vector of each k time step to obtain a feature o i , the calculation formula is as follows:
[0147]
[0148] Among them, f is a nonlinear activation function, and b1∈R is a bias. When a convolution kernel extracts the sequence data of a sample, a feature map o of (t-k+1)×1 shape is obtained.
[0149] The tensor to be processed is composed of three components: I, convolution kernel k, and output tensor S. (i, j) is the coordinate of the tensor, (m, n) is the coordinate of the convolution kernel, and each convolution operation can be expressed as:
[0150]
[0151] Among them, I×k represents the convolution operation, M and N represent the length and width of the convolution kernel respectively. i and j represent the coordinate position of the tensor I to be processed, which is also the position where the upper left corner of the convolution kernel is aligned.
[0152] (3) Maximum pooling layer: In order to reduce the complexity of the output and prevent overfitting of the data, a pooling layer of size 3 is selected. For the sequence x, the maximum pooling operation is repeated for each continuous vector with a window of r to obtain the maximum feature sequence:
[0153]
[0154] (4) The third 1D CNN layer: The output matrix of this layer is the input matrix of the average pooling layer.
[0155] (5) Average pooling layer: To further prevent overfitting, this pooling layer selects the average of the two weights in the neural network, leaving only one weight for each feature detector in this layer.
[0156] (6) Flattening layer: converts multidimensional data into one-dimensional data. The result of this layer is also used as the input layer of the next layer.
[0157] (7) LSTM hidden layer: Two hidden layers are set in this layer, which is a bidirectional recurrent neural network. The feature dimensions of the hidden layers are all defined as 5. The core formula of this layer is as follows:
[0158] f t =σ(W f ·[h t-1 , x t ]+b f )
[0159] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0160]
[0161] O t =σ(W o ·[h t-1 ,x t ]+b o )
[0162] h t =O t ×tanh(C t )
[0163] Among them, σ is the sigmoid activation function, which takes values between 0 and 1; tanh is the activation function, which takes values between -1 and 1; x t is the input vector at time t, which is the historical influencing factor sequence or daily load sequence; h t is the hidden layer state vector output at time t; c t is the state unit vector at time t; is the candidate state vector at time t; W is the weight coefficient; b is the constant bias.
[0164] (8) Attention layer: The essence of the attention layer is to find the weighted average sum of the output vectors of the last layer of LSTM. Assuming that for each time step t, Q is the query vector, K is the key matrix, and V is the value matrix, the formula of the attention model is as follows:
[0165]
[0166] Among them, d k is the dimension of the Key vector. Dividing by the dimension under the square root is to stabilize the gradient and prevent the value from being too large. The output of each time step is the weighted sum of the interaction between the corresponding query position and other positions in the entire sequence. This design allows the model to dynamically adjust the importance of information at different positions according to the focus of the current query.
[0167] (9) Fully connected layer: The input of the fully connected layer is normalized using the softmax function to obtain the weight assigned to each hidden layer vector. The weight size indicates the importance of the hidden state of each time step to the prediction result. The weight training process is as follows:
[0168] S i =tanh(WH i +bi )
[0169] a i =softmax(S i )
[0170] Then use the trained weights to calculate the weighted average sum of the hidden layer output vectors. The calculation results are as follows:
[0171]
[0172] Among them, H i is the output of the last LSTM hidden layer, S i For each hidden layer output score, a i is the weight coefficient.
[0173] (10) Output layer: This layer specifies the prediction time step O t , the final output is O t The prediction results of the step.
[0174] S4: Model training and tuning
[0175] (1) Select optimizer: Select the stochastic gradient descent (Adam) algorithm to update the weights of the neural network during training. The update formula is:
[0176]
[0177] Among them: θ represents the model parameters, t represents the number of iterations, η represents the learning rate, f i is the loss function for the i-th data point; in each iteration, the current parameter θ is calculated t The gradient below The parameters are then updated in the opposite direction of the gradient to reduce the value of the loss function.
[0178] (2) Learning rate adjustment: In order to achieve the optimal solution for the step size of parameter update while maintaining speed balance and stability, equal interval adjustment is used. The parameter settings are as follows: optimizer: the optimizer used in neural network training; step_size (int): the number of intervals for learning rate decrease, in epochs;
[0179] (3) Selection of loss function: The CNN network has high requirements for training speed, and considering that the training results need to be highly sensitive to the deviations of corrosion rate, pH value, and iron ion content that characterize corrosion risk, the mean square error (MSE) is selected as the loss metric. Its calculation formula is:
[0180]
[0181] Where: n represents the number of samples; yi is the true target value; y pred is the predicted target value.
[0182] (4) Training: Perform network training according to the network structure and parameter settings until the maximum number of iterations is reached (the loss function value meets the requirements).
[0183] S5: Model deployment
[0184] Package the model and integrate it into the corrosion integrity management system.
[0185] S6: Precision Corrosion Control
[0186] (1) Establish a feedback control loop. The principles are as follows:
[0187] (a) Set the normal range of output parameters: pH = [5.5, 6.5], iron ion content = (-∞, 3], corrosion rate = (-∞, 0.2].
[0188] (b) When the output parameters deviate, adjust the water injection amount, neutralizer dosage and corrosion inhibitor dosage at the top of the tower. The control logic is: when the pH deviates from the index range, adjust the neutralizer injection amount; when the iron ion content deviates from the index range, adjust the corrosion inhibitor injection amount; when the corrosion rate deviates from the index range, adjust the water injection amount.
[0189] (2) Hardware deployment.
[0190] (a) Sensor: Since there are corresponding sensors for input and output parameters, no additional installation is required;
[0191] (b) Controller selection: Select the proportional-integral-derivative controller, integrated into the PID control system of the atmospheric and vacuum distillation device;
[0192] (c) Controller adjustment: Adjust controller parameters to optimize response time and control system accuracy.
[0193] (d) Valve: Install control valves on the feed pipelines for water injection, neutralizer injection, and corrosion inhibitor injection to adjust the dosage. The output signal of the controller will control the opening of the valve and adjust the injection flow.
[0194] (3) Control algorithm: The control algorithm is implemented in the controller software. The algorithm will process the feedback signal from the pH sensor, compare it with the normal pH range, and generate a control signal to drive the valve.
[0195] (4) Continuous monitoring and adjustment.
[0196] Advantages of the present invention:
[0197] 1) Use advanced algorithms to analyze complex data sets to develop predictive models and provide actionable solutions for tower top corrosion control;
[0198] 2) Leverage real-time monitoring and control capabilities to dynamically adjust the three injection parameters based on changing process conditions. This real-time feedback loop enables proactive intervention, rapid response to disturbances, and continuous optimization of the injection process to achieve the desired results.
[0199] 3) By analyzing data, detecting anomalies and deviations from target parameters, maintenance activities can be proactively scheduled to minimize device downtime and potential safety risks, greatly improving the economic and social benefits of device operation.
[0200] 4) Compared with traditional corrosion control methods, it can significantly reduce costs and improve control accuracy.
[0201] 5) This method can be extended to other corrosion circuit systems such as catalytic tower top corrosion.
[0202] In other implementations, the control logic of the feedback control loop may also be:
[0203] When any of the pH, iron ion content or corrosion rate deviates from the specified range,
[0204] The updated neutralizer injection amount = e1×neutralizer injection amount + e2×corrosion inhibitor injection amount + e3×water injection amount, wherein e1, e2 and e3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water, respectively.
[0205] The updated corrosion inhibitor injection amount = f1×neutralizer injection amount + f2×corrosion inhibitor injection amount + f3×water injection amount, wherein f1, f2 and f3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water, respectively.
[0206] The updated water injection amount = g1×neutralizer injection amount + g2×corrosion inhibitor injection amount + g3×water injection amount, wherein g1, g2 and g3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water, respectively.
[0207] According to the range of pH, iron ion content or corrosion rate, the size of the corresponding weight parameter is obtained by looking up a table.
[0208] By adjusting input parameters (such as neutralization dosage, corrosion inhibitor dosage and water injection volume), output parameters (such as pH value, iron ion content and corrosion rate) are controlled to keep them within the set normal range. This control method helps to improve the stability and response speed of the system while reducing unnecessary energy consumption and material waste.
[0209] In other implementations, in S65, the specific steps include:
[0210] Get pH value in real time;
[0211] Calculate the deviation between the actual pH value and the set value;
[0212] Calculate the PID control signal based on the deviation, the formula is:
[0213]
[0214] Among them, K p , K i , K d They are proportional, integral and differential coefficients respectively.
[0215] In other implementations, S65 further includes adjusting the parameters in the PID:
[0216] Proportional P coefficient adjustment: The proportional coefficient of PID is adjusted inversely according to the water injection amount; when the water injection amount is more, the P coefficient is smaller; when the water injection amount is less, the P coefficient is larger.
[0217] Integral I coefficient adjustment: The integral coefficient of PID is adjusted inversely according to the injection amount of corrosion inhibitor; when the injection amount of corrosion inhibitor is larger, the I coefficient is smaller; when the injection amount of corrosion inhibitor is smaller, the I coefficient is larger.
[0218] Differential D coefficient adjustment: The differential coefficient of PID is adjusted according to the positive correlation between the change in the water injection volume and the injection volume of the corrosion inhibitor; when the change is more severe, the D coefficient is larger; when the change is less severe, the D coefficient is smaller.
[0219] By adjusting the PID coefficient, the pH value can be effectively and accurately controlled to ensure that the system operates in the optimal state.
[0220] An embodiment of the present application also discloses a system for predicting atmospheric tower top corrosion rate based on time series prediction, including a processor, wherein the processor executes the steps of the method for predicting atmospheric tower top corrosion rate based on time series prediction as described in any one of the above.
[0221] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for predicting atmospheric tower top corrosion rate based on time series prediction, characterized in that: The steps include: S1, real-time data collection: real-time collection of various input parameters and corresponding output parameters of crude oil evaluation data, DCS system, LIMS analysis data and online monitoring data to form a data set; S2, data preprocessing, including: S21, outlier processing, uses the isolation forest-based outlier detection algorithm to identify and remove outliers in the data set; S22, missing value processing, using linear interpolation to replace missing values in the data set; S23, data standardization, the data set was standardized using the min-max method; S24, input data. After the data is processed by S21 to S23, each data record contains n time slices. In each time interval, three data of the accelerometer x-axis, y-axis and z-axis are stored and transmitted to the neural network with a vector length of n×3; S3, model construction, adopts the CNN-LSTM-Attention composite model, captures the spatial features of the input sequence through the CNN layer, captures the temporal correlation through the LSTM layer, and strengthens the understanding of the internal correlation of the sequence through the Self-Attention layer; the framework structure of the model includes: (1) Input layer: specifies the format of input data; the format includes batch size, time steps and feature dimension; the batch size is set to 1 by default, the time step is t, and the feature dimension is n; then a sample can be represented as a real number sequence matrix R t×n , remember x i For R t×n The vector representation of the i-th time step data in ; (2) One-dimensional convolutional neural network layer: feature extraction; the number of convolution kernels is r, and the size is set to k, then x i:i+k-1 For R t ×n The real number matrix from the i-th time step to the i+k-1-th time step in the sliding step is 1; the weight matrix w1 is a k×n real number matrix; a feature extraction is performed on the sequence vector of each k time step to obtain a feature o i , the calculation formula is as follows: Among them, f is a nonlinear activation function, b1∈R is a bias; when a convolution kernel extracts the sequence data of a sample, a feature map o of (t-k+1)×1 shape will be obtained; The tensor to be processed is composed of three components: I, convolution kernel k, and output tensor S. (i, j) is the coordinate of the tensor, (m, n) is the coordinate of the convolution kernel, and each convolution operation can be expressed as: Among them, I×k represents the convolution operation, M and N represent the length and width of the convolution kernel respectively; i and j represent the coordinate position of the tensor I to be processed, which is also the position where the upper left corner of the convolution kernel is aligned; (3) Maximum pooling layer: Select a pooling layer of size 3; for the sequence x, repeat the maximum pooling operation on each continuous vector with a window of r to obtain the maximum feature sequence: (4) The third 1D CNN layer: The output matrix is the input matrix of the average pooling layer; (5) Average pooling layer: This pooling selects the average of the two weights in the neural network, and each feature detector has only one weight left in this layer; (6) Flattening layer: converts multidimensional data into one-dimensional data. The result of this layer is also used as the input layer of the next layer. (7) LSTM hidden layer: Two hidden layers are set in this layer, which is a bidirectional recurrent neural network. The feature dimensions of the hidden layers are all defined as 5. The core formula of this layer is as follows: f t =σ(W f ·[h t-1 ,x t ]+b f ) i t =σ(W i ·[h t-1 ,x t ]+b i ) The t =σ(W o ·[h t-1 ,x t ]+b o ) h t =O t ×tanh(C t ) Among them, σ is the sigmoid activation function, which takes values between 0 and 1; tanh is the activation function, which takes values between -1 and 1; x t is the input vector at time t, which is the historical influencing factor sequence or daily load sequence; h t is the hidden layer state vector output at time t; c t is the state unit vector at time t; is the candidate state vector at time t; W is the weight coefficient; b is the constant bias; (8) Attention layer: Calculate the weighted average sum of the output vectors of the last layer of LSTM; (9) Fully connected layer: The input of the fully connected layer is normalized using the softmax function to obtain the assigned weight of each hidden layer vector; (10) Output layer: specifies the prediction time step O t , output O t The prediction results of the step; S4, model training and tuning: including: S41, select an optimizer and use the stochastic gradient descent (Adam) algorithm to update the weights of the neural network; S42, learning rate adjustment, using equal intervals to adjust the learning rate; S43, select the loss function, use the mean square error (MSE) as the loss metric, and the calculation formula is: Where: n represents the number of samples; y i is the true target value; y pred is the predicted target value; S44, performing training, performing network training according to the network structure and parameter settings, until a maximum number of iterations is reached or the loss function value meets the set requirements; S5, model deployment: packaging the model and integrating it into the corrosion integrity management system; S6, precise corrosion control: S61, setting the normal range of output parameters; S62, when the output parameters deviate, the water injection amount, neutralization dosage and corrosion inhibition dosage of the tower top are adjusted according to the control logic; S63, hardware deployment; S64, build PID control system and adjust controller parameters; S65, processing the feedback signal from the pH sensor according to the control algorithm, comparing it with the normal pH range, and generating a control signal to drive the valve.
2. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1, characterized in that: The outlier processing in S21 uses an isolation forest outlier detection algorithm to identify and remove outliers in the data set, specifically including: Extracting some samples from the original data: adjusting the frequency and quantity of extraction according to the last PID control result; the larger the last PID control result, the higher the extraction frequency and the greater the number of extractions; the smaller the last PID control result, the lower the extraction frequency and the smaller the number of extractions; Select some features from some of the extracted samples to build a binary tree; use the idea of ensemble learning to extract samples and features multiple times until the data cannot be divided any further, and complete the tree construction; the path length calculation formula is as follows: h(x)=e+c(T.size) Among them, e represents the number of edges that the sample experiences from the root node to the leaf node of the tree, that is, the number of classifications; T.size represents the number of samples in the same leaf node as sample x, c(T.size) is a correction value, which represents the average path length of T.size samples to construct a binary tree, and c(n) is calculated as follows: The outlier calculation formula is as follows: Among them, h(x) is the path length of the sample, E(h(x)) is the mean path length of the sample, and c(n) is the average path length of n samples to construct a binary search tree; When the score of s(x, n) is close to 1, the sample is judged as an outlier and will be removed from the data set.
3. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1, characterized in that: The step S23, data standardization, uses the min-max method to perform standardization processing, specifically including: performing standardization processing on the data set using the min-max method, and the standardization processing formula is as follows: Among them, y1, y2, ..., y n ∈[0, 1] and dimensionless.
4. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1, characterized in that: The attention layer calculates the weighted average sum of the output vectors of the last layer of LSTM. The specific steps include: For each time step t, Q is the Query vector, K is the Key matrix, and V is the Value matrix. The formula of the attention model is as follows: Among them, d k is the dimension of the Key vector, and the output of each time step is the weighted sum of the interaction between the corresponding Query position and other positions in the entire sequence.
5. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1, characterized in that: The fully connected layer uses the softmax function to normalize the input of the fully connected layer to obtain the distribution weight of each hidden layer vector. The weight training process is as follows: S=tanh(WH i +b i ) a i =softmax(S i ) Then use the trained weights to calculate the weighted average sum of the hidden layer output vectors. The calculation results are as follows: Among them, H i is the output of the last LSTM hidden layer, S i For each hidden layer output score, a i is the weight coefficient.
6. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1, characterized in that: The step S41, selecting an optimizer and using the stochastic gradient descent (Adam) algorithm to update the weights of the neural network, specifically includes: The stochastic gradient descent (Adam) algorithm is chosen to update the weights of the neural network during training; the update formula is: Among them: θ represents the model parameters, t represents the number of iterations, η represents the learning rate, f i is the loss function for the i-th data point; in each iteration, the current parameter θ is calculated t The gradient below The parameters are then updated in the opposite direction of the gradient to reduce the value of the loss function.
7. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1, characterized in that: The specific steps of S61 and S62 include: The normal range of output parameters is set as follows: pH = [5.5, 6.5], iron ion content = (-∞, 3], corrosion rate = (-∞, 0.2]; When the output parameters deviate, the water injection amount, neutralization dosage and corrosion inhibitor dosage at the top of the tower are adjusted. The control logic is: When the pH deviates from the index range, adjust the injection amount of the neutralizer; when the pH is lower than the corresponding normal range, increase the injection amount of the neutralizer to increase the pH value; when the pH is higher than the corresponding normal range, reduce the injection amount of the neutralizer to lower the pH value; When the iron ion content deviates from the index range, adjust the injection amount of the corrosion inhibitor; when the iron ion content is lower than the corresponding normal range, increase the injection amount of the corrosion inhibitor to reduce the iron ion content; when the iron ion content is higher than the corresponding normal range, reduce the injection amount of the corrosion inhibitor to reduce the iron ion content; When the corrosion rate deviates from the index range, adjust the water injection volume; when the corrosion rate is higher than the set range, increase the water injection volume to reduce the corrosion rate; Alternatively, the control logic is: When any of the pH, iron ion content or corrosion rate deviates from the specified range, Updated neutralizer injection amount = e1×neutralizer injection amount + e2×corrosion inhibitor injection amount + e3×water injection amount, where e1, e2 and e3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water, respectively; Updated corrosion inhibitor injection amount = f1 × neutralizer injection amount + f2 × corrosion inhibitor injection amount + f3 × water injection amount, where f1, f2 and f3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water respectively; Updated water injection amount = g1×neutralizer injection amount + g2×corrosion inhibitor injection amount + g3×water injection amount, where g1, g2 and g3 are weight parameters corresponding to the injection amounts of neutralizer, corrosion inhibitor and water, respectively; According to the range of pH, iron ion content or corrosion rate, the size of the corresponding weight parameter is obtained by looking up a table.
8. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 1, characterized in that: In the S65, the specific steps include: Get pH value in real time; Calculate the deviation between the actual pH value and the set value; Calculate the PID control signal based on the deviation, the formula is: Among them, K p , K i , K d They are proportional, integral and differential coefficients respectively.
9. The method for predicting atmospheric tower top corrosion rate based on time series prediction according to claim 8, characterized in that: The S65 also includes adjusting the parameters in the PID: Proportional P coefficient adjustment: adjust the proportional coefficient of PID according to the anti-correlation of water injection volume; when the water injection volume is more, the P coefficient is smaller; when the water injection volume is less, the P coefficient is larger; Integral I coefficient adjustment: adjust the integral coefficient of PID inversely according to the injection amount of corrosion inhibitor; when the injection amount of corrosion inhibitor is larger, the I coefficient is smaller; when the injection amount of corrosion inhibitor is smaller, the I coefficient is larger; Differential D coefficient adjustment: The differential coefficient of PID is adjusted according to the positive correlation between the change in the water injection volume and the injection volume of the corrosion inhibitor; when the change is more severe, the D coefficient is larger; when the change is less severe, the D coefficient is smaller.
10. A system for predicting atmospheric pressure tower top corrosion rate based on time series prediction, characterized in that: It includes a processor, in which the steps of the atmospheric tower top corrosion rate prediction method based on time series prediction as described in any one of claims 1 to 9 are executed.
Citation Information
Patent Citations
Self-diagnosis PH on-line monitoring system and method
CN109813782A