Unit Quaternion Description Method for Detecting High- Temperature Geothermal Well Drilling Conditions

When the typically utilized method for detecting the drilling conditions of high-temperature geothermal wells is applied, the detection takes a long time, the detection results are inconsistent with the actual conditions, and there are problems such as low detection efficiency and large detection deviation. Therefore, a method for detecting the drilling conditions of high-temperature geothermal wells described by a unit quaternion is proposed. Based on quaternion theory, the quaternion model of the position and attitude is constructed to obtain the drilling attitude. According to the analysis results and the basic principle of kernel principal component analysis, a model is built to realize the detection of high-temperature geothermal well drilling conditions. The experimental results show that in many iterations, the time required is stable and lower than that of other comparison methods, and the detection errors are all lower than 10%. The proposed method has high detection efficiency and low detection errors.


Introduction
Minerals and petroleum are strategic resources that have great importance in terms of the national economy and people's livelihood. However, the use of fossil energy has been restricted due to carbon emissions in recent years, and countries are starting to develop clean energy; thus, the development of geothermal clean energy by China is inevitable [1]. Drilling is the basic means for developing geothermal resources, but there are high risks involved [2]. These risks may come from accidents and anomalies during drilling or cause financial loss due to the absence of oil and gas underground or failure to drill into high-quality thermal reservoirs. These risks may cause large economic waste and affect drilling efficiency [3]. This scenario demands higher requirements on drilling technology with the development of high-temperature geothermal resources in China [4]. The detection of the drilling conditions of hightemperature geothermal wells is necessary to alleviate the diffi-culties in drilling directional wells and complex geological conditions. There are problems such as low detection efficiency and large detection error in the present detection method for determining the drilling conditions of high-temperature geothermal wells; thus, the drilling condition detection method for high-temperature thermal wells is studied.
Yin et al. [5] proposed a drilling condition detection method based on underground measurements. It collects real-time attitude data underground by a data logger, analyzes vibration signals and counts dimensionless indicators, selects margin indicators and kurtosis indicators, and detects the drilling conditions for high-temperature thermal wells by these indicators. The results obtained by this method are not consistent with the actual results, and large detection error arises. Zhang et al. [6] proposed a drilling condition detection method based on KSFDA-SVDD. This method maps the data into high-dimensional space from the original space, calculates the discriminant matrix and reduces the dimensions, and realizes drilling condition detection by SVDD. This method, however, is hindered by the long time required to calculate the discriminant matrix and its low detection efficiency. Gao et al. [7] proposed a drilling condition detection method based on ANSYS. This method establishes a longitudinal free vibration model, calculates the natural frequency of the longitudinal vibration in drilling, analyzes the drilling system by the ANSYS finite element analysis software, and obtains the variation characteristics of drilling under different depth conditions to realize the detection of drilling conditions. This method, however, also requires a long time to realize detection and leads to low efficiency.
To solve the problems listed above, a unit quaternion description method for detecting high-temperature geothermal well drilling conditions is proposed. The innovation of this method is that it is based on the updated location data and attitude data of the drilling system, analyzes the drill string forces, lays the foundation for the drilling condition detection of high-temperature geothermal wells, establishes the drilling condition detection method for high-temperature geothermal wells on the basis of the stress analysis results of drill strings, measures the deviations between the statistical model and the measured sample, reflects the changes in the monitoring data in residual space, and realizes the dynamic detection of the drilling conditions in high-temperature geothermal wells.

