1. Introduction
Positive Displacement Motors (PDM) are extensively used in the oilfield to drill the formation towards the reservoir or to mill through any other restriction down hole. They have been developed in the 1940s and commercialized in the 1950s [
1]. PDMs (also called mud motors in drilling applications) are being used in drilling complex formation to improve the rate of penetration (ROP). In this type of rotation drilling, PDM converts the energy mud flow to mechanical energy (
Figure 1). On the slide drilling, PDM is responsible to generate bit rotation when drilling fluid is pumped. The performance of PDM can be controlled by the rotor/stator lobe configuration, rotary speed, and torque [
2]. Drilling with positive displacement motors dominates oilfield drilling operations due to its operational and economic advantages over conventional rotary drilling [
3].
PDMs are also very important in the coiled tubing (CT) industry, where they are mostly used to mill isolation plugs after hydraulic fracturing operations, which are common in shale gas environments, being one of the crucial parts of the Bottom Hole Assembly (BHA). “It is estimated that between 100,000 to 140,000 composite plugs are installed and milled each year in the US alone. Efficient removal of these composite plugs is critical in achieving operational efficiencies for both the operator and service suppliers” [
4].
In the PDM, the rotor has one lobe less than the stator, which leaves a gap where the fluid circulates and as the rotor fluid forces the rotor for the next free lobe in the stator. The resulting rotation generates torque to drive the drill bit.
PDMs are prone to failure, particularly due to stalling and the overpressure that this event produces. As more stalls are accumulated over time, this interruption to drilling can amount to significant losses of productive drilling time [
5]. A damaged motor downhole can lead to a loss up to hundreds of thousands of dollars in an offshore drilling rig. Stalling can also leave big cuts of the material being milled inside the wellbore, which are harder to circulate back to surface due to their size and shape, leading to an improper wellbore cleanout and finally to a stuck pipe situation. “Applying too much weight to the bit/mill increases the risk of stalling the motor. Stalls lead to a reduction in motor run life, increased coiled tubing fatigue, inefficient operation, and significant increase in the risk of leaving large chunks of composite material. These large composite chunks considerably increase the risk of the BHA becoming stuck in the well, and the risk that the chunks will block flowback equipment” [
4]. Because water or mud contain very little compressive fluids, the pressure can raise too quickly, so a distracted operator does not have time to react and stop the operation.
Avoiding or minimizing the time the PDM stalls during a milling operation is one of the main duties of the equipment operator during the job. However, this same operator is prone to the following human errors [
6,
7]: perceptual errors, when the operator does not notice the data from the sensors are abnormal; skill-based errors, when even after noticing the parameters are off, he or she cannot assess the situation based on this data; and decision errors, where the operator acknowledges the situation, however does not carry on with the proper action to address the problem. In an effort to minimize those errors and their detrimental effect, this work studies the use of Artificial Intelligence (AI) on the data available during the milling job with PDM as procedure decision-taking and operational troubleshooting are some of the application areas for AI in the oilfield and drilling industry being discussed in the literature [
8], and equipping the personnel with intelligent systems that improve the decision-making process can avoid the human-induced errors [
9].
Consequently, means of helping the operator to detect this stall and take the proper action motivated this research. All data available during the coiled tubing milling job is measured on surface and there is no direct measurement of the rotation of PDM to directly diagnose a stall. The interpretation of the surface parameters in conjunction is required from the operator at every second to properly assess what is happening with the tool downhole. Considering that the operator is human and prone to errors, this paper aims to use a computer algorithm to supervise the data on surface, recognize any abnormal situation and inform it to the user.
Sircar (2021) [
10] exemplified that many problem in drilling could be addressed by using Machine Learning (ML). Nevertheless, the case being studied has two major limitations for the use of ML: first, the dataset available for development is relatively small, containing data from 4 milling operations in different wells, however with the same PDM model and fluid; second, according to Noshi C [
11], despite the petroleum industry relying on a large number of sensors, it also relies on human interaction with the equipment, which is not recorded in the data and just applying a machine learning technique, which would consider only this sensor data, would lead to incorrect correlations between inputs and outputs. Since the operation with PDM is heavily dependent on human interaction, a ML algorithm was deemed unfit for this purpose and other AI techniques as Fuzzy logic had to be considered.
Fuzzy logic uses linguistic variables with degrees of pertinence, making it closer to the human way of thinking and reasoning, instead of using pure numerical values and functions. Zadeh [
12] first described the Fuzzy set in 1965, which were later mathematic modeled by Takagi and Sugeno [
13] in 1985. Despite all data being available during the milling job being numeric (such as pressure, weight, and flow rate), the operator judgement is still subjective on whether a stall is happening at a given moment and if he/she has to stop pumping fluid through the PDM or not. In such non-Boolean decision-making processes, the Fuzzy approach to this problem seems to be promising, as it accounts for the uncertainty of human decision imprecision on defining precise criteria for decision making [
12].
In the following sections, a Fuzzy Logic Inference System (FIS) with 3 inputs and 2 outputs which will monitor the surface parameters of a coiled tubing operation and detect the PDM stall in its initial seconds, giving enough time for pumping to be halted before the any damage occurs, is proposed. The system is required to detect the motor stalling as fast as possible, using only the data available from the coiled tubing unit surface sensors and other relevant pre-configured data. The setup of the inputs, outputs, knowledge database (fuzzy rules) and calculation is done with the support of an expert in coiled tubing and milling operations.
The following sections of this paper are structured as follows. The method section describes the FIS architecture, including inputs, outputs, rule-set, and pre-calculations of the system. The results and discussion section presents the outputs generated by the FIS using the acquisition dataset available for testing. All the abnormalities detected by the FIS are discussed and explained, and an overall discussion about the system is undertaken. Finally, the conclusion section ends this paper.
2. Related Works
Most of the efforts in the AI field to be applied for PDMs in the oilfield are regarding maintenance or data analysis of sensors in the tool itself. The most recent studies that use surface data together with AI to help the driller or CT operator to properly operate the motor or understand its real condition while downhole are mentioned below.
Demirer (2020) [
14] presented a system which uses mixed-integer programming (MIP) to give the optimal drilling parameters to reach an expected well trajectory. The system considered the properties from the PDM, drill bit and real time data from the rig and defined the optimal steering commands, as tool face and steering ratio, that allow the well trajectory to be as close to the plan as possible. This system was an improvement on similar systems such as the one proposed by Zhao (2019) [
15].
Zhang (2020) [
3] matched the downhole and surface data acquired from several PDMs and matched them to calculate the actual efficiency of the motor. By joining the pump pressure, flow rate, and top drive RPM from surface plus rotational speed from downhole with the PDM specification, the actual rotational speed, torque, and power input versus output (efficiency) were calculated. In this work, he defined a correlation between the surface data acquired and the real efficiency of the PDM and the degradation of that efficiency over time. According to the author, this workflow can be used to estimate the motor degradation in a real-time application.
Kamyab (2020) [
16] uses a rule-based system to detect in real-time at which stage of drilling program the rig is (e.g., tripping up, drilling) and determine if the step-by-step drilling program is being followed properly. This AI will monitor constantly all surface parameters and compare them with the pre-programmed steps, which include actions the driller has to do regarding the movement of the drill pipe, pumping fluids and maintaining
WOB and pressures as per his/her instructions.
4. Results and Discussion
4.1. FIS Execution with Test Data
Data from a real milling job was used to test and verify the proposed FIS. The set is comprised of data previously treated by removing any outliers and data which could interfere with the system. From this data, a total of 4 datasets were selected to test the FIS. Each of them was manually analyzed and values , and were taken from this data. These values were input to the FIS algorithm for each of these datasets. In a real application of this system in a real-time scenario, this manual input can be replaced by and automatic calculation of these parameters. A small dataset was created named Pre-Test Case to be used to initially test the system. Since it was a smaller dataset (20 min of acquisition data), it was faster to run on the Python algorithm. After the first adjustments and debugging done with the Pre-Test Case dataset, other 3 datasets numbered from 1 to 3 with more data (from 2 h to 4 h of acquisition) were used in the system to verify its functionality and accuracy.
All 4 datasets were run in the FIS algorithm on Python 3.10 and the output values recorded in an Excel sheet (.xls format). This data was later plotted.
4.2. Results Analysis
For all plots, we overlayed orange vertical lines to show where the PDMStatus output had a value ≥ 0.5, which is defined as VH (Very High) or EH (Extremely High), and is where the FIS inferred the stall event is being detected. The same was done for FlowRestriction output with a red line.
If during 1 s (1 acquisition data point) the PDMStatus output infers VH or EH, the stall is considered to happen. Even if the output goes under the threshold of 0.5 right after, one point only of stalling detection would, in a real situation, alarm the operator on a screen and he/she would be alerted of the abnormal condition, together with short instruction on the contingency to be performed (e.g., stop the pump immediately).
4.2.1. Pre-Test Case
When running the Pre-Test Case Dataset (
Figure 9), the FIS correctly detected all the stall events. The orange vertical lines in
Figure 9 show the datapoints where the PDMStatus output had a value ≥ 0.5, which is defined as VH (Very High) or EH (Extremely High) and is where the FIS inferred the stall event is being detected. The figure below shows the stall events happening around. 09:43, 09:54, and 09:57. Looking closer, a pressure spike can be seen around 09:46, which the system successfully did not flag as a stall, since there was no
WOB applied to define it as such.
The FIS detected 3 out of 3 stalls present in this data.
4.2.2. Dataset 1
The first dataset analyzed showed that the stalling events were detected as they are forming. At around 03:01 (
Figure 10), there is an event that was not detected by the system as a stall. This is due to the
WOB not being high enough, and the PDMStatus output did not reach a value higher than 0.5. This can be considered normal as maybe the motor started to reduce its RPM; however, the restriction was removed by the mill before the
WOB or CP could build up further.
At around 06:00, a FlowRestriction event is detected (denoted by the red vertical line) and this could be due to the fact that the motor was stalled and, while still having trapped pressure inside the housing, the operator started to remove the WOB by pulling up the CT string, which decreased the CTW_deviation back to N (Normal), and the FlowRestriction output was activated. This action of not waiting on the pressure to bleed off before moving up the tool string is an operational error by the operator side and could result in over-spinning of the PDM and, in the worst case, could lead to the rotor unscrewing from the PDM body and immediate failure of the tool. In a real case scenario, the PDMStatus output could be connected to an actuator on the CT unit that would not allow the CT pipe to move up even if the operator moves the lever to do so.
The FIS detected 7 out of 8 stalls present in this data.
4.2.3. Dataset 2
In Dataset 2 (
Figure 11), all the stall points at 23:19, 23:29, and 00:15 were successfully detected.
At around 00:26, there was an increase in pressure which did not result in a positive output for PDM Status and shows the importance of subtracting when calculating CP_deviation as in Formula (6). Without this compensation, the system would not account for the increase in CP_deviation because, since it is a result of an increase in the WHP, it could wrongly activate one of the outputs and generate a false output.
The FIS detected 4 out of 4 stalls present in this data.
4.2.4. Dataset 3
When running the FIS with the last dataset (
Figure 12), there are some false alarms during the first half of the acquisition (before 21:06), specially for the Flow Restriction, which was constantly alarming. Those alarms are mainly due the CP set point being defined as 7900 psi, which is an accurate value for the second half of the acquisition, but not for the first half, where the pressure was higher due to a higher pump flow rate. This indicates that this FIS will be more accurate if also adjusted by the flow rate of the fluid being pumped inside the CT string and through the PDM, which could not be done due to unavailability of accurate pump rate data in the available data. During the second half of the acquisition (21:06 onwards) the only stall event that occurred in reality was successfully detected by the FIS. There was an increase in pressure at 21:14; however, this event did not activate the PDM Status as no
WOB was applied, and the Flow Restriction output was activated as expected.
The FIS detected 3 out of 3 stalls present in this data.
4.3. Overall Discussion
Overall, the FIS detected 17 out of 18 stall events present in the data, resulting in a 94% accuracy, which is considered very satisfactory. As this system is not a controller and is not directly connected to any actuator in the process, the figure of the human operator will always be present, and the FIS will act similarly to a second person watching the data at all times, and monitoring the job together with the operator.
A total of 68,458 acquisition points were run through the system, and each point was recorded at every 1 s during the job. The Python implementation of this FIS could process around 130 points per second, which translates to 8 millisecond of processing time for every 1 s of data, showing the algorithm is lightweight and can probably be ported to a compact and low-cost device such as a FPGA, PIC, or SBC.
The different datasets used come from different wells, with different trajectories and different depth. This was deliberately organized in this way in order to expose the FIS and test it in different scenarios. The PDM, however, with a 27/8-inch OD and 5/6 lobes arrangement, is the same in all datasets and the MFs values were adjusted to fit the differential pressure x torque relation applicable to that specific motor. In a situation with a different PDM, these functions must be adjusted for a system to have meaningful results. This specific PDM model is the most widely used for CT operations. Different sizes or lobe setups are considered niche. The use of fluids with different rheology than water (e.g., drilling mud, gelled fluids) may also require this same adjustment.
5. Conclusions
The objective of constructing a FIS using Python and skFuzzy to detect the stalls in a CT milling operation was accomplished, and the objectives of this work were met. By using the available real-world data, this approach could be validated as the stall events present in this data were successfully flagged by the system as such. Almost all events apart from 1 were detected, leaving a 94% accuracy for the system. The events were also detected as the pressure started to rise; therefore, in a real scenario, the objective of alarming the operator to take action before the stall turns into a permanent damage to the PDM is met.
Even after discarding more usual ML-based techniques due to restrictions on the available data, the more dated FIS approach, with parameters and rules obtained by the expert only, proved to be a viable option to solve this kind of problem. For more niche problems like the one described in this paper, where no large amounts of data are available, legacy AI techniques are probably the only viable option.
Due to the relatively small amount of data used for testing, for it to be used as part of a commercial and/or production artificial intelligence system, this algorithm still needs to undergo further testing and improvement with more data from different sources, including the use of PDMs with different specification and different fluids. The use of the flow rate as an input of the system is also recommended, as it can be used to compensate changes in the acquired pressures if the operator changes the pump rate during the job, avoiding false alarms.
In the future, this system will be used as a base to monitor and supervise other operations involving the coiled tubing unit such as, jetting, inflatable packers, and acid/cement placement. The FIS structure can be maintained and only adjustments to the membership function values and rule database for each kind of operation might be required. Additionally, its ease of use can be improved by automating the definition of the set points for WHP, CP, and CTW before starting each use of the PDM, and also by automatically detecting when the PDM is at depth and about to start the job, which would avoid the system of being activated while tripping in or out of hole.
During this research, no similar work was found during the literature review. This is no guarantee that no similar system is being developed or exists, as such a system could be part of a commercial product by a private company, and thus not be presented in a paper to the scientific community due to commercial needs.