# Intelligent Stuck Pipe Type Recognition Using Digital Twins and Knowledge Graph Model
## Materials and Methods
### Recognition of Sticking Rules Based on SAX Morphology Aggregation Method
#### 2.2.2 Curve Recognition Based on SAX Morphological Aggregation Approximation
The given symbol sequences (ccddd, bbddd, bbcdd, and abcde) are specified as slow decrease sequences, the given symbol sequences (aaeee, aacee, aaeee, and bbeee) are specified as sudden decrease sequences, the given symbol sequences (ccccc, ccdcc, ccbcc, and cbcc) are specified as the continuous stability sequence, the given symbol sequences (ddaaa, ddcaa, eeaaa, and eecaa) are specified as the sudden increase sequences and the given symbol sequences (ccaaa, bbaaa, caaaa, and edcba) are specified as the slow increase sequences. The metric calculation formula of symbolic distance is as follows:  
\[\text{MINDIST}=\sqrt{\frac{m}{w}}\sqrt{\sum_{l=1}^{w}\left(dist\left(\hat{A}_{ l}^{q},\hat{A}_{l}^{c}\right)\right)^{2}+u\left(dist\left(\hat{S}_{l}^{q},\hat{S}_{l}^{c} \right)\right)^{2}} \tag{22}\]  
\[u=2\left(1+\frac{w}{m}\right)^{2}/9\left(1-\frac{w}{m}\right) \tag{23}\]  
m refers to the length of time series and is 20, and w refers to the dimension which is 1 in the formula. The observed series are divided into mean observation series and morphological observation series, and the given symbol sequence is divided into mean observation sequence and morphological observation sequence (namely slope coefficient). The MINDIST is the minimum distance value of two time series. \(\hat{A}_{l}^{q}\hat{S}_{l}^{q}\hat{A}_{l}^{c}\hat{S}_{l}^{c}\hat{S}_{l}^{c}\) After the measured mean and morphological sequence are obtained, they are calculated together with the given symbol sequences by the given minimum distance calculation method. The one with the smallest distance is similar to the corresponding given symbol sequence to obtain the trend judgment result of the sequence. As for the traditional SAX symbolized character distance calculation method, the intervals corresponding to a, b, c, c, d, and e are \([-\infty,-0.97]\), \([-0.97,-0.43]\), \([-0.43,\,0]\), \([0,\,0.43]\), \([0.43,\,0.97]\), and \([0.97,+\infty]\) upon calculation. The distance calculation method is the upper bound of symbol minus the lower bound of symbol. The calculation formula is as follows:  
\[\rm{dist}(a,b)=min(b)-max(a) \tag{24}\]  
The calculation result between symbol distances are shown in Table 6:  
Use the SAX algorithm described in the previous section to calculate the symbol distance between the given symbol sequences and the trend time series to be judged to determine the trend of stuck pipe data. Figure 6 illustrates the flow of stuck data trend recognition based on the SAX method. \begin{table}
\begin{tabular}{c c c c c c} \hline  & **a** & **b** & **c** & **c** & **d** & **e** \\ \hline a & 0 & 0 & 0.54 & 0.54 & 1.2 & 1.94 \\ \hline b & 0 & 0 & 0 & 0 & 0.86 & 1.2 \\ \hline c & 0.54 & 0 & 0 & 0 & 0 & 0.54 \\ \hline c & 0.54 & 0 & 0 & 0 & 0 & 0.54 \\ \hline d & 1.2 & 0.86 & 0 & 0 & 0 & 0 \\ \hline e & 1.94 & 1.2 & 0.54 & 0.54 & 0 & 0 \\ \hline \end{tabular}
\end{table} 
Table 6: SAX method symbol distance calculation results. Figure 6: Flow of stuck data trend recognition based on SAX method.