Planning pipeline pigging operations with predictive maintenance

Deposition of waxes, asphaltenes, scales or hydrates is one of the most challenging operational problems in the oil and gas industry, both during production and transportation. Direct inspection procedures, such as employing a closed-circuit television system, allow visual assessment of the blockage, yet discretely in time and, consequently, of low value for the purpose of ensuring production over time. Therefore, an indirect predictive maintenance method for systematic evaluation of the internal pipe section is herein developed, adding a much needed solution to the current body of knowledge. Using continuous field measurements, it is now possible to predict when pigging should be performed to avoid significant blockages. Moreover, evaluating the maintenance plan risk is another major achievement. Finally, the proposed methodology and model were applied to a real case-study yielding good results compared to the current scheduled maintenance approaches.


Introduction
A partial or total blockage has been a critical operational problem both in pipelines [1][2][3][4][5][6][7][8], and in wells [9,10] since the early days of the oil & gas industry, when not only paraffinic oils were transported [11] but also crude oils with high concentrations of solid particles that were likely to deposit [12].
Upstream, midstream, and downstream operations are affected as oils of different compositions, multiphase flows, emulsions, and even gas production [13] have the potential for deposition [14,15]. These particles will aggregate into annular deposits in certain pipe sections, significantly reducing the flow rates, if the upstream pumping conditions remain unchanged. Ultimately, flow lines can become completely blocked or under-producing down to uneconomical thresholds.
Yet, the industry's recent developments significantly increased the magnitude of the problem. As onshore and accessible oil reserves tend to get depleted after profuse field exploitation, while global oil demand is steadily increasing (peaking at 82 929 661 bbl/d in 2018), new production fields are quickly shifting to offshore [23], into deep and ultra-deep waters [25,26], leveraged by technological advances. As a result, heavier oils are being produced and transported in longer subsea lines, under the effects of lower temperatures E3S Web of Conferences 266, 01017 (2021) https://doi.org/10.1051/e3sconf/202126601017 TOPICAL ISSUES 2021 [24][25][26]. Under the aforementioned scenario, wax deposition can be regarded as an increasingly critical problem for the world's global energy output.
Currently, options for mitigating wax deposition effects are prevention and remediation techniques [14]. The former include pigging, chemical inhibitors, heating techniques, bacterial treatments, operational conditions adjustment (including the flow rate and pressure increase), coating materials, insulators, acoustic methods, electric fields, magnetic fields, and oscillatory motion, while the latter encompass the first four of the mentioned. However, all of those have cost, limited efficiency, and technical specificities which bound their scope of application. While pigging operations have been the industry standard for many years, their application in deep and ultra-deep waters is quite challenging. In fact, the associated production downtime can become costly in long-flow lines [14], while the installation of looped flow lines for round-trip pigging requires a significant initial investment [27] and the high pressure upon the infrastructure due to the section reduction may cause severe damages, especially in older and corroded pipes [28], and accidents with stuck instruments occasionally occur [23,25,28]. Another issue with pigging operations is related to the difficulty in scheduling them. On the one hand, insufficient pigging will not prevent the risk of product loss due to partial blockage of sections and will increase the risk of total blockage, as well as the risk of jamming instruments. On the other hand, too frequent recurrent operations will lead to unnecessary costs associated with downtime and deferred production [23,29].
Given the shortcomings with wax prevention techniques and maintenance scheduling, inspection procedures have been increasingly used. These include visual inspection with the use of closed-circuit video systems or acoustic methods [30]. These approaches can be expensive, cannot be used in very long pipelines or wells, and require case-specific data analysis. Moreover, video systems may require downtime and defer production. However, the most significant hindrance of these techniques is associated with their discrete nature. As data cannot be attained continuously, it is of limited value for continuous prevention programs. Koptev & Kopteva developed a new non-invasive measuring system, based on gamma-ray wave radiation that allows measuring the thickness of the deposits [31]. Under current and forthcoming industry conditions, the continuous wax management programs will be the basis for maintenance planning. Especially in new inaccessible and lengthier production lines, wax deposits no longer can be prevented in economically efficient terms or remediated as they occur. They must be predicted precisely.
The current research developed a methodology for employing real subsea pipeline data to accurately estimate the ideal maintenance operations scheduling, considering the desired economic and risk criteria. The developments included articulating a theoretical pressure drop model to transfer operational data to a K factor definition that could be used in the analysis proposing a mathematical framework for linearizing the attained data functions, defining operational criteria and associated thresholds, as well as setting an artificial intelligence-based predictive maintenance model. Based on real data from a regularly pigged pipeline, the model was applied and showed that for the same operational criteria the attained maintenance planning allowed heterogeneous, condition-based maintenance with fewer operations compared to a typical and predefined maintenance schedule. Beyond the economic gains, a continuous sectional loss monitoring was achieved including uncertainty measures, which allowed a significant decrease in the risk of a substantial blockage.
This work resumes the outcomes of an ongoing research program and is an expanded version of a communication to the 16 th International Forum Contest of Students and Young Researchers, entitled "Predictive maintenance program for obstructed wells or pipelines", which has been awarded with a Best Speaker distinction.
After this introductory section, the article depicts analytical developments towards a pressure-drop formula which can be implemented into the program, as well as the predictive maintenance model fundamentals. The proposed methodology follows, encapsulating the former theoretical framework into a practical set of steps to achieve the predictive maintenance model. The proposed methodology is then applied to a real case study, providing information about the input data, the methodology of implementation, and the received results. Finally, conclusions are drawn.

