A novel artificial intelligence automatic detection framework to increase reliability of PLT gas bubble sensing

Production logging tools (PLTs) and formation testing, even in logging while drilling (LWD) conditions during underbalanced drilling, are key technologies for assessing the productivity potential of a gas well and therefore to maximize recovery. Gas bubble detection sensors are key components in determining the fluid phases in the reservoir and accurately quantify recoverable reserves, optimize well placement, geosteering and to qualify the production ability of the well. We present here a new nonlinear autoregressive - breakdown artificial intelligence (AI) detection framework for PLT gas bubble detection sensors that categorize in real-time whether and which sensors become unreliable or have broken down during the logging measurements. AI tools allow the automatization of this method that is critical during data quality control of post-drilling PLT, but it is essential when the measurements are performed in LWD as data assessment and processing need to occur in real-time. This AI framework was validated on both a training and testing dataset, and exhibited strong classification performance. This method enables accurate real-time breakdown detection for gas bubble detection sensors.


Introduction
Logging while drilling (LWD) has become more and more widely utilized in the oil and gas industry, allowing improvement of well placement and support for geosteering and characterization of fluids and rock formations in real-time during the drilling process. A major challenge in LWD and formation testing is real-time data quality control to determine the different fluid phases within the drilled interval and detect the amount of gas in the wellbore.
Electrical and optical gas bubble sensors are widely applied in Production Logging in the oil and gas industry to determine the amount of gaseous components in the fluid phase. In underbalanced drilling (when the well is allowed to flow and produce fluids during drilling), production logging tools (PLTs) in an LWD configuration can contribute greatly to support well placement and geosteering, to assess the productivity potential of the well, and to design the well completion. Most electrical sensors utilize a capacitancebased approach for bubble detection, which is based on two electrodes and the measurement of the capacitance between them due to a change in the permittivity of the dielectric medium [3]. An increase in the number of gas bubbles in the fluid leads to a decrease in the capacitance of the composite fluid gas structure, and the output voltage increases. Depending on the measured capacitance, the size of the bubbles and the number of different bubbles can be empirically determined, following an inverse relationship [9,10]. A major challenge capacitance-based bubble sensors face is that in mixed oil-water-gas components, the sensor tip may be covered in oil or other fluids leading to a significant deterioration in the measurement quality of the gas bubble points.
Optical bubble sensors utilize the change in the light refraction of light that is caused by a change in the fluid components. The refraction index difference between the gaseous, oil and water phases is considerable, allowing therefore to better characterize the fluid composition and the percentage of the gaseous phase. An essential aspect of these sensing methods is to guarantee sensor measurement data quality; extensive research has been conducted in the recent decades on creating reliable and consistent measurement techniques.
Recent developments in sensor miniaturization based on micro-electromechanical system (MEMS) technology have enabled the development of a new generation of sensors allowing co-location of various measurements within inches, with flexible options for selecting and mixing sensing physics. Abbassi et al. [2] presented an electrical conductivity point sensor that enables to distinguish between hydrocarbon from water phases with 1-2-mm-bubble size detection limit. Highly focused electrical current between two active electrodes renders this water holdup measurement to be very stable. Besides, a unique triphasic singlepoint optical sensor based on refraction of light was developed. The point sensor allows, under suitable conditions and using a single sensor, to discriminate between gas, water and oil. Bubbles as small as of 0.5-mm-diameter size can be detected using this point sensor.
Aside from the electrical and optical measurements, ultrasonic Doppler physics has demonstrated to be very informative in determining flow diagnostics, in particular thanks to its sensitivity to gas presence and very low flow movement. For LWD and PLT applications, very low flow detection may be a significant importance given the potentially substantial amount of solid components that are encountered in the well, which renders classical mechanical velocity device prone to faults. Recent progresses in miniaturization have led to very small robust Doppler probes ( Fig. 1) firing acoustic energy in the ultrasonic range, typically 10 MHz [2].
An ultrasonic wave is emitted through the fluid and scattered back from inhomogeneities such as bubbles, droplets or solid particles carried by the flow. The Doppler effect shifts the reflected beam following the formula Where VF is the flow speed, Fr the received wave frequency, Fe the emitted wave frequency, Vs the speed of sound in the continuous medium and α the angle of the emitted wave with respect to the flow direction. Efficient transmission of the acoustic beam to the fluid requires that density of the fluid in contact with the transducer is large enough to avoid acoustic impedance mismatch. Gas continuous medium is therefore quite unfavorable condition, and Doppler is not expected to give optimal results in the high gas rate wells. Under favorable conditions when gas is not the dominant fluid, however, reliable flow speed variations with high level of gas have been observed in real situations. Figure 2 shows data acquired with the tool body Doppler during flow loop tests in air -water flows. Results show very good correlation between the frequency shift obtained from the ultrasonic array with rotation rate (RPS) from micro-spinners. Doppler measurements appear to be noisier. There are several factors that are responsible for this: • Spinner inertia creates a natural averaging of velocity while Doppler is sensitive to instantaneous velocity from particles or bubbles present in the fluid • Flow turbulences created by the tool diameter change spreads out the velocity distribution at the transducer array.
Significant improvements in signal processing have been achieved by running a series of lab experiments and understanding the influence of turbulence, Doppler sensors were immersed in mini-flow loops filled with water and (40-100 mm) Silica particles. Water and silica particles are pumped at decreasing then increasing rates while Doppler spectrum of frequency shifts are recorded continuously ( Fig. 3). At low pumping rate/low fluid flow speed, the flow is more homogeneous and particles essentially move axially. The corresponding Doppler spectrum shows one main peak. At high flow speeds, more than one peak can be observed on the spectrum. The peak at low frequencies is related to vortices present at the vicinity of the transducers while the axial velocity is best estimated using the later peak (higher frequency shifts, higher apparent velocity). These results have strongly improved the strategy for picking the appropriate frequency shifts by use of different methods adapted to change in flow regime (Fig. 4).
A well survey example with mixed water and gas flow is presented in Fig. 5. The well deviation ranges between 0 and 65 degrees, and fluid velocities are varying across the interval. Doppler measurements consisted of frequency spectrum with extracted energie levels as well as frequency shifts. Doppler frequency shifts (FS) show very good correlation with the mechanical mini-spinner rotational rates, even in presence of gas levels. Optical probe data provide measurement of gas holdup and bubble counts. When the well is deviated, phase segregation occur : gas is concentrated on the high side of the well, and gas is moving faster than water, which is occupying the low side. When the well is subvertical, the flow is homogeneous and so are the array indicators of phase holdup and mixture velocities.   Vaitekaitis et al. [9] describes the main benefits of the Doppler in the case of production logging a highly deviated producer with dense fluids and harsh conditions, where conventional production logging tools failed. The data acquisition was motivated for the well planning strategy of the field by establishing that the current zonal contributions matched the ones inferred from sequential well startup data. While running a production log survey, the Doppler transducers allowed to estimate flow speed where mechanical spinner did not function and in particular to help quantify small gas rate. The ability to detect gas from Doppler measurements at a certain distance of investigation can be eased by low intrinsic attenuation of the produced oil. Dutra et al. [6] presented a new optical imaging system for the utilization of infrared light for the imaging of air bubbles flowing in oil. The device incorporates a study of the effect of light absorption, reflection and refraction at the oil-water boundaries, and also determined the limits on the oil flow imaging [5,6]. Based on a sensitivity analysis, temperature variations were having limited effect on the signal quality, outlining the applicability in downhole conditions. Addressing the challenges in distinguishing different fluid phases from optical infrared sensing is addressed in the article by Sarkodie et al. [8,9]. The authors reviewed the key aspects for performance optimization of infrared fluid sensing, and determined that it becomes key to take into account both global and local measurements, in addition to temperature and pressure drops. One of the main conclusions is the recommendation by the authors to target the cross-analysis of infrared data with other available pressure-temperaturevolume correlations in order to better determine the mass flow rates for the phases and the bubble numbers.
While these measurements are quintessential for determining the various fluid phases in the wellbore, challenges may arise from unreliable or faulty readings of the gas bubble sensor devices. Even with advances in the robustness of these measurement devices, harsh downhole conditions may lead to a reduction in the measurement data quality. For example, the tip of the capacitance sensor may easily be covered in oil, providing false readings of extensive oil flow even though there may be significant oil and gas patches.
Predicting faulty measurement readings and conduct early on relieve operations are essential in order to avoid misleading data interpretations. Chuang et al. [4] outlined in their article an approach toward predicting maintenance requirements with a sensor platform, where they utilized a multivariate statistical analysis approach to forecast maintenance requirements of the sensors. In the context of gas bubble sensors, the challenge arises from misleading signal interpretations that may be caused by faulty or covered sensor equipment. In real-time analysis systems (LWD), this becomes ever more crucial as a delay in the detection of these anomalies may result in considerably worse operational decisions, safety and monetary losses.
To overcome this challenge, we developed a smart new nonlinear autoregressive breakdown detection forecasting algorithm for optical and electrical gas bubble sensors in real-time during LWD and PLT surveys.
Data-driven techniques were advantageous for the investigated challenge, given the multiple parameters as well as minimal correlation between them. This led to the decision of not utilizing other conventional modeling approaches such as stochastic models for this challenge.

