You are on page 1of 13

IADC/SPE-208778-MS

Prediction of Stuck Pipe Incidents Using Models Powered by Deep Learning


and Machine Learning

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


Anwesha Mal, Sven Inge Ødegård, Stig Helgeland, Samuel Zulkhifly Sinaga, and Morten Svendsen, eDrilling

Copyright 2022, IADC/SPE International Drilling Conference and Exhibition DOI 10.2118/208778-MS

This paper was prepared for presentation at the IADC/SPE International Drilling Conference and Exhibition held in Galveston, Texas, USA, 8–10 March 2022.

This paper was selected for presentation by an IADC/SPE program committee following review of information contained in an abstract submitted by the author(s).
Contents of the paper have not been reviewed by the International Association of Drilling Contractors or the Society of Petroleum Engineers and are subject to correction
by the author(s). The material does not necessarily reflect any position of the International Association of Drilling Contractors or the Society of Petroleum Engineers,
its officers, or members. Electronic reproduction, distribution, or storage of any part of this paper without the written consent of the International Association of Drilling
Contractors or the Society of Petroleum Engineers is prohibited. Permission to reproduce in print is restricted to an abstract of not more than 300 words; illustrations
may not be copied. The abstract must contain conspicuous acknowledgment of IADC/SPE copyright.

Abstract
One of the most common issues faced in the Drilling industry is a Stuck Pipe situation. Stuck Pipes lead to
huge losses in cost, energy and productive time. The objective of this paper is to predict stuck pipe incidents
prior to their occurrence by harnessing the power of machine learning and deep learning models.
Stuck incidents are some of the most difficult and challenging situations. The proposed method uses
a two-step model and available historical data from prior drilling operations to predict the occurrence of
such an incident well in advance so that it can be avoided. The first step of the model performs time series
predictions using a Recurrent Neural Network (RNN) with Walk Forward Validation. The second part of
the model uses a Random Forest Classifier to classify the predictions from the previous step and determine
if a stuck situation is likely. The classification model is pre-trained using historical drilling operational data
collected from old wells. It is possible to determine how far back the model should look at the data and
how far ahead it should predict. For the purpose of this paper, the model looks back 5000 timesteps and
predicted 3000 timesteps ahead. One timestep is 2 seconds in this case.
This model would be able to reduce nonproductive time, and help make drilling operations cleaner, faster
and greener. The biggest benefit of such a model is that it can learn on the go and would not require manual
intervention. Also, the model can upgrade and modify itself to changes in the drilling operations.

Introduction
Stuck pipes occur when the drill string cannot be moved from the well during the drilling operation. There
are a variety of reasons due to which a stuck pipe can occur. Broadly speaking, there could be mechanical,
and formation related sticking or differential sticking. In differential sticking, pressure differences cause the
drill pipe to be pinned against the wall of the hole being drilled and the force times coefficient of friction
becomes too large for the rig to pull the drill string out. Poor hole cleaning, collapsed casing, wellbore
geometry, geopressured formations and mobile formations are some of the reasons that can cause mechanical
or formation related stuck pipes. They can vary in severity from being minor to being so severe that they
bring drilling operations to a pause. (Bailey, Louis, et al.1991)
2 IADC/SPE-208778-MS

Stuck pipes are a major hassle to the drilling industry in terms of losses in drilling times, costs and energy.
They are estimated to cost the drilling industry millions of dollars in losses and in some cases can result in
loss of the drill string or wells. Stuck pipes incidents still happen often enough that they cannot be ignored.
Due to this, there has been an increased effort in the past few years to determine the occurrence of a stuck
pipes before they happen. (Bailey, Louis, et al.1991) In several cases, stuck pipe situations can be avoided
as there are signs leading up to such an event which may be spread out sporadically over weeks or days.
However, the human eye may not be able to pick up on these signs or correlate them to the occurrence of a

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