Pressure drop method
To compute the pressure drop due to friction in a pipe, the Darcy-Weisbach equation expressed in Equation 1 can be employed. This is an empirical relation for pipe flow resistance: where ∆ = pressure drop (Pa); = Darcy friction factor (-); = length of the pipe (m); = inner diameter (m); = density of the fluid ( −3 ); and = fluid velocity ( −1 ). For laminar flow regime, the viscous forces will be paramount, yielding lower Reynolds numbers (Re < 2000); the Darcy friction factor is a consequence of Hagen-Poiseuille's law, being defined by Equation 2: where Re = Reynolds number (-); and μ = fluid's dynamic viscosity ( ). Whereas a turbulent flow is found, Blasius proposed a simple equation to determine the Darcy friction factor for smooth pipe flow. Equation 3 is valid for Reynolds numbers between 3 × 10 3 and 10 5 (Blasius 1913): Colebrook-White proposed a general equation, valid for turbulent flow range (Re > 4000), which defines the Darcy friction factor as a function of Reynolds number, and the pipe's relative roughness ε/D [32]. Due to the implicit formation of Equation 4, the determination of the friction factor requires an iterative solution.
where = pipe roughness (in or m), and D = pipe diameter (in or m).

Predictive maintenance programs
Maintenance operations traditionally are either reactive or completely proactive [33]. Reactive approaches have been the oil & gas industry standard under the current term of "fail and fix" approaches. On the other end, proactive approaches can be referred to as scheduled plans and are associated with preventive maintenance [34]. Both approaches are of limited economic efficiency. On the one hand, the reactive approach increases the risks of serious accidents and downtime. On the other hand, the proactive approach is expensive and requires frequent production stops for maintenance operations. Moreover, none of the former systematically assesses data to prevent abrupt yet foreseeable blockages. Under these circumstances, predictive maintenance can be adopted as an adequate approach to align maintenance operations with actual conditions of pipelines and wells. Predictive maintenance makes use of acquired data depicting physical or operation indicators to assess the initial signs of malfunction [35]. Therefore, maintenance operations can be planned to avoid costly downtimes, significant production losses due to sectional reduction, and accidents [33].
The Oil & Gas industry is particularly prone to predictive maintenance. Its assets are large, complex and hard-to-access, including offshore and subsea installations. Therefore, predictive maintenance has already been deployed in digital oilfields, mostly for drilling operations, artificial lifts' electric submersible pumps, and rotating equipment, such as compressors [35]. However, the future analytics resources for big data analysis, leveraged by artificial intelligence, are deemed to change the paradigm.
Artificial intelligence embraces a multitude of computer-based techniques, the general taxonomy of which includes at least seven different disciplines [36][37][38]. Those include computer vision, expert systems, fuzzy logic, machine learning, natural language processing, robotics, and speech recognition. Among the former, machine learning techniques have had a profuse application for engineering problems [39], and in the Oil & Gas sector in particular. Machine learning techniques, which are usually classified as supervised learning, unsupervised learning, and reinforcement learning, develop algorithms with the ability for improving through experience with training [40]. Those also show good resilience to data errors and outliers, which is critical when dealing with real-time acquired data.
Accordingly, machine learning techniques can be used for autonomous decision-making regarding maintenance management [40,41], including managing deposits, increasing process reliability, and significantly reducing workforce needs. Examples of how artificial intelligence uses predictive maintenance can be found in Mirani & Samuel, with the use of unsupervised statistical learning to assess how long can drilling operations be carried out when control parameters are out of range [42]. This is an advancement from an early stage when only the real-time parameters fitting the stability range and need for maintenance were evaluated. Other examples, such as [43,44] include the profuse employment of casebased reasoning for unveiling diagnostics of well failures based on the previous knowledge, which most often is too complex to be directly applied without AI techniques.
To the best of authors' knowledge, no predictive maintenance program for deposition management has been formulated, depicted, and validated in published literature. This is quite surprising considering the magnitude of this problem, as well as the recent developments in predictive maintenance, though it does not rule out the possibility of such endeavors having been developed in-house within major industry players. Even so, the need to offer such a program to the scientific and technical communities can only be regarded as critical.
Employing a predictive maintenance plan minimizes overall intervention costs, as well as the blockage risk. Therefore, current research has focused on developing a predictive maintenance program. The goal of the program is to predict when maintenance operations should be executed by comparing the predicted evolution in a specific parameter with a predefined threshold, as defined in Figure 1. The predicted evolution of the parameter must account for collected data, as well as frame it into the knowledge constructed upon training with previous datasets. This assessment must be continuously performed with the acquired data.
To predict the remaining lifespan before reaching the defined threshold, artificial intelligence algorithms can be applied to time series models. Determination of this expected value can be done according to three types of models: similarity models, which consider the run-to-failure history data; degradation models, which are applied when the failure threshold is known; and survival models, which take into account the lifetime data.
For the pipeline blockage problem, since it is assumed that maintenance operations maintain flow conditions by limiting the blockage to a certain threshold, degradation model with a known failure threshold was used.
Degradation models, however, can refer to linear degradation models or exponential degradation models. The choice among those depends on the collected data and on the parameters used for synthesizing and pre-processing the datasets. For the proposed methodology to forecast the remaining useful operational life span for an obstructed pipeline, a linear degradation model was used to predict when the pigging should be performed. This linear degradation model is pre-set in Matlab, and it adheres to the continuous linear law, as defined in Equation 5: where = slope; ∅ = intercept term; = noise parameter. In this case, the linear degradation model will describe the temporal evolution of a linear stochastic process dependent on the K factor. To implement the model, two data groups are needed: training data and test data. The training datasets contain the condition indicator record, continuously sampled over a representative lifetime, while the test datasets include a unique table, with the condition indicator values over time, as recorded since the last pigging routine.
Based on current information and pre-recorded training data, the model used can predict with a certain degree of confidence when the next pigging routine is due. Specifically, this model will output the predicted remaining expected useful operational life after predicting when the condition indicator is expected to exceed a certain prescribed threshold.
The model can be recursively updated as new real field data becomes available. The predictive maintenance model steps can be systematized into Figure 2.