Experiments and methods
The developed framework (Fig. 2) encompasses a long short-term memory (LSTM) network approach for breakdown determination and the detection of anomalies automatically in real-time, and an autoregressive network model for exogenous variables for the forecasting of bubble count sensors data utilized for the breakdown estimation. Nonlinear autoregressive neural network (NAR) models have been of major interest in improving the estimation of time series data in a variety of fields, taking into account various influencing factors as input parameters. These NAR models are trained based on past feedback delay values in order to estimate the response at a time t. Mathematically, this is stated as where y(t) is the response variable at a time t , and d is the time delay parameter. The framework is illustrated in Fig. 1 that takes for the estimation of the forecasted output parameter ŷ(t) the recorded time-delayed y(t) and the exogeneous inputs x(t) and incorporates them into a feedforward network for the training and estimation. The autoregressive nature comes from the fact that in each estimation step, the network automatically incorporates the last d delayed input parameters, which can be referred to as a regressive approach. The modeling is similar to conventional feedforward network models, differing in that several input variables of the same type but recorded at different times are incorporated into the network estimation. The time delay parameters allow to fine tune the network training process via weighing the timedelayed parameters differently. For the network training, we 1 3 deployed an age-weighting approach where more recent data were recorded higher as compared to older. The benefit of such an approach is that recent information is strongly incorporated into the network. However, older information is not discarded and acts supportive in improving robustness of the estimation.
For the framework the exogenous parameters consist of the temperature, inclination of the LWD tool, line speed, the bearing angle and the temperature derivative. The series estimate consists of eight different measurements for the four electrical and four optical sensors as outlined in Fig. 3.
Having forecasted the bubble count measurements, the long short-term memory network is utilized for determining the status of the measurement tool. Long short-term memory networks are recurrent neural network structures that were developed to overcome the challenges arising from the vanishing gradient problem encountered with traditional RNNs. The network is composed of a cell, input gate, an output gate and a forget gate that regulate the flow of information into and out of the cell. The input gate defines to what extent a new value flows into a cell, while the output gate controls determine the extent to which the cell is used to compute the output activation.
Input measurements for the framework are the temperature, the rotational bearing angle, the well deviation, line speed and the bubble sensor counts for both the four electrical and optical sensors. The output classification is divided into five categories that indicate the number of sensors broken down. The categories go from zero to four, outlining that either no sensor is broken or that up to all four sensors face issues. The assumption is that in a breakdown scenario both the optical and primarily electrical bubble sensors are affected at the specified position.
The framework was examined on several test instances, with four sensors pairs each consisting of an optical and electrical bubble sensor. A breakdown of the electrical sensor is typically recognized from significant reading differences between the optical and electrical sensor due to the covering of the electrical bubble sensor tip. The training set for the network consisted of 400 different scenarios and the test set of 250 scenarios. The time delay consisted of 5 time steps based on a total number of 500 time steps that are were utilized for the analysis.