stuck pipe. For this reason, attempts are being made to create computational models to keep an eye out for
these warning signs and trigger alarms well in time to make changes to the operation so that a stuck pipe
situation can be bypassed. (Noshi et al.2018).
Models traditionally used are broadly classified into physical, mathematical and empirical. Empirical
models are simple but largely inaccurate. Mathematical models use laws of physics and mathematical
formulas to simulate the drilling scenario. They form a base line for comparison with the premise being that
the mathematical models simulate how the drilling operation should ideally progress. Any deviations from
that are considered as potential problems. These models work well within the confines of set operational
conditions but falter in new environments.
The current diagnostics models use mechanical and hydraulic modeling to perform advanced real time
modeling (ARM). This ARM system uses digital twin technology which comprises of a physical well as
well as a digital well created using mathematical models. Real time inputs from the drilling operations are
also made available to the digital well. Diagnostics are generally performed by comparing the modeled
results with the actual values obtained and suggestions are made accordingly. Advanced hydraulic models
and torque and drag models were designed to simulate the physical well. While this model performs well,
it can struggle with new unexpected scenarios and hence coupling this model with the power of AI and ML
enables it to work smarter and more efficiently. (Mayani et al.2019)
With the progress in technology and the advent of Internet of Things (IoT), it has become possible to
amass large quantities of data from drilling operations. Values of drilling parameters are collected and
transmitted in real time. This large pool of data makes it ideal for implementing artificial intelligence
models to make predictions and analyze trends and perform patten recognition. Models built using artificial
intelligence offer several advantages over traditional models. They have the ability to learn on the go and
adapt to changing situations which enables the models to be generalized. After the initial training, they
do not require human intervention. The models can run 24/7. With more time and data, the model can
update themselves and improve their performance. Also, it has the ability to quickly scan through large
amounts of data and find warning signs from amongst them. All these features make models built using deep
learning and machine learning ideal for identifying warning signs for the occurrence of stuck pipe situations.
However, at the same time it is important to mention the limitations of using machine learning models.
Traditionally there is a dearth of good quality data available in the drilling industry. Lack of standardization
for data collection results in data from wells being collected in different formats with different numbers
and names of parameters. A lot of historical data has also not been retained such as formation related
information resulting in chunks of important data being missing. Better availability of good quality data
directly correlates to better model performance. Another thing to keep in mind when building AI models
is that they are never a hundred percent safe. While AI models perform very well and often surpass human
performance, they are not a hundred percent accurate all the time. Therefore, the AI models being built here
will eventually be integrated with the existing wellAhead diagnostics system so that they can work together
to give accurate predictions and results.
IADC/SPE-208778-MS 3

Statement of Theory and Definitions


Artificial Intelligence (AI) is one of the most talked about technologies and for good reason. It enables
people to design algorithms that can learn from existing data and then go on to update itself based on what
it has learnt. This ability to reason and learn like humans along with the capacity of machines to go through
vast stores of data is what makes it so useful. It has become an integral part of several industries as well as
in the day to day of our lives. Machine learning is a subsection of AI that includes all programs that have
the ability to learn without being explicitly programmed. This set of programs learn from data and can be

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


broadly classified into Supervised and Unsupervised. As the name suggests, supervised machine learning
algorithms are programs that learn with supervision. There is a training data set that is labeled by domain
experts and provided to the algorithm to learn from. The algorithms then take what it has learnt and applies
it to new unseen data. In unsupervised learning, no training is provided, and the algorithm goes through
the data without any guidance on what to look for to find patterns and commonalities in the data set. Deep
learning falls under the umbrella of machine learning algorithms and refers to algorithms that use a Neural
Network architecture. A neural network is made up of sub modules called neurons which are arranged in
layers. A neural network tries to mimic the mechanism of neurons in the human brain. The first layer is
called the input layer and the final layer is called output layer. The layers in between are called hidden
layers. If a neural network has more than one hidden layer, it is called a deep learning network. Figure
1 shows the various categories, subcategories and the hierarchy of various machine learning algorithms.
(Shadizadeh et al.2010)