Proposed methodology
Following the theoretical framework developed and described in 2.1 and 2.2, an encompassing methodology is proposed to articulate the former with data acquisition and decision making.
The proposed methodology to predict when to apply pigging procedures can be summarized in Figure 3.
Concerning the factor expressed Equation 8, one should note that similar factors have been recently proposed by Singh. Yet, the herein proposed uses the flow rate as a parameter to foster intelligibility regarding its hydraulic nexus.
Both for laminar and turbulent regimes, the K factor ( and from Equations 7 and 8, respectively) shows a decrease as the pressure drop increases for a given flow rate. Therefore, the K factor decreases as the deposit grows.
Employing this methodology sustained in K factors, one can attain both the initial values for ideal pipe conditions without deposits, as well as continuous sets of K values as a function of time.
The K factors are an efficient way to evaluate the effect of an obstruction on the pressure drop growth for a certain volumetric flow rate. Indirectly it can measure how easily a fluid can flow between two sections. When the pipe becomes obstructed, the equivalent K factor will decrease.
As explained in section 2.2, to run the predictive maintenance model, a linear degradation formula was chosen. Subsequently, the failure threshold is set. This value is calculated for the maximum tolerable sectional area obstructed due to deposition. The percentual obstruction is calculated according to Equation 9: where = useful sectional areal for a given moment t ( 2 ).
Defining the threshold depends not only on the risk aversion of the operations manager, but also on the associated costs. In accordance with the industry standard, it was chosen to set a maximum sectional obstruction (as a percentage of the total pipe section) as admissible, and continuously assess the remaining operational lifetime until such threshold is reached.
Beyond the scope of this study, but entirely compatible with the proposed methodology, the next step can be taken by defining the end of useful life not as a conventional blockage ratio but following an economical assessment of maintenance costs and production losses due to blockage and downtime, as well an assessment of the risk of possible accidents due to significant deposits.
Since the linear degradation model was chosen, it is necessary to guarantee that the input data follows the linear law. The tables with the condition indicators for every hour need to be set, both for the training data and the current data (see section 2.2) in order to run the predictive maintenance model.
As new data becomes available, it is possible to estimate the new expected remaining useful life with each new data point. In this case, it is needed to perform a for cycle, updating the model with each new point.
To visualize the predicted values and the associated confidence intervals, a plot with the temporal evolution should be presented. This plot enables the decision-maker to decide whether a pigging is necessary or not.