Force Analysis
The core of the drilling system is its ability to update the location data and attitude data of the drilling system. Moreover, the position attitude quaternion model is constructed by quaternion theory, the attitude information and position information are obtained, the frequency response information of the position data and attitude data is denoised by the quaternion transfer rate function, and a quaternion signal model of the drilling system is formed. The updated quaternion differential equations are as follows: In the formula above, QðtÞ represents the attitude quaternion of the drilling system; ω b nb represents the vector; ðω b nb Þ q represents the quaternion form corresponding to ω b nb ; ω b ib = ½ω x ω y ω z T represents the angular velocity obtained by the gyroscope; C b n represents the attitude matrix; v x , v y , and v z represent the velocity components that correspond to the east, north, and sky directions in the navigation coordinate system, respectively; h represents the height above sea level; R N represents the radius of curvature corresponding to the system loca-tion; R M represents the Earth meridian corresponding to the location of the system; and ⊗ represents the quaternion prescribed form of operation; that is, from the direction opposite the axis of rotation, the counterclockwise angle is positive to judge the coordinate point.
The position data and attitude data of the system are obtained by the attitude quaternion based on the quaternion operation rule [8].
2.1. Force Analysis of Drill String. The stress of the drill string is complicated, involving extrusion, axial tension, a centrifugal force, a bending moment, and torque. The stress of different parts of the drill string is different in different states [9,10].
The axial force of the drill string is usually the pressure produced by the drilling pressure, the buoyancy of the drilling fluid, and the pressure produced by the weight of the iron column [11,12]. In addition, the frictional resistance between the drill string and the wall of the well and the drilling fluid during drilling, the pressure exerted on the wellbore and the wellbore of the drilling fluid circuit, and the change in the speed of the wellbore only during the tripping process will cause additional axial load.
During tripping, the dynamic longitudinal load generates instantaneous alternating voltage and compression voltage in the drill ring due to the change of the lifting speed of the drilling rig, which is related to the operation of the drilling rig. The tensile force F 0 corresponding to any section of the drill string in the vertical hole suspension can be calculated by the following formula: In the formula above, q p represents the gravity of the drill string; L p represents the length of the drill string below the section; q c represents the gravity of the drill collar; L c represents the length corresponding to the drill collar.
When the borehole is filled with drilling fluid, the drill string is subjected to drilling fluid pressure and self-weight [13], as shown in Figure 1.
In Figure 1, (1) in order to prevent the drill tool from breaking and falling off, it is necessary to carry out strict inspection on the drill tool during deep hole drilling. Therefore, this fixture can be used to carefully check the drilling tool when drilling the second shift every day. The main content of the inspection is the wear resistance, camber of the drilling tool, and the tightness of the threaded joint. Nonstandard drilling tools cannot be run into the hole. (2) Suppose the drill bit diameter is 50 mm, made of platinum, and the tension and torque of the 3:5 × 68 × 200 mm drill collar locking joint are designed to be within the range of kilometers. Considering that the rock formations of different depths in the well have different characteristics, it is possible to select different drill bits according to the characteristics of different rock formations. In order to ensure the consistent cutting edge of the drill bit, it is necessary to always pay attention to the wear of the drill bit during the process of deep hole drilling. It can also ensure that the drilling efficiency at the bottom of the hole is improved. In order to prevent accidents during deep hole drilling, it is stipulated that when the deep hole is 0~1000 m, and the locking joint can be used by tightening one and a half buttons. When the drilling depth is 1000-1600 m, there must be more than two buttons; otherwise, the joint must be replaced. Half-vehicle drilling: in order to prevent abnormal phenomena in drilling, reduce drilling speed, and damage drilling tools, deep holes can be drilled by half-vehicle. The handles and linkage handles of the switch cabinet must be supervised by someone. If the drill pipe is found to stop rotating in the hole, it should be hoisted and not forced to drill in to prevent breakage.
It is found that the influence of hydrostatic pressure and drilling fluid buoyancy on the lateral extrusion of the longitudinal force of the drill string is equivalent to reducing the line weight of the drill string. Using the coefficient K B to describe the degree of mitigation, the formula is as follows: In the formula above, ρ s represents the steel density of the drill string, and ρ d represents the density of the drilling fluid.
In addition to improper operation, the main problem of sand shale hole turning and jamming of drilling tools that often occur in deep hole drilling is the uniformity of the mud force. Therefore, the squeeze effect of the horizontal hydrostatic pressure and drilling fluid buoyancy is analyzed: (1) Checkout and adjust the mud performance. In order to make mud performance more suitable for drilling rock formations, inspection is performed every shift. The test content includes mud viscosity, relative density, sand content, and water loss rate. If the mud performance is unqualified, it should be adjusted immediately to keep the mud marsh funnel viscosity between 22.0 s and 25.0 s, the relative density between 1.1 and 1.5, the sand content not more than 5.0%, and the water loss rate not more than5.0 mg/l (2) The thickness of the covering soil layer is initially set as 800 m to1500 m, the mud marsh funnel viscosity is 22.0 s to 30.0 s, the relative density is 1.12 to 1.15, the sand content is not more than 3.0%, the water loss is not more than 3.0 mg/l, the hole depth is 1600 m to 3000 m, the mud marsh funnel viscosity is 35 s to 35 s, the relative density is 1.13 to 1.15, and the sand content is not more than 3.0%.
(3) When lifting the drilling tool, in order to maintain the pressure balance of the borehole wall, mud must be injected into the borehole to protect the borehole wall. In this way, a certain pressure can be maintained in the hole, collapse and block collapse can be prevented, and the mud quality can be ensured The axial tension F m at the cross section of any drill string is obtained by considering the lateral extrusion action of hydrostatic pressure and the buoyancy of the drilling fluid: The axial tension of a drill string section F w under normal drilling conditions is In the formula above, W is the drilling pressure. The neutral point describes the point where the axial force on the drill string is zero. Let us describe L n as the location of the neutral point. The formula is as follows: Assuming L nr is the actual length of the drill collar, the formula is as follows: In the formula, S f represents the safety coefficient. The friction of the drilling fluid and casing wall is F f , and F d is the dynamic load generated for lowering or raising the speed. The formula is as follows: In the formula, v is the velocity of down or up; g is the acceleration due to gravity; t is the duration of deceleration or acceleration; the effect on the drilling speed is shown in Figure 2.
Considering the friction F f and dynamic load F d , the axial force F t in any drill string section is obtained: In the formula, R is the radius of the borehole curvature; P is the concentrated load on the drill string; E is the average coefficient of the distributed load; I is the strength of the drill string.
The field-measured coefficient ζ is introduced into the upper formula to obtain the lower formula: It is found that the load on the drill bit P is usually composed of dynamic load P d and static load P s , the formula of which is as follows: The dynamic coefficient k d is set to describe the dynamic component of the drill string operation. The expression is as follows: The drilling pressure P, considering high frequency and low frequency, can be calculated by the following formula: In the formula above, P t is the high-frequency amplitude; ω b is the rotating frequency of the drill string at the bottom hole; P l is the low-frequency amplitude; ω c is the rotating frequency of the tooth wheel.
In practice, compared with the formula, we can see that the force produced by the drill string on the shaft wall is less affected by the high-frequency vibration; thus, it is necessary to consider only the low-frequency vibration [14]: 2.3. The Influence of In Situ Stress and Drilling Fluid Column Pressure on the Stress Distribution of the Surrounding Rock of the Wellbore Wall. In view of the complex working conditions in the depth of the formation, this article first needs to make certain assumptions: assuming that the formation is a homogeneous macroanisotropic elastic body, and assuming that its bedding surface is horizontal, the force problem of the wellbore can be simplified to a plane strain problem to study [15,16]. According to the actual force state of the wellbore, that is, the boundary conditions of the wellbore, this paper derives the stress equation of the surrounding rock of the wellbore on the basis of elastic mechanics theory. Firstly, the polar coordinate system is established, and the related basic mechanical equations of the surrounding rock of the shaft wall are derived and sorted out on the basis of the polar coordinate system.
Equilibrum differential equation is as follows: In the formula, σ θ is the tangential stress, σ r is the radial stress, τ rθ is the shear stress, f θ is the tangential volume force, f r is the radial volume force, r is the distance from a point on the wall to the axis of the borehole, and θ is the angle between the line connecting a point on the wall of the borehole with the axis of the borehole and the direction of the maximum horizontal ground stress.
By balancing the actual stress of the surrounding rock, it can be known that the drill wall will change again when the load on the drilling site is drilled. The diffusion range is limited, and the ground stress is only redistributed in a certain area in the center of the borehole. Outside this area, the ground stress will obtain an initial balance of tension before drilling; so, there is no tension concentration in this area.
Since the rock formation is actually composed of rock skeletons, it is necessary to analyze the pore pressure in the rock because there are pores between the rock skeletons. If the pore pressure is considered comprehensively, the voltage distribution around the borehole can be obtained.