Figure 1—Classification of Artificial Intelligence and its subcategories

For the models designed the paper, the whole pipeline from start to finish can be divided into four major
steps.

Data Collection, Cleaning and labeling


The most essential part of any machine learning model is the data. Without properly collected, cleaned and
labeled data, the results from the model will not be accurate as it would have learnt and investigated the
wrong information. For the purpose of this model, raw witsml logs were collected from 60 plus wells and
their respective well bores. These were cleaned, merged and compressed using python scripts. Cleaning the
log comprised of filling in empty data, getting rid of unnecessary columns, scaling the data and formatting
4 IADC/SPE-208778-MS

the log into something that the algorithms will accept as input. Principal component Analysis (PCA) was
carried out to determine which features are the most essential in predicting a stuck pipe situation. PCA is
a dimensionality reduction technique that projects high dimensional data in a lower dimensional space. It
captures the variance in the dataset as seen in Figure 2 with minimum error. The premise of feature selection
is that variables that show higher variance would have a bigger influence on the output as the data set is
more sensitive to changes in the values of these features. (Martinez et al. 2001)

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


Figure 2—Graphical representation of Principal Component Analysis

A set of 12 features namely Bit Depth, Well Depth, Block Position, Hook Load, Mud Density, Flow in
rate, flow out rate, Mud Temperature, Rate of Penetration (ROP), Standpipe Pressure (SPP), Torque, Weight
on Bit (WOB) and pit volume change were selected. The collected data is then labeled by drilling experts
and referencing operational drilling reports for historical wells. There are two purposes for this. Firstly, it
is to have an accurately labeled data set to train the classification model on. Secondly it is used to test the
model to have a benchmark to compare the model's performance to.
Deep Neural Network for Time Series Prediction. This step of the model performs time series analysis.
The model uses a Recurrent Neural Network (RNN) architecture with walk forward validation. An RNN
is a type of neural network architecture that allows the input from the previous step to be the input for
the next step. They are great at dealing with sequential data such as time series data. A Long Short Term
Memory Network (LSTM) which is a type of RNN is used. LSTMs have memory blocks which help it retain
time dependent information making them suitable for a time series problem. Each LSTM unit comprises of
three components, an input gate, output gate and a forget gate, which it uses to conditionally decide which
information should be retained and carried forward and which information should be forgotten as shown
in Figure 3. (Mohajerin et al.2019)
IADC/SPE-208778-MS 5

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


Figure 3—Single LSTM unit

The input to the RNN used here is a data set of each individual feature along with corresponding
timestamps. The output from the model is the predicted value of each feature 3000 time-steps which is
approximately 1 hour into the future from the input timestamp fed into the model for the feature. Multi-
threading is used to predict the values of the selected features in parallel. The system works as 12 recurrent
neural networks working simultaneously to generate results quicker. These predicted values are consolidated
into a new data frame which becomes the input for the next step. (Tokgöz et al, 2018.)

Figure 4—Unfolded RNN architecture

Classification model for Predicting Labels


This data set of predicted values obtained from the previous step is fed into the classification model which
uses a Random Forest (RF) classifier to classify the data. The RF model is pre-trained using historical
drilling data from 7 wells. Before the RF classifier can be trained, the data set needs to be balanced. In
the real world, most data sets are highly imbalanced. This applies to drilling data as well. Typically for
100 drilling operations, 1 or 2 stuck pipe cases may occur meaning that a majority of the time there is no
stuck pipe situation encountered when drilling. If the model is trained with a similar imbalanced data set,
the model will learn to predict not stuck in all cases as that is the most commonly encountered scenario.
This is called underfitting. However, this would mean that while the model seemingly has high accuracy,
6 IADC/SPE-208778-MS

