Pattern recognition-based decoding method for the negative pulsed downlink signal with a narrow pulse width

The negative pulsed downlink communication system is used to send surface control commands to the downhole rotary steering tool at thousands of meters, which is a significant part of the current rotary steering technology. At present, the transmission efficiency of negative pulsed downlink communication is very low, and only simple control commands can be transmitted in a few minutes, which limits the development of rotary steering technology with complex control functions. To improve the transmission rate of the downlink system, the downlink pulse width needs to be shortened. However, due to the influence of signal transmission characteristics, the waveform of a narrow pulse width signal will be severely distorted, which increases the difficulty of decoding the downlink signal. Therefore, a decoding method based on pattern recognition for negative pulsed downlink signal with narrow pulse width is proposed in this paper, which establishes a Euclidean distance matrix model between similar characteristic signal segments on the rising or falling edge of the downlink signal, the pulse coding timing of among the signal segment with each rising or falling edge is analyzed, the decoding and recognition of the downlink instruction are achieved, which solves the problem of large timing deviation in decoding the downlink signal with a current threshold method. The experimental results show that the method proposed in this paper can achieve accurate decoding of the 6 s pulse width downlink signal. Compared with the threshold method, it can be seen that the decoding accuracy of the method proposed in this paper can be greatly improved, and the smaller the signal pulse width, the more significant the advantage.


Introduction
The rapid development of two-way communication technology between the surface and downhole has accelerated the process of drilling engineering towards automation, which plays an important role in the realization of intelligent drilling under complex conditions (Dang et al. 2011;Liu et al. 2017;Warren II et al. 2005;Treviranus et al. 2009). Among them, downlink communication technology is responsible for sending surface control commands to the downhole tools, which is a key part of realizing the automatic operation of downhole tools. There are four main ways of signal transmission between downhole and surface: cables, electromagnetic waves, acoustic waves, and mud pulse. Currently, considering the transmission depth, transmission rate, reliability, and development cost, the mud pulse transmission method is the most widely used (Liu et al. 2000;Li et al. 2007). Generally, measurement while drilling systems (MWD) (i.e., uplink communication systems) mostly use positive mud pulse or continuous pressure wave technology to achieve communication, while downlink communication systems mainly use drilling fluid negative pulse technology to transmit commands issued by the surface control system, which changes the pressure or produces specific displacement change of the drilling fluid flowing through the drill string, then the downhole turbine generator or pressure sensor detects the change and performs signal processing to complete the transmission of information (Lin 2016). The transmission performance of this method is reliable, and it can be transmitted over long distances. Besides, it can be combined with the transmission mode of the MWD system to form a closed-loop control system with two-way communication between the surface and the undersurface (Li et al. 2007).
Currently, what hinders the rapid development of intelligent drilling is the low rate of information transmission between the surface control system and downhole tools. In order to increase the transmission rate, in recent years, some researchers had adopted Wired Drill Pipe (WDP) technology to achieve high-speed transmission, with a transmission rate of up to 40 bps, but this technology is only applicable to wells of about 3,000 m at most, which is not suitable for deep well information transmission. (Babu 2019); (Berro and Reich 2019) used the way of hybrid pulse transmission to shorten the pulse width, thereby increasing the transmission rate, then they used signal processing algorithms for processing the signal at the signal receiving terminal, but the article only analyzed the experimental effect of this method in uplink communication. With the application of big data and Automatic control technology in various industries, more and more intelligent algorithms and technologies are applied to drilling services. (Cao et al. 2020) used the realtime deep learning model to analyze the performance of downlink communication and rotary steering system, which improved the transmission efficiency of downlink communication, so that field engineers can make faster and more reliable decisions. Similarly, (Mathur et al. 2020) combined drilling automation and automatic mud pulse decoding technology with remote operation to provide unmanned while drilling and directional drilling services, reducing on-site construction personnel and improving two-way communication efficiency.
Using drilling fluid as the channel of the downlink signal is often accompanied by lots of noise, and the signal strength will continue to attenuate as the well depth increases during the transmission (Xiao et al. 2012). Therefore, the downhole device is generally equipped with a signal digital processing unit to remove the interference of noise, and normal processing methods include low-pass filtering, sliding average filtering, and wavelet transforms (Li et al. 2014) . As a key link of downlink communication, only by correctly decoding the downlink signal instruction word can the downhole tool complete the specific work following the surface control command. Common decoding methods are mainly based on discriminating the voltage threshold value as the core for processing, but the processing results in the actual field usually fail to achieve the expected results because of noise interference and signal jitter. In order to improve the decoding accuracy, Warren II et al. (2005) detected the peak value by correlating the filtered signal with a known reference waveform, and then performed threshold judgment, but this method requires downhole micro-processing need to prestored the reference signal in the device, which increases its burden. Treviranus et al. (2009) also used the threshold method for decoding. The difference is that they used a range of amplitude of a signal waveform as the threshold. This method has a better decoding effect than the direct peak threshold method, but the range of the amplitude value directly affects the decoding effect, that is, the reliability of the decoding method is not strong. Nan et al. (2012) proposed a signal recognition processing technology based on the principle of signal similarity. By comparing the autocorrelation degree of the amplitude of the sampled signal in each segment, the downlink communication command was calculated, which solved the problem of instruction recognition and interpretation methods are complicated and have a high bit error rate in the downhole device.
At present, most of the researches use the threshold method to achieve the recognition of the signal pulse width. However, as surface control commands become more complex and diverse, it is necessary to reduce the pulse width of negative pulse technology to achieve higher bit rate transmission. If the pulse width of the negative pulse is too narrow, the signal waveform will be severely distorted, and its bit error rate will be increased if using the customary threshold method for decoding. Liu et al. (2017) found that the signal waveform collected by the downhole device has similar waveform characteristics in the falling edge and rising edge segments. Dang et al. (2011) put forward to detect the time difference between the falling edges of adjacent pulses to identify instructions. Given this, this paper proposes a decoding method based on pattern recognition for the downlink signal with a narrow pulse width, which establishes a Euclidean distance matrix model matching the characteristic signal segments. By distinguishing the pulse width between similar segments in the downlink signal, the recognition and decoding of the signal are completed, and a feasible solution is provided for the accurate decoding of the negative pulsed downlink signal with a narrow pulse width, thereby increasing the transmission rate of the downlink signal.

