Open Access

Deep learning-based modeling of CO2 corrosion rate prediction in oil and gas pipelines

, , ,  and   
Mar 19, 2025

Cite
Download Cover

Introduction

Oil and gas pipeline is an important facility for oil and gas transportation, which carries the heavy responsibility of national economic development. Pipelines will have corrosion problems in long-term operation, and if they are not effectively protected, they will have a serious impact on the safety and operation of pipelines [13]. Carbon dioxide corrosion refers to the oil and gas pipeline containing a certain concentration of carbon dioxide and water corrosion. Some natural gas, especially condensate, often contains high concentrations of carbon dioxide. Carbon dioxide dissolved in the extraction water or condensate to generate bicarbonate ions, carbonate ions ions, so that the steel electrochemical corrosion [47]. Carbon dioxide corrosion belongs to hydrogen depolarization corrosion, often more serious than the same pH value of the strong acid corrosion. Its corrosion is controlled by the rate of depolarization reaction, but also with the corrosion products on the metal surface to form a film and the stability of the film, so the prediction of CO2 corrosion rate in oil and gas pipelines is of great significance [811].

The corrosion of oil and gas pipelines containing CO2 is mostly generated in the pipeline as well as water-soluble carbonic acid occurs in a typical electrochemical process, in the electrochemical effect, the pipeline occurs thinning, perforation and other manifestations. Therefore, when predicting the corrosion rate of oil and gas pipelines, the accuracy of the remaining life prediction should be guaranteed as much as possible [1214]. The corrosion study of CO2-containing oil and gas pipelines should not be analyzed only at the qualitative level, but should be further analyzed quantitatively, based on a comprehensive form of corrosion rate prediction model, to predict the corrosion rate of CO2-containing gas wells, to determine the time of pipe replacement and renewal of pipe, etc., in order to ensure the long-term stable and economic production of oil and gas [1518].

A CO2 corrosion model was constructed in the literature [19] to predict the corrosion rate of steel in oil and gas production and transportation systems. Based on experimental data, it was pointed out that the model covers different scenarios such as deoxygenated CO2 corrosion, aerated CO2 corrosion, etc., and the characteristics of the model and the connection between the different scenarios were outlined. Literature [20] presented a practical implementation of a robust integrated learning model for predicting corrosion rates within oil and gas pipelines, and the learning model was verified to have excellent performance through a series of studies. Literature [21] explored different prediction models used to assess the co-corrosion of carbon steel in the oil and gas industry. The differences between these models are explained, with the largest differences being in the “prediction of the effect of protective corrosion film” and “the effect of oil wetting on co-corrosion”. Literature [22] created a model for predicting internal pitting corrosion in oil and gas pipelines, which was able to predict the growth of pitting corrosion, including other internal pits not included in the model, based on readily available operating parameters by taking into account the statistical properties of pitting corrosion, and identified errors in the predictions, which were demonstrated based on data from multiple operating pipelines. Literature [23] constructed a neural network-based corrosion rate prediction model for oil and gas pipelines, and applied the LM back propagation algorithm to optimize the training of this model in order to improve its prediction accuracy. The model was also validated using MATLAB, and it was found that the prediction accuracy of the model was very high and could accurately predict the corrosion rate of the pipeline through the evaluation of industrial datasets.

In this study, in order to study the corrosion rate of CO2 in oil and gas pipelines, deep learning is used as the basic tool, and deep confidence networks, generative adversarial networks, and the Transformer model are studied in detail. Combined with the mechanism of corrosion rate of oil and gas pipelines, corrosion factors are selected, and in order to meet the needs of model training, this paper expands the collected corrosion data, and extracts the main features of corrosion rate through correlation analysis and principal component analysis. Finally, this paper uses the Adam algorithm to optimize the DBN model, proposes a corrosion rate prediction model based on the improved DBN model, and tests the prediction effect of the model to compare the prediction performance of different models.

Deep learning based CO2 corrosion rate prediction model
Deep Learning and Related Algorithmic Models

