# Collision Avoidance Behavior Mining Model Considering Encounter Scenarios
## 2 Methodology
### Recognition of Ship Encounter Scenarios  
Based on the ship avoidance steering point identified from the ship trajectory in Section 2.2, this section searches for the ship's encounter trajectory pair through the latitude, longitude, speed, heading, and time information contained in t-th point and judges the encounter scenarios of the two ships. (1) Ship encounters pair searching  
In maritime navigation practice, the OOW (Officer On Watch) typically assesses the urgency of potential collisions using the DCPA and the TCPA. According to the OOW's experience, in open waters, it is generally considered that when the DCPA is less than 2 nautical miles and the TCPA is greater than 0, there is a potential collision risk between ships ([PERSON] et al. [31], [PERSON] et al. [32]). In this paper, the criteria for potential collision risk are set as a DCPA less than 1.5 nautical miles and a TCPA greater than 0 but less than 30 min. By traversing the database using the collision avoidance turning point \(p_{o}(t_{o},lon_{o},lat_{o},so_{o},cos_{o})\) containing ship speed, course, position, and other information, we can calculate the DCPA and the TCPA with other ships at time \(t_{m}\). After data preprocessing, existing research provides relatively well-established methods to calculate the DCPA and the TCPA between any two ships. Assuming the coordinates of the two ships are \((\alpha_{1},\,\beta_{1})\) and \((\alpha_{2},\,\beta_{2})\), the process for calculating the DCPA and the TCPA between the two ships is described by Formulas (13) to (21), as follows:  
\[\left\{ \begin{array}{l}\lambda=\alpha_{2}-\alpha_{1}\\ B=\beta_{2}-\beta_{1}\end{array} \right. \tag{13}\]  
\[S_{B}=6378.137(1-e^{2})\int_{0}^{B}{(1-e^{2}\sin^{2}\beta)}^{-3/2}B \tag{14}\]  
In the formulas, \(\Delta L\) and \(\Delta B\) represent the longitude and latitude differences between the two ships in the geodetic coordinate system; \(e\) is the Earth's eccentricity, with a value of 0.0167; and \(S_{B}\) is the height of the calculation point above the Earth's equator. \[\left\{ \begin{array}{l}q=\ln\left[\tan\left(\frac{\pi}{4}+\frac{\beta}{2} \right)\left(\frac{1-e\sin\beta}{1+e\sin\beta}\right)^{e/2}\right]\\ \Delta X=6378.137 dL\\ \Delta Y=6378.137(q_{2}-q_{1})\\ C=arc\tan 2(\Delta X,\Delta Y)\end{array} \right. \tag{15}\]\[S=\left\{ \begin{array}{ll}\frac{(S_{\rm BP}-S_{\rm B1})}{\cos A_{1}}&(B\
eq 0)\\ r_{1}|\lambda|&(B=0)\end{array} \right. \tag{16}\]  
\[r_{1}=\frac{6378.137\cos\beta_{1}}{\sqrt{1-e^{2}\sin^{2}\beta_{1}}} \tag{17}\]  
\(q\) represents the latitude proportional conversion factor; \(\Delta X\) is the distance between the two coordinate points in the Mercator coordinate system; \(\Delta Y\) is the Earth's eccentricity; \(r_{1}\) is the radius of the spherical section at latitude \(B_{1}\); \(A_{1}\) is the azimuth angle; \(C\) is the angle between the straight line connecting the two ships' positions; and \(S\) is the straight-line distance between the two ships. By using the principle of velocity addition, the speed of the first ship is added to the other ship's velocity. The calculations for the DCPA and the TCPA are as follows:  
\[\left\{ \begin{array}{ll}V_{xT}=V_{T}\times\sin\phi_{T}\\ V_{yT}=V_{T}\times\cos\phi_{T}\end{array} \right.\left\{ \begin{array}{ll}V_{xO }=V_{O}\times\sin\phi_{O}\\ V_{yO}=V_{O}\times\cos\phi_{O}\end{array} \right.\left\{ \begin{array}{ll}V_{xR }=V_{xT}-V_{xO}\\ V_{yR}=V_{yT}-V_{yO}\end{array} \right. \tag{18}\]  
\[VR=\sqrt{V_{xR}^{2}+V_{yR}^{2}}\quad\phi_{R}=\arctan\frac{V_{xR}}{V_{yR}}+\alpha \tag{19}\]  
\[\alpha\left\{ \begin{array}{ll}0^{\circ}&V_{xR}\geq 0,V_{yR}\geq 0\\ 180^{\circ}&V_{xR}<0,V_{yR}&<0\\ 180^{\circ}&V_{xR}>0,V_{yR}&<0\\ 360^{\circ}&V_{xR}<0,V_{yR}&>0\end{array} \right.