Instrument Design for Detecting the Inner Damage of Casing

Detecting and localizing the inner damage of the downhole casing is crucial for oil and gas production. The current methods for damage detection suffer from polarization effect, capacitance effect, and difficulty in measuring weak direct current signals. As an alternative, we propose a new instrument design based on a six-electrode array in this study. The basic detection principle is introduced, and the key factors that affect the detection performance are studied through modeling and simulation. Besides, the entire system of the instrument design consisting of several modules is presented. In addition, an experiment is conducted to demonstrate the detection capability of the proposed design. It is found that the detection dynamic of the instrument is 93 dB and a signal-to-noise ratio is 73 dB. It can detect damage when salinity is lower than 120 g/l and can identify the location of damage with high resolution in the longitudinal and radial directions.


I. INTRODUCTION
Changqing Oilfield located in northwest China has high underground mineralization, and the resulting electrochemical effects cause the casing wall corrosion to be extremely serious. For this reason, petroleum engineers have taken protective measures, by using an epoxy cold package with sacrificial anodes above the liquid level, and applying coating made of DPC (a phenolic resin) below the liquid level and in the production layer [1]- [5]. However, the deformation of the downhole casing can easily lead to the peeling of the inner casing coating, and the physical scraping between the instrument and the borehole wall will also cause the damage of the inner casing coating, resulting in the decrease of the anti-corrosion effect of the inner casing coating [6]. As a consequence, the normal production of oil and gas and the downhole operation are severely affected, Therefore, it is of great significance to inspect the inner casing coating [7].
At present, the methods used to detect casing coating damage mainly include downhole electromagnetic thickness measurement, multi-arm caliper, optical television imaging, ultrasonic imaging, and related electrical logging The associate editor coordinating the review of this manuscript and approving it for publication was Datong Liu .
technologies. Downhole electromagnetic thickness measurement technology can not produce electromagnetic signal feedback on thin coating [8]; Multi-arm caliper logging tool can detect the change of inner diameter of oil casing, but it can not detect the quality of coating, and the attachments on oil casings will affect the measurement accuracy [9]; Optical imaging logging technology is affected by the surface cleanliness and limited space perspective of downhole oil casing, so it is difficult to accurately judge the specific situation of the inner coating of oil casing; Although the ultrasonic imaging logging tool can be applied to casing quality evaluation, its eccentricity has a great influence on the measured value, and it has not been used to detect the damage of inner coating [10]. Electric logging technology can be divided into single electrode method, multi-electrode method, and micro-electrode methods according to the measurement methods used. The single-electrode method can reflect the overall quality of the casing inner coating, but it can not detect local damages [11]. Most of the multi-electrode methods use the DC current detection method, which can not solve the polarization effects caused by electrolyte [12], [13]; The microelectrode method requires the instrument to be close to the inner wall of the casing, which can effectively detect the local coating quality, but it is easy to miss the area where the casing does not contact with the coating [14]. In 2011, Wan et al. proposed the Field Signature Method [15]. It was easy to explain and imagine. However, this detection method can not locate defects in the thickness direction and it is difficult to detect DC signals [16]. To meet the overall detection requirements of casing inner coating, a method based on conductivity characteristics was proposed, and the key factors affecting the measurement performance were analyzed. Moreover, an instrument design based on the six-electrode array was developed and tested with field experiments.
The rest of the paper is organized as follows. In Section 2, the detection method of conductivity is analyzed, the detection model is established, and the best detection parameters are analyzed. In Section 3, the instrument scheme is given, and in Section 4 and Section 5, the results and analysis of indoor and outdoor experiments are given.