Principle description of the bypass downlink system
The bypass downlink system (the scheme design shown in Fig. 1) can accurately adjust the flow of drilling fluid in the drill pipe, which can complete the accurate and reliable transmission of the downlink communication information (Liu et al. 2017). During drilling, the surface control system encodes the control information into a "0-1" command sequence, and it modulates the coded signal into the negative pulsed signal by periodically opening or closing the throttle valve on the flow section of drilling fluid. Opening or closing the valve once will form a pulse width waveform, and it is agreed that the coded downlink signal sequence is an integer multiple of the minimum pulse width T min (Edward et al. 2018). When the throttle valve is opened, the branch pipeline will bypass a fixed proportion of the normal displacement from the riser pipeline to the mud pool. When the throttle valve is closed, the flow of drilling fluid in the circulation system will return to the normal value (Qi et al. 2010). For example, the symbol "1" means spending time t 0 on open the valve, the drilling fluid displacement decreases q 0 from to q 1 , and the received signal waveform from downhole device shows a downward trend; the symbol "0" means spending time t 0 on close the valve, the displacement increases q 1 from to q 0 , and the signal waveform shows an upward trend. Generally, the downhole device uses the turbine generator to sense the flow change of drilling fluid and convert it into a voltage pulse signal. The voltage signal is detected by the digital-to-analog conversion circuit in the receiving device and stored in the circuit for further processing (Daniel et al. 1996).
During the transmission of the downlink signal, a large number of noise signals will be mixed in it, and strong noise signals may cover the downlink signal. During decoding, the interference of noise will also lead to the incorrect recognition of signal transition edges, thereby the accuracy of decoding will be dropped. Noise interference sources mainly include pump noise, downhole tool active noise, flow fluctuation, and electronic noise (Jian and Jing 2008). To suppress the impact of multi-frequency noise interference, researchers often used wavelet transform method (Chen et al. 2010)、adaptive cancellation technology (Keman 2016) or nonlinear "flat-top cancellation" filtering (Zhao et al. 2008) to process drilling fluid continuous pressure wave signal in MWD system. In order to overcome the influence of lowfrequency noise on the edge judgment of the signal and the influence of spike interference on the timing, some researchers use a fuzzy inference algorithm to distinguish various noises and process them separately, which can improve the reliability of the downlink signal (Treviranus et al. 2009).
After the downlink signal undergoes basic digital processing, it needs to be identified and decoded to control command. For the downlink signal represented by the negative pulse technology encoding method, the common decoding method of the threshold method refers to the output voltage of the received voltage signal is the fixed percentage of the initial displacement through the turbine generator as the timing threshold, and then by detecting the jump of the voltage signal to calculate each pulse width and obtain the instruction code (Qi et al. 2010). Actually, this algorithm requires the downhole processor to have a powerful adaptive function with the relative change of the signal amplitude, and need to have a special rounding technology for calculating the pulse width and the minimum pulse width (Nan et al. 2012).

