## 2 Methodology
### State Recognition Method  
During the model training stage, the measured acceleration values in each state were divided into sections with a duration of \(\Delta t\). To avoid interference from nearby factors such as pedestrian traffic near the sensor, an interference threshold \(\varepsilon\) was set to remove readings with values greater than \(\varepsilon\). The acceleration time history signals for the three directions were integrated into a unified time history signal, \(R\), using Equation (1). \(R\) is denoted by \(\{R_{i}\}\), with \(i\) = 1, 2, 3, \(\ldots\), \(m\). Here, \(m\) represents the number of acceleration data points obtained in each interval in a single direction of the triaxial accelerometer, and \(\Delta t\) represents the sampling interval. \(a_{xi}\), \(a_{yi}\), and \(a_{zi}\) represent the real-time readings in the three directions of the accelerometer, respectively. \[R_{i}=\sqrt{a_{xi}^{2}+a_{yi}^{2}+a_{zi}^{2}} \tag{1}\]  
Three time-domain features of \(R\) were extracted, namely, the mean (\(\overline{R}\)), the root mean square (\(R_{rms}\)), and the peak-to-peak (\(R_{pp}\)). \(\overline{R}\) was calculated using Equation (2), \(R_{rms}\) was calculated using Equation (3), and \(R_{pp}\) was calculated using Equation (4). \[\overline{R}=\frac{1}{m}{\sum_{i=1}^{m}R_{i}} \tag{2}\]  
\[R_{rms}=\sqrt{\frac{1}{m}{\sum_{i=1}^{m}R_{i}^{2}}} \tag{3}\]  
\[R_{pp}=max(R_{i})-min(R_{i}) \tag{4}\]  
\(R\) was first mean-centered and then transformed into the frequency domain using the Fast Fourier Transform (FFT). The relative power spectral density \(P_{i}\) was obtained according to Equation (5); then, the relative power spectral entropy \(R_{H}\) was determined by Equation (6). This process used Shannon entropy [57] from information theory to measure the complexity or randomness of the frequency domain power distribution. \[P_{i}=\frac{\left|\text{fft}(R_{i})\right|^{2}}{\sum_{j=1}^{m/2}\left|\text{fft }(R_{j})\right|^{2}}, \tag{5}\]  
\[R_{H}=\frac{-\sum_{i=1}^{m/2}P_{i}\text{log}_{2}P_{i}}{\text{log}_{2}(m/2)}, \tag{6}\]  
where \(\text{fft}(R_{i})\) represents the performance of the Fast Fourier Transform on \(R_{i}\). To improve the recognition accuracy of the climbing state and minimize the environmental noise, the offset axis crossing count, denoted as \(R_{cc}\), was introduced. As represented in Figure 4, \(R_{cc}\) was calculated as:  
\[R_{cc}={\sum_{i}I[(R_{i}-\delta)\times(R_{i-1}-\delta)<0]} \tag{7}\]  
where \(I[. ]\) is an indicator function that equals 1 if the condition inside the brackets is true and 0 otherwise. The offset magnitude, \(\delta\), was determined by:  
\[\delta=l_{c}/L_{max},\delta\in(0,1), \tag{8}\]  
where \(l_{c}\) represents the horizontal distance between adjacent hydraulic cylinders at the location of the triaxial accelerometer, and \(L_{max}\) signifies the horizontal distance between the two furthest hydraulic cylinders of the HBM. The combined feature vector \(F=\left\{F_{j}\right\}\) of the \(n\) time-domain signals \(R\) can be expressed as:  
\[F_{j}=\left[R_{rms},\overline{R},R_{pp},R_{H},R_{cc}\right], \tag{9}\]  
where \(j=1\), \(2\), \(3\), \(\ldots\), \(n\). The feature vector \(F\) is composed of five distinct features, which provide a comprehensive representation of the signal characteristics and enable effective signal classification and recognition of the working state of the HBM. Utilizing the combined feature vector \(F\) for the four distinct working states, a kNN classifier was trained and subsequently deployed within the monitoring system of the HBM. The classifier was utilized to categorize the real-time collected data into distinct working state categories, thereby enabling the recognition of the construction state of the equipment. The kNN classifier works by finding the \(k\)-nearest neighbors of a test sample in the feature space and assigning the test sample to the class that is most common among its \(k\)-nearest neighbors.