II. DETECTION PRINCIPLE AND SCHEME OF CASING INNER COATING A. DETECTION PRINCIPLE
The coating material used in DPC inner coating anti-corrosion technology of casing is phenolic resin, which is a typical insulating material [17], [18]. Therefore, when the quality of the coating in the casing decreases or is damaged, the conductivity between the casing and the well fluid near the damaged location will increase sharply [19]. According to this feature, if a detection electrode is placed close to the damaged part in the well fluid and an excitation voltage source is applied between the casing opening and the detection electrode, the damaged part of the casing can be regarded as a metal electrode, and the current between the damaged part of the casing and the detection electrode can indirectly reflect the damage degree of the coating. The detection schematic diagram is shown in Fig. 1(a). In order to detect the current, a sampling resistor R s is connected in series in the current loop, and the current in the loop can be detected by collecting the voltage difference between the two ends of the sampling resistor R s . In other words, when the damaged area S of the inner coating increases, it means that the smaller the resistance R x between AB points, the larger the loop current I will be, and the larger the voltage U obtained on the sampling resistance will be [20]. There is the following relationship between them: Coating damage S↑→R x ↓→I ↑→V s ↑; On the contrary, the coating is damaged S↓→R x ↑→I ↓→V s ↓. Therefore, by detecting the change of sampling voltage V s , the loop current can be reflected, and the damage of casing inner coating can be measured indirectly. Considering that minerals widely existing in drilling fluid are easy to produce polarization effect, AC signal should be used as excitation signal for voltage source. The detection circuit can be equivalent to the model shown in Fig. 1(b) [21], [22]. R x in Fig. 1 is the solution resistance of the two electrodes, which is related to the exposed the area of electrode plate and the salinity of the well fluid, and is a physical quantity that we need to measure. C x is the capacitance produced by the electric double layer effect, which is greatly affected by the concentration of well fluid electrolyte, and its size is generally tens or even hundreds of µf; C p is the distributed capacitance caused by the distribution of electrode wires, which is related to the length of electrode wires, and its order of magnitude is usually pf [23]. According to the equivalent circuit model of the sensor, the equivalent circuit impedance model is: As we all know, the capacitive reactance of a capacitor is inversely proportional to the capacitance value and the angular frequency ω. Therefore, when the conductivity is measured by the electrode method, the higher excitation signal frequency is beneficial to reduce the influence of the polarization effect, but at the same time, the capacitive reactance of the distributed capacitance C p will be reduced, which will lead to the increase of branch current flowing through the well. The current of the liquid resistor R x decreases, which easily causes measurement errors. Therefore, the measurement frequency of AC impedance is generally in the order of 10 3 Hz to 10 4 Hz [24]. Generally, the impedance of double-layer capacitance C x and lead distributed capacitance C p will affect the measurement results, and the size of C x can often reach more than 1000 times of C p . According to the calculation formula of capacitive reactance, when an AC signal with a frequency of 1KHz is used as an excitation source, it is assumed that the capacitance of C x is 100 µF and that of C p is 10pF. Using the capacitive reactance calculation formula, it can be known that the capacitance reactance of C x will not exceed 1.6 , while the capacitive reactance of C p is about 15.9M , and the impedance value of C x is far less than that of distributed capacitor C p . However, the well fluid resistance R x is affected by the limited space volume and salinity in the well, and its resistance is generally in the range of several hundred to several thousand ohms. Therefore, the influence of C x on the measurement results can be neglected, and the equivalent impedance Z between the damaged part and the electrode is simplified as: (2) VOLUME 9, 2021 It can be seen from equation (2) that when the value of jωC p is close to 0, the impedance Z obtained by measuring the conductivity by the DC electrode method is equal to the well fluid resistance R x . If the well fluid impedance between the two electrodes is measured directly, the actual measured value will be the complex impedance value of the well fluid instead of the well fluid resistance, which will lead to great measurement error [25].

