*3.2. BP Neural Network Model Considering the Uncertainties of Initial Corrosion Time and Corrosion Depth*

Because the pipeline does not begin to corrode immediately after being put into use, but takes time to begin to corrode, it is necessary to consider the uncertainty in initial corrosion time. Here, it is assumed that the initial time *T*initial follows a normal distribution when the pipeline begins to corrode. The detail is as follow [25].

$$T\_{\text{initial}} \sim N\left(T\_{0\nu} \, \text{std}\_{T\_0} \, ^2\right) \tag{12}$$

To construct this proposed ANN model, we first preprocess the input data, which are introduced in last section. Then, we calculate the actual corrosion time *T*actual using Equation (13). To consider the real situation, the corrosion coefficient *O<sup>i</sup>* related to corrosion rate in a short time is obtained according to the established neural network model. The corrosion amount of the pipeline is calculated and accumulated to obtain the corrosion model of the pipeline. Considering the uncertainties of measured value and actual corrosion rate, we assume that the corrosion coefficient follows the normal distribution represented by Equation (14). Then, the corrosion depth can be calculated using Equation (15).

$$T\_{\text{actual}} = T - T\_{\text{initial}} \tag{13}$$

$$
\tilde{O}\_i \sim N\left(O\_i, 2.5 \times 10^{-3} O\_i^{-2}\right) \tag{14}
$$

$$D(t) = D\_0 + \sum\_{i=1}^{t} \phi \left(\tilde{O}\_{i\cdot} i\right) \tag{15}$$

where the variable *T* is the service time of pipeline; *O<sup>i</sup>* represents the output corrosion coefficient of the *i*th year from the neural network; and *D*<sup>0</sup> is the initial corrosion depth. The function *φ* represents the relationship between corrosion coefficient and corrosion growth rate, so the corrosion coefficient can be taken as the corrosion rate especially for linear growth corrosion. What is more, to reduce the accidental error, the neural network is trained ten times, and the average of training results is used as the prediction result.

### *3.3. BP Neural Network Considering the Uncertainties in Corrosion Size*

Due to the limitations in inline inspection tools, there exist measurement errors in detected corrosion size. Hence, it is necessary to consider the uncertainties in corrosion size. In this proposed model, in addition to considering the uncertainties mentioned in model 2, the uncertainties in corrosion size (length, width, depth) are also added to the BP neural network model. The corrosion depth, width, and length can then be calculated by Equations (16)–(18).

$$D(t) = D\_0 + \sum\_{i=1}^{t} \phi \left(\tilde{O}\_{D\_i} i\right) \tag{16}$$