Simply put, deep learning algorithms are an enhanced version of traditional machine learning methods. If traditional machine learning algorithms can be viewed as a one-layer neural network, deep learning algorithms can be viewed as a multi-layer neural network. Thus, deep learning algorithms are a relative concept, a subset of machine learning algorithms.

Deep learning algorithms extract features from traditional machine learning algorithms and incorporate them into the model training process. That is, the input data is fed directly into the model, and the feature extraction is carried out through the deep learning model internally before training, so that the main step of manually extracting features can be eliminated and the training process of the model can be simplified. Since deep learning models incorporate the feature extraction method into the model, this also increases the complexity of the model. It is due to this complexity that deep learning models learn deeper features. What’s more, deep learning models can save a lot of labor by extracting various features through their own learning. In recent years, with the continuous development of deep learning algorithms, deep learning models have been widely used in applications such as images, speech, text, and so on. With the full utilization of computer hardware resources, the advantages of deep learning models are becoming more and more prominent.

Deep Confidence Networks

Deep Confidence Network Model (DBN) was first proposed in 2006, the basic constituent unit of DBN network is RBM, there are i unit in the visible layer of RBM and j units in the hidden layer. So the energy function of RBM can be expressed as: E(v,h|θ)=n=1im=1jwnmvnhmn=1ianvnm=1jbmhm

In Eq. i is the number of nodes in visible layer n and j is the number of nodes in implicit layer m. an(n = 1,2,3,…, i) and bm(m = 1,2,3,…, j) represent the states of n and m, respectively, vn and hm represent the deviations of n and m, respectively, and ωnm is the connection weight between n and m.

Due to the independence between the layers, the joint probability distribution of (v, h) can be obtained: p(v,h|θ)=eE(v,h|θ)Z(θ) Z(θ) represents the sum of the energy values between the visible and implied layers: Z(θ)=vheE(v,h|θ)

Because of the feature of unconnected layers, the activation probability of m hidden or n visible layers can be found if the states of the visible or hidden layers are known: p(hm=1|v,θ)=σn(vnωnm+bm) p(vn=1|h,θ)=σn(hmωnm+an) where σ is the sigmoid activation function.

The purpose of RBM training and learning is to find the value of parameter θ, i.e., to bring the distribution of the original data closer to the Gibbs distribution represented by the RBM, and thus the underlying problem can be turned into a great likelihood problem: L(θ)=t=1TlogP(v(t)|θ)=t=1TloghP(v(t),h|θ)=t=1Tloghexp[ E(v(t),h|θ) ]vhexp[E(v,h)|θ]=t=1T(loghexp[ E(v(t),h|θ) ]logvhexp[ E(v,h)|θ ])

In the recent development of neural networks and deep learning, the RBM model has played a significant role, and it is the foundation for deep confidence networks and deep Boltzmann machines. In addition, it can be used as a generative and discriminative model in a variety of domains, such as classification, dimensionality reduction, topic modeling, and so on.

The first layer of a DBN network is the visible layer V, which is used to receive raw data signals and then transmit the signals to the hidden layer H for feature extraction, which usually consists of a number of layers with different numbers of neurons, depending on the size of the data. During unsupervised training, V and H1 constitute the first RBM, and H1 and H2 constitute the second RBM. Neurons in the layers are connected together, but there is no connection between the layers. The data information from the previous RBM’s hidden layer is acquired by the hidden layer of each RBM, and several better and more abstract features are extracted from it. Finally, the feature data is transmitted to the third part of the DBN, the output layer, where the number of neurons is usually given according to the training task, and in case of a classification task, the number of neurons is the number of classifications.

There are multiple RBMs in the traditional DBN, and its learning process is divided into unsupervised training and backward fine-tuning. First, each RBM is trained according to the unsupervised greedy training method. In this process, the weights are updated using the contrast gradient algorithm. The hidden layer of the current RBM is treated as the visible layer of the next RBM, and then trained with the same steps until the last layer of the RBM is trained.Second, the network is extended into a forward neural network, where all neurons are locally optimized and the weights of the whole network are adjusted using the BP algorithm. The input data travels through the entire DBN network layer by layer, with each layer obtaining more high-level functionality than the previous layers. In two ways, deep learning has substantial advantages over traditional neural network learning methods. One benefit of each layer is that it greatly improves training efficiency, while the other is that they avoid the risk of traditional neural networks falling into local minima in an unsupervised learning environment.

