# Intelligent Stuck Pipe Type Recognition Using Digital Twins and Knowledge Graph Model
## Materials and Methods
### Identification of Sticking Degree Based on Physical Model and Particle Swarm Optimization Algorithm
#### 2.1.1 Physical Model of Hookload and Torque Based on 3D Borehole
Shear force difference between upper and lower ends of the unit:  
\[Q_{Pi}-Q_{P(i-1)}=\frac{2(M_{Pi}-M_{{P(i-1)}})+(F_{i-1}-F_{i})cos\frac{ \Delta\alpha_{i}}{2}sin\frac{\beta_{i}}{2}L_{i}\pm M_{PF}}{cos\frac{\Delta \alpha_{i}}{2}L_{i}} \tag{10}\]\[Q_{Ri}-Q_{R(i-1)}=\frac{2(M_{Ri}-M_{R(i-1)})+(F_{i}-F_{i-1})cos\frac{\Delta\alpha_{ i}}{2}sin\frac{\beta_{i}}{2}L_{i}\pm M_{RF}}{cos\frac{\beta_{i}}{2}L_{i}} \tag{11}\]  
If the string is lifted, the \"\(\pm\)\" item in the above formula is taken as \"\(+\)\"; if the string is lowered, it is taken as \"\(-\)\". \[M_{PF}=\pm\frac{\mu L_{i}}{6\tau_{P_{i}}}\bigg{|}\pm\frac{F_{i-1}+F_{i}}{2\tau_{ P_{i}}}cos\frac{\beta_{i}}{2}cos\frac{\Delta\alpha_{i}}{2}-q_{m}sin\overline{ \alpha}_{i}\bigg{|} \tag{12}\]  
\[\beta_{i}=cos^{-1}[cosa_{i}cosa_{i-1}+sina_{i}sina_{i-1}cos(\varphi_{i-1}- \varphi_{i})] \tag{4}\]0  
If the curved well section is an angle building section, the \"\(\pm\)\" item in the above formula is \"\(+\)\", and if it is a drop-off interval section, it is \"\(-\)\", including:  
\[ \begin{array}{c}M_{Pi}=El_{i}\frac{\Delta\alpha_{i}}{L_{i}}\ \ M_{P(i-1)}=El_{i-1}\frac{\Delta\alpha_{i-1}}{L_{i-1}}\\ M_{Ri_{i}}=El_{i}\frac{L_{i}}{L_{i}}\ M_{R(i-1)}=El_{i-1}\frac{t_{i-1}}{L_{i-1 }}\\ \tau_{P_{i}}=\frac{L_{i}}{|\Delta\alpha_{i}|}\ \tau_{R_{i}}=\frac{L_{i}}{| \beta_{i}|}\end{array}  \tag{14}\]  
The torque calculation expression formula is:  
\[T_{i}=T_{i-1}-\mu_{i}\tau_{i}|N_{i}| \tag{15}\]  
\(E\)--Elastic modulus of drill string stiffness (N \(\cdot\) m\({}^{2}\)); \(I\)--Moment of inertia of unit (m\({}^{-4}\)); \(q_{m}\)--Floating weight of drill pipe in drilling fluid (\(\frac{N}{m}\)); \(L_{i}\)--Unit length of section I (\(m\)); \(F_{i-1}\), \(F_{i}\)--Axial tensile force (N) on both ends of the element at the ith section; \(T_{i-1}\), \(T_{i}\)--Torque load at both ends of section i unit (N); \(M_{P(i-1)}\), \(M_{Pi}\)--Bending moment (N\(\cdot\)m) on both ends of the element at the ith section on the plane P; \(M_{R(i-1)}\), \(M_{R\bar{i}}\)--Bending moment at both ends of segment i element on R plane (N \(\cdot\) m); \(M_{RF}\), \(M_{PF}\)--Bending moment (N\(\cdot\)m) on both ends of the element at the ith section on the plane P; \(\alpha_{i}\), \(\Delta\alpha_{i}\), \(\alpha_{i}\)--Well deviation angle at both ends of the unit of section i and its increment and average value (rad); \(\mu\)--Friction coefficient, dimensionless; \(\mu_{t}\)--Circumferential friction coefficient, dimensionless; \(\tau_{P_{i}}\), \(\tau_{R_{i}}\)--Curvature radius of the i segment element on P plane and R plane (\(m\)); \(\beta_{i}\), \(\varphi\)--Dog leg angle and azimuth angle at both ends (rad). The model can simulate the value of hookload with different friction coefficient varying with well depth. It can help to identify the degree of sticking pipe. Take a horizontal well in Sichuan as an example for calculation. The M well trajectory data are shown in Table 1. The current bottom hole assembly (BHA) for the open hole are shown in Table 2 and the drilling fluid performance and drilling parameters are shown in Table 3.  
\begin{table}
\begin{tabular}{c c c} \hline
**Depth (m)** & **Inclination (\({}^{\circ}\))** & **Azimuth (\({}^{\circ}\))** \\ \hline
0 & 0 & 0 \\ \hline
23.98 & 0.3 & 184.18 \\ \hline
51.29 & 0.46 & 175.26 \\ \hline
79.45 & 0.74 & 158.55 \\ \hline
540.21 & 3.6 & 29.65 \\ \hline
598.32 & 2 & 82.65 \\ \hline
655.75 & 1.2 & 183.45 \\ \hline
2007.71 & 16.8 & 239.85 \\ \hline
2920.48 & 4 The above parameters are used to simulate the friction and torque of M well. Figure 2 shows the distribution of hookload with depth, and simulates the POOH hookload with friction coefficient of 0.5, 0.45, 0.4, 0.35, 0.3, 0.25, 0.2, 0.15, 0.1 and the RIH hookload with friction coefficient of 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5. Combined with the measured POOH and RIH hookload value, the approximate deviation degree of the sticking pipe can be obtained.