Description of the decoding problem for the downlink signal with a narrow pulse width
Actually, during the drilling, in order to enhance the transmission rate of the downlink communication, and communicate more information in a shorter period to achieve fast and efficient drilling operation. The transmission bit rate can be increased by reducing the minimum pulse width T min . However, if the pulse width is too small, it will lead to the distortion of the signal waveform, which seriously affects the decoding of the downlink signal (Warren II et al. 2005). The uplink communication needs to upload bottom hole parameters to the ground, such as Inclination, Azimuth, Temperature, Weight and torque on bit, etc., which are generally transmitted by positive pulse or continuous wave. At present, the pulse width can reach 0.2 s (Mwachaka et al. 2019), and the transmission rate can reach to 15bps. For downlink communication, we only need to feedback the uplinked information to adjust the parameters of the downhole tool from time to time, and for negative pulse-type downlink communication, downhole pressure is detected by turbine generators. But the too short pulse width cannot be detected due to mechanical inertia from turbine generators, so the downlink transmission rate is much lower than the uplink communication, and the signal pulse width is relatively large. For actual engineering, in order to improve the downlink transmission rate, Liu et al. (2017) conducted field experiments using 12 s and 8 s pulse width, and the signal waveform has been distorted. Huo et al. (2020) used a 5 s pulse width to conduct a "The three descending and three ascending encoding instructions " downlink communication method, and the simulation result showed that the waveform was not stable. In the field, in order to smoothly decode the downlink signal, oil service companies such as Schlumberger and Halliburton generally use 8 s pulse width for downlink communication. Therefore, in engineering, for type of negative pulsed downlink communication, if the turbo generator is used to detect the pressure signal, we can consider that the pulse width less than 8 s can be regarded as a narrow pulse width.
Generally, the transmission bit rate refers to the number of bits transmitted per second. The higher the bit rate, the more the number of symbols transmitted per unit time. For example, 8 s pulse width refers to the minimum pulse width of the downlink signal T min = 8 s, and one symbol is transmitted in 8 s, so the transmission bit rate is calculated for 0.125 bps. In signal identification, the integer relationship between the pulse width T of each drilling fluid pulse signal and the minimum pulse width T min is usually used to obtain each command code. The pulse width depends on the interval time between opening and closing the valve, a pulse width too small means that the valve is opened or closed quickly, but it is very likely that the designed pulse width time less than the time of the displacement changes once. The delay due to displacement changes will cause the signal waveform received by the signal detector to show a gradual change not a mutation at the rising and falling edges. Especially if the minimum pulse width T min is too small, the signal waveform is prone to have a phenomenon that a falling edge (rising edge) is not completed before the next rising (falling) during the transmission process. As shown in Fig. 2, it is a signal fragment of the 8 s pulse width after the filter processing. Because of this problem, if the traditional threshold method is still used to identify pulse width and command, it will cause a very high bit error rate because the signal waveform distortion can't accurately identify the transition point. Therefore, in order to increase the transmission bit rate of downlink communication while ensuring its correct decoding rate, we need to study a new decoding method to avoid the influence of signal waveform distortion. Researchers found that all falling edge and rising edge signal segments in the signal waveform have similar characteristics (Ng et al. 2009), which provides a new idea for the decoding problem: using the characteristics of the reference falling edge (or rising edge) signal segment to identify the remaining similar segments, thereby to identify each pulse width time, which provides a feasible and efficient method for signal decoding. Figure 3 shows the flowchart of the principle of pattern recognition in this paper. The core of the pattern recognition model uses the Euclidean distance matrix of the nearest neighbor method as the discriminant function to identify all signal segments with similar waveform characteristics.

