Research on waterborne collision avoidance and early warning algorithm based on location data

Zhenjiang Dagang Ferry, located in the middle and upper reaches of the Yangtze River Jiangsu section, is full of different types of ships. The steam ferry crosses the waterway and frequently meets with the passing ships, inducing water collision accidents. This article, taking cross-river ferrys and normal navigation ships as research subjects, proposes an algorithm for water navigation collision avoidance based on position data. First, by analyzing the dynamic coordinate of the ferry and navigation vessel, their navigation trajectories are predicted respectively. Second, the time when they arrive at the possible collision point is calculated, the type of traffic conflict is determined, the drive’s collision avoidance response time is considered, and a warning criterion for early warning is established. Finally, the proposed warning algorithm is analyzed to check to what extent the warning can help the ship avoid the collision. Sixteen sets of data showing the navigation of the ships are selected to compare the effect of the warning algorithm with the radar warning method. The research results show that the application of the algorithm can avoid unnecessary alarm, false alarm, and alarm failure the radar warnings have, improving the accuracy and helping avoid the collision accidents.


Preface
China has a vast sea area as well as extensive inland waterways. The Yangtze River is one of the busiest inland waters in China. Taking the Yangtze River in Jiangsu Province as an example, the average daily flow of the cross-section ships has reached more than 3000. For some special waters such as ferry navigation sections, the number of cross-crossings per day is nearly 10,000 since each ferry needs to cross the Yangtze River every day and there are various traffic conflicts with the passing ships. Once the ferry collides with the passing ships, the loss of personnel and property is massive and unaffordable.
Therefore, considering the complexity of the waters in the Yangtze River in Jiangsu Province and the particularity and importance of the traffic safety of the ferry vessels, the ship collision risk warning model based on comprehensive consideration of various factors should be established and the ship intelligent early warning system should be optimized. These proposals are of practical significance to reduce the ship collision and to improve the supervision of water traffic safety.

Research status at home and abroad
KEARON first proposed the method of using DCPA and weighting TCPA in 1977. The degree of collision risk of ships can be indicated by weighting calculation. However, since the dimension of DCPA and TCPA in this method is different from that of the neutral one and only the numerical value is calculated without considering the dimensional problem, it is obviously unreasonable to judge the risk by this method. 1 Japanese scholar Takeshi Kouma determined the collision risk based on DCPA and TCPA and also found that the errors measured in DCPA obey the normal distribution law. 2 However, the evaluation value of collision risk defined by this method, failing to take into account the difficulty of avoidance, cannot fully reflect the degree of collision risk of ships. In 1997, Japanese scholar Inoue et al. 3 established a subjective collision risk model by setting up the situation of ships approaching each other, combining simulation experiments, questionnaire adjustment, and regression analysis. Although the model is modified on the basis of Goodwin's ship domain, 4 the influence of ship size and target ship size has not been taken into account in ship domain, and this domain is only suitable for open waters on the sea. Scholars such as Brunson made the revision based on the model established by Burgert and others. The idea is to calculate the expected safety distance by referring to the current driving state of the vehicle and the driver's reaction time. The alarm will be triggered once the warning distance threshold is greater than the expected safety distance. 5 Knipling 6 established a position expression showing two vehicles' motion process based on Newton's kinematics equations to determine the collision risk that may occur during the driving and used it as the principle of anti-collision warning system. Japan's Mazda Automobile Co., Ltd, designed an anticollision system based on the safe braking distance calculated according to the kinematics of the vehicle. 7 Using the mathematical method of fuzzy comprehensive evaluation and having determined the risk function of each parameter, Z Zhang 8 considered various factors such as people, ships, and environment based on the principle of ship collision geometry. J Gao 9 established a threshold model, including critical collision distance SDA min , critical safety encounter distance SDA_L, and safety encounter outer boundary SDA max and used it as a basis for quantification of different levels of decision thresholds. R Liu and Q Hu 10 added subjective factors such as the latest rudder time and ship safety distance when establishing the collision risk calculation model. P Ren 11 takes the minimum meeting time of the two ships at the latest rudder point and the minimum meeting time when the distance between the two ships is the boundary value as TCPA boundary value; Zheng and Wu 12 believe that the main factors that affect ship space collision risk SCR include d DCPA 0 (relative bearing of recent encounters d DCPA 0 ), the minimum safe passage distance, the boundary where the driver's psychological feeling risk is 0, the relative orientation of the incoming ship, the ambiguity of the domain boundary, and d DCPA 0 observation error. P Su, 13 the scholar of Jimei University, determined the ship's latest rudder timing by determining the safe distance of approach of the ships in different areas of the port and judged the ship's risk by the latest rudder timing. D Hou et al. 14 proposed an automotive active collision avoidance system based on the vehicle dynamics model and the model of vehicle safety distance.
At present, extensive research has been carried out on the risk assessment of collision of ships and vehicles at home and abroad, but there is no recognized most effective method to sovle the risk assessment of ship collision prevention. The ideas of the anti-collision warning model for vehicles, to some extent, are worthy of reference during the study of anti-collision warning for ships. However, the Yangtze River waters are complex, and there are few early-warning models for the determination of ship collision risk in inland waters. Besides, many parameters in the existing ship risk assessment model need to be obtained through statistical historical data, and the models fail to consider hydrological conditions, channel characteristics, the characteristics of the ship operation and the ferry operation, and other factors, so the evaluation results cannot be used as the basis for real-time dynamic warning. This article will focus on the deficiencies of existing research.
The algorithm for determination of the risk of ship collision avoidance