Generating Adversarial Networks

In 2014, Generative Adversarial Networks (GAN) was proposed. GAN is one of the most widely used applications in adversarial learning. The structure of GAN consists of a generator and a discriminator. Random noise can be input into the generator to get a pseudo sample, and real samples together into the discriminator, the discriminator by judging the input samples and generator to form a game training, the discriminator’s goal is to accurately distinguish between the input samples and the generator’s goal is to make the pseudo samples as far as possible with the real samples to form the same distribution, and repeated training of the two networks to form a dynamic Nash equilibrium. Training the discriminator results in a greater discriminative loss, while training the generator results in a smaller loss, so the objective function of the GAN is defined as: minGmaxDV(D,G)=Ex~Pdata(x)[ log(D(x)) ]+Ez~Pz(z)[ log(1D(G(z))) ]$$\mathop {\min }\limits_G \mathop {\max }\limits_D V\left( {D,G} \right) = {E_{x \sim {P_{data}}}}\left( x \right)\left[ {\log \left( {D\left( x \right)} \right)} \right] + {E_{z \sim {P_z}\left( z \right)}}\left[ {\log \left( {1 - D\left( {G\left( z \right)} \right)} \right)} \right]$$ where random noise z is sampled from the prior distribution Pz(z), x is sampled from the true data distribution Pdata(x), and G(z) is the generated sample. The activation functions of the generator G are Relu and Sigmoid, and the activation function of the discriminator D is Leak Relu, x and G(z) are input into the discriminator D, and the output is the probability of judging the source as real.

Fixing the generator network G, the optimization problem for the discriminator network D can be transformed into: DG*(x)=Pdata(x)Pdata(x)+Pg(x)

Where Pg(x) represents the state of generating the pseudo-sample, the final optimization result of the discriminator network is that DG*(x) reaches the maximum value, which can be obtained at this time Pdata = Pg. Through the analysis of the optimization loss function of the discriminator, it can be learned that it has reached the maximum value, which is in line with the results of Eq. Therefore, if the data sample of the pseudo-sample is consistent with the data distribution of the real sample, then the generator network G will also obtain the optimal solution, which is expressed as: 2JSD(PdataPg)2log(2)

Here, JS stands for the Jensen-Shannon distance, which is used to evaluate the gap between the two distributions, and its property compared to the KL distance is that it is non-negative, so in order to minimize the loss of the generator, in this paper, we only need to minimize the value of JS to achieve the lowest value of the loss –log4. And the minimum value of JS indicates that the distributions of the two are exactly the same, and so finding the best generator is actually is the way to find the minimum JS value. After many rounds of iteration, according to the theoretical derivation, the quality of the final sample should be infinitely close to the real sample, which makes it difficult for the discriminator to distinguish the generated sample from the real sample.

Transformer model

Transformer model is a deep neural network coupled with a self-attention mechanism and parallelized processing data proposed by the Google team in 2017. Transformer is a deep learning model based on self-attention. Transformer model consists of an encoder and a decoder, where the encoder is used to encode the input sequence and the The decoder is used to generate the output sequence, which was initially used in the field of Natural Language Processing (NLP).The Transformer network uses a self-attention mechanism to process the sequence information as a whole, avoiding recursive transfer between information and allowing attention to local information with strong correlation.

The self-attention mechanism allows the model to focus on different locations in the input sequence during encoding and decoding, thus capturing long-distance dependencies in the sequence. It performs a weighted summation of the sequence by computing the attentional weights between the query, keys, and values to obtain a representation of each position.