Pattern recognition mathematical model
(1) Determine the reference signal segment. The reference segment is selected on the first falling edge segment of the signal waveform (the rising edge segment can also be selected, this paper takes the falling edge as the analysis object), and the selection method can adopt the k-means algorithm initial clustering center selection method, generally, there are "choice by experience", "random method" and "density method" (Xing and Xiao 2010).
This paper chooses the "density method" to determine the reference signal segment.
If the signal takes 8 s as the minimum pulse width T min and the sampling frequency F s is 100 Hz, the minimum number of sampling data points N for one sampling is 800. To fully express the waveform characteristics of the falling edge signal, the sampling time T s of the research segment should be selected to accounts for 10%-40% of the entire segment on the falling edge. To determine an infinitesimal integer d arbitrarily, if a certain signal segment sequence B 0 in the first falling edge segment satisfies the condition: The signal segment B 0 is called the reference signal segment with the waveform characteristics of the falling edge. The data expression of B 0 is (1) T 0 is the starting time point of the reference signal segment, a is the mean value of the signal amplitude of the first falling edge segment, and the expression is as follows: where A i is the first falling edge signal data sequence, m is the data number of the falling edge signal.
(2) Identify similar signal segments. Using the waveform characteristics of the reference signal segment to identify all similar segments, adopting the idea of Euclidean distance discriminant function of the nearest neighbor method. Set the sample is SN = {(x 1 , a 1 ), (x 2 , a 2 ), … , (x N , a N )} , x i is the sample data, a i is the corresponding category (Wu et al. 2002). For an unknown sample x , the sample with the closest distance to it in SN is set as x ′ , and the solution expression is recorded as: where (x i , x j ) is the Euclidean distance between two samples, denoted as: For the Euclidean distance of the matrix, if the sample matrix in the algorithm is denoted as P , and the reference matrix is denoted as Q , then the Euclidean distance matrix is as follows:

Fig.3 Flowchart of feature pattern principle
In this paper, the signal amplitude data are traversed to find the falling edge signal segments with similar characteristics. B 0 represents the starting point. To ensure the accuracy of the model, the algorithm step is set to 1, and the difference matrix L 1 between signal amplitudes is recorded as: Among them, b i is the signal segment that is continuously collected in time length T s , and its data sequence , n , and n is the number of traversed data.
Record the mean value L 2 of the signal difference matrix L 1 : Taking the difference matrix L 1 ( L 1 = L 11 L 12 … L 1n ) of the two signal segments and the mean matrix of the difference ( L 2 is a value, which can be described as a 1 × 1 matrix) as the sample matrix and reference matrix in the abovementioned Euclidean distance matrix model. Calculate their Euclidean distance matrix, denoted as D: The sequence of the matrix D is expressed as D = D 1 D 2 … D n , D is a 1 × n matrix, which is the number of data that can be traversed.