$$L(t) = L\_0 + \sum\_{i=1}^{t} \phi\left(\widetilde{O}\_{L'}i\right) \tag{17}$$

$$\mathcal{W}(t) = \mathcal{W}\_0 + \sum\_{i=1}^{t} \phi \left( \widetilde{O}\_{W'} i \right) \tag{18}$$

where *D*, *L*, and *W* represent the corrosion amount of the pipeline in the direction of depth, length, and width, respectively; and *D*0, *L*0, and *W*<sup>0</sup> correspond to the initial corrosion depth, length, and width, respectively.

According to a selected sample, we calculate the corrosion coefficient in three corrosion directions firstly. We assume that there are fixed corrosion coefficients *O*e*<sup>w</sup>* and *O*e *l* in the width and length directions, respectively. Here, we can calculate the corresponding corrosion amounts of *W*(*t*) and *L*(*t*). Then, the variations of corrosion amount in these two parameters are included in the input data of the BP neural network, and the corrosion coefficient in the depth direction is the output parameter. By substituting the corrosion coefficient into Equation (16), the corrosion depth can be obtained for further risk analysis. In each simulation run, the variations in the corrosion length and width of the test sample over time are added to the sample data. We use the same input data as training data to obtain this proposed model 3 for future comparisons.

### **4. Case Studies**

### *4.1. General Information*

In this section, examples are used to demonstrate the effectiveness of the proposed models. The comparison results for the three corrosion models can be used for the subsequent reliability evaluation and risk analysis of pipelines. Table 3 summarizes the differences among three BP neural network models. The pipeline failure caused by a corrosion defect is mainly because the corrosion depth reaches the critical value. So, in the following case studies, we mainly focus on the growth of corrosion depth rather than length and width. Based on the field data, we investigate three types of corrosion depth growth models. In the first case, the depth of corrosion increases with time linearly. In the second case, corrosion growth follows an exponential distribution. As for the third case, the growth of corrosion depth in each period conforms to the gamma growth process.

**Table 3.** Three gradually improved models.


*4.2. Case Study 1: Uniform Corrosion Hypothesis*

The growth of the defect depth is characterized by:

$$d(t) = d\_0 + \mathcal{g}\_d t \tag{19}$$

where *d*<sup>0</sup> represents the initial corrosion amount and *g<sup>d</sup>* is the growth rate of corrosion depth. *g<sup>d</sup>* is used as the output parameter in the neural network model. When considering the uncertainty, we assume that *g<sup>d</sup>* follows the normal distribution, that the actual corrosion depth growth rate conforms to the theoretical value, and that the variance is 0.05 times the theoretical value.

4.2.1. Traditional Linear Corrosion Growth Model (Model 1)

The BP neural network is used to simulate the corrosion depth of the pipeline, and the results are shown in Figure 2.

**Figure 2.** Comparison results of pipeline life prediction: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.

As can be seen from the figure, when the BP neural network method is used to predict pipeline corrosion, the prediction results are promising. The predicted corrosion depth growth rates are relatively close to the theoretical growth rate, which can illustrate the great potential of the BP neural network method in predicting pipeline remaining useful life.

4.2.2. Linear Corrosion Growth Model Considering the Uncertainties of Initial Corrosion Time and Corrosion Depth (Model 2)

With the uncertainties of initial corrosion time and corrosion depth in the model 2, and the prediction results of the model 2 is observed and compared with model 1 in Figure 3. The summary of comparison results is shown in Table 4.

After 20 simulation runs of the corresponding network, the service life of the pipeline is shown in Table 4.

To facilitate the comparison, take the absolute value of error for calculation. It can be obtained that the standard deviation of the error of model 2 is 1.1806, and that the standard deviation of the uniform corrosion of model 1 is 1.7084. Thus, it can be concluded that the neural network model 2 is better than the previous model 1. As can be seen from the above figure and table, the prediction results of model 2 are closer to the real values than model 1, which fully illustrates that the proposed model 2 has better performance of predicting pipeline corrosion growth and remaining useful life.

**Figure 3.** Comparison results of real value, model 1 and model 2: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.

**Table 4.** Analysis of the results of pipeline service life.


4.2.3. Linear Corrosion Growth Model Considering the Uncertainties of Corrosion Size (Model 3)

We build the model 3 based on the previous model 2 and add the uncertainties in corrosion length and width in the BP neural network. The results are shown in Figure 4. Furthermore, to compare the prediction results of the three models more clearly, the mean of squared errors (MSE) between the predicted value and real values is calculated in Table 5.

**Figure 4.** Comparison results of the three models and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.



From the comparison results in the above figures, it can be seen that, after considering the variations in the length and width of corrosion over time, the results of model 3 are closer to the true values compared with model 1 and model 2. At the same time, the above table shows that the MSEs of model 3 are smaller than model 2 and model 1. What is more, the results of model 2 are better than model 1. Considering multiple uncertainty sources, it can be explained that the simulated effects of the above three neural network models are gradually getting closer to reality. Consequently, the proposed BP neural network models produce better results and can make a more accurate pipeline remaining useful life prediction than the traditional BP neural network model (model 1).

### *4.3. Case Study 2: Exponential Model Hypothesis*

The three BP neural network models can also be used to predict the exponential corrosion growth model of the pipeline. The growth of the defect depth is characterized by:

$$d(t) = d\_0 + kt^{\gamma} \tag{20}$$

where *d*<sup>0</sup> is the initial corrosion depth, and *k* and *γ* are the parameters of the exponential corrosion growth model. Because the variability of *k* is usually large, and the variability of *γ* is usually small [26], the value of *γ* is selected as 0.5. Then, the model parameter *k* is used as the output of neural network models. 4.3.1. Traditional Exponential Growth Model (Model 1) No uncertainty is considered in model 1. When constructing the exponential growth

### 4.3.1. Traditional Exponential Growth Model (Model 1) model of the pipeline, it is assumed that the time index of the real corrosion rate obeys a

No uncertainty is considered in model 1. When constructing the exponential growth model of the pipeline, it is assumed that the time index of the real corrosion rate obeys a normal distribution with a mean value of 0.5 and a variance of 0.05. At the same time, a proportional coefficient is constructed using real corrosion data. We obtain the simulation results every five years. The corresponding results are shown in Figure 5. The simulated results accord with the trend of actual value, but there are big differences as useful life increases. normal distribution with a mean value of 0.5 and a variance of 0.05. At the same time, a proportional coefficient is constructed using real corrosion data. We obtain the simulation results every five years. The corresponding results are shown in Figure 5. The simulated results accord with the trend of actual value, but there are big differences as useful life increases.

**Figure 5.** Comparison results of model 1 and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4. **Figure 5.** Comparison results of model 1 and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.

Corrosion Time, Corrosion Index, and Scale Factor (Model 2)

4.3.2. Exponential Corrosion Growth Model Considering the Uncertainties in Initial

In the proposed model 2, we consider the uncertainties of the initial corrosion time, the corrosion index, and the scale factor in the BP neural network. The simulation results are evaluated every five years, and the results are compared and analyzed, as shown in

Figure 6 and Table 6.

4.3.2. Exponential Corrosion Growth Model Considering the Uncertainties in Initial Corrosion Time, Corrosion Index, and Scale Factor (Model 2)

In the proposed model 2, we consider the uncertainties of the initial corrosion time, the corrosion index, and the scale factor in the BP neural network. The simulation results are evaluated every five years, and the results are compared and analyzed, as shown in Figure 6 and Table 6.

**Figure 6.** Comparison results of the two models and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.

**Table 6.** Variance of the difference between the predicted value and real value.


It can be seen from the figures that, among the above four samples, the simulated results of the four figures show that the prediction results generated by model 2 are closer to the true value than model 1. In addition, from Table 6, the standard deviations of model 2 are smaller than model 1, which indicates that model 2 performs better than model 1 in the pipeline corrosion depth growth prediction. However, the prediction results are still not accurate enough for the pipeline remaining useful life prediction.

4.3.3. Exponential Corrosion Growth Model Considering the Uncertainties of Corrosion Size (Model 3)

In addition to considering the uncertainties of initial corrosion time and relevant corrosion depth parameters, the variations in length and width over time are also added to the BP neural network model. Then we compare the results of this new model (model 3) with model 1 and model 2. The results are shown in Figure 7. The differences between the predicted value and real values are also summarized in Table 7.

**Figure 7.** Comparison results of the three models and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.



It also clearly shows that, after considering the changes in the length and width of corrosion over time, the results of model 3 are closer to the true values. In other words, from model 1 to model 3, accuracy and stability are gradually enhanced. Furthermore, compared with model 1 and model 2, the prediction accuracy for model 3 increase a lot, which concludes the uncertainties in corrosion length and width do affect the growth of corrosion depth a lot.

### *4.4. Case Study 3: Gamma Distribution Hypothesis*

4.4.1. Traditional Gamma Corrosion Growth Model (Model 1)

In this gamma growth model, it is assumed that the amount of corrosion per year obeys a gamma distribution. The growth of the defect depth is characterized by:

$$d(t) = d\_0 + d\_\mathcal{g}(t) \tag{21}$$

$$F(d\_{\mathcal{S}}(t) \Big| a, \mathcal{S}, t) = \beta^{\text{at}} \Big(d\_{\mathcal{S}})^{\text{at} - 1} \exp(-\beta d\_{\mathcal{S}}) / \Gamma(\text{at}) \tag{22}$$

where *dg*(*t*) denotes the homogeneous gamma process. The probability density function of *dg*(*t*) is given by Equation (22), where *α* and *β* are shape and scale parameters of gammar process, respectively. Moreover, in our paper, the scale parameter *β* is assumed to be 48 according to the specific value. We use the shape parameter *α* as the main output parameter of the BP neural network. According to this notion, we establish a BP neural network model, and the results are shown in Figure 8. Furthermore, the prediction results have the same trend with the actual values, but there still are some prediction errors.

**Figure 8.** Comparison results of model 1 and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.

4.4.2. Gamma Process Corrosion Growth Model Considering the Uncertainties of Initial Corrosion Time and the Shape Parameters (Model 2)

In this model, the uncertainties of the initial corrosion time and the shape parameters are considered in the BP neural network. We compare this model 2 with model 1 and the actual value. These results are shown in Figure 9.

**Figure 9.** Comparison results of the two models and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.

The tendency of the results is the same as the uniform corrosion model and exponential model. The model which considers uncertainties of initial corrosion time and shape parameters has better prediction results.

### 4.4.3. Gamma Corrosion Growth Model Considering the Uncertainties of Corrosion Size (Model 3)

The steps are the same as linear and exponential growth models, and we also consider the uncertainties in corrosion size over time in the proposed BP neural network. The comparison results for models 1, 2, and 3 are shown in Figure 10. The differences between the predicted value and real values are also summarized in Table 8.

After considering the uncertainties in the length and width of corrosion over time, the results of model 3 are closer to the actual values. Additionally, from model 1 to model 2 to model 3, accuracy and stability are gradually enhanced. As linear, exponential and Gamma corrosion growth models can be used to describe most corroded the pipelines' degradation working cases. So, we take these three hypothetical growth models as examples, and our proposed BP neural network models' rationality, effectiveness, and universal applicability are verified.

**Figure 10.** Comparison results of the three models and the real results: (**a**) sample 1; (**b**) sample 2; (**c**) sample 3; (**d**) sample 4.


**Table 8.** Variance of the difference between the predicted value and real value.

### **5. Conclusions**

This paper proposed BP neural network models for pipeline useful life prediction considering the uncertainties in initial corrosion time and corrosion size. Furthermore, we use the field data from the Sinopec Pipeline Storage and Transportation Co., Ltd. to demonstrate the effectiveness of the proposed model. We first preprocess the collected field data, and we can use these data (pipe parameters, corrosion location, corrosion size, etc.) as input random variables to construct the neural network model. Three gradually improved models are considered in the pipeline RUL prediction, and the uncertainties are added to each model to make the hypothetical pipeline corrosion situation closer to reality. At the same time, by comparing the results of the neural network with the real values, it can be seen that the results are relatively close, which fully illustrates the effectiveness and the rationality of the BP neural network method in predicting the corrosion degree of pipelines. Three proposed BP neural network models are compared with actual values, a corresponding comparative analysis of the results shows that the model 3 which considers

the uncertainties from corrosion initial time and corrosion size produce more accurate prediction results. Lastly, we use three case studies to demonstrate the effectiveness of the proposed models. Three types of corrosion growth models, namely uniform, exponential model, and gamma process models, are applied to the proposed models mentioned above. The comparison results prove that the proposed models have universal applicability to different working conditions.

**Author Contributions:** Conceptualization, Z.L. and J.Z.; methodology, M.X.; software, Z.L. and M.X.; validation, Z.L., J.Z. and M.X.; formal analysis, M.X. and X.P.; investigation, M.X.; resources, M.X.; data curation, M.X.; writing—original draft preparation, Z.L. and J.Z.; writing—review and editing, M.X.; visualization, M.X. and X.P.; supervision, M.X. and X.P.; project administration, M.X. and X.P.; funding acquisition, M.X. and X.P. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the National Natural Science Foundation of China, grant number 72001039, 71671035, 12102090.

**Data Availability Statement:** The data presented in this study are available on request from the corresponding author.

**Conflicts of Interest:** The authors declare no conflict of interest.
