Method, device and storage medium for calculating ship encounter based on time slicing
By processing ship AIS data using a time-slicing method, potential encountering vessels can be screened and verified. This solves the problem that existing technologies cannot calculate ship encounter events in detail, improves calculation speed and accuracy, and ensures maritime navigation safety.
Patent Information
- Application Number
- CN202510032954.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2045-01-08
AI Technical Summary
Current technology lacks detailed methods for calculating and statistically analyzing all encounters between ships, which makes it impossible to guarantee the safety of maritime navigation.
A time-slicing-based approach is adopted, using Alibaba Cloud ADBPG spatiotemporal database to collect and decode ship AIS signals. After cleaning the data, it is stored in the database and processed by time slices to screen potential encountering ships and verify their encounter events. This includes screening ships that are not stationary, have a water speed greater than 7 knots, are in open sea, and have a latitude-longitude difference of less than 1. The distance between them and other ships is calculated to determine the encounter type.
It significantly reduces the amount of ship AIS data, improves calculation speed and accuracy, provides support for real-time and historical analysis, provides strong support for ship risk management decisions, and ensures the safe navigation of ships.
Smart Images

Figure CN120144891B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of shipping informatization and shipping digitization, and particularly relates to a method, device and storage medium for calculating ship encounter based on time slicing. BACKGROUND
[0002] With the continuous development of the shipping industry, the density of sea ships is increasing, and the ship encounter situation is gradually complicated. Ship encounter is a necessary condition for ship collision. In recent years, ship collision accidents have occurred from time to time. Ship collision accidents sometimes cause serious personnel and property losses. Therefore, quickly and accurately extracting ship encounter events is the key to improving the water traffic safety supervision capability. In order to solve this problem, many experts and scholars have carried out extensive research on the automation of ship collision avoidance decision. To this day, 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 scene of ships in open waters from the perspective of space and time through the AIS trajectory of the ship. However, due to the lack of AIS data sources, large amount of AIS data and large amount of calculation, there is currently no detailed method to calculate and count all ship encounter events in the industry, so that the safety of ships sailing at sea cannot be guaranteed. SUMMARY
[0004] The present application solves the problem that there is currently no detailed method to calculate and count all ship encounter events in the industry, and provides a method for calculating ship encounter based on time slicing. With the aid of Aliyun ADBPG spatiotemporal database, the encounter events of ships in the database are calculated through AIS time slicing data of the ships.
[0005] The technical solution claimed in the present application is as follows:
[0006] A method for calculating ship encounter based on time slicing, comprising the following steps:
[0007] S1: Collecting global ship AIS signals, decoding the ship AIS signals to obtain ship AIS data, cleaning the ship AIS data, and storing the cleaned ship AIS data into a database;
[0008] S2: Dividing the ship AIS data stored in S1 according to time to obtain a plurality of time slices, storing the ship AIS data corresponding to the minimum time of each search ship on each time slice, if there is no ship AIS data of a ship on the current time slice, taking the ship AIS data corresponding to the minimum time of the ship on the previous time slice as the ship AIS data corresponding to the current slice, and adjusting the time of the ship AIS data to the current time slice and storing it.
[0009] S3: screening potential encounter ships and verifying the screened potential encounter ships to determine whether the potential encounter ships have an encounter event; the screening is screening all ships on each time slice in S2 to determine ships with potential encounter risks; the verification is querying all trajectories of the potential encounter ships within a certain time period before and after the current time based on the AIS data of the ships stored in S1 to determine whether there are ships with AIS trajectories within a distance of 1 nautical mile around the potential encounter ships, if there are, the current ship has an encounter event, the encounter type is determined, and the AIS data of the ships corresponding to the encounter event is stored; otherwise, the current ship does not have an encounter event.
[0010] Preferably, the database in S1 adopts a Postgresql database or an ADBPG space-time database of Ali Cloud; and the cleaning in S1 adopts 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 ships in S3 is as follows:
[0014] Step 1: screening ships with a speed greater than 7 knots on water and not at rest;
[0015] Step 2: screening ships in open sea from the ships obtained in step 1; the ships in open sea are ships without ports within 30 nautical miles around the current positions of the ships;
[0016] Step 3: excluding ships with a longitudinal and latitudinal difference greater than 1 from the ships obtained in step 2 and ships around the ships;
[0017] Step 4: screening ships with a distance less than or equal to 10 nautical miles from the ships obtained in step 3 and ships around the ships to obtain potential encounter ships.
[0018] Preferably, the speed on water in step 1, the range of open sea in step 2, the longitudinal and latitudinal difference in step 3, and the distance in step 4 can be adjusted according to requirements.
[0019] Preferably, the calculation process of the distance between a ship and another ship or the distance between a ship and a port is as follows: assuming that the coordinate point of the ship is represented by P1, and the coordinate point of another ship or a port is represented by P2, the calculation formula of the distance is:
[0020]
[0021] wherein d is the distance between the two coordinate points. is the latitude of coordinate point P1; is the latitude of coordinate point P2; Delta lambda is the longitude difference of coordinate point P1 and coordinate point P2, Delta lambda = lambda1 - lambda2, wherein: lambda1 is the longitude of coordinate point P1, and lambda2 is the longitude of coordinate point P2; R is the radius of a simplified spherical model of the earth; M_2_NM is a function of converting units of meters into nautical miles.
[0022] Preferably, the encounter types in S3 include: meeting, crossing and overtaking; and the verification in S3 refers to returning the potential encounter ship to the AIS data of the ship stored in the database in sequence, inquiring all trajectories within 10 minutes before and after the ship and judging whether there is a ship AIS trajectory with a distance less than 1 nautical mile.
[0023] The application further provides 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 encounter based on time slicing when executing the computer program.
[0024] The application further provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions; and the computer execution instructions are executed by a processor to implement the method for calculating ship encounter based on time slicing.
[0025] Beneficial effects:
[0026] The application provides a method for calculating ship encounter based on time slicing, collects global ship AIS signals, decodes the ship AIS signals to obtain ship AIS data, cleans the ship AIS data, deletes repeated and abnormal ship AIS data, reduces the amount of subsequent ship AIS data participating in processing, and stores the cleaned ship AIS data into a database; the ship AIS data stored in S1 is divided into multiple time slices according to time, the ship AIS data corresponding to the minimum time of each ship in each time slice is stored, if there is no ship AIS data of a ship in the current time slice, the ship AIS data corresponding to the minimum time of the ship in 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, so that the speed of subsequent data calculation is significantly improved, at the same time, through the above method, the quality of ship AIS data can be greatly improved, and the accuracy of subsequent calculation is improved; potential encounter ships are screened and the screened potential encounter ships are verified, whether the potential encounter ships exist encounter events is verified, the ship encounter can be analyzed from two points of real time and history, strong support is provided for ship risk management decision, and the problem that there is no detailed method for calculating and counting all ship encounter events in the current industry is solved.
[0027] The process of screening potential encounter ships is as follows: screening ships with a speed greater than 7 knots and not at rest; screening ships in the above-mentioned ships in open sea areas; excluding ships with a latitude and longitude difference greater than 1 from the above-mentioned ships; screening ships with a distance less than or equal to 10 nautical miles from the above-mentioned ships, obtaining potential encounter ships, and finally greatly reducing the number of ships participating in calculation, thereby greatly reducing the amount of ship AIS data for parameter calculation, improving the calculation speed, and verifying that the ship calculation range can be compressed to an acceptable range after the above screening, which is beneficial to the safe navigation of ships. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 The method flow chart for calculating ship encounter based on time slicing of the embodiment of the application.
[0029] Figure 2 The storage form of ship AIS data in the database of the embodiment of the application.
[0030] Figure 3 The storage form of ship AIS data of each time slice of the embodiment of the application.
[0031] Figure 4 The port data storage form of the embodiment of the application.
[0032] Figure 5 The schematic diagram of each encounter type of the embodiment of the present application.
[0033] Figure 6 The storage form of the ship encounter record data of the embodiment of the present application. DETAILED DESCRIPTION
[0034] The present application will be further described below in combination with the drawings:
[0035] The first group of embodiments, a method for calculating ship encounter based on time slicing
[0036] The present group of embodiments provides a method for calculating ship encounter based on time slicing, as shown in the following steps: Figure 1
[0037] S1: Collecting global ship AIS signals, decoding the ship AIS signals to obtain ship AIS data, cleaning the ship AIS data, and storing the cleaned ship AIS data into a database; the ship AIS data includes: ship MMSI, time, latitude and longitude, current ship state, speed, and ship heading; the current ship state includes anchoring, berthing, sailing, etc.; the database uses a Postgresql database or an ADBPG space-time database of Ali Cloud; the cleaning uses an open source ETL tool.
[0038] S2: Dividing the ship AIS data stored in S1 according to time to obtain multiple time slices, storing the ship AIS data corresponding to the minimum time of each search ship on each time slice, if there is no ship AIS data of a ship on the current time slice, taking the ship AIS data corresponding to the minimum time of the ship on the previous time slice as the ship AIS data corresponding to the current slice, adjusting the time of the ship AIS data to the current time slice, and storing the ship AIS data; the corresponding time of each time slice can be configured according to requirements.
[0039] S3: Screening potential encounter ships and verifying the screened potential encounter ships to determine 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 to determine whether there is a ship AIS trajectory within a distance of 1 nautical mile around the potential encounter ship, if there is, the current ship has an encounter event, the encounter type is determined, and the ship AIS data corresponding to the encounter event is stored; otherwise, the current ship does not have an encounter event; the encounter type includes: meeting, crossing, and overtaking;
[0040] In the specific embodiments of the present application, the process of screening potential encounter ships is as follows:
[0041] Step 1: screening ships that are not stationary and have a water speed greater than a certain value;
[0042] Step 2: screening ships in Step 1 that are in open sea; the ships in open sea are ships that have no port within a certain nautical miles near the current position of the ships;
[0043] Step 3: excluding ships in Step 2 that have a longitudinal and latitudinal difference with surrounding ships greater than a certain value;
[0044] Step 4: screening ships in Step 3 that have a distance to surrounding ships less than or equal to a certain nautical mile, to obtain potential encounter ships.
[0045] In the above process of screening potential encounter ships, the distance between a ship and another ship or the distance between a ship and a port, assuming that the coordinate point of the ship is represented by P1 and the coordinate point of the other ship or the port is represented by P2, the calculation formula of the distance is as follows:
[0046]
[0047] Wherein: d is the distance between two coordinates; is the latitude of coordinate point P1; is the latitude of coordinate point P2; Δλ is the longitudinal difference between coordinate point P1 and coordinate point P2, Δλ = λ1 - λ2, wherein λ1 is the longitude of coordinate point P1 and λ2 is the longitude of coordinate point P2; R is the radius of the simplified spherical model of the earth; M_2_NM is a function of converting units of meters to nautical miles.
[0048] The above method of calculating ship encounter based on time slicing is described below in combination with specific data as follows:
[0049] 1. Collect, clean and store global ship AIS data
[0050] Collect 200,000 AIS signals of major merchant ships worldwide, decode the obtained ship AIS signals to obtain 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 , to support subsequent slicing calculation. The storage form of ship AIS data in the database is shown in Figure 2 . The ship AIS data mainly includes ship AIS mmsi , time AIS t , latitude and longitude AIS lon / lat , speed AIS speed , and current ship state AISstatus , the ship bow AIS hdg .
[0051] 2, generating time slice data
[0052] The quality of ship AIS data is uneven, some ships will send AIS signals every minute, while some ships may send AIS signals after several hours. The method of time slicing is to evenly distribute the AIS data of these ships on each time slice. In the specific embodiment of the application, the ship AIS data in S a is divided into 10-minute slices, that is, each 10 minutes is a slice, and the time range corresponding to time t is T t , and the slice is S t , for example, the slice at 0 o'clock on January 1, 2023 covers AIS data from 23:55 on December 31, 2022 to 0:04 on January 1, 2023, and the next slice is 0:10 on January 1, 2023. Similarly, it contains AIS data from 0:05 on January 1, 2023 to 0:14 on January 1, 2023.
[0053] In particular, when the quality of ship AIS data of a ship is high, that is, the sending frequency of AIS signals is high, there are multiple ship AIS data of the ship on a certain time slice, at this time, the earliest ship AIS data is taken as the ship AIS data of the ship for storage; when the quality of ship AIS data of a ship is poor, that is, the time interval is long, the ship will send AIS signals, the ship AIS data of the ship in the previous time slice is taken and the time of the ship AIS data is adjusted to the current slice for storage. The ship AIS data on the time slice is stored in the form of Figure 3 , as shown in Figure 3 , a piece of ship AIS data of all ships currently at sea is stored on the time slice, through the above method, not only the amount of ship AIS data of some ships is reduced, but also the ship AIS data of all ships at sea is evenly distributed on each time slice, which facilitates subsequent encounter time judgment of ships.
[0054] In specific embodiments, in each time slice, the record with the minimum time in the time range corresponding to the time slice is taken, or the record in the previous slice S t_pre ; S t represents the record with the minimum time in the time range:
[0055] S t ={select(AIS mmsi ,AIS t... )from S awhere(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 records 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] Merging S t and S t ’ gives the complete vessel time-slice data.
[0060] 3. Calculate vessel encounters
[0061] After generating the time-slice data of vessels, the vessel encounters are calculated in each time-slice in two steps as follows:
[0062] (1) Calculate potential encounter vessels E t ’:
[0063] According to past experience, if the distance between vessels is less than 1 nautical mile in open sea, there is a risk of collision. If there is no port within 30 nautical miles of the current position of the vessel, it means that the vessel is in open water. There are about 5000 basic ports in the world. The basic port data is stored in the database in the form of Figure 4 As shown in Figure 5 , the encounter of the current vessel with surrounding vessels is divided into three types: meeting, crossing and overtaking.
[0064] In theory, all AIS position coordinates of vessels at sea are saved in any time-slice. If the distance between all vessels is directly calculated, the amount of calculation will exceed the bearing range, so potential encounter vessels need to be screened. In theory, if the distance between vessels is less than 1 nautical mile, the difference between the latitude and longitude in the AIS data of the vessels should be less than 1. The potential encounter vessels are screened in the following steps:
[0065] Step 1: Screen for ships that are not stationary and have a speed relative to the water greater than 7 knots. The screening formula is as follows:
[0066] E t '={select(AIS mmsi AIS t... )from S t where AIS speed >=7 AND AISstatus='Sailing'}
[0067] It has been verified that the above method can filter out 80% of the ships in the warehouse;
[0068] Step 2: Continue filtering based on the previous step, using port name P from the port data P. name Port code P mmsi Port latitude and longitude P lon / lat The formula for screening vessels in open waters is as follows:
[0069] E t '={select(AIS mmsi AIS t... )from E t 'where not esists(select 1 from Pwhere d(AIS lon / lat ,P lon / lat )<=30)}
[0070] It has been verified that, based on the previous step, an additional 60% of ships can be filtered.
[0071] Step 3: Exclude all ships in the vicinity of the existing ships whose latitude and longitude difference is greater than 1. After verification, based on the previous step, filter another 50% of the ships.
[0072] Step 4: Select vessels within 10 nautical miles of the remaining vessels; after verification, continue filtering by 70% of the vessels based on the previous step.
[0073] The two filtering conditions in steps 3 and 4 above can be placed in one formula, as follows:
[0074] E t '={select(AIS mmsi AIS t... )from E t 't1 where esists(select 1 from E t t2where 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 increases or decreases, the water speed in step 1, the range of the open sea in step 2, the latitude and longitude difference in step 3, and the distance in step 4 can be adjusted according to the needs, and finally the ship calculation range can be compressed to an acceptable range.
[0076] (2) Verify the encountered ship E t :
[0077] After the above step (1), the remaining ships are potential encounter ships. The ship will be returned to the AIS data table in sequence to query all the trajectories of the previous and subsequent 10 minutes and judge whether there is a ship AIS trajectory 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 fromE t ’)and esists(select 1 from S a t2 where t2.AIS t between t1.AIS t -‘10mins’andt1.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 encountered ship (encounter record data) at the current time slice. The encounter record data of the ship is stored in the form of Figure 6 .
[0080] Second embodiment, an electronic device
[0081] The embodiments of the present application provide an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the method for calculating ship encounter based on time slicing according to the first group of embodiments when executing the computer program.
[0082] The third group of embodiments, a computer readable storage medium
[0083] The embodiments of the present application provide a computer readable storage medium, wherein computer execution instructions are stored in the computer readable storage medium; and the computer execution instructions are used for implementing the method for calculating ship encounter based on time slicing according to the first group of embodiments when executed by a processor.
[0084] It should be noted that the above specific embodiments can make those skilled in the art more fully understand the present application, but in no way limit the present application. Therefore, although the present application has been described in detail with reference to the drawings and embodiments, those skilled in the art should understand that the present application can still be modified or replaced by equivalents, in short, all technical solutions and improvements which do not depart from the spirit and scope of the present application should be covered in the protection scope of the patent of the present application.
Claims
1. A method of calculating ship encounters based on time slicing, characterized in that, The method comprises the following steps: S1: collecting global ship AIS signals, decoding the ship AIS signals to obtain ship AIS data, cleaning the ship AIS data, and storing the cleaned ship AIS data in a database; S2: dividing the ship AIS data stored in S1 into multiple time slices according to time, storing the ship AIS data corresponding to the minimum time of each ship in each time slice, if there is no ship AIS data of a ship in the current time slice, taking the ship AIS data corresponding to the minimum time of the ship in the previous time slice as the ship AIS data corresponding to the current slice, adjusting the time of the ship AIS data to the current time slice, and storing the ship AIS data; S3: screening potential encounter ships and verifying the screened potential encounter ships to determine whether there is an encounter event; the screening refers to screening all ships in each time slice in S2 to screen ships with potential encounter risks; the verification refers to querying all trajectories of a potential encounter ship in a certain time period before and after the current time based on the ship AIS data stored in S1 to determine whether there is a ship AIS trajectory within a distance of 1 nautical mile around the potential encounter ship, if there is, the current ship has an encounter event, the type of encounter is determined, and the ship AIS data corresponding to the encounter event is stored; otherwise, the current ship does not have an encounter event; The process of screening potential encounter ships comprises: Step 1: screening ships with a speed greater than 7 knots and not at rest; Step 2: screening ships in open waters from the ships obtained in step 1; the ships in open waters are ships without a port within 30 nautical miles around the current position of the ships; Step 3: excluding ships with a latitude and longitude difference greater than 1 from the ships obtained in step 2; Step 4: screening ships with a distance less than or equal to 10 nautical miles from surrounding ships to obtain potential encounter ships; The distance between a ship and another ship or the distance between a ship and a port, assuming that the coordinate point of the ship is P1 and the coordinate point of another ship or the port is P2, the distance calculation formula is: where: d is the distance between two coordinates; 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 a function to convert meters to nautical miles.
2. A method of time-slice based computation of ship encounters according to claim 1, characterized in that, The database in S1 adopts a Postgresql database or an Aliyun ADBPG spatiotemporal database; the cleaning in S1 adopts an open-source ETL tool.
3. A method of time-slice based computation of ship encounters according to claim 2, characterized in that, The time corresponding to the time slice in S2 can be configured according to requirements.
4. The method of claim 3, wherein, The time corresponding to the time slice in S2 is 10 minutes.
5. A method of time-slice based computation of ship encounters according to claim 4, characterized in that, The speed in step 1, the range of open waters in step 2, the latitude and longitude difference in step 3, and the distance in step 4 can be adjusted according to requirements.
6. A method of time-slice based computation of ship encounters according to claim 5, characterized in that, The encounter types in S3 include: meeting, crossing, and overtaking; the verification in S3 refers to querying all trajectories of a potential encounter ship 10 minutes before and after the current time from the ship AIS data stored in the database, and determining whether there is a ship AIS trajectory within a distance of 1 nautical mile.
7. An electronic device comprising: The memory, the processor and the computer program stored in the memory and capable of running on the processor, characterized in that the processor implements the method for calculating ship encounter based on time slicing according to any one of claims 1-6 when running the computer program.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions; the computer execution instructions are executed by the processor to implement the method for calculating ship encounter based on time slicing according to any one of claims 1-6.
Citation Information
Patent Citations
Ship automatic identification system data processing system and method
CN115422308A
Ship wandering detection method based on AIS data
US20220171796A1