it is not able to accurately identify stuck pipe situations. Under-sampling is used to balance data. In this
technique, all the data from the minority class, which is the stuck situation data, is kept while the data from
the majority class is truncated so that the resulting data set has an even distribution of both classes. The
balanced data set is then scaled and labeled using labels provided by drilling experts. This data is then used
to train the Classification model. Decision Trees are the building blocks of the random forest classifier. It
is an ensemble learning method that uses a collection of decision trees. Each tree randomly samples from
the data set and makes its own decision. A majority vote is performed, and the most voted class is selected

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


as the output of the classifier. This is known as bootstrapping. The premise for the random forest classifier
working so well is that many relatively uncorrelated trees working as a collective would likely outperform
any individual model. (Hegde et al. 2015.)
The trained model is then saved and used for making future predictions on new unseen data.

Results and Analysis


When testing the performance of the model, several parameters are used besides just the accuracy of the
model. This is because accuracy alone is not sufficient to gauge the performance of a model and may often
be misleading. Like previously mentioned, real world data is heavily imbalanced and when testing on such
data if the model predicts all as "Not Stuck", the accuracy would be high but in actuality, the performance
would be poor as the model is only predicting the same label irrespective of the actual label. A confusion
matrix is used and precision, recall and f1 score are considered along with the accuracy of the model. This
takes into consideration the true positives, true negatives, false positives and false negatives. True positive
would mean accurately predicting a stuck situation when it occurs, falls positive means predicting a stuck
situation as not stuck. True negative is when the model can correctly predict a not stuck situation and False
negative is when a model incorrectly predicts a not stuck situation as stuck.
Precision = True Positive / (True Positive + False Negative)
Recall = True Positive / (True Positive + False Negative)
Accuracy = (True Positive + True Negative) / All Samples
Figure 5 gives a graphical representation of how a confusion matrix is calculated and how the various
metrics of performance are calculated from it.

Figure 5—Confusion Matrix


IADC/SPE-208778-MS 7

Description and Application of Equipment and Processes Presentation of


Data and Results
Testing was performed on multiple wells which were not part of the training data set. Overall, the model
can forewarn of a stuck pipe situation with high accuracy. The models’ predictions largely coincide with
observations made by drilling experts. Sometimes the model picks up signs of abnormal behavior prior to
it being observed by drilling experts. While the model should be able to predict a stuck pipe situation with
accuracy, it is also important that the model does not wrongly predict a stuck pipe situation in a well where

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


it does not occur. The model was tested in such scenarios as well and was able to correctly identify the
absence of a stuck pipe situation. Here, the results from three different wells are presented, two of which
have stuck pipe situations and one without.
For the First well being presented, a Stuck Pipe situation was encountered on the third day of drilling. A
test dataset of size 950000 is used to display the performance. The model achieves an accuracy of 98.99%,
Precision of 100% and recall of 98.93%. As seen in the plots, the model predictions mostly coincide with
observations made by drilling experts and sometimes prior to observations made by human eyes. The parts
highlighted in red indicate the predictions made by the model while the portions highlighted in blue indicate
the labels made by the drilling experts. Figures 7 to 9 show the progression of the drilling operation and
the warnings issued by the algorithm which are highlighted in red. They also show the areas identified by
drilling experts as problematic. These areas are highlighted in blue in the plots.

Figure 6—Well 1: Plot of feature values on day 1 of Drilling


8 IADC/SPE-208778-MS

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


Figure 7—Well 1: Plot of feature values on day 2 of Drilling: Red highlighted areas Identified
by the model as problem areas. Blue highlighted areas are labelled By drilling experts.

Figure 8—Well 1: Plot of feature values on day 3 of Drilling: Red and blue highlighted
portions Are overlapped indicating that model aligns with predictions made by experts.
IADC/SPE-208778-MS 9

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


Figure 9—Well 1: Plot of feature values on day 4 of Drilling: Overlapped red and blue portions

Figure 10—Confusion Matrix for Well 1

For the second well, drilling operations took place for 26 days and the stuck pipe situation was
encountered on the 8th day of drilling as seen in Figure 14. Testing is done on a section of the well with a
dataset size of 810000. The model achieves an accuracy of 98.81%, precision of 100% and recall of 98.77%.
Portions of the plot which are empty are because the drilling operators were not collecting data during those
periods.
Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023
IADC/SPE-208778-MS