In the Transformer model, each encoder and decoder layer consists of a multi-head attention mechanism and a feed-forward neural network. The multi-head attention mechanism allows the model to pay attention in different representation subspaces, thus capturing semantic information at different levels and from different perspectives.The Transformer model has achieved remarkable success in text processing tasks, especially in machine translation tasks. It is capable of modeling the input sequence globally and has good parallel computing performance. The mathematical representation of the self-attention mechanism is shown below: Attention(Q,K,V)=softmax(QKTdk)V Q denotes the query vector, K denotes the key vector, V denotes the value vector, and dk denotes the dimension of the key vector. softmax function is used to compute the attentional weights by normalizing them between 0 and 1 for weighted summation.

Transformer’s encoder and decoder achieve global modeling by stacking multiple self-attention layers and feedforward neural network layers. The encoder is used to encode the input sequence and the decoder is used to generate the output sequence. In addition to BERT, the Transformer model has spawned many other variants and improvements, such as XLNet, an improved version of BERT, and Transformer-xl, which enhances Transformer’s ability to model long-term dependencies.These models have made significant progress in the field of natural language processing and have become benchmark models for many tasks.

Corrosion rate mechanism of oil and gas pipelines
CO2 corrosion mechanism

CO2 often exists in the form of associated gas in oil and gas, and its corrosion type mainly includes localized corrosion and uniform corrosion. Localized corrosion, including pitting, surface corrosion and flow-induced localized corrosion, etc., this type of corrosion can easily lead to oil casing puncture, but also the main form of damage and failure of oil casing. Localized corrosion is mainly generated with the CO2 corrosive environment in the surface of the casing corrosion product film generated in close contact with the corrosive medium flow rate and the composition of the casing material will also affect the occurrence of localized corrosion. The CO2 localized corrosion of the oil casing has been the focus of the corrosion field, but the current research on localized corrosion is still insufficient, and can not make accurate judgment and prediction of the localized corrosion rate. When CO2 in the form of uniform corrosion exists, all or most of the area of the exposed part of the oil casing is uniformly damaged by corrosion, which leads to a reduction in the strength of the tubing and the thickness of the tubing wall, and it is easy to fall out of the well accident. Uniform corrosion is mainly controlled by the corrosion product film formed on the surface of the casing, but also by the corrosive environment CO2 partial pressure, temperature, corrosive medium flow rate, corrosive medium pH value and alloying elements in the pipe.

CO2 corrosive effect is mainly through CO2 dissolved in aqueous solution after the formation of carbonic acid and caused by galvanic corrosion. When the steel surface encounters aqueous solution containing CO2, the surface will easily generate corrosion product film or deposit a layer of scale, when the film or scale is more dense, like a physical barrier to inhibit the continuous corrosion behavior of steel. However, when this layer of film or scale for the structure is not dense, this layer of metal under the scale will form an oxygen-deficient area, it is easy to form an oxygen-rich area with the surrounding oxygen-concentrated electrode, oxygen-deficient area of steel due to the oxygen deficiency potential is more negative and anodic iron dissolution occurs, the formation of a small anode, and finally with the rear outside of the large cathode area to form a corrosive battery of a small anode and a large cathode, to promote corrosion of the corrosion product film or the corrosive effect of the steel under the rear.

About CO2 corrosion mechanism and law gradually tends to mature, generally believe that the reaction of its corrosion process as follows:

First, CO2 dissolved in aqueous solution to form carbonic acid: CO2+H2OH2CO3

H2CO3 in aqueous solution undergoes a two-step ionization: H2CO3H++HCO3 HCO3H++HCO32

Steel undergoes galvanic corrosion in H2CO3 solution: 2H++FeFe2++H2 Fe2++CO32FeCO3

Its total corrosion reaction is: CO2+H2O+FeFeCO3+H2

During the corrosion process, intermediate product Fe(OH)2 is present before corrosion product FeCO3 is generated. The chemical reaction of steel in a bicarbonate medium solution proceeds in the following steps: Fe+2H2OFe(OH)2+2H++2e Fe+HCO3FeCO3+H++2e Fe(OH)2+HCO3FeCO3+H2O+OH FeCO3+HCO3Fe(CO3)22+H+