B. CONDUCTIVITY MEASUREMENT METHOD
To accurately measure the actual well fluid resistance and solve the influence of capacitance effect and polarization effect on the measurement results, we have studied several mature conductivity measurement methods at present: operational amplifier conductivity measurement method [26], bipolar pulse excitation method [27], phase-sensitive detection method [28] and dual-frequency sinusoidal signal measurement method [29], These methods have their advantages in reducing measurement errors.
The operational amplifier conductivity measurement method is shown in Fig. 2(a). By applying AC constant voltage signal to the solution to be measured and measuring the current passing through the sensor, the conductivity of the solution can be indirectly obtained. The advantage of this method is that the output voltage of the operational amplifier has a linear relationship with the conductivity of the measured solution within the measuring range, which solves the problem of non-linear change of the measured resistance value and the problem of sensor resolution reduction when the conductivity of the solution is large. However, in the practical design of an operational amplifier circuit, it is necessary to carefully consider the impedance change caused by AC signal to a double-layer capacitor, as well as the factors such as open-loop gain, input impedance, passband bandwidth, power supply influence, and quality factor of an operational amplifier, which makes the implementation more complicated.
As shown in Fig. 2(b), the bipolar pulse excitation method can effectively eliminate the influence of electric double-layer capacitance on the measurement of solution resistance. The basic idea is to use a bipolar square wave signal to charge and discharge the electric double layer capacitor C x repeatedly, so when the capacitor charge and discharge reach steady-state, C x is equivalent to a short circuit state. According to Kirchhoff's voltage law, at this time, only the sampling resistor R s and the solution resistor R x are in the circuit for voltage division, and the solution resistance can be calculated after collecting and processing the voltage difference between both ends of R s . Although the bipolar pulse measurement method can eliminate the influence of the capacitance effect in principle, it has high requirements on the conversion speed and detection accuracy of the detection circuit. Considering that the potential difference and spontaneous potential between the earth and the ground of the power supply will interfere with the detection process, the bipolar pulse signal needs to strictly keep 50% duty cycle in the detection process to achieve better detection results. Otherwise, the pulse edge can not be accurately judged, and the voltage at both ends of the sampling resistor Rs can not be differentially sampled at the appropriate time point. Therefore, it is considered that this method has high requirements for the detection environment and is difficult to be practically applied to the measurement of well fluid conductivity. Fig. 2(c) is the basic principle diagram of the phasesensitive measurement method. Its basic idea is to realize accurate resistance measurement by collecting the phase difference and amplitude difference between the excitation end and the detection end of the sinusoidal excitation signal. Because the resistance has no phase shift effect on the current phase, the real part and imaginary part of the impedance can be separated [30]. Then, Discrete Fourier Transform (DFT) is used to calculate the voltage and current signals, and the amplitude-frequency characteristics and phase-frequency characteristics of sinusoidal signals are obtained. Then, the impedance angle of the measured impedance is calculated to obtain the actual well fluid impedance. Although this method can improve the measurement accuracy of the resistance to be measured and eliminate the effects of polarization and capacitance effects, it is necessary to ensure that the phase difference between the sinusoidal signal of the measured resistance and the sinusoidal signals of other impedances is controlled at 90 • during the measurement process. Otherwise, the influence of electric double-layer capacitance can not be completely filtered out, so this method is not suitable for the measurement of well fluid impedance.
The dual-frequency sinusoidal signal measurement method is shown in Fig. 2(d). Under the action of a sinusoidal signal with an excitation frequency of ω = 2πf, the impedance of well fluid was measured twice, and the influence of the capacitance effect is eliminated through theoretical calculation. The calculation method is to calculate the equivalent circuit model in Fig. 1(b) by using the relevant formula of admittance. The RC parallel admittance in formula (2) is: The modulus of admittance is: |Z | is the module of impedance measured at this excitation frequency, and its value includes the influence of R x and C p . When the frequency of the excitation signal is 2ω, the measured impedance mode is: Combine formula (4) and formula (5) for simultaneous solution, Make t = ω 2 C p 2 R x 2 : Combinations of formula (5) and formula (6) are available: It can be seen from formula (6) and formula (7) that the dual-frequency sinusoidal signal measurement method only needs to measure the impedance values at different excitation frequencies. Substituting into the formula calculation can eliminate the influence of capacitance effect and polarization effect on an impedance measurement in principle. From the perspective of engineering realization, only two sinusoidal signals of different frequencies are used as excitation sources and the effective value of the voltage difference between the two ends of the sampling resistor is calculated and the real well fluid resistance can be obtained by substituting it into formula (7). In summary, we choose the dual-frequency sinusoidal signal measurement method and realize the accurate measurement of the real resistance of the well fluid [31].

C. KEY PROBLEMS OF CONDUCTIVITY DETECTION
In the practical application process of the casing inner coating quality inspection instrument, the damaged part of the casing inner coating is equivalent to one end of the detection electrode, and the other end of the detection electrode is placed on the instrument frame, which is used as two detection electrodes for conductivity inspection. According to the calculation formula for measuring solution resistance with parallel electrodes: In the formula: K is electrode constant; σ is conductivity (S/cm); L is electrode spacing (cm); S is Detection electrode area (cm 2 ).
The electrode constant K of the conductivity sensor accurately describes the geometric characteristics of the two electrodes of the sensor. It is the length ratio of the sample in the key area between the two detection electrodes, which directly affects the sensitivity and accuracy of measurement. In the process of using a traditional conductivity cell to detect the conductivity of the solution, the determination of the conductivity cell constant and the cell constant has a great influence on the error in the detection process [32]. In order to accurately measure the conductivity of the well fluid, it is necessary not only to calibrate the conductivity cell constant with an accurate KCl solution but also to place a detection electrode with an accurate size to ensure that the detection electrode is in complete contact with the solution to be measured, thereby obtaining an accurate conductivity value [33], [34]. However, in the actual logging process, because of the complex electrolyte composition in the well fluid, the problem of dynamic liquid level, and the interference of various electromagnetic noises in the well, it is impossible to quantitatively determine the values of conductivity cell constant and electrode constant [35]. What we are more concerned about is whether a significant change in conductance can be observed on the detection electrode when the damaged area of the casing inner coating changes, so as to determine the relationship between the two and solve the practical engineering needs. To sum up, the key problems that need to be solved are: (1) The structure and size of electrodes are very important in the measurement of conductivity. In order to design a reasonable electrode, it is necessary to analyze the influence of its structure and size on conductivity measurement and to provide a theoretical basis for selecting appropriate electrode parameters.
(2) During the detection process, an AC signal should be applied between the metal casing and the detection electrode, so as to ensure that the current flow through the well fluid as much as possible to form a loop between the two. Therefore, it is important to carefully isolate the signal source to reduce current dissipation.

