# A Novel Method for Risk Assessment and Simulation of Collision Avoidance for Vessels based on AIS
## 4 Collision Avoidance Algorithm
In addition, the SDA is calculated according to the Goodwin model as follows [8; 12]:  
\[SDA=D(\Delta B)+K_{1}+K_{2} \tag{17}\]  
where \(K_{1}\) is the systemic sensitivity effect to SDA, and \(K_{1}\) = 0 for AIS. \(K_{2}\) is the effect of the maritime area to SDA. The weight is small, and it can be considered equal to 0. The values of \(D(\Delta B)\) corresponds to the following [33]:  
\[D(\Delta B)=\left\{ \begin{array}{ll}1.1-0.2\frac{\Delta B}{180^{0}}&0^{0} \leq\Delta B\leq 112.5^{0}\\ 1.0-0.4\frac{\Delta B}{180^{0}}&112.5^{0}<\Delta B\leq 180^{0}\\ 1.0-0.4\frac{360^{0}-\Delta B}{180^{0}}&180^{0}<\Delta B\leq 247.5^{0}\\ 1.1-0.4\frac{360^{0}-\Delta B}{180^{0}}&247.5^{0}<\Delta B\leq 360^{0}\end{array} \right. \tag{18}\]  
The functional function of \(R\) is [33]:  
\[U_{R}=\left\{ \begin{array}{ll}1&R\leq r_{1}\\ \frac{1}{2}-\frac{1}{2}\sin[\frac{\pi}{r_{2}-r_{1}}(R-\frac{r_{1}+r_{2}}{2})] &r_{1}<R\leq r_{2}\\ 0&R>r_{2}\end{array} \right. \tag{19}\]  
where \(r_{1}=\) distance for latest actions (DLA) indicates the collision distance of the vessels and the latest action to avoid collision. This distance is not fixed, which depends on the size, speed, type of the ship, the weather condition, the operational ability of officers, and so on. In fact, the traveled distance is safe in the range of 0.4 to 1 nautical mile. In simulation calculations, the article selects \(r_{1}=1\). \(r_{2}\) indicates the distance from the ship to the target ship in the danger zone. If \(r_{2}\) is not in the safe range, it can be considered to be safe. So, \(r_{2}=r_{1}+d_{2}\). The functional function of TCPA is [33]:  
\[U_{TCPA}=\left\{ \begin{array}{ll}1&TCPA\leq t_{1}\\ \frac{t_{2}-TCPA}{t_{2}}&t_{1}<TCPA\leq t_{2}\\ 0&t_{2}<TCPA\end{array} \right. \tag{20}\]  
where \(t_{1}\) is the time of arrival to the collision. \(t_{2}\) is the time of arrival to the destination. Normally, 6-8 nautical miles between ships is usually considered the auto driving stage when using autopilot. For the sake of safety, this article set 8 nautical miles as the distance between ships beginning to form a collision situation. Then, we set the time required to sail from 8 nautical miles between ships to the closest point of approach as \(t_{2}\). Next, the TCPA was set to correspond to \(t_{2}\). \(t_{1}\) and \(t_{2}\) are given by [33]:  
\[t_{1}=\left\{ \begin{array}{ll}\frac{\sqrt{DLA^{2}-DCPA^{2}}}{V_{et}}&DCPA\leq DLA \\ \frac{DCPA-PLA}{V_{et}}&DCPA>DLA\end{array} \right. \tag{21}\]  
\[t_{2}=\frac{\sqrt{8^{2}+DCPA^{2}}}{V_{ot}} \tag{22}\]  
The functional function of \(\Delta B\) is [11; 33; 35]:  
\[U_{\Delta B}=\frac{1}{2}[\cos(\Delta B-19^{0})+\sqrt{\frac{440}{289}+\cos^{2} (\Delta B-19^{0})}]-\frac{5}{17} \tag{23}\]  
So, the algorithm of collision avoidance, namely the collision-risk index (CRI), is calculated as follows:  
\[CRI=\alpha_{DCPA}U_{DCPA}+\alpha_{TCPA}U_{TCPA}+\alpha_{R}U_{R}+\alpha_{ \Delta B}U_{\Delta B} \tag{24}\]  
where U\({}_{DCPA}\), \(U_{TCPA}\), \(U_{R}\), and \(U_{\Delta B}\) are membership functions that represent the distance at the closest point of approach, the time to the closest point of approach, and the distance and the azimuth of the ship and target ship, respectively. Each factor has different effects on the collision risk. The numbers \(\alpha_{DCPA}\), \(\alpha_{TCPA}\), \(\alpha_{R}\), \(\alpha_{\Delta B}\) are the weights ranging from 0 to 1, and they have a total of 1, which indicates the effects to collision capability of each membership function to the collision risk. The specific calculation process and the value ranges of the above parameters are given in Section 5.