Decoding algorithm
Using the elements in the Euclidean distance matrix D as a function curve and the analysis curve can determine its minimum values T , which represents the starting point of each similar segment T = {T 0 , T 1 , T 2 , … , T j } , Where the element T 0 represents the starting point of the reference signal segment.
Calculating the signal segment data represented by it as B 1 , B 2 , … , B j , and the sequence B j can be recorded as: Among them, j = 1, 2, … , k − 1 , where k represents the number of falling edges of the entire signal waveform.
For improving the accuracy of identifying the starting point of the downlink command, this paper uses the specific structure of the sync header to determine the starting point of the coded downlink signal. The structure of the sync header should be significantly different from the transmitted symbols. For example, the structure of "8 s-8 s-20 s-8 s" can be used for 8 s pulse width. The sync header contains two similar segments, so the decoding of the downlink signal can be stared to count from the similar segment B 2 .
(1) Calculate the actual minimum pulse width T A−min . In the case of adding a sync header signal segment, the actual minimum pulse width when the signal waveform is distorted can be calculated: (2) Decode the corresponding instruction word. The actual minimum pulse width can be used to determine the instruction code between each pulse width. Firstly, finding the pulse width interval time ΔT of each similar segment: Calculating the integer value q j of the actual minimum pulse width T A−min : Among them, j = 1, 2, … , k − 1 . Remove the signal segment occupied by the sync header, then start from the intermediate data point ] of the similar segment B v ( v = 2, 3, … , k − 1 ) and record it as a new data sequence C l with a step length T A−min , the data sequence C l is as follows: Among them,l = 1, 2, … , T A−min , calculating the mean value of the sequence as c w : Among them w is the number of instruction words (code units). Assign a value to the code element M from the ΔT by comparing the value: Meanwhile, the data x(ΔT − q j ⋅ T A−min ) needs to be eliminated. The specific process of instruction word decoding algorithm is shown in Fig. 4:

Experimental conditions
As shown in Fig. 5, the field experiment in Tuo 90-inclination 12 well from China is conducted to study the proposed model. The bypass downlink communication system is used to generate negative pulse flow. Stop drilling and to send data at the drilling depth of 1500 m. Previously, the pump pressure was 13 MPa, the drilling fluid flow was 33L/s, its density was 1050 kg/m 3 , and the bypass flow was set to 4L/s. According to the set coding rules, sending a group of information: pulse width is 8 s, sync head is set to "8 s-8 s-20 s-8 s", automatic orientation, the well angle is 5.5°, and the azimuth is 178.5°, the control command coding of this information is "110,000,001,011,011,101,110,101".

Experimental results
Before decoding the downlink signal, it is necessary to be digital preprocessing, which is mainly to remove the noise interference by filtering algorithm. This paper intends to use the Kalman filter for denoising. Kalman filter is usually implemented in two steps, time update and measurement update (Zhang et al. 2012). The recursive flowchart of the calculation method is shown in Fig. 6: Among them, A is the state transition matrix, K is the Kalman gain matrix, and H is the system matrix. Repeat the above algorithm model to estimate the signal x k and error covariance matrix P k recursively. After filtering by MAT-LAB, the signal before and after filtering is shown in Fig. 7.
The above model is used for the filtered signal. Since the minimum pulse width is designed 8 s, T s can be set to 2 s in this example, and the "density method" is used to identify the reference signal segment B 0 , as shown in Fig. 8. The figure shows the waveform of the signal segment B 0 has an obvious downward trend, which can be used as a reference signal segment, Calculating the starting point of reference fragment T 0 = 39.81 s.
Then, using the Euclidean matrix model of pattern recognition to find all similar segments with the same waveform characteristic as the reference signal segment. The graph represented by the Euclidean distance matrix D is shown in Fig. 9: Calculating each local minimum of the Euclidean distance matrix curve D , and the time starting points of similar segments can be obtained as T 1 = 55.21 s, T 2 = 83.23 s, T 3 = 148.11 s, T 4 = 163.61 s, T 5 = 187.11 s, T 6 = 219.21 s, T 7 = 251.05 s, T 8 = 266.80 s. And the curve presents a change law similar to the waveform of the downlink signal, which conforms to the model prediction. The specific positions of similar segments on the entire signal waveform diagram are shown in Fig. 10: Figure 10 shows the waveform characteristic of each signal segment is similar, and the actual minimum pulse width T A−min = 7.70 s can be obtained from the sequence T . According to the decoding algorithm in the previous section, the pulse timing diagram can be made as shown in Fig. 11: The symbol M shown in the timing diagram is "110,000, 001,011,011,101,110,101", which is consistent with the test preset instruction. In order to verify the decoding result that obtained by this model can have a high accuracy rate in the case of the smaller pulse width. Conducting another signal experiment: pulse width 6 s, sync head is set to "6 s-6 s-14 s-6 s", Automatic orientation, the control instruction code is "1,010,101,010". The signal after low-pass digital filtering is modeled to obtain all falling edge signal segments with similar characteristics, and the decoded result is given, as shown in Fig. 12 and Fig. 13.
Similarly, a series of falling edge signal fragments with similar waveform characteristic can be obtained through the pattern recognition model processing, and Fig. 13 shows the instruction code element is "1,010,101,010", which is the same as the downlink communication information. Above this, the method proposed in this paper achieves surface control information is transmitted quickly and verifies the feasibility of this model for decoding of a pulse width of 6 s.