Due to the differences in experimental setup conditions, in addition, the lack of effective experimental validation regarding CO2 corrosion intermediates, these reasons lead to disagreements in the understanding of CO2 corrosion mechanisms and laws. In addition, the corrosion mechanism and law of CO2 change with different environmental influences and material composition, making the corrosion mechanism of steel in the CO2 environment varied.

H2S corrosion mechanism

In the process of oil and gas extraction of various types of corrosive associated gases, H2S in aqueous solution is the highest solubility, H2S dissolved in aqueous solution immediately after the ionization, so that the solution is acidic, thus producing corrosion damage to steel. In the H2S corrosive environment, the type of corrosion usually includes two categories, one for the electrochemical reaction leading to steel H2S environment cracking, its main manifestations of SSC, HB, HIC and SOHIC. which, SSC refers to the H2S corrosive cathodic reaction of the precipitation of hydrogen atoms in the catalytic effect of the HSand S2–and failed to form a hydrogen molecule, the hydrogen atoms into the steel after the addition of tensile or other stresses are prone to the formation of Steel hydrogen embrittlement or cracking; HB and HIC refers to the H2S corrosion cathodic reaction precipitation of hydrogen atoms accumulated in the steel sulfide inclusions in the reduction of hydrogen, thus forming steel internal cracking or surface bubbling. Another type of electrochemical reaction process for the anode iron dissolved in the formation of localized corrosion or uniform corrosion, which is similar to the type of CO2 corrosion, the localized corrosion manifested as pitting perforation resulting in easy to pierce the pipe, uniform corrosion is mainly manifested as a thinning of the wall thickness of the pipe.

H2S dissolved in aqueous solution immediately after the ionization occurs thus accelerating the ionization reaction of steel: H2SHS+H+ HSH++S2

The electrochemical reaction of iron in an aqueous solution of H2S is: Fe+H2S+H2OFeHSAdsorption+H3O+ FeHSAdsorptionFeHS++2e FeHS++H3O+Fe2++H2S+H2O Fe2++HSFeS+H+ H2S of the corrosion intermediates and corrosion products are mainly FeS, Fe9S8, Fe3S4, FeS2, etc., due to differences in corrosion conditions, the corrosion products generated will be different. When the H2S content is low, can produce a good density of FeS and FeS2 corrosion product film, due to the good combination with the substrate, so it will inhibit the continuous corrosion of steel, and even make the steel to achieve near-passivation state. When the H2S content is higher, it will generate loose layered or powdery iron sulfide product film, the product film can not prevent Fe2+again contact corrosive media, but also with the metal matrix to form a macroscopic battery, accelerating the corrosion of steel.

HS corrosive environment with the difference in environmental conditions may both accelerate the corrosive effect of steel, but also inhibit the corrosion of steel. In the acidic medium solution, HS promotes accelerated cathodic reaction precipitation of hydrogen atoms and anodic iron dissolution rate, thus the corrosion rate rises accordingly, while when the HS concentration content in the medium solution is less than 0.44×10−3 mol/L and pH value between 3 ~ 5, H2S on the corrosion of steel is very weak, attributed to the reason is that this condition is generated under the FeS protective film is relatively dense.

Regarding the corrosive effect at low H2S concentrations, it is due to the following reactions: Fe+H2S+H2OFeHSAdsorption+H3O+ FeHSAdsorptionFe(HS)Adsorption+e Fe(HS)AdsorptionFeHS++e

The corrosion intermediate product FeHS+ can react on the electrode surface not only to form FeS1–x, but also to generate Fe2+. The relevant reactions are as follows: FeHS+FeS1x+xHS+(1x)H+ FeHS++H3O+Fe2++H2S+H2O H2S corrosion process, the formation of the final corrosion product FeS in the process of the first formation of intermediate products FeS1–x, even if H2S in the medium solution concentration is very low, when the medium solution pH value between 3 ~ 5, in the early stage of corrosion, H2S corrosion rate will also be larger, but with the growth of time, the average corrosion rate will gradually decline, this is because with the gradual transformation of FeS1–x into FeS and FeS2, can play a role in shielding the corrosion product film under the Steel and corrosive media in contact with the role of this time H2S inhibit the role of corrosion is shown.