Basic idea of algorithm
In the busy waters with high density of ships, it is necessary to improve the accuracy of the ship's risk judgment model in order to reasonably determine whether there is a potential collision risk between the steam ferry and the target ship. In this study, on the basis of the original port water vessel risk judgment model, the location of suspicious collision points is calculated and the effectiveness of suspicious collision points is analyzed based on the principle of ''two points forming a line.'' By calculating the time difference between the two ships' arrival at the suspicious collision point and the response time of the driver to avoid collision, the possibility of collision between the two ships can be judged, so as to realize the reasonable quantification of the danger judgment in the water area (Figures 1 and 2).

Real-time prediction of ship navigation trajectory
In order to reasonably judge whether there is a potential risk of collision between the two ships, based on the principle of ''two points forming a line,'' the coordinates of each ship during a period of time are connected, and the formed straight line is the real-time prediction line of the ship's navigation trajectory. The real-time trajectory prediction lines of any two ships may form a intersection on the plane, which is called the suspicious collision point of the two ships. The coordinate of the suspicious collision point is timeeffective because the moment the trajectory of the ship changes, the coordinate of this point, absolutely, will not be fixed on the same site.
Suppose that the coordinate position of ship A at the previous moment is (M x 0 , M y 0 ), the current coordinate position of ship A is (M x now , M y now ), the coordinate position of ship B at the previous moment is (N x 0 , N y 0 ), and the current coordinate position of ship B is (N x now , N y now ). Then the linear equation of the real-time trajectory prediction line of ship A and ship B is The intersection point of two straight lines (i.e. the suspicious collision point of two ships) can be obtained by solving equation (1). It is recorded as P and its coordinate is (P x , P y ).

Suspect collision point validity identification
In order to further determine the effectiveness of the suspicious collision point, a simple relational operation is performed by means of the coordinates of the two ships by discussing different situations when the ships meet.
1. Ships that are moving toward a suspicious collision point at the same time For two ships running in the direction of intersection at the same time, as shown in Figure 3, the suspicious collision point P obtained is obviously effective. At this time, it shall meet the following requirements  where lat a refers to the current latitude of ship A; lat a 0 refers to the latitude of ship A at the previous time; lon a refers to the current longitude of ship A; lon a 0 refers to the longitude of ship A at the previous time; lat b refers to the current latitude of ship B; lat b 0 refers to the latitude of ship B at the previous time; lon b refers to the current longitude of ship B; lon b 0 refers to the longitude of ship B at the previous time; lat P refers to the latitude of suspicious collision point P; lon P refers to the current longitude of suspicious collision point P.
That is, if the direction of both ships is toward the suspected collision point, the suspicious point is valid.

Suspicious collision points appear between the front and rear points of ship A
If two ships travel in the direction of the intersection but the suspicious collision point P happens to appear between the front and rear points of ship A (as shown in Figure 4), or the P point coordinates coincide with the current time coordinates of ship A (as shown in Figure 5), the obtained suspicious collision point P is still valid. At this time, it shall meet the following requirements However, for the case shown in Figure 6, the condition where one ship travels toward the P point and the other ship travels away from the P point also satisfies formula (4), but in reality, there is no possibility of collision between the two ships. Therefore, when the requirements of formula (2)-(4) are met, it is necessary to judge whether the P point is between the line segment connected by the previous and current time of ship B. If so, the suspicious collision point P is still valid, otherwise the suspicious collision point is excluded.