D. MODELING AND SIMULATION
According to the detection principle, and according to actual engineering needs, the detection model shown in Fig. 3 is proposed. Assuming that the inner radius of the wellbore whose inner surface is sprayed with the insulating coating on the inner surface is r w , the interior is filled with a uniform medium with a conductivity of σ . There is circular damage with radius r a on the surface of the inner coating of the wellbore. It is assumed that a cylindrical coordinate system is established at the intersection of the radial direction of the damage and the shaft axis of the wellbore, and O is the origin of the coordinate system. Place a ring-shaped detection electrode at the shaft center position B of the wellbore, the inner radius is r b , the outer radius is R b , the electrode height is h b , and the distance between B and O is x. An AC voltage source is placed in the instrument. One end of the AC voltage source is connected with the upper edge of the metal casing located on the ground through a cable, and the other end is connected with the detection electrode. With the change of the depth of the detection electrode, the conductance between the detection electrode B and the damaged point will change correspondingly. By measuring the voltage on the sampling resistor, the area of the damaged position can be estimated and located indirectly.
According to the theory of electromagnetism, static charge produces an electrostatic field, and a steady current produces a steady current field. When the induced electric field is much smaller than the Coulomb electric field, a sinusoidal AC signal excitation can be used to obtain an electric quasi-static field. Use Maxwell's equations to solve the electric field inside the casing. The differential forms of the four equations are: In the formula, B, D, E, H, J, V, , ρ, σ , µ are magnetic induction intensity, electric displacement, electric field intensity, magnetic field intensity, current density, electric potential, dielectric constant, charge density, electrical conductivity and magnetic permeability, respectively [36]. For time-varying electric fields and currents, when the magnetic effect is negligible, the basic equation of the differential form of the electrical quasi-static field is: Under the time-varying condition, the time-varying electric field is approximately irrotational, and the divergence of electric displacement D is still equal to the free charge density at that point. According to the current conservation equation: Take the divergence of the differential form of the full current law formula in equation (10) to obtain the constant current equation: The general medium is isotropic, and the physical property equation of its properties is: The basic boundary conditions of the electric quasi-static field include the conservation of current and Faraday's law, the differential form of which is: According to the calculation formula of electric potential and electric field strength: Simulation of conduction current J c and displacement current J d in time-varying electric field: To sum up, we use equations (14), (15), and (16) to establish a quasi-static analysis model of an electric field in the casing. The established model satisfies the above-mentioned correlation equation internally, while the edge satisfies the relevant boundary conditions. Considering that COMSOL has a powerful simulation function [37]. We use this software to analyze the current loop and determine the parameters of the detection electrode.
Based on the conductivity detection model, the AC/DC module of the simulation tool and Dirichlet boundary conditions are selected to establish the casing detection model, and its key parameters are studied [38]. Because the bottom of the casing is in direct contact with the earth, the electric  potential is set to 0 V; When the inner coating of the wellbore is intact, the inner wall of the wellbore is set to be electrically insulated. To reduce the number of grids and the amount of calculation, and speed up the simulation speed of the model, the impedance boundary condition is set to simulate a thin layer with high resistivity. The relevant default parameters used in the simulation model are shown in Table 1.
Circular damage appears on the insulating inner wall of the wellbore at a certain depth, and the electric potential distribution result at a certain moment is obtained by simulation calculation, as shown in Fig. 4. Simulation results show that: (1) The potential between the damaged part of the wellbore coating and the detection electrode shows a downward trend, the potential distribution in other areas is uniform, and the current direction is consistent with expectations; (2) The electric potential is attenuated by 38dB from the maximum value to the minimum value, which fully meets the resolution requirements from the perspective of detection; (3) To improve the degree of the current collection, reduce the escape of loop current through the earth and isolate other interference, it is recommended to take isolation measures in the excitation voltage source.
Because the conductivity of the well fluid and the damaged area of coating in a wellbore are unknown, it is necessary to optimize the size parameters of the detection electrode as much as possible to meet the measurement requirements of different well conditions. In general, we mainly consider (1) The influence law of well fluid salinity; (2) The relationship between the position, size, damaged area of the detection electrode, and the equivalent resistance of the well fluid.
(3) Number selection and distribution scheme of detection electrodes. In order to determine the appropriate electrode parameters, the control variable method is used to simulate the sensitive variables, and the default values of Table 1 are selected for the remaining parameters.