CO2 corrosion prediction model based on improved DBN

In general, DBN can be categorized into two phases for training: unsupervised layer-by-layer pre-training and supervised backward fine-tuning process. Default values for all network weights are set at the beginning, followed by the implementation of pre-training for each independent and mutually exclusive part, i.e., each layer of the RBMs, to ensure that it maps various attributes in the input samples into different dimensions and maintains as much as possible the correlation between them. Since the sample features may be distributed across multiple potential states, a BP network is ultimately used to complete the DBN’s global correction of the entire system until a specified maximum number of cycles is satisfied or until a certain range of error rates is allowed to be tolerated.

Neural network contains very many parameters which will affect the training of the model as well as the final output, and the optimizer is mainly used to update and calculate these parameters, so choosing the right optimizer is necessary for neural network. When we train the model, we have to set the size of the learning rate, and the learning rate itself is difficult to adjust, and for many neural network optimizers, some small changes in the learning rate will make the model have different performance, if the learning rate is not set appropriately, it may seriously affect the final results of the model.

The most common method of parameter gradient update algorithm currently applied in DBN is SGD (Stochastic Gradient Descent), which is used to update the gradient formula: θt=θt1ηθL(θt1)

Where t represents the number of iterations counter, L(θt–1) is the loss function in the objective optimization problem, ∇θL(θt–1) is the gradient of L(θt–1) with respect to θ, and is the notion of derivative to be used in the process of finding the best solution. In addition, the most important factor in the computation is the choice of the appropriate learning rate η of the hyperparameters, a parameter that can be determined by the trade-off between multiple rounds of trials and the lowest point of model prediction error. In practice, however, how to set the starting learning rate is a very tricky issue. If it is set too high, the process can become very prone to oscillations and the final results can deviate too much from the expected results, thus reducing the overall effectiveness. On the other hand, if it is set too small, the entire artificial neural network system will be in a stagnant state and will not be able to effectively distinguish between good and bad input data samples, thus failing to achieve the effect of improving training accuracy.

In Adam’s algorithm, the value of ||mt|| is interpreted as the absolute value of the mean of the current gradient, and when the vast majority of the past gradient is very different from the present gradient, vt becomes equally large. If ||mt|| is now very large, it means that the vast majority of the past gradient and the present gradient rarely cancel out, implying a better stability of the current update of the gradient. If ||mt|| is now very small, it means that the vast majority of past gradients and present gradients are usually opposite, which makes the absolute value ||mt|| obtained from gt expectation extremely small, implying that the update of the current gradient is less stable, and the weighting coefficients of the historical gradients accumulated during the iteration of the first-order variables are larger, while the weighting coefficients of the existing changes in the gradients are relatively small, so that the updating of the gradients is speed is more sluggish. At the late stage of updating, due to the expectation vt of gt2 is very large, the learning rate of Adam’s algorithm η/(vt+ε) is too small, then at this time, the local area of continuous fluctuation is prone to fall into the local optimal solution.

The modified first-order and second-order variable update formula is: mt=γmt1+gt vt=βvt1+(1β)mtmt

The parameter update formula is: θt+1=θtηvt+εmt

Compared with the Adam optimization algorithm to record the first-order variables of the gradient, the optimized Adam-DBN algorithm uses the traditional momentum method in the computation of the first-order variables and retains only the momentum factor γ, and the degree of stability of the objective function significantly affects the first-order variables; in the computation of the matrix of the second-order variables, the squared gradient is adjusted to be the squared momentum, and initialization bias corrections are eliminated, and since the Adam learning rate is mainly controlled by the second-order momentum, when the gradient change is in oscillation, ||mt|| changes less, and the learning rate changes at a tentative rate, which can better jump out of the oscillation; when the gradient update is relatively stable, ||mt|| increases, and vt increases rapidly, and is closer to the optimal point, which will not oscillate repeatedly near the optimal point due to the rapid decay of the learning rate. In this paper, the improved Adam algorithm is used for network optimization.

