# 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
The orange scatter points in Figure 2 indicate the measured POOH hookload of the well, which is generally distributed along the tripping hanging weight line with a friction coefficient of 0.3. According to the well M drilling log, there is no resistance in the well during tripping, indicating that tripping is safe. If there is a stuck phenomenon, the measured hookload of the well will gradually distribute to the friction coefficient of 0.4 or more. \begin{table}
\begin{tabular}{c c c} \hline
**Depth (m)** & **Inclination (\({}^{\circ}\))** & **Azimuth (\({}^{\circ}\))** \\ \hline
3613 & 85.4 & 190 \\ \hline
4000 & 85.4 & 190 \\ \hline
4500 & 85.4 & 190 \\ \hline
4542 & 96.7 & 191 \\ \hline
4660.57 & 98.6 & 189.8 \\ \hline
4746.97 & 99.4 & 190.5 \\ \hline
4920 & 97.8 & 190.9 \\ \hline \end{tabular}
\end{table} 
Table 1: _Cont._ \begin{table}
\begin{tabular}{c c c c c c} \hline
**Tool** & **OD (mm)** & **ID (mm)** & **Length (m)** & **Cumulative** & **Linear Weight (N/m)** \\ \hline PDC bit & 215.9 & 30 & 0.32 & 0.32 & 1120.8 \\ \hline Positive displacement motor & 172 & 30 & 8.2 & 8.52 & 1089 \\ \hline Non-magnetic pressure drill pipe & 127 & 108.6 & 9.4 & 17.92 & 290 \\ \hline Slope heavy weight drill pipe & 127 & 76.2 & 37.38 & 55.3 & 700 \\ \hline bumper & 168 & 74 & 9.87 & 65.17 & 1471.6 \\ \hline Slope heavy weight drill pipe & 127 & 76.2 & 37.52 & 102.69 & 700 \\ \hline Slope drill pipe & 127 & 108.6 & 3051.62 & 3154.31 & 290 \\ \hline Slope drill pipe & 139.7 & 121.4 & 1765.7 & 4920.01 & 325.9 \\ \hline \end{tabular}
\end{table} 
Table 2: Current bottom hole assembly (BHA) for well M open hole. \begin{table}
\begin{tabular}{c c c c c c} \hline
**Mud Weight (g/cm\({}^{3}\))** & **\(\varphi\)3** & **\(\varphi\)100** & **\(\varphi\)300** & **\(\varphi\)600** & **Flow Rate (L/s)** \\ \hline
1.6 & 6 & 7 & 60 & 72 & 20 \\ \hline \end{tabular}
\end{table} 
Table 3: Drilling fluid performance and drilling parameters for well M.  
1.2 Identification Method of Sticking Degree Based on Particle Swarm Optimization and Physical Model of Hookload  
Supposing that the problem is solved in D-dimensional search space. The population consists of m particles, that is to say that \(\mathrm{S}=\left\{x_{1}^{k},x_{2}^{k},\cdots,x_{m}^{k}\right\}\) the position vector of the ith particle in the search space at the time k represents a possible solution to the problem. \(x_{i}^{k}=\left\{x_{i1}^{k},x_{i2}^{k},\cdots,x_{iD}^{k}\right\}(i=1,2, \cdots,\mathrm{m})\). The velocity vector corresponding to the particle represents the motion of the particle in each dimension of space. \(v_{i}^{k}=\left\{v_{i1}^{k},v_{i2}^{k},\cdots,v_{iD}^{k}\right\}\). The velocity and position of the ith particle in the d dimension at the time k + 1 are calculated as shown in Equation and Equation. \[v_{id}^{k+1}=w\times v_{id}^{k}+c_{1}\times r_{1}\times\left(p_{id}^{k}-x_{id }^{k}\right)+c_{2}\times r_{2}\times\left(p_{gd}^{k}-x_{id}^{k}\right) \tag{16}\]  
\[x_{id}^{k+1}=x_{id}^{k}+v_{id}^{k+1} \tag{17}\]  
wherein, \(x_{id}^{k}\)--Current position of the particles; \(v_{id}^{k}\)--Velocity of movement of the particles; \(p_{id}^{k}\)--Optimal value of the individual position of particles; \(p_{gd}^{k}\)--Optimal population position; w--Inertia factor; k--iterations; m--Population particle number; \(c_{1}\)--Accelerated factor; \(r_{1}\)--Random number; D--Space dimensionality. (1) As for the population size m, a small number of particles is sufficient for general problems. m is generally 10-30 to reduce the computing cost; as for complex search spaces or specific types of problems, m can be 100-200, and even larger. (2) As for adjustable control parameters (including inertia factor w and acceleration factor c1 and c2), the inertia factor w is used to control the influence of the particle's previous velocity on the current velocity, and its value is generally between (0,1).