Input data
As a case study for illustrating the proposed methodology, it was desirable to use a reliable data source that included accurate condition data and a well-developed and well-executed standard maintenance program. That could be found in [45], where the case of a subsea pipeline with 23,000 m length and an 0.3048 m (12 in) internal diameter, which carries a waxy crude oil with 800 kg/m 3 density and an average dynamic viscosity of 10 cP, is provided and described.
The oil volumetric flow varied around the mean value of 0.10 m 3 /s (55,000 BPD) during 32 days in which the operational conditions are reported in literature [45]. Figure 4 shows the temporal evolution of the volumetric flow rate. Since the operational temperature reaches values below the wax appearance temperature, the deposition occurs inside the pipe. The pressure-drop increases due to the reduction of the sectional area. Figure 5 indicates not only the evolution of the pressure drop due to the deposition but also the moments when the pigging operation was performed to mechanically remove the deposits from the pipeline. According to the operational data, provided in Figure 5, four periods can be highlighted between the pigging routines. Table 1 summarizes the initial and the final instants and the respective pressure drop values for those instants. The pigging routines were successively performed once a week (see Fig. 5), which can be regarded as a scheduled maintenance program. This maintenance plan has shown very efficiently for the quasi-constant flow conditions. Each pigging intervention enabled a pressure drop reduction from around 2.2 MPa to 1.4 MPa. According to these values and considering the average volumetric flow rate of 0.1 m 3 /s and applying Equations 8 and 9, it was possible to conclude that the pigging routine was scheduled to be performed when the pipeline was approximately 20% obstructed.

Methodology implementation
After determining the flow regime and computing the Reynolds number, it was possible to conclude that Equation 8 should be applied to determine the K factor. When this pipeline of 23 km and 12 in is totally clean, the factor is constant and equal to 3.174E-05 3 −1 −1/1.75 . If the pigging routine was completely effective, and no deposit is stick to the pipe wall, the factor assumes the same value. For the four operational periods described in Table 1, the factor was assessed and its temporal evolution since the previous pigging operation is presented in Figure 6. Having developed the K factors concept from the pressure drop method results, datasets can be accurately fitted into a linear degradation model after the function is linearized accordingly. The function that describes its behavior, in terms expressed by Equation 5 and rearranged as in Equation 10, is given by Equation 11: where = slope; ∅ = intercept term; = noise parameter; and = location factor.
Setting the predictive maintenance model for the current case-study data, operational periods A to D were considered as individual datasets. Its recorded data was used to compute the K factor, as shown in Figure 6, yet no data filtering, cleansing, or outlier removal was performed before the predictive maintenance model was run, despite the fact that an evident outlier exists in the operational period C.
The reasoning behind this choice lies in the need for assessing whether the machine learning-based predictive maintenance model has the ability to deal with inaccurate data points.
As only four datasets are available, a decision was made to assign three of those for the training data and the remaining operational period was set as current data, along which the remaining useful operational lifetime should be continuously assessed by the trained predictive maintenance model.
In each model run, an option had to be chosen on either performing a static study or a dynamic assessment. While the former uses the complete dataset information to predict the remaining useful operational lifetime, the latter continuously and recursively re-assesses the remaining useful operational lifetime estimate as information is added throughout the dataset. Given the fact that the proposed methodology is deemed to be applied for determining real-time estimates in an industrial context, the option for the dynamic study was chosen.
The reliability of the results was assessed using the probability distribution function for the estimated remaining useful operational life.