Analysis
The above experimental results show that the pattern recognition-based decoding method for downlink signal with narrow pulse width has the characteristics of high accuracy and strong feasibility when the pulse width is 8 s and 6 s, which achieves rapid and accurate transmission of surface control commands.
Currently, using the threshold method has always been a common way to decode the downlink signal. This method generally recognizes the pulse transition edges through a fixed threshold voltage, and it uses the interval of each transition edge as the pulse width, then decodes sequentially with the signal waveform direction (Qi et al., 2010). Under the same experimental conditions, the threshold method is used to decode the above downlink signal of 8 s pulse width, and the symbol obtained from the decoding result is "110,00 0,011,001,011,001,100,101". Figure 14 shows the decoding comparison results of the two methods.
It can be viewed on Fig. 14, when the threshold method is used in the processing of the downlink signal with narrow pulse width, if the signal continuously jumps, the decoding timing will be deviated due to the distortion of the signal waveform. Therefore, the threshold method is not suitable for the downlink signal with a narrow pulse width. And related research showed that the decoding accuracy of this decoding method is only 60%-70% when the minimum pulse width time is less than 20 s. In contrast, the method proposed in this paper has more advantages.

Discussion
The key to adopting the decoding method proposed in this paper is to identify the reference signal segment with the waveform characteristic in the signal. Thanks to the change feature of drilling fluid displacement and the compressibility of the drilling fluid itself, we can find a small segment from the falling edge (or rising edge) segment of the downlink signal as the reference signal segment, so for the narrower pulse width downlink signals, as long as finding signal segments with similar waveform characteristics, we can use this model to decode it. Compared with the threshold method, it can be seen that the decoding accuracy of this method can be greatly improved, and the smaller the signal pulse width, the more significant the advantage. In addition, analyzing the principle of this method shows that this model is also suitable for considering the signal segment of the rising edge during decoding the downlink signal.

Conclusion
A decoding method based on pattern recognition for negative pulsed of downlink signal with narrow pulse width is proposed in this paper, which solves the problem of the difficulty of decoding and identification when the pulse width of negative pulsed technology is too small. In this method, the Euclidean distance matrix model between the similar signal segments with the rising or falling edge of the downlink signal is established, and the decoding and recognition of the downlink instruction are achieved by solving the pulse encoding timing between each rising or falling edge. The experimental study is carried out to verify the feasibility of the proposed method.
An experiment on a set of 8 s pulse width downlink signal, the decoding result is consistent with the preset instructions of the surface control system, and the decoding accuracy rate can reach 100%. By comparing the decoding result with the threshold method, it can be seen that for the downlink signal with narrow pulse width, the method proposed in this paper solves the problem of large timing deviation in decoding the downlink signal with current threshold method. And greatly improves the decoding accuracy of the narrow pulse width signal.
Additionally, another experiment on a set of 6 s pulse width downlink signal, and the result is still consistent with the preset instructions. Therefore, this method provides a reliable basis for decoding the downlink signals with a narrower pulse width, which can transmit more information in a shorter time, and provides a feasible decoding method for achieving intelligent high-speed drilling and transmitting a higher bit rate. And the smaller the signal pulse width, the more obvious the advantage of this method. Moreover, the decoding method involved in this paper can provide a possibility for efficient and reliable decoding using positive pulsed uplink transmission, which is also the direction of the next research. 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/.