# LR-MPIBS: A LoRa-Based Maritime Position-Indicating Beacon System
## 2 Materials and Methods
### Workflow and Data-Processing Algorithm
#### 2.3.2 The Positioning Data Processing Algorithm of PIT
We design a Key Positioning Data Extraction Algorithm (KPDEA) for the drift trajectory of personnel on the sea surface, which extracts key positioning data and stores it in the \(array_{KPD}\). These data are used for subsequent compression and encapsulation. The drift trajectory can be divided into three categories: relatively static, wide-angle turning, and small-angle turning. These features are used in the design of KPDEA. First, the position of the person may have a small range of movement or they may be static, the drift distance is within a certain range. The following can thus be used to identify movement over a small range in the positioning data: \[\textit{thre\_min}=k_{\text{min}}\times v_{\text{min}}+2\times loca_{err}\] (5) where \(k_{\text{min}}\) is the model estimation coefficient and \(v_{\text{min}}\in[0.0\text{-}0.5]\)m/s is the minimum value of the sea-surface horizontal drift velocity. If \(dis\_pp\) is less than \(thre\_min\), this indicates that the personnel drift range is small, and the previously stored key point information can be used to replace the current location information, discarding the current location information. Otherwise, we use the subsequent feature recognition methods. Secondly, we extract a key positioning point for the drift trajectory of drowning personnel through a wide-angle turning feature. We establish tow vectors of the latest drift trajectory direction vector \(\overrightarrow{P_{pre}P_{las-u}}\) and the last historical drift trajectory direction vector \(\overrightarrow{P_{ori}P_{dir}}\) of the personnel. The key positioning points \(P_{ori}\) and \(P_{dir}\) denote the starting and ending coordinates of the last historical drift trajectory direction vector, respectively. The valid positioning data \(P_{pre}\) and \(P_{las-u}\) denote the starting and ending coordinates of the latest drift trajectory direction vector, respectively. The trajectory pinch-angle \(\theta_{las}\) is calculated between this two vectors. The algorithm extracts key positioningpoints by comparing \(\theta_{las}\) with the angle threshold \(\theta_{thr}\) set by the system. The method for extracting key positioning data from wide angles feature is as follows:  
The original positioning data obtained by [PERSON] are mapped onto the WGS-84 coordinate system, which causes the setting of \(\theta_{thr}\) to vary according to different geographic locations. In this paper, the \(\theta_{thr}\) setting is simplified by projecting the trajectory vector into an \(x\)-\(y\) coordinate system. Taking the vector \(\overrightarrow{P_{pre}P_{las-u}}\) as an example, the latitude and longitude coordinates of \(P_{las-u}\) are projected to the \(x\)-\(y\) coordinate system with \(P_{pre}\) as the origin, using  
\[ \begin{array}{l}x_{las-u}=111\times\cos(\frac{wp_{pre}\times\pi}{180})\times (jP_{las-u}-jP_{pre})\times 1000\\ y_{las-u}=111\times(wp_{las-u}-wp_{pre})\times 1000\end{array}  \tag{6}\]  
where \(x_{las-u}\) and \(y_{las-u}\) denote the actual offset distance (m) of \(P_{las-u}\) relative to \(P_{pre}\) in the longitude and latitude directions, respectively. The coordinate representation of vector \(\overrightarrow{P_{pre}P_{las-u}}\) is \((x_{las-u},y_{las-u})\). The trajectory pinch-angle calculation formula is  
\[\theta_{las}=\left\langle\overrightarrow{P_{pre}P_{las-u}},\overrightarrow{ P_{ori}P_{dir}}\right\rangle=\arccos(\frac{|x_{las-u}\times x_{dir}+y_{las-u} \times y_{dir}|}{\sqrt{x_{las-u}}^{2}+y_{lus-u}}\times\sqrt{x_{dir}+y_{dir}}^{2}) \tag{7}\]  
where \(x_{dir}\) and \(y_{dir}\) denote the actual offset distance (m) of \(P_{dir}\) relative to \(P_{ori}\) in the longitude and latitude directions, respectively. If \(\theta_{las}\) is larger than \(\theta_{thr}\), this indicates the occurrence of a wide-angle turning feature. \(P_{pre}\) are the key positioning data, which are stored in the \(array_{KPD}\) of key positioning data. Otherwise, one must further extract key positioning data through the small-angle turning feature.