Influencing Factors of Borehole Stability.
In the process of conventional drilling, there will be many formations, and these formations will lead to various structures. At the same time, influencing factors such as high temperature and high

Human Factors.
If the speed of the drill bit is too fast, pressure will be generated while drilling, thereby increasing the pressure in the well. If the pressure rises immediately, the stability of the wellbore will be severely impaired. If the formation fracture pressure is lower than the current pressure generated by the drill bit, a wellbore rupture will occur.

Drilling Condition Detection of High-Temperature Geothermal Well
When testing the drilling condition of a high-temperature geothermal well, the following items should be addressed first: (1) We should select clean water, foam, or air drilling fluid for the sand-carrying flow as much as possible, because most known geothermal wells are in environmentally sensitive areas, and the use of waterbased drilling fluid or oil-based drilling fluid will greatly increase the related costs, which is not conducive to the development of economic benefits. To obtain clean geothermal resources with underground temperatures, the sand-carrying methods above should be selected. However, at the same time, the clean water drilling method may also increase the difficulties in pressure-stabilizing wellbores and protecting wellbores and increase the risk of complicated conditions under the well (2) To develop a moderately-high-temperature geothermal well efficiently and safely and to protect the formation and fluid from contamination, nearly balanced or underbalanced drilling technology should be selected, and the corresponding underbalanced drilling blowout preventer device should be matched (3) Before geothermal development, the temperature distribution should be studied; however, due to the high formation temperature and large amount of fluid returned from geothermal wells, it is difficult to understand the temperature distribution. For example, due to the large amount of return fluid and high lower resistance, electrical testing tools have difficulty arriving at the objective layer. Moreover, there is a large error between the electrical measured temperature and the real formation temperature. To ensure that the tool can enter, we must adopt the new high-density, thick-slurry pressure well operation. Finally, the actual measured temperature will be lower than expected due to the mixing of lowtemperature fluid and high-temperature fluid, which further complicates the formulation of the later scheme. Therefore, transmission logging can be used without replacing the drilling fluid, and electric measuring instruments can be used under drill pipes or continuous oil pipes To make the test more accurate, a gas-liquid separator should be prepared in the wellhead testing process and equipment after completion to measure the physical parameters of the gas-liquid, which will facilitate the collection of parameters and the development of plans in the future.
To obtain the relative position of the subject object and the aerial image, we can use the six external azimuth elements of each image that can be obtained directly or indirectly. The method of real-time acquisition of the external orientation elements by the Global Positioning System and the Internal Navigation System is a direct method that is easy to limit by high fluctuation of the accuracy and placing a high requirement on the equipment. It needs to reach a certain precision level if the higher-order term is abandoned and the lowerorder term of the expansion series is selected, which leads to the problem of initial value selection. If the initial value cannot be known or is selected improperly, it will cause iterative nonconvergence. However, it is necessary to establish a certain correspondence first before using the quaternion, which is easy to calculate and has significant geometric significance, such as the point between the image point and the corresponding ground point, and then establish an important collinear theory in photogrammetry. This theory is based on the ideal relationship between the surface point, the projection center, and the corresponding image point in the same line, and its mathematical representation establishes the collinear conditional equation of the mathematical relations between the photography center, the image point, and the object point; that is, a one-to-one correspondence between the spatial coordinates of the image square and the object square is established. Using the collinear equation, which is less affected by the field and other factors, the external and internal azimuth elements can be observed in more detail, and the resolution of the near-Earth observation can be improved.
On the basis of the basic principle of core element analysis, the drilling condition detection model of a high-temperature geothermal well described by the unit quaternion is established according to the results of the drilling column force analysis, and the drilling condition detection of a hightemperature geothermal well is realized.
3.1. Basic Theory of Core Element Analysis. Kernel principal component analysis (KPCA) is a modeling method independent of process mechanism. It only needs to conduct statistical modeling through the information of process data and then use the model to realize process monitoring. Kernel 5 Geofluids principal component analysis (KPCA) is a nonlinear extension of principal component analysis (PCA). Its basic idea is to map the sample data from the input space to the highdimensional function space by nonlinear transformation and then extract attributes from the high-dimensional function space by using PCA. Specific operation steps are as follows: Step 1. get the data.
Step 2. subtract the mean. For PCA to work properly, the mean of the data must be subtracted, and the mean of the subtracted data is the average of each dimension.
Step 3. calculate the covariance matrix.
Step 4. calculate eigenvector and eigenvalue of covariance matrix. Since the covariance matrix is square, the eigenvectors and eigenvalues need to be calculated to obtain useful information of the data, in which the vector is the unit vector.
Step 5. select components to make up the pattern vector. In this step, data compression is used to reduce the dimension. In fact, the eigenvector of the maximum eigenvalue is the principal component of the data, and the eigenvector corresponding to the maximum eigenvalue is the vector through the middle of the data, which is the largest correlation between the data. After the eigenvectors are obtained, they are arranged according to the eigenvalues from the largest to the smallest, and the importance level of the components is given. After that, the eigenvectors are composed of pattern vectors, and an eigenvector with a small eigenvalue is ignored.
Step 6. get new data.
Select the components to be retained (feature vectors) to form a pattern vector, transpose it, and multiply it left by the transpose of the original data to get new data.
The covariance matrix C corresponding to the mapping data is obtained by mapping the raw data X in highdimensional space F by nonlinear mapping Φ and setting the mean value to zero. The expressions are as follows: The strict linearization formula of the collinear equation expressed by the unit quaternion matrix avoids frequent trigonometric function operations in the adjustment calculation. Let us assume that λ is the corresponding eigenvalue of C, and that V is the corresponding eigenvector of V. The relationship between them is as follows: Set correlation coefficients a i to describe eigenvectors V: Let us assume that K : K ij = <Φðx i Þ, Φðx j Þ > represents the n × n-dimensional matrix. By bringing the matrix into the upper form, we can obtain the lower form: The problem of finding the matrix characteristic equation can be used to replace the nonlinear mapping problem through the above process.