1) THE INFLUENCE LAW OF WELL FLUID SALINITY
Because the salinity of the well fluid is different under different well conditions, it is required that the measuring range of the electrode be as wide as possible. Therefore, it is necessary to study the relationship between the radius r a of the damaged area and the conductivity of the well fluid under different salinity conditions. Fig. 5(a) shows the simulation results under four different salinity conditions of well fluids. The results show that with the increase of salinity of well fluid, the current density increases obviously. In order to facilitate the comparison of the influence of the salinity of the well fluid on the measurement, a rectangular coordinate system is established with the center of the circular damage, the abscissa is the radius of the circular damage, and the ordinate is the equivalent resistance between the detection electrode and the damage. Fig. 5(b) shows the numerical simulation results. The curve shows: (1) In the well fluid environment with the same salinity, the equivalent resistance value decreases rapidly with the increase of the radius r a of the damaged part, until it remains at a relatively stable value; (2) The salinity parameters have a great influence on measured resistance, so it is necessary to conduct salinity calibration experiments in the future. (3) In the condition of the same damage radius, the equivalent resistance value decreases with the increase of the salinity of the well fluid and vice versa.
Gang G and others have done similar research work [39]. By fitting the experimental data, they obtained the fitting relationship between the equivalent resistance R x and the damage radius r a as R = a · r b a , both a and b are constants. Refer to its index relationship, Referring to its exponential relationship, we try to fit the data obtained from simulation calculation and get the result under the default salinity of 0.1 ms/cm.  Equation (17) has good goodness of fit (R 2 = 0.999), which shows that there is an exponential function relationship between the equivalent resistance value and the damage radius in the model, which is mutually verified with other research conclusions.

2) THE INFLUENCE LAW OF ELECTRODE POSITION, SIZE AND DAMAGED AREA
To study the influence of the distance between the detection electrode and the damaged point on the measurement results, four different distance conditions were chosen for simulation, and the calculation results are shown in Fig. 6. Fig. 6(a) shows that there is a significant change in potential during the detection. The current density per unit volume increases as the distance decreases. The curve in Fig. 6(b) shows: (1) When the damage radius is in the range of 0 to 10mm, R x drops rapidly from the maximum value; (2) With the increase of the damage radius, the descending speed of R x obviously slows down, and gradually approaching a resistance value which is highly related to the damage distance of the electrode; (3) When the damage radius is the same, there is an approximately linear relationship between R x and the electrode spacing, and the damage position of the coating can be calculated quantitatively by R x .
To further explore the influence of the size and damaged area of the detection electrode on R x , we combined the parameters r a and h b in the model to carry out a joint scanning calculation and got the simulation results as shown in Fig. 7. The curved surface in Fig. 7 shows that: in the case that the radius of the detection electrode remains unchanged, the width h b of the detection electrode has little influence on impedance measurement. Considering that the skeleton of the instrument needs a certain strength in actual downhole operation, the outer radius of the detection electrode should be consistent with that of the instrument.