Experiments for predicting CO2 corrosion rates in natural oil pipelines
Oil and Gas Pipeline Corrosion Data Expansion and Feature Screening

Based on the analysis of the corrosion mechanism of oil and gas pipelines, temperature, pH, pressure and other factors will affect the corrosion rate of pipeline CO2, in which the wall shear is deeply affected by the temperature, pressure, medium and flow rate, the corrosion product film will play a protective role on the pipe wall to slow down the corrosion, but the corrosion product film is subject to a number of factors, such as temperature and pH, and so on, therefore, in the construction of the corrosion rate of CO2 Therefore, when constructing the input indexes of CO2 corrosion rate prediction model, the factors with eigenvalue greater than 1 and cumulative contribution rate above 85% are considered.

Due to the complex environment of oil and natural pipelines, it is more difficult to collect data, due to the small number of samples, resulting in the corrosion prediction based on deep learning is not comprehensive enough, so through the collection of existing data for data expansion data in order to be used for the training of deep learning algorithms, a total of 75 sets of data were collected in this paper, and 75 sets of the sample set of the oil and gas pipelines were expanded through Matlab, which was divided into 60 The training samples are divided into 60 training samples and 15 samples to be predicted, and the original corrosion remaining life training samples are expanded to 1000 by using double cubic interpolation and inverse distance-weighted interpolation, in order to obtain sufficient and reasonable data sets to be applied to the prediction of the remaining corrosion life of buried pipelines, and 978 groups of corrosion data are obtained by eliminating some invalid data.

Based on the acquired data, the corrosion factors are sorted out and their importance is determined. If there is a strong correlation between the factors, the dimension will be reduced. If there is no strong correlation between the factors, then these results can be used directly for prediction. According to the size of the absolute value of the correlation coefficient to identify the degree of correlation of different corrosion factors, 0 ~ 0.3 indicates a weak correlation, 0.3 ~ 0.5 is a low correlation, and 0.5 or more is judged to have a significant correlation.

The corrosion factor correlation analysis results are shown in Table 1, corrosion factors G1~G9 are temperature, pH, pressure, medium, flow rate, material selection, water content, carbonic acid concentration and CO2 concentration, respectively. The correlation coefficient of carbonic acid concentration (G8) and CO2 concentration (G9) is 0.715 which is greater than the absolute value of correlation coefficient r of 0.5, the correlation relationship is more significant. The correlations of the other corrosion factors are not very obvious, or even very weak. In other words, the correlation degree of corrosion factors is relatively low from the overall situation. Considering the carbonic acid concentration (G8) and CO2 concentration (G9), the correlation between the two corrosion factors is relatively high, and the principal component analysis is chosen to extract the main components of the pipeline corrosion factors.

Analysis of corrosion factor correlation analysis

Evaluation factor G1 G2 G3 G4 G5 G6 G7 G8 G9
G1 1
G2 0.231 1
G3 -0.181 0.215 1
G4 0.123 0.231 0.345 1
G5 0.253 0.325 0.456 0.122 1
G6 0.189 0.123 0.485 0.213 0.213 1
G7 0.231 0.321 0.012 0.005 0.322 0.214 1
G8 0.321 0.231 0.030 0.023 0.125 0.216 0.038 1
G9 0.073 0.062 -0.031 0.082 0.123 0.133 0.052 0.715 1

The corrosion sample data were standardized, and the principal component analysis was used for corrosion factor feature screening, and the variables were selected according to the cumulative contribution rate of more than 85% when extracting the main corrosion features.

The results of principal component analysis are shown in Fig. 1, (a) and (b) are the eigenvalues of principal component analysis, the contribution rate of principal component analysis and the cumulative contribution rate, respectively. It can be seen that the cumulative contribution rate of the first eight principal components is as high as 92%, more than 85%, in accordance with the general principle of selection in order to ensure the integrity of the corrosion structure, it is necessary to use the first eight principal components as the model input indicators. With the original corrosion characteristics data just 1 dimension difference, each corrosion factor except G8 and G9 have a strong correlation, the rest of the factors are weakly correlated, comprehensive consideration of the selection of the eigenvalue is greater than 1 and the cumulative contribution rate of 85% or more, and ultimately, in order to ensure the completeness of the corrosion dataset, do not remove the last corrosion factor.