Results & discussion
We examined the framework on a benchmark data set for breakdown estimation. The benchmark data set was separated into a training, validation and test data set, which were randomly extracted from the overall set with percentages of 70 %, 15 % and 15 %. During the extraction, we ensured that the three different data sets were balanced in order to avoid incorporating biases. The data consisted of the temperature recorded, the temperature derivative, the rotational bearing angle, the deviation of the well, the line speed and the optical and electrical sensors. Figure 3 displays the sensor configuration, showing the position of the individual optical and electrical bubble sensors within the tool. The tool may rotate during the drilling process, which is recorded by measuring the bearing angle (rotational angle) measurement.
To outline the different breakdown scenarios and its effect on the signals, we display in Fig. 4 examples of the signal time series in the training set. For different scenarios, the sensors may fail at different times. The scenario when all four sensors fail clearly outline the drop in the measurement sensing capability when all sensor bubble count values drop off significantly. This is in contrast with the measurement results for other instances where this drop is not occurring.
We further display in Fig. 5 samples measurements of the rotational bearing angle as well as the measured temperature for a single scenario. The various temperatures for the different scenarios may differ significantly, but are crucial to avoid wrong conclusions in the classification process.
The results of the forecasting via the NARX network are displayed in Fig. 6. A comparison between the target and estimated sensor measurements outlined the strong performance of the framework to simultaneously forecast the bubble sensor measurements in real-time. The autoregressive network is able to capture the strong variations in the sensing data for both the electrical and optical sensors, irrespective of the status of the sensor.
We further display in Fig. 7 the training performance as well as training state for the NARX network training. The training outlines that the network training converges rather quickly and makes only minimal improvements after 400 epochs. The convergence is also exemplified in the gradient evolution and the number of validation checks that are conducted. The developed framework clearly outlines the high quality forecasts for the bubble sensing data for the network.
The classification results for the network are displayed in Figs 8 and 9. The cross plots display the predicted categorizations versus the true category for each scenario sequence, Fig. 6 Graphical illustration of the nonlinear autoregressive network model for the estimation of the bubble count sensor measurements with the input parameters such as Inclination, bearing angle and line speed and stronger classification quality is characterized by a strong diagonal pattern. As previously discussed, the output of the network is divided into five categories, indicating the number of sensors having broken down. For category 0, no sensor broke down, while for category 4, all four sensors broke down and provided unreliable measurements. Figure 8 exhibits the strong classification quality of the network due to the strong correlation between the estimates and the true classifications for the training data. The overall estimation accuracy is 92%, which is rather strong given the 400 training scenarios used for the network training. Figure 9 displays the same comparison for the 250 test scenarios, and while the test scenarios are considerably different from the training scenarios that the network still provided strong classification results with an accuracy of 87.5%. The results indicate a slight bias of the network toward underestimating the number of sensors breaking down. This may be due to the fact that the sensor data measurements may exhibit some partial sensing that may be perceived by the network as still reliable sensor data quality. This situation occurs solely when trying to distinguish between whether multiple sensors having broken down or not. When trying to determine whether at least one sensor has broken down, the framework only slights overestimates this (Figs. 10,11,12,13 and 14).

Conclusions
We have presented a novel long short-term memory network framework for the breakdown detection of bubble detection sensors in real-time. The framework exhibited strong classification for breakdown detection, as well as determining the number of unreliable or broken down sensors. The framework can be utilized in real-time during drilling with LWD production logging to detect early breakdown patterns of gas bubble detection sensors and to perform relieve operations if necessary. This innovative application of AI to realtime sensing signal analysis has the potential to reduce the uncertainties on pay zone quantification, maximize production, improve measurements reliability and safety of drilling operations.

Compliance with ethical standards
Conflict of interest On behalf of all the co-authors, the corresponding author states that there is no conflict of interest.
Ethical approval The authors declare that there are not violations with respect to any potential ethics rules for this journal.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creat iveco mmons .org/licen ses/by/4.0/.