# 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  
In a three-dimensional curved well section, the well deviation and orientation are always changed. The bending of the pipe string element is a spatial curve, and its force is a spatial force system. According to the spatial geometric approximation, Figure 1 shows that the force and deformation of the pipe string element can be decomposed into two upper planes f, and finally solved according to the principle of force superposition. Figure 1: Relationship among R, P, Q planes of a 3D curved well section. Firstly, the stress and deformation of the drill string element are decomposed into two planes, the first vertical plane consisting of chord \(\overline{ii-1}\) and \(Z\) axis is the P plane, and its normal vector is \(\overrightarrow{n_{P}}\),  
\[\overrightarrow{n_{P}}=\left| \begin{array}{cccc}i&j&k\\ 0&0&1\\ sin\ \overline{a}\ cos\ \overline{\varphi}&sin\ \overline{a}\ sin\ \overline{\varphi}& cos\ \overline{\pi}\end{array} \right| \tag{1}\]  
The second plane is a plane composed of O, \(i\) and \(i-1\), called R plane, which is the dogleg angle plane defined by [PERSON]. Its normal vector is \(\overrightarrow{n_{R}}\). \[\overrightarrow{n_{R}}=\left| \begin{array}{cccc}\overrightarrow{i}& \overrightarrow{j}&\overrightarrow{k}\\ sinia_{i-1}cos\varphi_{i-1}&sinia_{i-1}sin\varphi_{i-1}&cosa_{i-1}\\ sinia_{i}cos\varphi_{i}&sinia_{i}sin\varphi_{i}&cosa_{i}\end{array} \right| \tag{2}\]  
Angle between P plane and R plane is \(\theta\). \[\theta=cos^{-1}\frac{\overrightarrow{n_{P}}\cdot\overrightarrow{n_{R}}}{( |\overrightarrow{n_{P}}|)(|\overrightarrow{n_{R}}|)} \tag{3}\]  
Unit \(L_{i}\) Dog leg angle is \(\beta_{i}\):  
\[\beta_{i}=cos^{-1}[cosa_{i}cosa_{i-1}+sina_{i}sina_{i-1}cos(\varphi_{i-1}- \varphi_{i})] \tag{4}\]  
\[\varepsilon_{i}=\pm\beta_{i} \tag{5}\]  
If the curved well section is an angle building well section, the \"\(\pm\)\" item in the above formula is taken as \"\(-\)\", and if it is a drop-off interval section, it is taken as \"\(+\)\". For the force balance analysis of the unit, the mechanical model of the pipe string unit is established as follows:  
\[F_{i-1}=F_{i}+\frac{\Big{(}Q_{P_{i}}-Q_{P_{(i-1)}}\Big{)}sin\frac{\Delta \alpha_{i}}{2}+\Big{(}Q_{R_{i}}-Q_{R_{(i-1)}}\Big{)}sin\frac{\tilde{\theta}_{ i}}{2}+q_{m}L_{i}cos\overline{\alpha}_{i}\pm\mu|N_{i}|}{\cos\frac{\tilde{ \theta}_{i}}{2}cos\frac{\Delta\alpha_{i}}{2}} \tag{6}\]  
If the string is lifted, the \"\(\pm\)\" item in the above formula is taken as \"\(+\)\"; if the string is lowered, it is taken as \"\(-\)\". The radial support force on the unit of section i is \(N_{i}\):  
\[N_{i}=\sqrt{{N_{{P_{i}}}}^{2}+{N_{{R_{i}}}}^{2}+2{N_{{P_{i}}}}{N_{{R_{i}}}} cos\omega} \tag{7}\]  
Angle building well section \(\omega=\theta\), drop-off interval section \(\omega=\pi-\theta\), P plane and R plane radial support force \(N_{{P_{i}}}\), \(N_{{R_{i}}}\) are as follows  
\[N_{{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{)}L_{i} \tag{8}\]  
\[N_{{R_{i}}}=\bigg{(}\pm\frac{F_{i-1}+F_{i}}{2\tau_{{R_{i}}}}cos\frac{\beta_{i} }{2}cos\frac{\Delta\alpha_{i}}{2}-q_{m}sin\overline{\alpha}_{i}cos\omega \bigg{)}L_{i} \tag{9}\]  
If the curved well section is an angle building well section, the \"\(\pm\)\" item in the above formula is taken as \"\(-\)\", and if it is a drop-off interval section, it is taken as \"\(+\)\".