Figure 1.

Main component analysis results

Analysis of CO2 corrosion rate prediction results

According to the selected corrosion pipeline sample data and 9 principal components of the normalization process as the output of the whole system, the data obtained as input data randomly divided into the training set and test set, the data obtained according to the proportion of the randomly divided into two groups, 782 groups of data for model training, the remaining 196 groups for prediction, the input of the trained model for prediction, and comparison with the actual value to detect the effect of model prediction is shown in Figure 2. The CO2 corrosion rate prediction results can be seen in Fig. 2, from the comparison between the predicted corrosion rate and the actual corrosion rate, it can be seen that the predicted value is very close to the real value, and the maximum value of the relative error of CO2 corrosion rate is not more than 3%, which is small and the prediction effect is good.

Figure 2.

Prediction of CO2 corrosion rate

In order to compare the prediction performance of this paper’s model more intuitively, it is compared with the previously mentioned traditional DBN model, Generative Adversarial Network (GAN), and Transformer model, and the relative errors of the prediction results of the different models are shown in Fig. 3, which shows that the improved DBN model in this paper has the best prediction effect, with the relative error stabilized between 1.3 and 2.8%, and the highest error compared to the The maximum error is reduced by 1.3% compared with the traditional DBN model. Compared to other models, the prediction effect of this paper’s model still has a significant advantage, which indicates that the prediction effect of this paper based on improved DBN is better.

Figure 3.

Relative error of prediction of different models

In order to further verify the prediction effect of the constructed model, this paper will choose three indicators to compare the prediction results of different models, namely, the mean absolute error (MAE), the mean absolute percentage error (MAPE) and the root mean square error (RMSE). Comparison of model prediction performance is shown in Table 2, which shows that the MAE, MAPE and RMSE of the improved model in this paper are 0.035, 1.893% and 0.039 respectively, which are smaller than the other three groups of models. The effectiveness of the improved DBN model in this paper is further verified, and it performs better in predicting the CO2 corrosion rate in pipelines.

Model predictability can be compared

Index DBN GAN Transformer Ours
MAE 0.925 0.121 0.212 0.035
MAPE(%) 3.480 4.486 5.872 1.893
RESE 0.0985 0.135 0.321 0.039
Conclusion

In this paper, on the basis of deep learning, the DBN model is improved by using Adam algorithm, and the corrosion rate prediction model based on the improved DBN model is constructed, and the performance of different prediction models is analyzed through experiments. The findings of this paper are as follows:

In order to meet the data requirements of the prediction model, this paper expands and characterizes the collected corrosion data, among which, the correlation coefficient of carbonic acid concentration (G8) and CO2 concentration (G9) is 0.715 greater than the absolute value of the correlation coefficient r of 0.5, the correlation is more significant, while the correlation of the other corrosion factors is not very obvious, or even more so, it is very weak. From the contribution rate of principal component analysis and the cumulative contribution rate, the cumulative contribution rate of the first eight principal components is as high as 92%, and the overall consideration is that in addition to the strong correlation between G8 and G9, the correlation with the rest of the factors is weaker, so in order to ensure the completeness of the corrosion dataset, the final nine corrosion factors are still used for analysis.

The maximum value of the relative error of the CO2 corrosion rate prediction model based on the improved DBN model in this paper does not exceed 3%, and the relative error is stable between 1.3 and 2.8%, with the highest error reduced by 1.3% compared with the traditional DBN model. In addition, the MAE, MAPE and RMSE of the improved model in this paper are 0.035, 1.893% and 0.039, respectively, which are still the best prediction results compared with the traditional DBN model, GAN and Transformer model, and further validate the practical effect of the corrosion rate prediction model in this paper.

Language:
English