Drilling Condition Detection of High-Temperature
Geothermal Well. A lithological statistic of output fluid T 2 is established in the core principal element space, which is the sum of squares of the vector after standardized processing, reflecting the change [17] in the drilling condition monitoring data in the principal element space. The expression is as follows: In the formula, Λ −1 represents the inverse matrix corresponding to the diagonal matrix composed of k under hightemperature geothermal conditions, α represents the significance level, and 1 − α represents the confidence of the heat 6 Geofluids storage depth. These yield the control limits T 2 k,n,α corresponding to T 2 .
Surface condition statistics SPE are established in the residual space, the deviation between the statistical model and the measured sample is measured [18][19][20], and the variation in the drilling fissure height data in residual space is reflected. ΦðxÞ is reconstructed in the feature space F to obtain the expression of the surface condition statistics SPE: Simplifying the formula above, we obtain When the significance level of the surface condition statistics SPE is α [21], the control limit obtained in the position attitude quaternion model is Q α : In the formula above, c α is the critical value of the normal distribution at the significance level α [22][23][24].
The drilling condition of a high-temperature geothermal well is then detected based on the calculated T 2 and SPE.
The testing progress of the unit quaternion method for detecting high-temperature geothermal well drilling conditions is shown in Figure 3.

Result and Analysis
To confirm the overall effectiveness of the unit quaternion description method for detecting high-temperature geothermal well drilling conditions, a method for detecting the dril-ling conditions of high-temperature geothermal wells should be tested. The operating parameters are as shown in Table 1: The database used in this test is access and BDE, and the testing platform used is Linux. The unit quaternion description method and the test methods were described [5][6][7] are used to detect the drilling conditions of high-temperature geothermal wells. The test results are shown in Figure 4.
According to the data shown in Figure 4, the detection time of the method of this paper is shorter than that of the other methods in multiple iterations. The drilling condition detection method of a high-temperature geothermal well under unit quaternion description constructs the position attitude quaternion model through quaternion theory, obtains the attitude information and position information of the system, and analyzes the drilling force. The detection time is shortened, and the detection efficiency of the drilling condition is improved.
In this design, the deviation degree between the statistical model and the measurement sample is measured. The measurement process reduces the model error. To verify the reduction degree, the degree of deviation between samples of different methods is compared, which is also called the detection error. The testing results are as follows.
According to Figure 5, the detection error in this method is less than 10% in many iterations. Compared with the unit quaternion description method and the method described in literature 5, 6, and 7, the method of this paper has a lower detection error because it establishes the drilling condition detection method of high-temperature geothermal wells based on core element analysis and confirms the effectiveness  In the force analysis of the drill string in the drilling conditions of a high-temperature geothermal well, the mapping data reflect the change in monitoring data in the main element space, while the change degree of the monitoring data dynamically reflects the drilling condition of a high-temperature geothermal well. The unit quaternion description method and the test method were described [5][6][7] to test the dynamic change in the drilling conditions of high-temperature geothermal wells, that is, the number of dynamic components in the mapping data. The comparison is shown in Figure 6.
As shown in Figure 6, the number of dynamic components of this method has been kept between 70 and 80, higher than those of the other methods, mainly because the model measures the deviation between the statistical model and the measured samples in the kernel space. The square sum of the vectors after standardized treatment accurately reflects the change in the monitoring data, dynamically reflects the drilling conditions of high-temperature geothermal wells, and realizes the detection of the drilling conditions in hightemperature geothermal wells.

Conclusions
The continuous change in working conditions leads to different changes in the variables in the drilling process, and some uncertain factors easily cause accidents threatening safety. Therefore, it is necessary to detect the drilling conditions in high-temperature geothermal wells. A method for testing the drilling conditions of high-temperature geothermal wells under the unit quaternion description is proposed. If the set of quaternions is considered as a multidimensional real space, the quaternions represent a four-dimensional space. Compared with the complex number in two-dimensional space, a testing model for the drilling conditions of a hightemperature geothermal well can be constructed in a short time. Improving the detection efficiency and reducing the detection error ensure the safety of drilling engineering in high-temperature geothermal wells.

Data Availability
The data used to support the findings of this study are included within the manuscript.

Conflicts of Interest
The authors declare that they have no conflicts of interest.

Acknowledgments
This work was financially supported by the National Science and Technology Major Program of China (2016ZX05047003-004). We thank the project for its support.    8 Geofluids