3) DISTRIBUTION SCHEME OF SHAFT AXIAL DETECTION ELECTRODE
The simulation results in the previous section show that when the damaged area is large, the impedance change rate obtained by using a single detection electrode is very small. To obtain higher axial resolution, we propose an axial double-electrode rings detection scheme. In the following, the single and double-detection electrode rings are simulated respectively, and the simulation results shown in Fig. 8(a) are obtained. The results in the figure show that: in the case of a single-electrode ring, the current is prone to escape, which is not conducive to the current collection. When the double-electrode rings solution is adopted, the electric potential of the damaged part in the casing changes obviously, and the current trend is more concentrated, which is beneficial to improve the longitudinal resolution of the damaged part.
The curve in Fig. 8(b) and Fig. 8(c) shows that: (1) When the damaged point and the electrode are at the same depth (the abscissa is 0), the curve of equivalent impedance is a minimum value at this point, which further shows that the ring-shaped detection electrode can locate the damaged position. (2) It is verified that there is an approximately linear relationship between the equivalent resistance and the electrode distance. (3) Compared with the single-ring electrode, the change rate of equivalent impedance after using the double-ring electrode is significantly increased, regardless of single-point damage or multi-point damage(k1>k3, k2>k3), from the highest 655 /m to 8000 /m. It is equivalent to further increasing the variation range of the equivalent impedance to be measured, which is conducive to improving the detection dynamics and measurement accuracy of the instrument. Therefore, it is advisable to use a double-electrode ring to complete the depth location and area estimation of the damage.

4) DISTRIBUTION SCHEME OF RADIAL DETECTION ELECTRODES IN WELLBORE
Although the electrode ring can effectively identify the location of the axial damage point in the wellbore, this structure can not identify the specific location of the radial damage point in the round wellbore. To this end, we propose a radial four-arm electrode detection scheme, and its structure is shown in Fig. 9(a). The arm electrodes are supported by a spring, and under the action of tensile force, four point-shaped detection electrodes are pushed to the vicinity of the inner wall of the wellbore. The four-arm electrodes at the same depth as the wellbore divide the wellbore into four quadrants radially. The polar coordinate system is established with the center of the wellbore as the origin and the radius of the wellbore as the radius. Assuming that #1 Arm electrode is VOLUME 9, 2021 located at the polar angle of 0 • , #2 Arm to #4 Arm electrodes are located at polar angles of 90 • , 180 • , and 270 • , respectively. When the damage points appear in the 4 quadrants in sequence, the electric field distribution in the wellbore is simulated, and the result is shown in Fig. 9(a). The simulation results show that the electric field near the damaged area changes significantly, and the radial orientation of the damaged area can be determined by using 4 arm electrodes.
The simulation curves in Fig. 9(b) show that: When the damage is located at the pole angle of 0 • , the #1 Arm electrode is closest to the damage of the inner coating of the casing, where the equivalent resistance value is the smallest. The #3 Arm electrode is the farthest away from the damage, so its equivalent resistance is the largest. Because the radial distance between the #2 Arm electrode and the #4 Arm electrode and the damaged part is equal, their equivalent resistance values remain the same. In the same way, it can be found that when the polar angle of the damage is at 90 • , the equivalent resistance of #2 Arm electrode is the smallest. We can see that the detection resistance curve changes symmetrically within the polar angle range. Therefore, by comparing the equivalent impedance of the four arm electrodes, the radial orientation of the damage can be judged. In summary, the following simulation conclusions can be obtained. (1) The circuit that detects the current needs to be isolated.

5) DETECTING SCHEME DESIGN
The detection principle of casing inner coating damage is shown in Fig. 10. Two electrode rings named E ring1 and E ring2 are installed at the upper end of the cylindrical instrument, and four arm electrodes named E arm1 to E arm4 are installed at the lower end of the instrument. A circuit board is placed in the instrument, which is mainly used for providing excitation voltage and sampling current on multi-electrode channels. Among them, the excitation voltage source is named S, and one end of it is connected with a cable core in the underground multi-core cable. Hereinafter named as communication cable. Use the communication cable to send the current to the ground and connect with the ground end of the metal casing. If a sampling resistor R sample x is connected in series between each electrode and S, the current of each sampling channel can be calculated by measuring the voltage on each sampling resistor. This current is inversely proportional to the sum of the well fluid impedance formed between each electrode (R ring1 to R ring4 ) and the damaged point, the wellbore resistance R wellbore and the resistance R cable of the communication cable. Because the resistance of wellbore and the resistance of communication cable are relatively fixed, the above method can indirectly calculate R ring1 to R arm4 . Because the well fluid impedance is closely related to the damage position of the electrode and the inner coating, the corresponding damage position of the casing inner coating can also be found.

