Method and device for calculating ship encounter based on time slices and storage medium
Through time slice-based methods, the AIS data of ships are collected, processed and analyzed, and the incidents are screened and verified, which solves the problem of lack of detailed methods in the prior art to calculate the incidents of ships, and improves maritime traffic safety and computing efficiency.
Patent Information
- Application Number
- CN202510032954.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-01-08
AI Technical Summary
The existing technology lacks detailed methods to calculate and count all ships' incident events, resulting in the safety of ships' navigation at sea.
Using a time-based slicing method, by collecting and decoding global ship AIS signals, cleaning data and storing them into a database, dividing data according to time to form multiple slices, filtering potential ships and verifying that they will encounter events.
By reducing the amount of AIS data in ships and improving data calculation speed and accuracy, it can analyze ship encounters from real-time and historical perspectives, provide support for ship risk management decisions, and improve maritime traffic safety supervision capabilities.
Smart Images

Figure CN120144891A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of shipping informatization and shipping digitization, and particularly relates to a method, device and storage medium for calculating ship encounters based on time slices. Background Art
[0002] With the continuous development of the shipping industry, the density of ships at sea has been increasing, and the situation of ship encounters has gradually become complex. A ship being in an encounter situation is a necessary condition for a ship collision. In recent years, ship collision accidents have occurred from time to time. Ship collision accidents sometimes cause serious losses of personnel and property. Therefore, quickly and accurately extracting ship encounter events is the key to improving the water traffic safety supervision ability. To solve this problem, many experts and scholars have carried out extensive research on the automation of ship collision avoidance decision-making. To date, ships still face many risks when encountering nearby ships in open waters.
[0003] Ship managers and shipping industry practitioners need to restore and track the encounter scenarios of ships in open waters from the perspectives of time and space through the AIS trajectories of ships. However, due to reasons such as the lack of AIS data sources, large amounts of AIS data, and large computational amounts, there is currently no detailed method in the industry to calculate and count the encounter events of all ships, thus making it impossible to guarantee the safety of ships sailing at sea. Summary of the Invention
[0004] The present invention solves the problem that there is currently no detailed method in the industry to calculate and count the encounter events of all ships, and provides a method for calculating ship encounters based on time slices. With the assistance of the Alibaba Cloud ADBPG spatio-temporal database, the encounter events of ships in the database are calculated through the time slice data of ship AIS.
[0005] The technical solutions claimed by the present invention are as follows:
[0006] A method for calculating ship encounters based on time slices, comprising the following steps:
[0007] S1: Collect global ship AIS signals, decode the ship AIS signals to obtain ship AIS data, then clean the ship AIS data, and store the cleaned ship AIS data in a database;
[0008] S2: Divide the ship AIS data stored in S1 into multiple time slices according to time, take the ship AIS data with the smallest time corresponding to each ship on each time slice for storage. If there is no ship AIS data of a certain ship on the current time slice, take the ship AIS data with the smallest time corresponding to this ship on the previous time slice as the ship AIS data corresponding to the current slice, and adjust the time of the ship AIS data to the current time slice and store it.
[0009] S3: Screen potential encounter vessels and verify the screened potential encounter vessels to check if there is an encounter event; the screening refers to screening all vessels in each time slice in S2 to screen vessels with potential encounter risks; the verification is to query all trajectories within a certain time period before and after the current time based on the vessel AIS data stored in S1 for the potential encounter vessels to determine if there are vessel AIS trajectories within a distance of less than 1 nautical mile around them. If so, there is an encounter event for the current vessel, determine the encounter type, and store the vessel AIS data corresponding to the encounter event; otherwise, there is no encounter event for the current vessel.
[0010] Preferably, the database in S1 uses a Postgresql database or an Alibaba Cloud ADBPG spatio-temporal database; the cleaning in S1 uses an open-source ETL tool.
[0011] Preferably, the time corresponding to the time slice in S2 can be configured according to requirements.
[0012] Preferably, the time corresponding to the time slice in S2 is 10 minutes.
[0013] Preferably, the process of screening potential encounter vessels in S3 is as follows:
[0014] Step 1: Screen vessels that are not stationary and have a speed over the ground greater than 7 knots.
[0015] Step 2: Screen the vessels obtained in Step 1 that are in open sea areas; the vessels in open sea areas are vessels with no ports within 30 nautical miles of the current position of the vessel.
[0016] Step 3: Exclude vessels for which the differences in longitude and latitude between the vessels obtained in Step 2 and the surrounding vessels are all greater than 1.
[0017] Step 4: Screen vessels obtained in Step 3 that are within a distance of less than or equal to 10 nautical miles from the surrounding vessels to obtain potential encounter vessels.
[0018] Preferably, the speed over the ground in Step 1, the range of the open sea area in Step 2, the difference in longitude and latitude in Step 3, and the distance in Step 4 can be adjusted according to requirements.
[0019] Preferably, the calculation process for the distance between a vessel and another vessel or the distance between a vessel and a port is: Assume the coordinate point of the vessel is represented by P 1 and the coordinate point of another vessel or the port is represented by P 2 then the formula for calculating the distance is:
[0020]
[0021] Where: d is the distance between two coordinate points; is the latitude of the coordinate point P 1 ; is the latitude of the coordinate point P 2 ; Δλ is the difference in longitude between the coordinate point P 1 and the coordinate point P 2 , Δλ = λ 1 - λ 2 , where: λ 1 is the longitude of the coordinate point P 1 , λ 2 is the longitude of the coordinate point P 2 ; R is the radius of the simplified spherical model of the earth; M_2_NM is a function that converts meters to nautical miles.
[0022] Preferably, the encounter types described in S3 include: head-on, crossing, overtaking; the verification described in S3 means that the potentially encountering ships are sequentially returned to the ship AIS data stored in the database, and all their trajectories in the previous and next 10 minutes are queried to determine whether there are ship AIS trajectories with a distance less than 1 nautical mile.
[0023] The present invention also provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that when the processor executes the computer program, the method for calculating ship encounters based on time slices is implemented.
[0024] The present invention also provides a computer-readable storage medium, characterized in that a computer execution instruction is stored in the computer-readable storage medium; when the computer execution instruction is executed by a processor, it is used to implement the method for calculating ship encounters based on time slices.
[0025] Beneficial effects:
[0026] The present invention provides a method for calculating ship encounters based on time slices, which collects global ship AIS signals, decodes the ship AIS signals to obtain ship AIS data, then cleans the ship AIS data, deletes duplicate and abnormal ship AIS data, reduces the amount of ship AIS data participating in subsequent processing, and stores the cleaned ship AIS data in a database; the ship AIS data stored in S1 is sliced according to time to obtain multiple time slices, and the ship AIS data with the smallest time corresponding to each ship on each time slice is stored. If there is no ship AIS data of a certain ship on the current time slice, the ship AIS data with the smallest time corresponding to this ship on the previous time slice is taken as the ship AIS data corresponding to the current slice, and the time of the ship AIS data is adjusted to the current time slice and stored. Through the above method, the amount of ship AIS data can be greatly reduced, thereby significantly improving the speed of subsequent data calculation. At the same time, through the above method, the quality of ship AIS data can be greatly compensated, and the accuracy of subsequent calculations can be improved; potential encounter ships are screened and the screened potential encounter ships are verified to determine whether there is an encounter event for the potential encounter ships. The ship encounters can be analyzed from two perspectives: real-time and historical, providing strong support for ship risk management decisions and solving the problem that there is no detailed method in the current industry to calculate and count the encounter events of all ships.
[0027] The process of screening potential encounter ships is as follows: screening ships that are non-stationary and have a speed over water greater than 7 knots; screening the ships obtained above that are in open waters; excluding the ships above in which the longitude and latitude differences from surrounding ships are all greater than 1; screening the ships above in which the distance from surrounding ships is less than or equal to 10 nautical miles to obtain potential encounter ships. Through condition exclusion, the number of ships participating in the calculation is ultimately greatly reduced, thereby greatly reducing the amount of ship AIS data for parameter calculation and improving the calculation speed. It has been verified that through the above screening, the ship calculation range can be compressed to an acceptable range, which is beneficial to the safe navigation of ships. Brief Description of the Drawings
[0028] Figure 1 It is a flowchart of the method for calculating ship encounters based on time slices according to an embodiment of the present invention.
[0029] Figure 2 It is the storage form of ship AIS data in the database according to an embodiment of the present invention.
[0030] Figure 3 It is the storage form of ship AIS data for each time slice according to an embodiment of the present invention.
[0031] Figure 4 It is the storage form of port data according to an embodiment of the present invention.
[0032] Figure 5 This is a schematic diagram of various encounter types in the embodiments of the present invention.
[0033] Figure 6 This is the storage form of ship encounter record data in the embodiments of the present invention. Detailed implementation manners
[0034] The following further describes the present invention with reference to the accompanying drawings:
[0035] The first group of embodiments, a method for calculating ship encounters based on time slices
[0036] This group of embodiments provides a method for calculating ship encounters based on time slices. As Figure 1 shown, the method includes the following steps:
[0037] S1: Collect global ship AIS signals, decode the ship AIS signals to obtain ship AIS data, then clean the ship AIS data, and store the cleaned ship AIS data in a database; the ship AIS data includes: ship MMSI, time, longitude and latitude, current ship status, speed, and ship heading; the current ship status includes anchoring, berthing, sailing, etc.; the database uses a Postgresql database or an Alibaba Cloud ADBPG spatio-temporal database; the cleaning uses an open-source ETL tool.
[0038] S2: Split the ship AIS data stored in S1 according to time to obtain multiple time slices, and store the ship AIS data with the smallest time corresponding to each ship on each time slice. If there is no ship AIS data of a certain ship on the current time slice, then take the ship AIS data with the smallest time corresponding to this ship on the previous time slice as the ship AIS data corresponding to the current slice, and adjust the time of the ship AIS data to the current time slice and store it; the time corresponding to each time slice can be configured according to requirements.
[0039] S3: Screen potential encounter ships and verify the screened potential encounter ships to check whether there is an encounter event; the screening refers to screening all ships on each time slice in S2 to screen ships with potential encounter risks; the verification is to query all trajectories within a certain time period before and after the current time based on the ship AIS data stored in S1 for the potential encounter ships to determine whether there are ship AIS trajectories with a distance less than 1 nautical mile around them. If so, there is an encounter event for the current ship, determine the encounter type, and store the ship AIS data corresponding to the encounter event; otherwise, there is no encounter event for the current ship; the encounter types include: head-on encounter, crossing encounter, overtaking encounter.
[0040] In a specific embodiment of the present invention, the process of screening potential encounter ships is as follows:
[0041] Step 1: Screen ships that are not stationary and have a speed over water greater than a certain value;
[0042] Step 2: Screen the ships obtained in Step 1 that are in open sea areas; the ships in open sea areas are those without ports within a certain nautical mile near the current position of the ship;
[0043] Step 3: Exclude ships among those obtained in Step 2 whose longitude and latitude differences from surrounding ships are all greater than a certain value;
[0044] Step 4: Screen the ships obtained in Step 3 whose distances from surrounding ships are less than or equal to a certain nautical mile to obtain potential encounter ships.
[0045] During the above process of screening potential encounter ships, for the distance between a ship and another ship or the distance between a ship and a port, assuming the coordinate point of the ship is represented by P 1 and the coordinate point of another ship or the port is represented by P 2 , the calculation formula for the distance is:
[0046]
[0047] where: d is the distance between the two coordinates; is the latitude of the coordinate point P 1 ; is the latitude of the coordinate point P 2 ; Δλ is the longitude difference between the coordinate point P 1 and the coordinate point P 2 , Δλ = λ 1 -λ 2 , where: λ 1 is the longitude of the coordinate point P 1 , λ 2 is the longitude of the coordinate point P 2 ; R is the radius of the simplified spherical model of the earth; M_2_NM is a function that converts meters to nautical miles.
[0048] The following uses specific data to illustrate the above method for calculating ship encounters based on time slices, specifically as follows:
[0049] 1. Collect, clean, and store global ship AIS data
[0050] Collect AIS signals of 200,000 major merchant ships globally, decode the obtained ship AIS signals to get initial ship AIS data, clean the ship AIS data through an ETL tool, and store the cleaned ship AIS data in a Postgresql database, denoted as S a, which provides support for subsequent slicing calculations. The storage form of ship AIS data in the database is as Figure 2 shown. Ship AIS data mainly includes ship AIS mmsi , time AIS t , longitude and latitude AIS lon / lat , speed AIS speed , current ship status AIS status , ship's heading AIS hdg .
[0051] 2. Generate time slice data
[0052] The quality of ship AIS data is uneven. Some ships send AIS signals every minute, while some ships may send AIS signals after many hours. The time slicing method is to evenly distribute the AIS data of these ships on each time slice. In the specific embodiment of this application, the ship AIS data in S a is sliced according to 10 minutes per slice, that is, every 10 minutes is a slice, then the time range corresponding to time t is T t , and the slice is S t . For example, the slice at 0:00 on January 1, 2023 covers the AIS data from 23:55 on December 31, 2022 to 0:04 on January 1, 2023. The next slice is 0:10 on January 1, 2023. Similarly, it contains the AIS data from 0:05 on January 1, 2023 to 0:14 on January 1, 2023.
[0053] Particularly, when the quality of the ship AIS data of a certain ship is high, that is, the sending frequency of the AIS signal is relatively high, there are multiple pieces of the ship AIS data of this ship on a certain time slice. At this time, the ship AIS data of the earliest time is taken as the ship AIS data of the ship for storage; when the quality of the ship AIS data of a certain ship is poor, that is, the AIS signal is sent only after a long time interval, the ship AIS data of this ship in the previous time slice is taken, and the time of the ship AIS data is adjusted to the current slice and then stored. The ship AIS data on the time slice is stored in the Figure 3 form as Figure 3 shown. One piece of ship AIS data of all current ships in navigation is stored on the time slice. Through the above method, not only the amount of the ship AIS data of some ships is reduced, but also the ship AIS data of all ships in navigation can be evenly distributed on each time slice, which is convenient for subsequent judgment of the meeting time of ships.
[0054] In a specific embodiment, in each time slice, the record with the smallest time in the time range corresponding to the time slice is taken, or the previous slice St_pre The record in; S t represents the record with the minimum time within the time range:
[0055] S t = {select(AIS mmsi , AIS t... ) from S a where(AIS mmsi , AIS t. ) in (select AIS mmsi ,
[0056] min(AIS t ) from S a where AIS t in T t group by AIS mmsi )}
[0057] S t ’ represents the record from the previous slice S t_pre :
[0058] S t ’ = {select(AIS mmsi , AIS t... ) from S t_pre where AIS mmsi not in (select AIS mmsi ) from S t)}
[0059] Merge S t and S t ’ to obtain the complete ship time slice data.
[0060] 3. Calculate ship encounters
[0061] After generating the ship time slice data, calculate ship encounters in each time slice according to the following two steps:
[0062] (1) Calculate potential encounter ships E t ’:
[0063] According to past experience, in open waters, if the distance between ships is less than 1 nautical mile, there is a risk of collision. If there is no port within 30 nautical miles of the current ship's position, it means the ship is in open waters. Define approximately 5,000 basic ports globally. The basic port data is stored in the database in the Figure 4 form. As Figure 5 shown, the encounters between the current ship and surrounding ships are divided into three types: head-on, crossing, and overtaking.
[0064] In theory, all AIS position coordinates of in - transit vessels are saved in any time slice. If the distances between all vessels are directly calculated, the computational load will exceed the bearable range. Therefore, potential encountering vessels need to be screened. In theory, if the distance is less than 1 nautical mile, the difference in longitude and latitude in the AIS data of the vessels should be less than 1. The screening is carried out step by step as follows:
[0065] Step 1: Screen vessels that are not stationary and have a speed over water greater than 7 knots. The screening formula is:
[0066] E t ’ = {select(AIS mmsi ,AIS t... )from S t where AIS speed >=7 AND AISstatus = ‘navigating’}
[0067] It has been verified that 80% of the vessels in the library can be filtered by the above method;
[0068] Step 2: Based on the result of the previous step, continue to screen. Screen vessels in open waters based on the port name P name , port code P mmsi , and port longitude and latitude P lon / lat in the port data P. The screening formula is:
[0069] E t ’ = {select(AIS mmsi ,AIS t... )from E t ’ where not esists(select 1 from P where d(AIS lon / lat ,P lon / lat )<=30)}
[0070] It has been verified that, based on the result of the previous step, 60% more vessels can be filtered;
[0071] Step 3: Exclude all vessels for which the difference in longitude and latitude of all vessels near them in the library is greater than 1. It has been verified that, based on the result of the previous step, 50% more vessels can be filtered;
[0072] Step 4: Screen vessels among the remaining vessels that have nearby vessels with a distance less than or equal to 10 nautical miles; It has been verified that, based on the result of the previous step, 70% more vessels can be filtered.
[0073] The screening conditions of the above Step 3 and Step 4 can be put in one formula, and the formula is as follows:
[0074] E t’ = {select(AIS mmsi , AIS t... ) from E t ’ t1 where exists(select 1 from E t t2 where t1.AIS lon - t2.AIS lon < 1 or t1.AIS lat - t2.AIS lat ) < 1) and d(t1.AIS lon / lat , t2.AIS lon / lat ) <= 10}
[0075] After the above steps 1 - 4, the ship calculation range can be compressed to an acceptable range. When the number of ships in navigation increases or decreases, the speed relative to water in step 1, the range of the open sea area in step 2, the difference in longitude and latitude in step 3, and the distance in step 4 can be adjusted according to requirements, and finally it can meet the requirement of compressing the ship calculation range to an acceptable range.
[0076] (2) Verify the encountering ship E t :
[0077] After the above step (1), the remaining ships are potential encountering ships. Query all the trajectories of these ships in the AIS data table for the previous and next 10 minutes in turn and judge whether there are ship AIS trajectories with a distance less than 1 nautical mile. The formula is as follows:
[0078] E t = {select(AIS mmsi , AIS t... ) from S a t1 where AIS mmsi in(select AIS mmsi from E t ’) and exists(select 1 from S a t2 where t2.AIS t between t1.AIS t - ‘10mins’ and t1.AIS t + ‘10mins’ and d(t1.AIS lon / lat , t2.AIS lon / lat ) < 1}
[0079] And record the ship AIS data of the current ship and the corresponding ship AIS data of the encountering ship (encounter record data) at the current time slice. The encounter record data of the ship is in accordance withFigure 6 Stored in a form
[0080] The second group of embodiments, an electronic device
[0081] This group of embodiments provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the method for calculating ship encounters based on time slices described in the first group of embodiments.
[0082] The third group of embodiments, a computer-readable storage medium
[0083] This group of embodiments provides a computer-readable storage medium, in which computer-executable instructions are stored; when the computer-executable instructions are executed by a processor, they are used to implement the method for calculating ship encounters based on time slices described in the first group of embodiments.
[0084] It should be noted that the above specific implementation manners can enable those skilled in the art to understand the present invention and creation more comprehensively, but do not limit the present invention and creation in any way. Therefore, although this specification has described the present invention and creation in detail with reference to the drawings and embodiments, those skilled in the art should understand that the present invention and creation can still be modified or equivalently replaced. In short, all technical solutions and their improvements that do not depart from the spirit and scope of the present invention and creation should be covered by the protection scope of the patent of the present invention and creation.
Claims
1. A method for calculating ship encounters based on time slices, characterized in that: The steps include: S1: Collect global ship AIS signals, decode ship AIS signals to obtain ship AIS data, then clean the ship AIS data and store the cleaned ship AIS data in the database; S2: The ship AIS data stored in S1 is divided into multiple time slices according to time, and the ship AIS data with the smallest time corresponding to each searched ship on each time slice is taken for storage. If there is no ship AIS data of a certain ship on the current time slice, the ship AIS data with the smallest time corresponding to the ship on the previous time slice is taken as the ship AIS data corresponding to the current slice, and the time of the ship AIS data is adjusted to the current time slice and stored; S3: Screening potential encounter ships and verifying the screened potential encounter ships to verify whether there is an encounter event for the potential encounter ships; the screening refers to screening all ships on each time slice in S2 to screen ships with potential encounter risks; the verification is to query all trajectories of the potential encounter ship within a certain period of time before and after the current time based on the ship AIS data stored in S1 to determine whether there is a ship AIS trajectory with a distance less than 1 nautical mile around it. If so, there is an encounter event for the current ship, determine the encounter type, and store the ship AIS data corresponding to the encounter event; otherwise, there is no encounter event for the current ship.
2. The method for calculating ship encounters based on time slices according to claim 1, characterized in that: The database described in S1 uses Postgresql database or Alibaba Cloud ADBPG spatiotemporal database; the cleaning described in S1 uses open source ETL tools.
3. The method for calculating ship encounters based on time slices according to claim 3, characterized in that: The time corresponding to the time slice in S2 can be configured according to requirements.
4. The method for calculating ship encounters based on time slices according to claim 3, characterized in that: The time slice in S2 corresponds to 10 minutes.
5. The method for calculating ship encounters based on time slices according to claim 1, characterized in that: The process of screening potential encounter vessels described in S3 is: Step 1: Screening of non-stationary ships with a water speed greater than 7 knots; Step 2: Screening the ships in the open sea from the ships obtained in step 1; the ships in the open sea are ships that have no port within 30 nautical miles of the current position of the ship; Step 3: Eliminate the ships whose latitude and longitude differences between the ships obtained in step 2 and the surrounding ships are greater than 1; Step 4: Filter the ships obtained in step 3 and the surrounding ships whose distance is less than or equal to 10 nautical miles to obtain potential encounter ships.
6. The method for calculating ship encounters based on time slices according to claim 5, characterized in that: The water speed in step 1, the range of the open sea in step 2, the longitude and latitude difference in step 3, and the distance in step 4 can be adjusted as needed.
7. The method for calculating ship encounters based on time slices according to claim 6, characterized in that: The distance between a ship and another ship or between a ship and a port is calculated as follows: Assuming that the coordinate point of the ship is represented by P1 and the coordinate point of the other ship or port is represented by P2, the distance calculation formula is: Where: d is the distance between two coordinate points; is the latitude of coordinate point P1; is the latitude of coordinate point P2; Δλ is the difference in longitude between coordinate point P1 and coordinate point P2, Δλ=λ1-λ2, where: λ1 is the longitude of coordinate point P1, λ2 is the longitude of coordinate point P2; R is the radius of the simplified spherical model of the earth; M_2_NM is the function that converts the unit meter into nautical miles.
8. The method for calculating ship encounters based on time slices according to claim 7, characterized in that: The types of encounters described in S3 include: encounter, crossing, and overtaking; the verification described in S3 means returning the potential encountering ships to the ship AIS data stored in the database in sequence, querying all their tracks within 10 minutes before and after, and determining whether there is a ship AIS track with a distance less than 1 nautical mile.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for calculating ship encounters based on time slices as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions; when the computer-executable instructions are executed by the processor, they are used to implement the method for calculating ship encounters based on time slices as described in any one of claims 1-7.
Citation Information
Patent Citations
Ship probability conflict detection method based on minimum safe distance model
CN113536544A
Ship automatic identification system data processing system and method
CN115422308A
Hub river reach experience channel generation method based on big data
CN117672008A
Ship wandering detection method based on AIS data
US20220171796A1
Cited By
Connection relation detection method and device, program product and storage medium
CN121327407A