## 4 Calculation Method of Target Well Distance  
As shown in Figure 1, once the current \(l_{s}\) from the current source is injected into the formation, the current \(l_{c}\) accumulates in the casing of the target well and flows along the casing axially. This current excites the magnetically induced magnetic field in the formation, so the distance between the measuring point and the casing can be calculated using the magnetic field measurement tool. The Z coordinate with Q as the origin is established on the axis \(\Phi_{1}\) of the drilling well, and its conversion relationship with the (\(X\),\(Y\),\(Z\)) coordinate system is as follows:  
\[\left\{ \begin{array}{l}x=-z^{\prime}\cdot\sin(\theta)\\ z=z^{\prime}\cdot\cos(\theta)\end{array} \right. \tag{12}\]The distance \(r\) is marked between the position of the low-frequency magnetic field detector and the casing micro-ring \(dz\). The angle \(\alpha\) is marked between the line from \(dz\) to the measurement point of the low-frequency magnetic field detector and the axis of the casing. According to the Biot-Savart law with Formula (8) and Formula (12), Formula (13) can be derived. \[dB_{c}\left(z^{\prime},z\right)=\frac{\mu_{0}\mu_{e}}{4\pi}\cdot\frac{I_{c}(d,z )\cdot\left(d+z^{\prime}\cdot\sin(\theta)\right)}{\left[\left(d+z^{\prime} \cdot\sin(\theta)\right)^{2}+\left(z-z^{\prime}\cdot\cos(\theta)\right)^{2} \right]^{\frac{3}{2}}} \tag{13}\]  
Integrating along the casing axis Z, the magnetic induction intensity along the axis \(\Phi_{1}\) in the Z coordinate can be expressed as follows:  
\[B_{c}\left(z^{\prime}\right)=\frac{\mu_{0}\mu_{e}}{4\pi}\cdot\int_{-L_{d}}^{L _{ch}}\frac{\left(d+z^{\prime}\cdot\sin(\theta)\right)\cdot I_{c}(d,z)\cdot dz }{\left[\left(d+z^{\prime}\cdot\sin(\theta)\right)^{2}+\left(z-z^{\prime} \cdot\cos(\theta)\right)^{2}\right]^{\frac{3}{2}}} \tag{14}\]  
According to the MWD principle, two low-frequency magnetic field detectors, \(H_{u}\) and \(H_{d}\), are arranged on the measuring tool at the upper/lower end. They are symmetrically configured with the Z coordinate origin Q as the center. In this paper, \(H_{u}\) and \(H_{d}\) are successively configured at the center of the Q point and the upper/lower electrodes, so the corresponding Z coordinate values are \(L/4\) and \(-L/4\), respectively. According to Equation (14), the magnetic field intensity measured by \(H_{u}\) and \(H_{d}\) is as follows:  
\[\left\{ \begin{array}{l}B_{u}=\frac{\mu_{0}\mu_{e}}{4\pi}\cdot\int_{-L_{d}}^{ L_{ch}}\frac{\left(d+L\cdot\sin(\theta)/4\right)\cdot I_{c}(d,z)\cdot dz}{ \left[\left(d+L\cdot\sin(\theta)/4\right)^{2}+\left(z-L\cdot\cos(\theta)/4 \right)^{2}\right]^{\frac{3}{2}}}\\ B_{d}=\frac{\mu_{0}\mu_{e}}{4\pi}\cdot\int_{-L_{d}}^{L_{ch}}\frac{\left(d-L \cdot\sin(\theta)/4\right)\cdot I_{c}(d,z)\cdot dz}{\left[\left(d-L\cdot\sin( \theta)/4\right)^{2}+\left(z+L\cdot\cos(\theta)/4\right)^{2}\right]^{\frac{3}{2 }}}\end{array} \right. \tag{15}\]  
The distances between \(H_{u}\) and \(H_{d}\) and the casing are found with Formula (16), respectively. \[\left\{ \begin{array}{l}d_{u}=d+L\cdot\sin(\theta)/4\\ d_{d}=d-L\cdot\sin(\theta)/4\end{array} \right. \tag{16}\]  
Since \(L\), \(I_{s}\), \(R_{f}\), \(R_{m}\), \(\sigma_{c}\), \(r_{d}\), \(r_{t}\), \(r_{c}\), \(l_{c}\), and the other relevant parameters are known, in the ideal case that the measuring point is far from the bottom of the casing, the distribution diagram corresponding to \(B\)-(\(d\),\(\theta\)) can be drawn by Equation (15), and the distance and angle between the ranging tool of the drilling well and the target casing can be obtained by a single point measurement. In special circumstances where the depth of the drilling well approaches the bottom of the target well, the symmetric infinite length characteristic of the casing no longer holds in the model.