Results
Figures 7 to 10 show the expected remaining useful operational life along the data recordings in a dynamic and recursive assessment for each operational period, from A to D. In all cases, the end of useful operational life is considered when the pipe obstruction reaches 20% of the pipe section. For all estimates, beyond the expected value, there also are upper and lower bounds for the 95% confidence bound.   As information is added, the predictive maintenance model compares all new data to date, from the beginning of the record to the current time, with the expectable behavior learnt from training and testing with previous datasets. This allows forecasting, at every moment how long the system can wait and respect the defined criteria, until a pigging operation is performed.
Despite the fact that the training and test datasets were exiguous, since industry applications should ideally comprise thousands of datasets instead of just three, the results show very coherent estimations. As time elapses, the expected remaining useful operational life decreases and the global operation-to-operation window is only slightly affected by the characteristics of each dataset, which can be also observed in Table 2.
The 95% confidence bounds show the accuracy of the model, since the uncertainty around the determined values is small and generally decreasing as information is added and the moment for performing the maintenance operation is approached.
Concerning Figure 9, one shall note that no outliers are observed in the useful operational life, despite the fact that obvious outliers were present in the input data.
To evaluate the reliability of the results, a probability distribution function for the estimated life span can be obtained, as depicted in Figure 11 to Figure 14.
Given that pigging procedures were performed after 162-192 hours of operation, this case study real field data from periods A to D, the option was chosen to assess the remaining useful operational life using a probability distribution function 120 hours after the last operation. This period should correspond to the decision point when the next operation should be planned.   The comparison between the latter values and the performed scheduled maintenance program can be found in Table 2. These results show that, in general, pigging operations could be slightly postponed without significant risk of non-compliance with the end-of-life criteria (9 hours, 29 hours, and 3 hours during operating periods A, B and D, respectively). On the other hand, they also show that pigging should have been done earlier during operating period C to avoid the risk of over 20% partial blockage.
Extrapolating these operating periods to a year-long period, we can see that instead of 51 pigging operations only 50 could be performed. Yet, even with fewer pigging procedures, the risk of non-compliance with the maximum allowable sectional blockage is significantly reduced.
Application of the proposed methodology to the case study has minimized the number of pigging procedures and reduced operational risks, which actively contributes to minimizing the flow assurance problems identified in the bibliography (as described in Section 1). Since maintenance costs are due to escalating as production trend leans towards deep and ultra-deep offshore fields, with much longer flowlines, the economic impacts of the former are of paramount importance and are a clear extension of the existing knowledge in the field. Likewise, the ability to assign confidence associated with scheduling inspections also adds some value to the current state-of-the-art technologies of pipeline blockage.
Moreover, the attained results can be employed for relating each obstruction probability in time with the expected economic cost of not performing the pigging operation. Such a quantification may assume the formulation synthesized in Equation 12, where the partial costs , depend not only on the probability of occurrence, , for which the achieved obstruction probability is important, but also on case-specific conditions. These partial costs, , include but are not limited to, pumping energy costs, deferred flow, material breakdown, downtime and extreme blockage costs, such as repair costs, spills and their environmental impact or penalties and fees.
By comparing this expected cost of not performing the pigging operation with the cost of performing it at any given moment, the decision process can be aided.
Furthermore, with the herein developed predictive maintenance methodology, decisions may be taken in advance.
It is important to stress out, however, that each company has its own risk strategy and acts accordingly when planning pipeline pigging operations, and each production site has its own technical and economic context. Therefore, the aforementioned costs and probability functions will be case-specific.

Conclusions
This work proposes, explains, and illustrates a methodology to perform a predictive maintenance program for obstructed pipelines while addressing the uncertainties associated with the field measurements.
Noteworthy developments resulting from this study include the definition of and factors from the pressure drop method based on laminar or turbulent flow, respectively. These factors are used as a practical way for transferring the acquired data to predictive maintenance models.
However, the most significant innovations that can be attributed to the proposed method include allowing the optimal maintenance planning for given criteria or a threshold. It has been shown that by comparing the methodology even with a well-studied and optimized maintenance schedule, it is possible to decrease the number of pigging operations to avoid pipe blockages.
Furthermore, the predictive maintenance methodology provides for a continuous assessment of the maintenance needs. This means that, if an event out of the historic data knowledge occurs, such as an abrupt change in the flow rate or the fluid properties that can accelerate the blockage, the model will act accordingly and recommend a maintenance operation in the due time. Contrarily, if beneficial events happen, the model will be able to analyze their effects, avoiding pigging actions before those are really required. This enables maintenance scheduling under a scenario that uses other preventive techniques, such as the injection of flow improvers. Under such a scenario, the proposed methodology allows an accurate analysis of K factors along with comparison with several historic datasets, enabling complex and multicriteria decisions about the employment and efficiency of additional measures while re-scheduling standard maintenance actions.
One other major advantage is the possibility of assigning confidence bounds to the remaining useful operational life estimates. Not only will this be critical for assisting the maintenance planning, but also significantly enhances the risk assessment of operations.
A case study was developed to evaluate the impact of applying a predictive maintenance plan compared to the scheduled preventive plan that has been used over many years and has shown some advantages when applied even for a short data set.
Finally, the ability of the model to cope with outliers without previous filtering and cleansing is extremely valuable, since it allows direct using real-time acquired datasets.