Ships that sail away from suspicious collision points
For the situation shown in Figure 7, there is no possibility of collision between two ships running in the   opposite direction of the intersection at the same time, but in fact there is a reverse intersection point between the trajectories, so the collision point P is invalid and needs to be excluded from early warning. At this time, it shall meet the following requirements lat P À lat a ð Þ3 lat a À lat a 0 ð Þ \0 lon P À lon a ð Þ3 lon a À lon a 0 ð Þ \0 That is, if the direction of travel of both boats deviates from the suspicious collision point, the suspicious point is invalid.

Judgment of collision risk
In practical applications, only the latitude and longitude information of the ships can be obtained with the assistance of radar and AIS, and it is impossible to directly know the distance between the ships. Therefore, it is necessary to use relevant mathematical formula for conversion. After preliminary determination of whether ship A and ship B have a collision point, the distance from the ship to the suspicious collision point and from the other ship to this point are calculated respectively. According to the benchmark of 0°w arp, the longitude of the east longitude is taken, the longitude of the longitude is taken by the west longitude, the 90°-latitude value is taken by the north latitude, and the 90°+ latitude value is taken by the south latitude, and the current latitude and longitude of the research point is converted into the coordinate algebraic value.
According to the triangle derivation, the calculation formula for the angle between two spatial points is where m lat a refers to the algebraic value of the current longitude coordinate of ship A; m lon a refers to the algebraic value of the current latitude coordinate of ship A; m lat b refers to the algebraic value of the current longitude coordinate of ship B; m lon b refers to the algebraic value of the current latitude coordinates of ship B; and u refers to the angle between ship A and ship B (degree). The earth's radius of 6,371,004 m, so the formula for calculating the distance between any two points is d = 6, 371, 004 3 arccos u 3 p4180 ð6Þ Formula (4) is used to calculate both the distance from the ship to the suspicious collision point P and from the other ship to P (i.e. Dist m and Dist n ). If both of them are less than 300 m, the time for the two ships to reach the suspicious collision point is calculated respectively. If either of them is more than 300 m, there is no risk of collision between two ships because the distance is too far.
Calculate the time when the two ships reach the suspicious collision point P t a = Dist m V m ð7Þ Here, the concept of time threshold is introduced. The time the first one needs to reach the suspicious  If ship A and ship B have a point at which collision can occur and both the distance from ship A to the suspect collision point P and from ship B to P are less than 300 m, calculate the time difference between the two ships reaching the suspicious collision point and also take the driver's reaction time into account, both of which are used as the criterion for evaluation. For the driver's collision avoidance reaction time, the average value was 1.2 s. 15 If formula (10) is satisfied, then there is no risk of collision If formula (11) is satisfied, then there is a risk of collision between the two ships where t a refers to the time ship A needs to reach a suspicious collision point; t b refers to the time ship A needs to reach a suspicious collision point; and t n refers to the time threshold.

Judgment of ship collision hazard level
After preliminarily determining whether there is a risk of collision between the two ships, the unsafe state shall be alarmed at the corresponding level so that the pilot can take corresponding measures to provide real-time emergency route decision support for the ship and realize risk avoidance during the navigation. Assuming that the ship B first reaches the suspicious collision point P, as shown in Figure 9, the time the ship B needs to reach the suspicious point P subtracted from the time the ship A needs to reach the suspicious point P is the relative time and the distance between ship A's coordinate position and the suspected collision point P (i.e. the relative distance) is Dist M = 6, 371, 004 3 arccos fsin (M x now ) 3 sin (P x now ) 3 cos (P y now À M y now ) + cos (M x now ) 3 cos (P x now )g 3 p4180 ð12Þ Figure 8. Ship B completely sailed away from the suspicious collision point P.
Then the time required for ship A to travel to point P, that is, the relative time is where V m refers to the speed of ship A (km/h); ship A's coordinate position is (M x now , M y now ); and point coordinates are (P x now , P y now ). If ((relative time À reaction time)=(threshold)).1, then there is no danger of collision; if 0:75\ ((relative time À reaction time)=(threshold)) ł 1, then carry out first-level warning; if 0:5\((relative time Àreaction time)=(threshold)) ł 0:75 then carry out second-level warning; if 0:25\((relative timeÀ reaction time)=(threshold)) ł 0:5 then carry out thirdlevel warning; if ((relative time À reaction time)=(threshold)) ł 0:25 then carry out four-level warning. Among them, the higher the dangerous level, the greater the risk of the ship.