III. INSTRUMENT SYSTEM SCHEME A. INSTRUMENT SYSTEM DESIGN
According to the above detection scheme, the overall schematic design of the instrument is designed as shown in Fig. 11, which is composed of the logic control module, generate stimulus signal module, the acquisition processing module, and communication module. Specific functions are described as follows: (1) Logic control module. To satisfy the real-time consideration of signal detection and data communication, the FPGA (Field Programmable Gate Array) is selected as the main control chip. (2) Generate stimulus signal module. The excitation module is mainly composed of a voltage source and signal isolation. Voltage source module includes FPGA, DA converter, and operational amplifier. The excitation source uses DDS(Direct Digital Synthesis) technology to generate sinusoidal signals with frequencies of 1KHz and 2KHz in time-sharing. After low-pass filtering and power amplification, the sinusoidal signal becomes an AC voltage signal with an offset of 0V and peak-to-peak value of 10V. Because the measured current loop is connected with the ground through the casing, the isolation transformer is used to isolate the ground between the two, which reduces the interference between the ground and the ground of the circuit board and realizes the current collection. The isolation transformer is wound with 84:84 turns to ensure that the input impedance of the primary side and the output impedance of the operational amplifier are as consistent as possible to obtain the maximum transmission power. (3) Acquisition processing module. To solve the problem that the equivalent resistance value of the detection electrode is infinite when there is no current loop formed, the anti-open circuit resistance is connected in parallel at both ends of the equivalent resistance value. According to Kirchhoff's voltage law, after the excitation signal passes through the impedance network, the AC voltage signal containing impedance information is obtained on the sampling resistor. Then, the voltage difference between the two ends of the sampling resistor is sampled and amplified by the instrumentation amplifier, and then the sampled signal is subjected to full-wave rectification and low-pass filtering, and the AC signal is converted into a unipolar voltage signal. On this basis, the signals are sent to the AD converter for analog-to-digital conversion by using a multiplexer, and the signal acquisition and processing are completed. (4) Communication module. To improve the efficiency of data transmission and reduce the interference of complex electrical noise in the well, the CAN (Controller Area Network) bus is used for communication between the instrument and the data acquisition box. After receiving the remote frame command from the data acquisition box, the casing inner coating inspection instrument performs normalization processing and data arrangement on the multi-channel measurement data, and communicates with the data acquisition box through the CAN bus.

B. DETECTING CIRCUIT BOARDS AND INSTRUMENTS
A detection circuit board manufactured according to the above detection scheme is shown in Fig. 12. Due to the space limitation of downhole tools, a design scheme of VOLUME 9, 2021 two circuit boards is adopted, and the circuit board size is 185mm*25mm. On the left side of the upper circuit board is the communication module, and the communication protocol is the CAN bus. The middle part of the upper circuit board is the main control module (FPGA), which is responsible for the logic control of the system. On the right side is the generate stimulus signal module, which is used to generate a stable sinusoidal excitation signal. The lower circuit board is responsible for the acquisition, processing, and analogto-digital conversion of analog signals. Fig. 13 shows the actual picture of the detecting instrument. The instrument has through-cables, arm electrodes, ring electrodes, and instrument compartments from left to right. The left end of the instrument has a through-cable reserved inside, which can be conveniently connected to other instruments. The 4 arm electrodes are pushed against the inner wall of the casing through the ceramic support arm. The end of the support arm adopts a roller design to ensure that the arm electrodes effectively contact the inner wall of the casing while avoiding scratches on the inner coating. The radius of the two ring electrodes is consistent with the radius of the shell of the instrument, and the surface is concavo-convex to ensure full contact with the well fluid medium. All measuring electrodes are introduced into the instrument compartment inside the right end of the instrument through the insulating pressure-bearing sealing plug and connected with the detection circuit board.

