# 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  
The positioning data received by the PIT Beidou module at a frequency of 1 Hz may have large deviations or errors due to interference from the sea-surface environment [29]. The existing position indicator system only sends the latest positioning point information within the alarm message transmission cycle (>30 s), and the available positioning data in the background are limited. This transmission method affects the accurate judgment of the position of the drowning personnel and the prediction of drift trajectories, reducing rescue efficiency. In this paper, we design a positioning data processing algorithm for the PIT. During the receiving cycle, the algorithm evaluates the validity of each positioning datum in real time, extracts key point coordinates, and caches them to an array (\(array_{KPD}\)). Finally, the key point dataset is compressed and encapsulated into packets for transmission. This algorithm increases the accuracy and quantity of positioning data obtained in the background while ensuring energy consumption, effectively improving rescue efficiency. Figure 4: Power-management module circuit. Figure 5: Basic workflow of the LR-MPIBS. 1. Verify The Positioning Data Validity: A maximum distance estimation model for drowning drift is designed to test the effectiveness of the positioning data obtained during the receiving cycle, discarding large deviation data. The maximum drift distance (_thre_err_) estimation formula is \[\textit{thre\_err}=k_{\text{err}}\times v_{\text{max}}\times\Delta t+2\times loca _{err}\] (3) where \(k_{\text{err}}\) is the estimation coefficient, \(v_{\text{max}}\in[1.0,\,2.5]\) m/s is the maximum value of sea-surface horizontal drift velocity [30], \(\Delta t\) is the time interval from the latest historical valid positioning data acquisition time to current, and \(loca_{err}\) is the maximum random measurement deviation of the Beidou module. \(dis\_pp\) represents the distance difference between the current collected positioning data and the latest historical valid positioning data. The \(dis\_pp\) can be calculated using Formula (4) as follows: \[ \begin{array}{l}dis\_pp=R\times\arccos(\cos(\frac{wp_{las}\times\pi}{180}) \times\cos(\frac{wp_{pre}\times\pi}{180})\\ \times\cos(\frac{|\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$\textit{ $\textit{\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$ $\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$\cdot$}}}}}}$}$}$}$}$}}}}} }{180}-\frac{|\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$ \textit{\textit{\textit{$\textit{\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$\textit{$ $\textit{$\textit{$\textit{$\textit{$\cdot$}}}}}$}$}$}}$}$}}}}} }{180})+\sin(\frac{(wp_{las}\times\pi}{180})\times\sin(\frac{(wp_{pre}\times\pi }{180}))\\ \end{array} \] (4) where \(R=6371\) km is the radius of the earth, and \(jp_{las}\), \(wp_{las}\), \(jp_{pre}\), and \(wp_{pre}\), respectively, denote the longitude and latitude of the current and previous positioning data. The \(dis\_pp\) and \(thre\_err\) are obtained using Formulas (3) and (4). If \(dis\_pp\) is less than \(thre\_err\), the previously retained valid positioning data will be saved to \(P_{pre}\) and the current positioning data will be retained to \(P_{las-u}\) for subsequent key data extraction. Otherwise, the current positioning data will be discarded. This operation improves the effectiveness and accuracy of the positioning data to be sent. (2) Extract The Key Positioning Data: The positioning data collection frequency of LR-MPIBS is 1 Hz, and the minimum alarm transmission cycle is 30 s. If all valid data within the cycle are encapsulated and sent, there is a large amount of redundant information in the rescue information packet. Long data packets can lead to increased energy consumption and may reduce the success rate of data transmission [31].