Figure 12—Well 2: Plot of feature values on Day 5 of drilling.


Figure 11—Well 2: Plot of feature values on Day 4 of drilling.
10
Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023
11

Figure 13—Well 2: Plot of feature values on Day 6 of drilling.

Figure 14—Well 2: Plot of feature values on Day 7 of drilling.


IADC/SPE-208778-MS
12 IADC/SPE-208778-MS

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


Figure 15—Well 2: Plot of feature values on Day 8 of drilling. Model predicts indications of stuck pipe even with
missing data. Red and blue highlighted areas overlap indicating the model aligns with experts’ observations

Figure 16—Confusion matrix for Well 2.

The final well encountered no stuck pipe situation. Portions of the well were taken and tested in a rolling
fashion and the model correctly predicted the absence of a stuck pipe situation.

Conclusions
1. The model can detect Stuck pipe situations with high accuracy and sufficiently ahead of time so that
it can be avoided.
2. Model updates and learns with time.
3. Model can be updated to an online model so that it can be adapted to run in real time.
4. Model reduces Non-Productive Time and costs. It enables an energy-efficient and safer drilling
process.
5. Model is shown to perform well on a wide array of different wells and not on any specific cluster
of wells.
IADC/SPE-208778-MS 13

6. Model will be integrated with the existing eDrilling wellAhead platform and work in unison with it
to give real time predictions and diagnostic messages. Eventually model will be expanded to use AI/
ML models to automatically change parameter values without needing human intervention.
7. This model moves us one step closer to Automatic drilling control.

References
Bailey, Louis, et al. "Stuck pipe: causes, detection and prevention." Oilfield Review;(Netherlands) 3.4 (1991).

Downloaded from http://onepetro.org/SPEDC/proceedings-pdf/22DC/2-22DC/D022S005R002/2650651/spe-208778-ms.pdf/1 by U. of Alberta Library user on 15 September 2023


Hegde, Chiranth, Scott Wallace, and Ken Gray. "Using trees, bagging, and random forests to predict rate of penetration
during drilling." SPE Middle East Intelligent Oil and Gas Conference and Exhibition. OnePetro, 2015.
Martinez, Aleix M., and Avinash C. Kak. "Pca versus lda." IEEE transactions on pattern analysis and machine intelligence
23.2 (2001): 228–233.
Mayani, Maryam Gholami, Rommetveit, Rolv, Helgeland, Stig, Oedegaard, Sven Inge, and Kristian Olaf, Kjørstad.
"Advanced Real-Time Monitoring Provides Early Detection and Prevention of Costly Well Problems." Paper presented
at the SPE/IADC International Drilling Conference and Exhibition, The Hague, The Netherlands, March 2019.
Mohajerin Nima, and Steven L. Waslander. "Multistep prediction of dynamic systems with recurrent neural networks."
IEEE transactions on neural networks and learning systems 30.11 (2019): 3370–3383.
Noshi, Christine I., and Jerome J. Schubert. "The Role of Machine Learning in Drilling Operations; A Review." Paper
presented at the SPE/AAPG Eastern Regional Meeting, Pittsburgh, Pennsylvania, USA, October 2018.
Sadiq, Tanvir, and Ridha Gharbi. "Prediction of frictional drag and transmission of slack-off force in horizontal wells
using neural networks." SPE Eastern Regional Meeting. OnePetro, 1998.
Shadizadeh, S. R., F. Karimi, and M. Zoveidavianpoor. "Drilling stuck pipe prediction in iranian oil fields: An artificial
neural network approach." Iran Chem J. Eng 7.4 (2010): 29–41.
Tokgöz, Alper, and Gözde, Ünal. "A RNN based time series approach for forecasting turkish electricity load." 2018 26th
Signal Processing and Communications Applications Conference (SIU). IEEE, 2018.

You might also like