Case study
Simulation analysis is carried out based on anticollision warning algorithm proposed above. Assuming that each vehicle navigates along the preset trajectory, this article calculates the possibility of the collision between each ferry and each passing ship. According to the regulations of the People's Republic of China on Inland River Collision Avoidance, when there is a possibility of collision between a steamboat and a passing ship, the steamboat should give priority to avoiding ships sailing in straight line and must not force its way in the direction of the ship. By demonstrating the effect of the algorithm on ship collision avoidance after the warning, this article tests whether the proposed method can successfully avoid collision accidents.
Before the simulation starts, the scenario where multiple ships meet is designed: the initial position, heading, and speed of each ship are shown in Table 1; the initial meeting of the ship and its relative position are shown in Figure 10. The assumptions are as follows: (1) the speed of all ships does not change during the voyage; (2) the impact of wind speed and water flow on the ship is not taken into account, and the course of the  As shown in Figure 10, the scenario where the multiple ships encounter includes two kinds of situations: the ships move toward a suspicious collision point and the suspicious collision point appears between the front and rear points of a ship. The position of the suspicious collision point and the corresponding warning level can be calculated through the anti-collision warning algorithm.
In this study, the ships are taken as research objects. As shown in Table 2, the suspicious collision point M first appears between ship 3 and ship 2 and the coordinate of the point changes with time. When T = 10 s, according to the evaluation standard of the early warning, the system will issue the first-level warning and the course of the ship will change by 15°. In addition, according to the anti-collision early warning algorithm, it is determined that when T = 15 s, there is no possibility of collision between ship 3 and ship 2. However, in the process of continuing the navigation, the suspicious collision point N is generated due to the collision between ship 3 and ship 1, in which case the early warning system issues the second-level warning and then ship 3 alters the course and resumes the original course. It can be evidently seen from the trajectory of each ship that the ship successfully avoids other ships in the way and there is no collision accident. The ship makes the avoidance twice during the voyage in all ( Figure 11).

Data collection
This article takes the water safety management of Zhenjiang Dagang, Ferry in Jiangsu as an example. At present, mainly taking advantage of radar warning, this area utilizes the Beidou positioning system installed on the ferry to carry out radius warning. Once a vessel appears within the dangerous radius, the system will immediately issue an alarm. For the convenience of comparative analysis, this article selects the early warning data of 13 October 2018, as shown in Table 3. The table shows the historical data of the ship's navigational trajectory.

Simulation and simulation comparison
Prediction of the sailing track. This article selects 16 sets of ship information data for real-time trajectory prediction, as shown in Figure 12, where the blue line represents the trajectory of ship A, and the orange line represents the trajectory of ship B. According to the principle of ''two points forming a line,'' the position of the suspicious point can be calculated and its validity will be evaluated. The gray point is the suspicious point that fails to meet the minimum warning standard of the system, and the red point is the collision point that reaches the early warning standard.
Radar warning analysis. Based on the method of radar scanning, the ship's trajectory is analyzed. According to the 16 sets of ship information data, if the distance between the two ships is less than 300 m, the radar will issue an early warning, and 14 sets of data will reach the early warning standard. Among them, there are five advanced warnings, five secondary warnings, and four low-level warnings ( Figure 13).
Analysis of early warning algorithms in this article. It is assumed that the trajectory is analyzed by using the optimization algorithm. Among the 16 sets of ship information data, only two sets of data reach the early warning threshold, including a third-level warning and a first-level warning.
Comparative analysis. As shown in Figure 14, when the radar warning method is adopted, it is found that the second group of data does not issue an early warning because the distance between the two ships exceeds 300 m; however, when both the distance from the suspicious collision point to the ship and from the point to the other ship are less than 150 m, the two ships are likely to collide but the radar still does not give an alarm in time. After analyzing 12 groups of data, there is no suspicious collision point between the two ships, which means no collision may occur, but the radar warning method issues a first-level warning, which is a serious false alarm. Based on the analysis mentioned above, the feasibility of the optimization algorithm is validated since it can accurately determine the collision risk of the two ships and significantly reduce the false alarm rate of the radar warning method.

Conclusion
Focusing on the dangerous situation of conflict between ferry and past ships, this article proposes a dynamic anti-collision warning algorithm based on location data. By designing a scenario where multiple ships meet, the effect of the warning algorithm for collision avoidance is analyzed and actual data are invoked to be analyzed. The results of research show that the optimization algorithm proposed in this article changes the traditional single early warning mode with radar scanning radius as the main index. By obtaining the real- Table 3. Ship navigation trajectory historical data.
Insertion time longitude latitude a ship ID speed time dynamic information of the ship, tracking and judging the suspicious points of any two ships in the water in time and excluding the invalid suspicious points, the frequency of false alarm of early warning is reduced, the accuracy of early warning is improved, and the collision accidents can be avoided.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.