## 5 Calculation Method of Target Well Orientation  
During the drilling process, it is essential to plan the drilling trajectory in accordance with the orientation of the target well. The relative rotation angle between the axis of the target well and the height edge of the measurement tool should be used as a reference. The ranging tool consists of the low-frequency magnetic field detection units, each containing a three-axis low-frequency magnetic field high-precision measurement module and altitude acquisition module. These modules are utilized for measuring the low-frequency magnetic field vector, gravity vector, and geomagnetic vector, as well as calculating the high side direction and low-frequency magnetic field vector direction of each measurement segment. As depicted in Figure 1, the triaxial orthogonal coordinate components of the upper/lower low-frequency magnetic field's high-precision measurement subs are successively marked as (\(X_{u}\), \(Y_{u}\), \(Z_{u}\)) and (\(X_{d}\), \(Y_{d}\), \(Z_{d}\)). The Z-axis is parallel to the drill tool axis and facing upward, while the X-axis serves as a reference axis for measuring on the tool surface. Therefore, the data measured by the ranging tool can be labeled accordingly. The upper magnetic field measures the triaxial orthogonal vector of the sub: the magnetic field (\(B_{ux}\), \(B_{uy}\), \(B_{uz}\)) and gravity (\(G_{ux}\), \(G_{uy}\), \(G_{uz}\)). The lower magnetic field measures the triaxial orthogonal vector of the sub: the magnetic field (\(B_{dx}\), \(B_{dy}\), \(B_{dz}\)) and gravity (\(G_{dx}\), \(G_{dy}\), \(G_{dz}\));  
The calculation method determines the angle between the measurement point of the target well and the height side of the measuring tool. Since the ranging tool contains two low-frequency measuring devices, the upper/lower low-frequency magnetic field measuring subs can be measured according to Equations (17) and (18). \[\left\{ \begin{array}{l}\beta_{u}=\arctan\left(\frac{\phi_{x}\cdot B_{ux} \cdot(G_{xy}\cdot B_{ux}-B_{dy}\cdot G_{ux})-G_{dz}\cdot B_{z}^{2}\cdot(G_{ux} \cdot B_{ux}+G_{uy}\cdot B_{uy})}{\phi_{x}\cdot B_{ux}\cdot(G_{ux}\cdot B_{ux} +B_{dy}\cdot G_{uy})+G_{dz}\cdot B_{z}^{2}\cdot(G_{uy}\cdot B_{ux}-G_{ux}\cdot B _{uy})}\right)\\ \varphi_{u}=\sqrt{\left(G_{ux}^{2}+G_{uy}^{2}\right)\cdot\left(B_{ux}^{2}+B_{uy }^{2}\right)-G_{uz}^{2}\cdot B_{uz}^{2}}\\ B_{u}=\sqrt{B_{ux}^{2}+B_{uy}^{2}+B_{uz}^{2}}\end{array} \right. \tag{17}\]  
\[\left\{ \begin{array}{l}\beta_{d}=\arctan\left(\frac{\phi_{d}\cdot B_{dz} \cdot(G_{dy}\cdot B_{dx}-B_{dy}\cdot G_{dx})-G_{dz}\cdot B_{dz}^{2}\cdot(G_{ dx}\cdot B_{dx}+G_{dy}\cdot B_{dy})}{\phi_{d}\cdot B_{dz}\cdot(G_{dy}\cdot B_{ dx}+B_{dy}\cdot G_{dy})+G_{dz}\cdot B_{dz}^{2}\cdot(G_{dy}\cdot B_{dx}-G_{dx} \cdot B_{dy})}\right)\\ \varphi_{d}=\sqrt{\left(G_{dx}^{2}+G_{dy}^{2}\right)\cdot\left(B_{dx}^{2}+B_{ dy}^{2}\right)-G_{dz}^{2}\cdot B_{dz}^{2}}\\ B_{d}=\sqrt{B_{dx}^{2}+B_{dy}^{2}+B_{dz}^{2}}\end{array} \right. \tag{18}\]  
where \(\beta_{u}\) represents the angle between the gravity high side of the upper low-frequency magnetic field measurement sub and the direction of the target well, rad; \(\beta_{d}\) is the angle between the gravity high side of the lower low-frequency magnetic field measurement sub and the direction of the target well, rad. It should be noted that in the effective range of ranging, if the difference between \(\beta_{u}\) and \(\beta_{d}\) is relatively large and the difference between them exceeds the measurement error, it should be determined that the axis \(\Phi_{1}\) of the current drilling well ranging tool is not in the same plane as the axis \(\Phi_{2}\) of the target well casing. The casing current distribution characteristics are equivalent to the effect generated by the component of the projection of the upper/lower electrodes in the XOY plane of the drilling well. If the difference between \(\beta_{u}\) and \(\beta_{d}\) is relatively large, the drilling control trajectory should be adjusted in a timely manner to ensure its consistency.