IV. EXPERIMENTAL PROCESS AND DATA ANALYSIS
To test the performance of the instrument indoors and further optimize the detection parameters of the instrument, an experimental device as shown in Fig. 14 was designed. The experimental device uses a plexiglass cylinder to simulate the downhole casing. The detection instrument for the inner coating of the casing is placed in the cylinder, and the detection instrument communicates with the computer through a cable and a data acquisition box. To simulate the damage with different damage radii, one end of the cable is connected to the mouth of the metal sleeve, and the other end is connected with a metal disc with a known radius. The metal disc is attached to the inner wall of the cylinder to simulate the damage of the inner coating.
In order to explore the relationship between sampling resistance and well fluids with different salinities, we selected an appropriate sampling resistance and carried out a salinity  experiment. The experiment simulates the well fluid environment of different salinity, adding water into the casing, and then adding quantitative NaCl in batches. The equivalent impedance of solutions with different salinity was measured, and the experimental results are shown in Table 2.
It can be seen from the data in Table 2 that the resistance of the solution varies from 25K to several hundred ohms in the experiment. According to Kirchhoff's voltage law. When the solution resistance is between 100 and 25 K , the voltage difference between the two ends of the sampling resistor is calculated when different resistance values are selected. The calculation results are shown in Table 3.
By comparing the voltage dynamic range of the sampling resistor in Table 3, it can be seen that the optimal value of the sampling resistor is 330 . The AD conversion precision of the detection circuit is 16 bit, and the theoretical detection performance is as high as 93 dB, which ensures that the instrument still has high resolution under different salinity well conditions. To verify the detection accuracy of the designed two detection electrode rings and four arm electrodes, an experiment was carried out to locate the damaged part of the casing inner coating. In the experiment, the controlled variable method is used to simulate the well fluid environment with different salinity by changing the NaCl content in water. The distance between the #3 Arm electrode of the control instrument and the damaged part is the closest, and record the equivalent resistance of each measuring electrode and the damaged part. The experimental results are shown in Fig. 15.
The curve in Fig. 15 shows that: (1) Under the environment of high salinity, the equivalent resistance of the instrument will decrease obviously. (2) The equivalent resistance value detected by the instrument #3 electrode is obviously different from other channels because the #3 electrode is closest to the   damaged position, which can accurately locate the damaged position, which is consistent with our expectation. (3) The instrument has good resolution and sensitivity in low salinity. With the increase of salinity, the equivalent resistance values of the six electrodes are gradually approaching, and the resolution of the instrument detection can be further improved.

V. FIELD TEST RESULTS AND DATA ANALYSIS
The inner coating detector of the downhole casing uses four measuring arm electrodes and two ring electrodes as a combined sensor to measure. The maximum opening diameter of the four-arm electrode is 152mm, which can effectively stick to the casing diameter of 5.5 inches. The logging software adopts a production logging ground system independently developed by CNPC (China National Petroleum Corporation) logging. The inner coating inspection instrument of the casing is connected to the platform in the form of a function library. The inner coating inspection instrument of the casing is connected to the platform in the form of a function library. During field logging, the casing internal coating detector and the four-parameter telemetry communication instrument are used to go down the well. Therefore, in actual logging, not only six coating resistivity curves can be obtained, but also parameters such as gamma, well temperature, pressure, and magnetic coupling can be obtained, which provides a reliable basis for the calibration and verification of coating instruments. Six detection electrode curves in integrated acquisition software are as follows, RT(#1 Ring electrode); RL(#2 Ring electrode), R1, R2, R3, and R4 correspond to four arm electrodes(#1 Arm electrode to #4 Arm electrode). The actual logging results in well pad Shang 60-591 are shown in Fig. 16 and Fig. 17.
The results in Fig. 16 show that the equivalent resistances of the six detection channels are all maximum values before the instrument reaches the downhole liquid level. After the detection electrode of the instrument comes into contact with the well fluid, the excitation signal source forms a detection current loop through the well fluid. At this time, the equivalent resistance decreases rapidly due to a certain salinity in the VOLUME 9, 2021 well fluid. Not all downhole casings are covered with coatings, and the coupling part between the casings is bare, so the instrument also has a response curve to casing coupling.
The curve results in Fig. 17 show that when the instrument detects the uncoated short casing, the equivalent resistance values of the six detection electrodes all show an obvious downward trend, which shows that the instrument responds quickly to the uncoated casing. When the inner coating is damaged at a certain depth of the casing, the equivalent resistance of the RT and RL electrodes will show a downward trend. By observing the curve, we can see that the equivalent resistance of R2 decreases significantly. Therefore, it can be judged that the inner coating near the R2 electrode is damaged at this depth. In summary, the casing inner coating inspection instrument is a very effective means of evaluating the quality of the casing inner coating in new wells and the integrity appraisal of the casing coating in old wells.

VI. CONCLUSION
In this paper, according to the detection requirements of the inner coating damage of downhole casing, we explained the basic principle of the conductivity method to measure the quality of the inner coating of the casing, analyzed four conductivity measurement methods, and discussed the key issues of conductivity detection. On this basis, the influence of well fluid salinity was analyzed through numerical simulation. Besides, the arrangement scheme of the axial two-ring electrode and the radial four-wall electrode was put forward, and the detection circuit of the dual-frequency signal source was designed. Experiments were carried out indoors and outdoors, and the experimental results show that the prototype can work reliably under the well condition with salinity lower than 120g/L, which provides an effective detection method for the quality evaluation of casing inner coating.