Ais and radar data fusion method and device based on haversine formula
By using the Haversine formula and interpolation algorithm to time-align and assign identifiers to AIS and radar data, the problems of unstable AIS signals and lack of identification information in radar are solved, thus achieving high-precision maritime vessel monitoring.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2026-03-31
AI Technical Summary
In existing technologies, AIS systems are susceptible to risks of being manually shut down or tampered with, have insufficient signal stability, and lack target identification information in radar data, resulting in insufficient accuracy and reliability in maritime vessel monitoring.
The Haversine formula is used to fuse AIS and radar data. The data is time-aligned by an interpolation algorithm, and the distance between targets is calculated using the Haversine formula. A unified identifier is assigned to the radar data to achieve data matching and fusion.
This has improved the accuracy and reliability of maritime vessel monitoring, and established a more accurate, continuous, and complete dynamic monitoring system for maritime vessels, meeting the requirements for high precision and high reliability.
Smart Images

Figure CN120873070B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, specifically to a method and apparatus for fusion of AIS and radar data based on the Haversine formula. Background Technology
[0002] With the booming development of the marine economy, the maritime shipping industry is becoming increasingly busy, and ship traffic continues to rise. Against this backdrop, efficient and accurate maritime vessel monitoring technology has become a key support for ensuring maritime traffic safety, optimizing shipping management, and improving the efficiency of marine resource development and utilization.
[0003] Currently, Automatic Identification Systems (AIS) are widely used in ship monitoring. AIS can automatically broadcast static information (such as the ship's unique identifier MMSI, name, and type) and dynamic data (such as the ship's real-time position (latitude and longitude), speed, and heading) to surrounding vessels and shore-based base stations. Its advantage lies in providing rich details about a ship's identity and navigation status, which can assist in maritime traffic management, collision prevention, and maritime search and rescue operations. However, AIS also has some limitations. For example, ships need to actively and correctly turn on and maintain the normal operation of AIS equipment. There is a risk of intentionally turning off or tampering with AIS information. Furthermore, in complex marine environments (such as when there is strong signal interference or the ship is in a geographically obstructed area), the transmission stability of AIS signals may be affected, leading to data loss or untimely updates.
[0004] Meanwhile, radar also plays a crucial role in maritime surveillance. Radar detects information such as a ship's position and speed by emitting electromagnetic waves and receiving reflected signals from targets. It is capable of operating around the clock and in all weather conditions, effectively monitoring ship movements even in poor visibility (such as fog or nighttime), thus compensating for some of the shortcomings of AIS. However, radar itself faces challenges. For example, radar data often lacks target identification information, providing only limited data such as position and speed, making it difficult to directly determine the ship's specific identity, type, and navigational intentions. Furthermore, radar is affected by its own physical characteristics and environmental factors, including clutter interference and target obstruction, which may lead to target identification errors or omissions.
[0005] To fully integrate the advantages of both AIS and radar ship monitoring technologies and overcome their respective shortcomings, AIS and radar data fusion technology has emerged. This technology, through specific processing procedures and algorithms, organically integrates the rich ship identification and navigation status information provided by AIS with the real-time ship position and motion information monitored by radar. Its aim is to build a more accurate, continuous, and complete dynamic monitoring system for maritime vessels, meeting the increasingly complex requirements for high precision and reliability in maritime traffic safety supervision, marine resource protection, and marine development activities. Summary of the Invention
[0006] To address the problems in the existing technology, this application provides a method and apparatus for fusion of AIS and radar data based on the Haversine formula, in order to integrate AIS information and radar information, construct a more accurate, continuous and complete dynamic monitoring system for ships at sea, and meet the requirements of high precision and high reliability for ship monitoring.
[0007] To solve at least one of the above problems, this application provides the following technical solution:
[0008] Firstly, this application provides a method for fusing AIS and radar data based on the Haversine formula, including:
[0009] Acquire AIS data and extract MMSI information from it, using it as the unique identifier for the AIS target; for AIS data with the same identifier, apply an interpolation algorithm to process them within a set time window to obtain AIS interpolated data;
[0010] Acquire Radar data, which contains a temporary identifier; within a set time window, apply an interpolation algorithm to process the data to obtain Radar interpolated data, and align the data points of the AIS interpolated data with those of the Radar interpolated data.
[0011] The Haversine formula is used to calculate the distance between the Radar interpolated data of each Radar target and each AIS interpolated data, and the calculated distance is compared with a set threshold. If the distance is less than the threshold, the Radar target is considered to be successfully matched with the corresponding AIS target. The mapping relationship of the matched data is sent to the Radar data before interpolation. In the standardization operation of Radar data, the temporary identifier of the successfully matched Radar data is converted into the corresponding identifier.
[0012] The matched portions of the AIS data and the Radar data are merged into a unified data stream and fused according to a preset algorithm to determine the final trajectory data of the target.
[0013] Furthermore, the step of processing AIS data with the same identifier using an interpolation algorithm within a set time window to obtain AIS interpolated data further includes:
[0014] After interpolation is completed, these AIS interpolated data are stored in the cache with the identifier as the key;
[0015] Before interpolation, AIS interpolation data is retrieved from the cache using an identifier, and then combined with the new AIS interpolation data to form Radar interpolation data;
[0016] The step of processing the data using an interpolation algorithm within a set time window to obtain Radar interpolated data further includes:
[0017] After interpolation is completed, these Radar interpolation data are stored in the cache with the identifier as the key;
[0018] Before interpolation, the Radar interpolation data is retrieved from the cache by the identifier and combined with the new Radar interpolation data to form the Radar interpolation data;
[0019] After the Radar target successfully matches the corresponding AIS target, the matched Radar interpolation data is deleted from the cache.
[0020] Furthermore, the formula for calculating the distance between the Radar interpolated data of each Radar target and each of the AIS interpolated data using the Haversine formula is as follows:
[0021] ,
[0022] in, It is the distance between two points on the sphere (the shortest distance along the great circle). The radius of the sphere (the average radius of the Earth is approximately 6,371 km). , Latitude (in radians) is the distance between two points on a sphere. and Longitude (in radians) is the distance between two points on a sphere. The difference in latitude between two points on a sphere. , The difference in longitude between two points on the sphere. .
[0023] Furthermore, the step of acquiring AIS data also includes:
[0024] For each received AIS data record, the longitude, latitude, and heading fields are checked. For longitude, it is determined whether it falls within the range of -180° to +180°. For latitude, it is determined whether it falls within the range of -90° to +90°. For heading, it is determined whether it falls within the range of 0° to 360°. If the data falls outside these ranges, it is considered abnormal and is filtered out, retaining only the normal data that meets the range requirements.
[0025] The steps for acquiring Radar data also include:
[0026] For each received Radar data record, the longitude, latitude, and heading fields are checked. For longitude, it is determined whether it is within the range of -180° to +180°. For latitude, it is determined whether it is within the range of -90° to +90°. For heading, it is determined whether it is within the range of 0° to 360°. If it is outside the range, the data is considered abnormal and is filtered out, retaining only the normal data that meets the range requirements.
[0027] Furthermore, the step of acquiring AIS data further includes:
[0028] Convert AIS data into a unified Trace object format, which includes identifier, timestamp, latitude and longitude, and speed fields;
[0029] Following the step of acquiring Radar data, the following is also included:
[0030] Radar data is converted into a unified Trace object format, and the structure of this object is consistent with that of the Trace object of AIS data; for Radar data that has already matched the AIS target, the corresponding identifier is directly assigned to it during conversion.
[0031] Furthermore, the step of aligning the data points of the AIS interpolated data with those of the Radar interpolated data includes: setting an external trigger signal to cause the AIS and radar devices to start recording data simultaneously every whole second; and forcibly aligning the AIS data and Radar data to a fixed time grid during data recording.
[0032] Also includes:
[0033] Calculate the timestamp difference between AIS data and Radar data for the same physical event;
[0034] Perform time-sliding window matching on the trajectory data of AIS and radar to find the time offset corresponding to the maximum correlation;
[0035] If persistent clock drift is detected between devices, offset compensation is automatically added to the data processing pipeline.
[0036] Furthermore, the step of performing fusion processing according to a preset algorithm to determine the final trajectory data of the target includes: for the AIS data and Radar data within the time window corresponding to each identifier, performing fusion processing according to the following rules:
[0037] If the data only contains AIS data, then the latest AIS data within the time window is directly selected as the fusion result;
[0038] If only Radar data is available, the average value of all Radar data within the time window is calculated and used as the fusion result.
[0039] If both AIS data and Radar data are available, the fusion result is selected according to the pre-configured priority strategy: if AIS is prioritized, the latest AIS data is used; if Radar is prioritized, the average value of the Radar data is used.
[0040] Secondly, this application provides an AIS and radar data fusion device based on the Haversine formula, comprising:
[0041] The first data acquisition module is used to acquire AIS data and extract MMSI information from the AIS data, using it as the unique identifier of the AIS target; for AIS data with the same identifier, an interpolation algorithm is applied to process them within a set time window to obtain AIS interpolated data.
[0042] The second data acquisition module is used to acquire Radar data, which has a temporary identifier; within a set time window, it applies an interpolation algorithm to process the data to obtain Radar interpolated data, and aligns the data points of the AIS interpolated data with those of the Radar interpolated data.
[0043] The trajectory recognition module is used to calculate the distance between the Radar interpolated data of each Radar target and each AIS interpolated data using the Haversine formula, and compare the calculated distance with a set threshold. If the distance is less than the threshold, the Radar target is considered to have successfully matched the corresponding AIS target. Before the mapping relationship of the matched data is sent to the Radar data interpolation, the temporary identifier of the successfully matched Radar data is converted into the corresponding identifier during the standardization operation of the Radar data.
[0044] The trajectory fusion module is used to merge the matched portions of the AIS data and the Radar data into a unified data stream, and perform fusion processing according to a preset algorithm to determine the final trajectory data of the target.
[0045] Thirdly, this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the AIS and radar data fusion method based on the Haversine formula.
[0046] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the AIS and radar data fusion method based on the Haversine formula.
[0047] Fifthly, this application provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the AIS and radar data fusion method based on the Haversine formula.
[0048] As can be seen from the above technical solution, this application provides an AIS and radar data fusion method and apparatus based on the Haversine formula. By interpolating the AIS data and radar data for time alignment, the interpolated AIS data and radar data can be accurately matched in the trajectory recognition operator according to the Haversine formula. Through the matching operation of AIS data and radar data, the radar data is given a unified identifier with the AIS data, which solves the problem of confusing target identity information in traditional monitoring methods. This identifier runs through the subsequent processing flow of this method, enabling the fusion method to achieve a perfect combination of the rich identity of AIS and the advantages of low-frequency data with the real-time position and high-frequency data of radar. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 This is a flowchart illustrating the AIS and radar data fusion method based on the Haversine formula in the embodiments of this application.
[0051] Figure 2 This is a schematic diagram of the three main processes of the AIS and radar data fusion method based on the Haversine formula in the embodiments of this application;
[0052] Figure 3This is a schematic diagram of the cubic spline interpolation method for the AIS and radar data fusion method based on the Haversine formula in the embodiments of this application;
[0053] Figure 4 This is a schematic diagram illustrating the trajectory association of the AIS and radar data fusion method based on the Haversine formula in the embodiments of this application;
[0054] Figure 5 This is a schematic diagram of the AIS data processing flow of the AIS and radar data fusion method based on the Haversine formula in the embodiments of this application;
[0055] Figure 6 This is a schematic diagram of the radar data processing flow of the AIS and radar data fusion method based on the Haversine formula in the embodiments of this application;
[0056] Figure 7 This is a schematic diagram of the data fusion process of the AIS and radar data fusion method based on the Haversine formula in the embodiments of this application;
[0057] Figure 8 This is a structural diagram of the AIS and radar data fusion device based on the Haversine formula in the embodiments of this application;
[0058] Figure 9 This is a schematic diagram of the structure of the electronic device in the embodiments of this application.
[0059] Figure label:
[0060] Electronic device 9600, central processing unit 9100, memory 9140, communication module 9110, input unit 9120, audio processor 9130, display 9160, power supply 9170, buffer memory 9141, application / function storage unit 9142, data storage unit 9143, driver storage unit 9144, antenna 9111, speaker 9131, microphone 9132. Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0062] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.
[0063] In view of the problems existing in the prior art, this application provides an AIS and radar data fusion method and apparatus based on the Haversine formula. By interpolating the AIS data and radar data for time alignment, the interpolated AIS data and radar data can be accurately matched in the trajectory recognition operator according to the Haversine formula. Through the matching operation of AIS data and radar data, the radar data is given a unified identifier with the AIS data, which solves the problem of confusing target identity information in traditional monitoring methods. This identifier runs through the subsequent processing flow of this method, enabling the fusion method to achieve a perfect combination of the rich identity and low-frequency data of AIS and the real-time position and high-frequency data of radar.
[0064] To integrate AIS and radar information and construct a more accurate, continuous, and complete maritime vessel dynamic monitoring system that meets the high precision and reliability requirements of vessel monitoring, this application provides an embodiment of an AIS and radar data fusion method based on the Haversine formula. (See also...) Figure 1 , Figure 2 As shown, the AIS and radar data fusion method based on the Haversine formula specifically includes the following:
[0065] Step S101: Acquire AIS data and extract MMSI information from the AIS data, using it as the unique identifier of the AIS target; for AIS data with the same identifier, apply an interpolation algorithm to process it within a set time window to obtain AIS interpolated data.
[0066] Optional, see reference Figure 5 As shown in this embodiment, the AIS data processing module connects to the Kafka message queue through the Apache Flink Kafka consumer API, subscribes to the corresponding AIS data topic, and receives raw AIS data transmitted in NMEA format in real time. Each data entry contains multi-dimensional ship status information, including the ship's MMSI (Maritime Mobile Service Identifier), precise latitude and longitude information, timestamp, and heading.
[0067] For example, you can use the programming library provided by Kafka to initialize a consumer object in your code, set the connection parameters and subscribed topics, and then continuously pull new messages through a loop. For instance, using the kafka-python library in Python, you can create a KafkaConsumer instance, specify parameters such as bootstrap_servers and topic, start a loop, and call the poll() method each time to retrieve a batch of messages; these messages are the raw AIS data.
[0068] During actual navigation, ships may generate erroneous AIS data due to various reasons such as equipment failure and signal interference. If these abnormal data are not cleaned, they will seriously interfere with subsequent ship trajectory analysis, fusion and other processing, leading to incorrect decision-making results. Therefore, it is necessary to filter out data that is obviously inconsistent with actual geography and navigation common sense.
[0069] Optionally, in this embodiment, the longitude, latitude, and heading fields in the received AIS data records are checked one by one by the first data cleaning operator. For longitude, it is determined whether it is within the range of -180° to +180°; for latitude, it is determined whether it is between -90° and +90°; and for heading, it is checked whether it is within the range of 0° to 360°. If it is outside the range, the data is considered abnormal and is filtered out, retaining only the normal data that meets the range requirements.
[0070] For example, corresponding logical conditional statements can be written in the code, such as using an if-else structure to determine whether the longitude, latitude, and heading meet the conditions. For instance, for the longitude field, if longitude < -180 or longitude > 180, it is marked as abnormal data. The same logic is applied to the latitude and heading fields. The data that meet the conditions are grouped into a new data stream, which is then output as the cleaned AIS data stream.
[0071] Continue to refer to Figure 5 As shown, different data sources may use different data formats and identification methods. For example, AIS data has its own original data format, while subsequent radar data may have different representations. Therefore, this embodiment extracts the MMSI information from each cleaned AIS data entry using a first standardization operator, using it as the unique identifier of the ship and assigning a corresponding target-id (identifier). Then, the AIS data is converted into a unified Trace object format, which includes key fields such as target-id, timestamp, latitude and longitude, and speed, achieving data format standardization and facilitating unified processing of data from different sources by subsequent modules.
[0072] For example, a Trace class or data structure can be defined at the code level, containing the fields specified above. Then, a function or method can be written to populate the relevant information from each piece of cleaned AIS data received according to the specified fields, generating a Trace object instance. For instance, the MMSI field can be directly assigned to the target-id field; the original timestamps in the AIS data can be formatted and standardized to a standard time format before being assigned to the timestamp field of the Trace object; similar conversions and assignments can be performed on other fields such as latitude and longitude.
[0073] In this embodiment, through standardization, various types of data can be converted into a unified Trace object format and assigned a unique target-id. This enables data from different sources to be accurately identified, associated, and processed in subsequent processing, improving the accuracy and efficiency of data fusion and analysis.
[0074] refer to Figure 3 , Figure 5 As shown, since AIS data is typically reported by ships at regular time intervals (e.g., every few minutes), this results in discontinuities in ship trajectories over time, making it difficult to accurately reflect the ship's true motion state. This is especially problematic during trajectory matching and fusion, potentially affecting the accuracy of the results. Therefore, this embodiment uses a first data interpolation operator to interpolate the AIS data. For non-interpolated AIS data sequences corresponding to the same target-id, they are arranged in timestamp order. Then, a time window (e.g., 1 hour) is selected, and a cubic spline interpolation algorithm is applied to the data points within this window to generate continuous trajectory data at 1 point per second. This compensates for the excessively large time intervals in the original data caused by factors such as the reporting intervals of ship AIS devices. After interpolation, the interpolated data is categorized by target-id and stored in a Redis cache database for quick access and use by the subsequent trajectory recognition module.
[0075] For example, the data can first be grouped by target-id, and then the data within each group can be sorted by timestamp. Next, the size of the time window is determined, and the timestamps and corresponding latitude and longitude coordinates of the data points are extracted within each window. Using a cubic spline interpolation algorithm (e.g., the `interpolate.splrep` and `interpolate.splev` functions from the scipy library in Python), an interpolation function is generated based on the original data points, and then interpolation calculations are performed over 1-second time intervals to obtain the new trajectory point data. This interpolated data is stored with target-id as the key. A Redis hash structure or other suitable data structure can be used to store multi-field interpolated data for easy and fast subsequent queries and updates.
[0076] In this embodiment, data interpolation can generate denser and more continuous trajectory points in time, describing the ship's motion trajectory in more detail. This provides a higher quality data foundation for subsequent accurate matching and fusion with radar data, while also improving the temporal resolution of the entire trajectory analysis system, making the monitoring and prediction of ship dynamics more timely and accurate.
[0077] Step S102: Obtain Radar data, which has a temporary identifier; within a set time window, apply an interpolation algorithm to process it to obtain Radar interpolated data, and align the data points of the AIS interpolated data with those of the Radar interpolated data.
[0078] Optional, see reference Figure 6 As shown in this embodiment, similar to the AIS Source, the Radar data processing module connects to the corresponding radar data topic in the Kafka message queue through the Kafka consumer Apache Flink API to receive raw radar data. This radar data mainly includes point coordinates (usually in polar coordinates, such as rectangular coordinates converted from distance, azimuth, etc.), timestamps, and reflection intensity, which are used to describe the location and related characteristics of the target detected by the radar in space.
[0079] For example, you can use the Kafka consumer programming library in your code, set up the connection parameters and the radar data topic you want to subscribe to, and start a consumption loop to continuously pull radar data messages from Kafka. For instance, using the KafkaConsumer class in Java, you can configure parameters such as bootstrap.servers and group.id, call the subscribe() method to subscribe to the radar data topic, and then call the poll() method in a while loop to get message batches, thereby obtaining the raw radar data.
[0080] During radar detection, various factors such as sea clutter and electromagnetic interference can interfere with the generation of erroneous target tracking information. Failure to eliminate this invalid data will affect the subsequent matching and fusion with AIS data, reducing the overall system's accuracy in identifying and tracking maritime targets. Therefore, cleaning radar data is a crucial step in ensuring data quality.
[0081] Optionally, in this embodiment, the received radar data is cleaned using a second data cleaning operator, primarily checking the validity of the latitude and longitude information of the points. Based on geographical knowledge, it is determined whether the longitude is between -180° and +180° and the latitude is between -90° and +90°. At the same time, obviously erroneous or invalid point data, such as coordinates of zero point zero or other unreasonable values, are removed, thereby obtaining relatively clean and reliable radar data for subsequent processing.
[0082] For example, during code implementation, a function can be written to check the latitude and longitude fields in the radar data one by one. For instance, a conditional statement such as if (radar_longitude<-180 || radar_longitude>180 || radar_latitude<-90 || radar_latitude>90 || (radar_longitude == 0&&radar_latitude == 0)) can be used to consider the radar point as invalid data and filter it out; otherwise, it is retained as valid data and output to subsequent modules.
[0083] Continue to refer to Figure 6 As shown, this embodiment uses a second standardization operator to convert the cleaned radar data into a unified Trace object format, consistent with the Trace object structure of AIS data. For radar data that has already matched AIS targets (the corresponding target-id can be determined through historical matching relationships), the corresponding target-id is directly assigned during conversion; while for unmatched radar data, no target-id is assigned temporarily, and a Trace object without a target-id is generated.
[0084] For example, a class or data structure identical to the AIS Trace object can be defined to store radar data, and a conversion function can be written. In the function, it first checks whether the radar data has a corresponding target-id in historical matching records (this can be done by querying local cache or database matching records). If it exists, the corresponding target-id is filled into the target-id field of the Trace object; if it does not exist, the field is left blank for now. Then, the timestamp, latitude and longitude, reflection intensity, and other information from the radar data are filled into the corresponding fields of the Trace object to complete the standardization conversion.
[0085] Converting radar data into a unified Trace object format enables data from different sources to have the same interface and data structure in subsequent processing, facilitating unified processing and fusion operations. Simultaneously, assigning a target-id to matched radar data allows for rapid association with corresponding ship targets, improving processing efficiency; while unmatched radar data requires subsequent matching through trajectory recognition and other steps. This differentiated processing approach helps to better manage radar data in different states, improving the accuracy and performance of the entire data fusion system.
[0086] Optionally, in this embodiment, Redis sends the interpolated data back to the data interpolation operator to ensure the continuity of data interpolation. For example, in AIS data processing, the first data interpolation operator needs to perform batch interpolation on data within a certain period (e.g., 1 hour). However, the actual data stream arrives continuously, and new data needs to be combined with historical interpolation results to generate a seamless, continuous trajectory. For instance, when processing data within the current time window (e.g., 10:00-11:00), the interpolation operator needs to read the interpolation results from 9:00-10:00 in Redis to ensure the continuity of the trajectory on the timeline.
[0087] Meanwhile, this design avoids redundant calculations and optimizes performance. If each interpolation requires reprocessing the entire dataset, the computational overhead is enormous. Caching historical interpolation results in Redis significantly reduces redundant calculations. Redis's role is to cache already interpolated data; the interpolation operator only needs to process new data and merge it with historical data, improving efficiency. For example, when batch interpolating AIS data hourly, only the newly arrived 1-minute data needs to be processed, rather than recalculating the entire 1-hour window.
[0088] Optionally, in this embodiment, Redis sends the matched data (radar target-id to target-id) to the second normalization operator to replace the temporary identifier of the Radar data, directly assigning it the corresponding identifier during the conversion. The purpose of this design is that, in this embodiment, the core responsibility of the trajectory recognition operator is to calculate trajectory matching, which is an algorithm-intensive module. If it replaces the temporary ID, it would violate the single responsibility principle and increase the computational load. The core responsibility of the normalization operator is data format conversion and identifier management, a state-intensive module, which is naturally suitable for maintaining dynamic identifier mappings. If the ID is replaced in the trajectory recognition operator, subsequent data must wait for the previous match to complete, causing a delay. Replacing it in the normalization operator eliminates the feedback delay and improves the data flow speed.
[0089] Meanwhile, the standardized operator serves as the sole entry point for the radar data stream, maintaining a full radar-target-id → target-id mapping table to ensure all data is uniformly identified at the entry point. If this mapping is distributed across trajectory recognition operators, inconsistencies in mapping states during parallel execution of multiple instances necessitate distributed locks, increasing latency. Ship radar reflection points are often covered by overlapping radar coverage; a unified ID at the entry point prevents subsequent modules from receiving duplicate data, making subsequent window calculations more accurate.
[0090] Furthermore, replacing the temporary ID in the trajectory recognition operator would compromise the idempotency of the data stream and cause subsequent processing modules to receive inconsistent data versions. Worse still, if the matching logic needs modification, the entire system must be shut down for an update. Standardized operator replacement also provides error isolation; if a matching error occurs, it only affects a small amount of data. In contrast, incorrect replacement in the trajectory recognition operator scheme would pollute the entire data stream, requiring an additional backtracking and cleaning mechanism.
[0091] This design also enhances the system's scalability. When adding new data sources (such as satellite data), only the mapping logic of the standardized operator needs to be extended, without modifying the core trajectory recognition algorithm. The standardized operator also provides a unique state observation point to monitor the size and update frequency of the mapping table and to statistically analyze the proportion of unmatched targets in real time. In contrast, if state management is mixed into the trajectory recognition operator, it becomes difficult to distinguish between algorithm errors and state errors.
[0092] For example, this embodiment provides a scenario example of a ship suddenly activating AIS:
[0093] Initially, the radar tracks the target radar-target-id: R888 (no target-id).
[0094] After AIS is enabled, the trajectory recognition operator is successfully matched, R888→T100 is established, and Redis pushes the mapping to the standardized operator.
[0095] Subsequent processing: In the standardized operator, new radar data is directly labeled with target-id: T100. The trajectory recognition operator no longer receives R888 data (because it already contains the correct ID).
[0096] The advantage of this design is that the fusion module can immediately identify a known vessel, avoiding false alarms about new targets.
[0097] refer to Figure 3 , Figure 6 As shown, since the unmatched radar data may correspond to new ship targets or other unidentified targets, the data of these targets also need to be interpolated to form a continuous trajectory. In this way, in the subsequent trajectory identification process, it can be more accurately matched with the AIS interpolated trajectory, thereby identifying new ship targets or determining the movement of unknown targets.
[0098] In this embodiment, the second data interpolation operator extracts the timestamps and corresponding coordinate information of unmatched radar data (i.e., data without a target-id), and arranges them in chronological order. Within a set time window (e.g., 1 hour), a suitable interpolation algorithm (such as linear interpolation or spline interpolation) is used to generate a continuous trajectory of 1 point per second to form a relatively complete radar target motion trajectory. After interpolation, these data are stored in a Redis cache with the key "radar-target-id" (temporary identifier) so that subsequent trajectory recognition operators can quickly access and use these data for matching operations.
[0099] For example, unmatched radar data can be sorted by timestamp and the time window size determined. For each unmatched radar target, the original data points are extracted within the time window, and then an appropriate interpolation algorithm is selected for interpolation calculation. For instance, in Python, a simple linear interpolation function can be used to calculate the coordinate values of intermediate time points based on the time and coordinates of the original data points. When storing the generated interpolated data, a temporary radar-target-id can be generated for each unmatched radar target, serving as the key in Redis. A hash structure is used to store information such as the coordinates of each time point, facilitating subsequent updates and queries.
[0100] This embodiment improves the temporal resolution of radar data through interpolation, making radar trajectories and AIS trajectories more comparable in the time dimension, thereby enhancing the entire data fusion system's ability to detect and identify maritime targets.
[0101] Optionally, in order to align the data points of AIS interpolation data with those of Radar interpolation data, in this embodiment, an external trigger signal can be set to make the AIS and radar devices start recording data simultaneously every whole second. For example, at 12:00:00.000, all devices synchronously start data acquisition, and during data recording, the AIS data and Radar data are forcibly aligned to a fixed time grid (such as one point per second).
[0102] Furthermore, AIS and Radar data of the same physical event (such as ship horn sounds or lighthouse signals) can be aligned as reference events. The timestamp deviation between the two can be calculated, and cross-correlation analysis can be used to perform time sliding window matching on the trajectory data of AIS and radar to find the time offset corresponding to the maximum correlation. If a continuous clock drift between devices is detected (e.g., 1 second slower per day), offset compensation is automatically added to the data processing pipeline. For example, if radar data is detected to be 0.5 seconds slower than AIS data overall, a 0.5-second correction is added to all radar timestamps during processing.
[0103] Step S103: Calculate the distance between the Radar interpolation data of each Radar target and each AIS interpolation data using the Haversine formula, and compare the calculated distance with a set threshold. If the distance is less than the threshold, the Radar target is considered to be successfully matched with the corresponding AIS target. Before transmitting the mapping relationship of the matched data to the Radar data interpolation, in the standardization operation of the Radar data, the temporary identifier of the successfully matched Radar data is converted into the corresponding identifier.
[0104] Optional, see reference Figure 4 , Figure 6As shown, in this embodiment, the trajectory recognition operator retrieves all AIS interpolation data and currently unmatched radar interpolation data from Redis. For each radar interpolation target (identified by radar-target-id), the distance between its trajectory and each AIS trajectory is calculated using the Haversine formula. The calculated distance is compared with a set threshold (e.g., 100 meters). If the distance is less than the threshold, the radar target is considered to have successfully matched the corresponding AIS target. The successfully matched radar data is assigned a corresponding target-id, and the updated matching relationship (the mapping between radar-target-id and target-id) is saved to Redis and the MySQL database to ensure the persistence and fast access of the matching relationship. At the same time, the matched radar interpolation data is deleted from Redis to avoid duplicate processing. The newly matched target-id and radar-target-id mapping relationship is fed back to the second normalization operator in real time so that subsequent received radar data can be assigned the correct target-id in a timely manner according to the latest matching relationship.
[0105] For example, in terms of code implementation, a function can first be written to read AIS interpolation data and unmatched radar interpolation data from Redis. Then, for each radar interpolation target, the AIS interpolation targets are iterated through, and the Haversine formula is applied to calculate the shortest distance or average distance between the two trajectories in space (depending on the matching strategy used). For example, for each point in the radar and AIS trajectories, the distance corresponding to its latitude and longitude is calculated, the minimum distance is found, and it is determined whether it is less than a threshold. If a match is successful, the corresponding radar-target-id record in Redis is updated, and the target-id information is added; at the same time, the new matching relationship is inserted into the matching relationship table in the MySQL database. For the matched radar interpolation data, a Redis delete command is executed to remove it from the cache. In addition, the new target-id and radar-target-id mapping relationship is sent through a message queue or by directly calling the relevant interface of the second normalization operator, updating its internal matching relationship record.
[0106] Trajectory recognition is a crucial step in the data fusion process. It matches radar trajectories with AIS trajectories, associating unknown targets detected by radar with known AIS ship targets, thus achieving comprehensive identification and tracking of maritime targets. The Haversine formula accurately calculates the distance between two points on the Earth's surface. The distance threshold-based matching method is simple and effective, quickly filtering out potentially matching target pairs. Storing the matching relationships in Redis and MySQL ensures fast access during processing (due to Redis's in-memory storage) and guarantees the ability to restore historical matching relationships from MySQL after system restarts or other failures, ensuring the continuity and accuracy of data fusion. Simultaneously, a feedback mechanism allows newly received radar data to be promptly assigned target-ids based on the latest matching information, improving the automation and real-time performance of the entire system.
[0107] Optionally, in this embodiment, the Haversine formula is used to calculate the distance between two points on the Earth's surface. That is, the formula for calculating the distance between the Radar interpolation data of each Radar target and the respective AIS interpolation data in this embodiment is:
[0108] ,
[0109] in, It is the distance between two points on the sphere (the shortest distance along the great circle). The radius of the sphere (the average radius of the Earth is approximately 6,371 km). , Latitude (in radians) is the distance between two points on a sphere. and Longitude (in radians) is the distance between two points on a sphere. The difference in latitude between two points on a sphere. , The difference in longitude between two points on the sphere. .
[0110] Specifically, the derivation process of this formula is as follows:
[0111] For any two points on a sphere, the semi-versus of the central angle can be calculated using the following formula:
[0112]
[0113] Where, hav is an abbreviation for the semi-versus function:
[0114]
[0115] d is the distance between the two points (along a great circle, see spherical distance), r is the radius of the sphere, and the equals sign on the left is... It is the central angle, measured in radians.
[0116] d can be solved by applying the inverse half-vector function (if its value can be found) or by using the arcsine function:
[0117]
[0118] Substituting the values, we get:
[0119]
[0120] Optionally, to accelerate the matching speed, in this embodiment, the geographical area can be divided into multiple grids or a quadtree index structure can be used to store the AIS interpolated trajectory points in the corresponding spatial index according to their geographical area. When it is necessary to find AIS trajectory points adjacent to the radar point, the geographical area where the radar point is located and the surrounding potentially related areas are first determined, and then candidate AIS trajectory points are quickly retrieved from the spatial index of these areas.
[0121] For example, in RedisGeo, when using the GEORADIUS command, you can specify the latitude and longitude coordinates of the radar point and the search radius (e.g., 100 meters). This command will utilize Redis's internal spatial index structure to efficiently return all AIS trajectory points within this range, avoiding the need to compare all AIS trajectory points one by one, which greatly reduces computational complexity and time cost.
[0122] Optionally, in this embodiment, an environmental monitoring module can be established to collect information such as weather and sea conditions in real time, and adjust the distance threshold according to preset rules or models. For example, when the wind speed exceeds a certain threshold and the wave height is large, it is judged as a high-wind-wave scenario, and the distance threshold is increased accordingly. At the same time, a feedback mechanism is set up to automatically optimize the threshold parameters based on the historical matching success rate and false matching rate.
[0123] For example, a distance threshold configuration table corresponding to different environmental conditions can be stored in a configuration center (such as ZooKeeper), and the system can periodically or in real time pull the latest threshold parameters from the configuration center. Alternatively, a dynamic threshold adjustment model can be built based on historical matching data using machine learning algorithms, taking the current environmental characteristics and recent matching results as input, and outputting the optimal distance threshold.
[0124] Optionally, in this embodiment, dynamic feature information such as speed and heading can be extracted from AIS and radar data, and multi-feature matching can be performed by combining distance factors for comprehensive matching evaluation. Each feature is assigned a corresponding weight, and the matching score is calculated based on the similarity of the features to determine whether two trajectory points belong to the same target.
[0125] Optionally, in this embodiment, the matching relationships can also be backed up. When storing the matching relationships in MySQL, in addition to recording the matching relationship itself, version number and timestamp fields are added. Each time the matching relationship is updated, a new version number is generated and the current timestamp is recorded. When the system fails and needs to be recovered, the most recent valid matching relationship version is found based on the timestamp for recovery. Assuming that Redis crashes at a certain moment, the system filters the matching relationship records within the most recent hour based on the timestamps recorded in MySQL, and rebuilds the matching relationship cache in Redis in chronological order to ensure that data processing can continue based on the correct matching relationships after the system recovers.
[0126] Step S104: Merge the matched portions of the AIS data and the Radar data into a unified data stream, and perform fusion processing according to a preset algorithm to determine the final trajectory data of the target.
[0127] Optional, see reference Figure 7 As shown, in this embodiment, the Union operator module receives non-interpolated AIS data (with target-id) output from the first data interpolation operator and non-interpolated radar data (matched portion) with target-id output from the second normalization operator in the radar processing flow. These two data portions are simply merged into a unified data stream, while filtering out unmatched radar data during the merging process, retaining only those data that have been successfully matched and have target-id.
[0128] For example, this can be implemented in code using merge operators provided by message queues or data stream processing frameworks (such as the union operator in Apache Flink). Two input data streams (AIS with target-id and radar with target-id) are taken as input and merged into a single data stream using the merge operator. Before merging, a filtering operation can be added to ensure that only matching (target-id) data from the radar stream enters the merging process. For example, in Flink, the filter operator is first applied to the radar data stream to filter out unmatched data, and then the filtered radar and AIS data streams are merged using the union operator.
[0129] In this embodiment, after the preceding processing, both AIS data and matched radar data share the same target-id, allowing them to be processed uniformly. The Union operator module integrates these data into a common data stream, providing a foundation for subsequent data grouping processing. This enables subsequent steps to consider information from both data sources simultaneously, further improving the efficiency and accuracy of data processing and achieving true data fusion.
[0130] Optionally, in this embodiment, corresponding metadata fields (such as source_priority) can be set for AIS data and radar data within the data stream processing framework. When data is generated or enters the processing flow, this field is assigned a value based on the data source; for example, AIS data is assigned a value of 0, and radar data is assigned a value of 1. Subsequent processing modules (such as trajectory fusion operators) can read this priority label. When a selection or comprehensive decision needs to be made between AIS and radar data, the information from the higher-priority data source is given priority, thereby improving the quality and reliability of the fusion results.
[0131] Optionally, in this embodiment, a buffer (such as a queue structure) can be set up before merging the data streams, allowing delayed data to enter the buffer within a certain time range (such as 1 second). Simultaneously, the timestamp information of the data is recorded, and during merging, the data in the buffer and the real-time data are merged together in chronological order.
[0132] For example, in Apache Flink, enabling the AllowedLateness configuration allows late data to enter the window for processing, and combines this with a watermark mechanism to control the processing of out-of-order data. The watermark is used to identify the time boundary of the data. Only when the delay time between the data's timestamp and the watermark is within an acceptable range is the data allowed to enter the subsequent processing flow, thereby effectively handling out-of-order data problems caused by network jitter and other reasons.
[0133] Optionally, in this embodiment, the unified data stream output by the Union operator module is grouped according to the target-id field using the KeyBy Target-id module. This way, the data corresponding to each target-id is aggregated into multiple independent data substreams, and the data points in each substream belong to the same target vessel, containing the vessel's AIS and radar trajectory information.
[0134] For example, you can use the keyBy operator (such as Flink's keyBy method) in a data stream processing framework to specify grouping by the target-id field. For instance, calling data_stream.keyBy("target_id") in the code, where data_stream is the data stream output by the Union operator, will partition the data according to the target-id. Subsequent processing of the data within each partition will then focus on the data corresponding to the same target-id.
[0135] In this embodiment, grouping by target-id allows for the aggregation of all data corresponding to each vessel (regardless of whether it originates from AIS or radar), facilitating subsequent independent processing and analysis for each vessel, such as trajectory analysis and status prediction. This grouping method improves the targeting and efficiency of data processing because subsequent processing of each vessel's data does not require sifting through a large amount of data; operations can be performed directly within the grouped data substreams. It also helps ensure the accuracy of the processing results and avoids confusion between data from different vessels.
[0136] Optionally, in this embodiment, a target state machine can be established to set state attributes (such as ACTIVE, INACTIVE, LOST) for each target-id. A scheduled task or an event-driven approach can be used to periodically check the update time of each target ID. If a target-id has no new data updates within a set time period (e.g., 30 minutes), its state is changed from ACTIVE to INACTIVE, and the data related to that target-id is removed from the current processing data stream.
[0137] For example, monitoring logic can be added to the data stream processing framework to update the last update time of the corresponding target-id whenever new data is received. Then, a timer can be used to iterate through the status and last update time of all target-ids at regular intervals, and the status of target IDs that have not been updated after the timeout can be updated and removed, thereby avoiding the system from processing invalid or outdated target data and saving system resources.
[0138] Optionally, in this embodiment, ID conflict resolution can be achieved as follows: Within the same time window, when multiple radar points match the same AIS target, the matching relationship between each radar point and the AIS target is recorded and statistically analyzed. The number of matches for each target-id is counted, and the target-id with the most matches and the highest match confidence is selected as the final matching result.
[0139] For example, within a time window, a counter can be maintained for each possible target-id. Whenever a radar point matches a target-id, the counter is incremented by 1. At the end of the window, the counter values of each target-id are compared, and the target-id with the largest value is selected as the final matching result. If multiple target-ids have the same counter value, their matching scores (such as distance, feature similarity, etc.) are further compared to determine the final result.
[0140] Optionally, in this embodiment, a consistent hashing algorithm can be used to hash the target-id and map the hash value to a processing node. This ensures that the same target-id always maps to the same processing node, unless there are topology changes such as the addition or removal of processing nodes. During data distribution, the target-id is sent to the corresponding processing node based on its hash value.
[0141] Consistent hashing algorithms minimize data redistribution caused by changes in processing nodes. When the number of processing nodes changes, only a small number of target-ids need to be reassigned to processing nodes, while the processing nodes for most target-ids remain unchanged. This reduces cross-node communication overhead, improves system processing efficiency and the accuracy of state management, and enables the system to operate more stably and efficiently in a distributed environment.
[0142] Optionally, in this embodiment, a rolling time window module is used to divide the data stream grouped by target-id obtained through the KeyBy operation into time windows. For example, a 5-second rolling time window is set, that is, the data is divided into windows every 5 seconds, and all data points (including AIS and radar trajectory points) within the window are aggregated together as a data set for output, which is used for subsequent trajectory fusion processing.
[0143] For example, in a data stream processing framework, a window operator can be used after keyBy to define a time window. For instance, in Flink, .window(TumblingProcessingTimeWindows.of(Time.seconds(5))) is used to create a 5-second rolling processing time window. In this way, for each target-id group of data streams, the system will automatically divide the window according to the set time interval and collect the data within the window for subsequent processing.
[0144] In this embodiment, by setting a time window, the target data for each vessel can be segmented and processed in the time dimension. This allows for data fusion and analysis within a limited time frame, promptly reflecting the vessel's motion status in the most recent time period, while also facilitating control over the frequency and load of data processing. The 5-second window setting ensures real-time data transmission, enabling subsequent operations such as trajectory fusion to quickly respond to changes in the vessel's status, thus supporting real-time monitoring and decision-making.
[0145] Optionally, in this embodiment, the speed information of each target can be parsed from the data stream, and the length of the time window for the corresponding target can be dynamically adjusted according to the speed. For example, a shorter time window (e.g., 3 seconds) can be set for high-speed ships to reflect their motion state changes more promptly; a longer time window (e.g., 10 seconds) can be set for low-speed ships to accumulate more data points for more accurate analysis.
[0146] For example, in the data stream processing framework, a state object is maintained for each target, containing the current speed information and the corresponding time window length. When new data arrives, the target's speed information is updated, and the time window length is recalculated according to preset rules. The window length adjustment information is sent to the window management module via the side output stream, which then divides and processes the data according to the new window length.
[0147] Optionally, in this embodiment, the ReduceFunction or AggregateFunction can be used to process and aggregate data line by line within the time window. For example, for radar point coordinate data, each time a new data point is received, its latitude and longitude values are added to the sum variable, and the value of the count variable is increased. When the window is triggered, the average value is directly calculated based on the sum and count, without having to perform a one-time batch calculation on all data at the end of the window.
[0148] For example, an accumulator object can be defined in the code implementation, containing a sum of latitude and longitude and a count field. Whenever new radar data arrives, the method in ReduceFunction is called to add the new latitude and longitude values to the corresponding fields of the accumulator and increment the count. In this way, when the window is triggered, the average coordinates of the radar points within the window can be obtained by simply dividing the sum of latitude and longitude in the accumulator by the count, reducing memory usage and computation time.
[0149] Optionally, in this embodiment, the trajectory fusion operator module performs fusion processing on the AIS and radar trajectory point sets within the time window corresponding to each target-id according to the following rules: If only AIS data is available, the latest AIS trajectory point within the time window is directly selected as the fusion result, because AIS data contains rich ship identity information, and using the latest data can ensure the timeliness of the identity information; if only radar data is available, the average value of the coordinates of all radar points within the time window is calculated, and this is used as the high-precision position information after fusion. The averaging method can reduce noise interference in radar data and improve position accuracy; if both AIS and radar data exist, the fusion result is selected according to a pre-configured priority strategy. If AIS is configured as priority, the latest AIS data is used; if radar is configured as priority, the average value of radar points is used. In addition, the priority can be adjusted in real time according to dynamic factors such as the position of the target distance sensor and the reliability of the sensor. For example, when the ship is close to the AIS receiving base station and the AIS signal quality is good, AIS data is used first; while when the ship is in a radar coverage area with less radar interference, radar data is used first.
[0150] For example, in the code implementation, the data type within the time window can be determined first (AIS only, radar only, or both). For AIS only, a sorting operation is used to find the AIS trajectory point with the latest timestamp and output it. For radar only, the average coordinates of all radar trajectory points (e.g., longitude average, latitude average, etc.) are calculated to generate the fused trajectory points. When both are present, pre-configured priority parameters are read (which can be loaded from a configuration file or database), and the appropriate data is selected as the fusion result based on these parameters. Simultaneously, algorithm logic is written to consider factors that dynamically adjust priorities, such as real-time acquisition of distance information between the ship and the sensor, sensor signal strength, etc. A pre-defined algorithm model (e.g., a weighted decision model) is used to calculate which data source should be prioritized at the current moment, and a fusion decision is made accordingly.
[0151] In this embodiment, the trajectory fusion rules are designed to comprehensively consider the advantages and characteristics of both AIS and radar data sources, employing the optimal fusion strategy under different data conditions to generate more accurate and reliable ship trajectory information. AIS data excels in the accuracy and completeness of ship identification information, while radar data may be more advantageous in terms of ship position accuracy, especially when AIS signals are lost or not updated in a timely manner. Through priority configuration and dynamic adjustment mechanisms, the fusion method can be flexibly selected based on the actual application scenario and data quality, improving the system's adaptability and robustness. This ensures that the fused trajectory data better reflects the ship's true motion state, meeting the needs of various ship monitoring and navigation applications.
[0152] Optionally, in this embodiment, a signal quality monitoring module can be added to the AIS and radar equipment or the data receiving end to collect signal quality indicators such as signal strength (e.g., RSSI) and signal-to-noise ratio (SNR) in real time, and transmit this information along with the data to the trajectory fusion operator module. In the fusion operator, the priority of AIS and radar data is dynamically adjusted based on the comparison result between the current value of the signal quality indicator and the set threshold.
[0153] For example, when the AIS signal strength is below a set threshold, the AIS signal quality is considered poor, which may affect the accuracy of the data. In this case, the priority is automatically switched, and radar data is used as the primary reference data for fusion processing. Conversely, when the AIS signal quality is good and the radar signal quality is poor, AIS data is used first. In this way, a more reliable data source can be flexibly selected based on the actual signal quality, improving the accuracy of the fusion results.
[0154] Optionally, in this embodiment, a Kalman filter algorithm can be used to model and predict the motion state (such as position, velocity, and heading) of each target. When a target intersection scene is detected, the fusion result is corrected based on the current motion state of the target and the predicted position at the next time point to ensure that mismatches or trajectory confusion do not occur due to target intersections.
[0155] For example, Kalman filtering estimates and updates the target state by establishing the target's state transition equation and observation equation, using a recursive approach. Before the target crossover, the filter's predictions are used to anticipate potential crossover scenarios and adjust the subsequent fusion results. For instance, the monitoring frequency of target heading and velocity changes is increased during the crossover period. After the crossover ends, accurate target trajectory tracking and fusion are quickly restored based on new observation data.
[0156] Optionally, in this embodiment, the fusion trajectory data (Fusion Trace) output by the trajectory fusion operator module can be received through the fusion data storage module, and this data can be written into the Prometheus time-series database for storage. Simultaneously, the stored data is synchronously pushed to various application systems, such as electronic chart display systems and automatic collision avoidance and early warning systems, so that these applications can obtain the latest ship fusion trajectory information in a timely manner, providing decision support for ship operators, maritime regulatory departments, etc.
[0157] As can be seen from the above description, the AIS and radar data fusion method based on the Haversine formula provided in this application can perform time alignment of AIS data and radar data through interpolation processing, so that the interpolated AIS data and radar data can be accurately matched in the trajectory recognition operator according to the Haversine formula. Through the matching operation of AIS data and radar data, the radar data is given a unified identifier with the AIS data, which solves the problem of confusing target identity information in traditional monitoring methods. This identifier runs through the subsequent processing flow of this method, enabling the fusion method to achieve a perfect combination of the rich identity and low-frequency data of AIS with the real-time position and high-frequency data advantages of radar.
[0158] To integrate AIS and radar information and construct a more accurate, continuous, and complete maritime vessel dynamic monitoring system, meeting the high precision and reliability requirements of vessel monitoring, this application provides an embodiment of an AIS and radar data fusion device based on the Haversine formula for implementing all or part of the aforementioned AIS and radar data fusion method based on the Haversine formula. See [link to embodiment]. Figure 8 The AIS and radar data fusion device based on the Haversine formula specifically includes the following components:
[0159] The first data acquisition module 10 is used to acquire AIS data and extract MMSI information from the AIS data, using it as the unique identifier of the AIS target; for AIS data with the same identifier, an interpolation algorithm is applied to process them within a set time window to obtain AIS interpolated data.
[0160] The second data acquisition module 20 is used to acquire Radar data, which has a temporary identifier; within a set time window, it is processed by an interpolation algorithm to obtain Radar interpolated data, and the data points of the AIS interpolated data are aligned with the data points of the Radar interpolated data.
[0161] The trajectory recognition module 30 is used to calculate the distance between the Radar interpolated data of each Radar target and each AIS interpolated data using the Haversine formula, and compare the calculated distance with a set threshold. If the distance is less than the threshold, the Radar target is considered to be successfully matched with the corresponding AIS target. Before the mapping relationship of the matched data is sent to the Radar data interpolation, the temporary identifier of the successfully matched Radar data is converted into the corresponding identifier in the standardization operation of the Radar data.
[0162] The trajectory fusion module 40 is used to merge the matched portions of the AIS data and the Radar data into a unified data stream, and perform fusion processing according to a preset algorithm to determine the final trajectory data of the target.
[0163] As can be seen from the above description, the AIS and radar data fusion device based on the Haversine formula provided in this application embodiment can perform time alignment of AIS data and radar data through interpolation processing, so that the interpolated AIS data and radar data can be accurately matched in the trajectory recognition operator according to the Haversine formula. Through the matching operation of AIS data and radar data, the radar data is given a unified identifier with the AIS data, which solves the problem of confusing target identity information in traditional monitoring methods. This identifier runs through the subsequent processing flow of this method, enabling the fusion method to achieve a perfect combination of the rich identity and low-frequency data of AIS with the real-time position and high-frequency data advantages of radar.
[0164] From a hardware perspective, in order to integrate AIS information and radar information to build a more accurate, continuous, and complete maritime vessel dynamic monitoring system and meet the high precision and high reliability requirements of vessel monitoring, this application provides an embodiment of an electronic device for implementing all or part of the AIS and radar data fusion method based on the Haversine formula. The electronic device specifically includes the following components:
[0165] The system comprises a processor, memory, a communications interface, and a bus; wherein the processor, memory, and communications interface communicate with each other via the bus; the communications interface is used to realize information transmission between the AIS and radar data fusion device based on the Haversine formula and core business systems, user terminals, and related databases and other related devices; the logic controller can be a desktop computer, tablet computer, or mobile terminal, etc., and this embodiment is not limited to these. In this embodiment, the logic controller can be implemented with reference to the embodiments of the AIS and radar data fusion method based on the Haversine formula and the embodiments of the AIS and radar data fusion device based on the Haversine formula in the embodiments, the contents of which are incorporated herein, and repeated details will not be described again.
[0166] It is understood that the user terminal may include smartphones, tablet computers, network set-top boxes, portable computers, desktop computers, personal digital assistants (PDAs), in-vehicle devices, smart wearable devices, etc. Among these, the smart wearable devices may include smart glasses, smartwatches, smart bracelets, etc.
[0167] In practical applications, the AIS and radar data fusion method based on the Haversine formula can be partially executed on the electronic device side as described above, or all operations can be completed in the client device. The choice can be made based on the processing power of the client device and the limitations of the user's usage scenario. This application does not impose any limitations on this. If all operations are completed in the client device, the client device may further include a processor.
[0168] The aforementioned client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side; in other implementation scenarios, it may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, a server cluster consisting of multiple servers, or a distributed server structure.
[0169] Figure 9 This is a schematic block diagram illustrating the system configuration of the electronic device 9600 according to an embodiment of this application. Figure 9 As shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It is worth noting that... Figure 9 This is an example; other types of structures can also be used to supplement or replace this structure to achieve telecommunications functions or other functions.
[0170] In one embodiment, the AIS and radar data fusion method based on the Haversine formula can be integrated into the central processing unit 9100. The central processing unit 9100 can be configured to perform the following control:
[0171] Step S101: Acquire AIS data and extract MMSI information from the AIS data, using it as the unique identifier of the AIS target; for AIS data with the same identifier, apply an interpolation algorithm to process them within a set time window to obtain AIS interpolated data;
[0172] Step S102: Obtain Radar data, which has a temporary identifier; within a set time window, apply an interpolation algorithm to process it to obtain Radar interpolated data, and align the data points of the AIS interpolated data with those of the Radar interpolated data.
[0173] Step S103: Calculate the distance between the Radar interpolation data of each Radar target and each AIS interpolation data using the Haversine formula, and compare the calculated distance with a set threshold. If the distance is less than the threshold, the Radar target is considered to be successfully matched with the corresponding AIS target. Before the mapping relationship of the matched data is transmitted to the Radar data interpolation, in the Radar data standardization operation, the temporary identifier of the successfully matched Radar data is converted into the corresponding identifier.
[0174] Step S104: Merge the matched portions of the AIS data and the Radar data into a unified data stream, and perform fusion processing according to a preset algorithm to determine the final trajectory data of the target.
[0175] As described above, the electronic device provided in this application performs time alignment of AIS data and radar data through interpolation processing, enabling the interpolated AIS data and radar data to be accurately matched in the trajectory recognition operator according to the Haversine formula. Through the matching operation of AIS data and radar data, the radar data is assigned a unified identifier with the AIS data, which solves the problem of confusing target identity information in traditional monitoring methods. This identifier runs through the subsequent processing flow of this method, enabling the fusion method to achieve a perfect combination of the rich identity and low-frequency data of AIS with the real-time position and high-frequency data advantages of radar.
[0176] In another embodiment, the AIS and radar data fusion device based on the Haversine formula can be configured separately from the central processing unit 9100. For example, the AIS and radar data fusion device based on the Haversine formula can be configured as a chip connected to the central processing unit 9100, and the AIS and radar data fusion method function based on the Haversine formula can be realized through the control of the central processing unit.
[0177] like Figure 9 As shown, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily need to include these components. Figure 9 All components shown; in addition, the electronic device 9600 may also include Figure 9 For components not shown, please refer to existing technology.
[0178] like Figure 9As shown, the central processing unit 9100, sometimes also referred to as a controller or operating control, may include a microprocessor or other processor device and / or logic device, which receives inputs and controls the operation of various components of the electronic device 9600.
[0179] The memory 9140 may be, for example, one or more of a cache, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices. It may store the aforementioned failure-related information, and also store a program for executing that information. The central processing unit 9100 may execute the program stored in the memory 9140 to perform information storage or processing, etc.
[0180] Input unit 9120 provides input to central processing unit 9100. Input unit 9120 may be, for example, a keypad or touch input device. Power supply 9170 provides power to electronic device 9600. Display 9160 displays images and text. Display may be, for example, an LCD display, but is not limited thereto.
[0181] The memory 9140 can be a solid-state memory, such as a read-only memory (ROM), random access memory (RAM), a SIM card, etc. It can also be a memory that retains information even when power is off, can be selectively erased, and contains more data; examples of this type of memory are sometimes referred to as EPROMs. The memory 9140 can also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142 for storing application programs and function programs or processes for executing the operation of the electronic device 9600 via the central processing unit 9100.
[0182] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for the electronic device for communication functions and / or for performing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0183] The communication module 9110 is a transmitter / receiver that sends and receives signals via the antenna 9111. The communication module 9110 (transmitter / receiver) is coupled to the central processing unit 9100 to provide input signals and receive output signals, which is the same as in a conventional mobile communication terminal.
[0184] Based on different communication technologies, multiple communication modules 9110 can be configured in the same electronic device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module 9110 (transmitter / receiver) is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and receive audio input from the microphone 9132, thereby realizing typical telecommunications functions. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. Additionally, the audio processor 9130 is coupled to a central processing unit 9100, enabling on-device recording via the microphone 9132 and on-device playback of stored audio via the speaker 9131.
[0185] Embodiments of this application also provide a computer-readable storage medium capable of implementing all steps of the AIS and radar data fusion method based on the Haversine formula, where the execution subject is a server or client, as described in the above embodiments. The computer-readable storage medium stores a computer program that, when executed by a processor, implements all steps of the AIS and radar data fusion method based on the Haversine formula, where the execution subject is a server or client, as described in the above embodiments. For example, when the processor executes the computer program, it implements the following steps:
[0186] Step S101: Acquire AIS data and extract MMSI information from the AIS data, using it as the unique identifier of the AIS target; for AIS data with the same identifier, apply an interpolation algorithm to process them within a set time window to obtain AIS interpolated data;
[0187] Step S102: Obtain Radar data, which has a temporary identifier; within a set time window, apply an interpolation algorithm to process it to obtain Radar interpolated data, and align the data points of the AIS interpolated data with those of the Radar interpolated data.
[0188] Step S103: Calculate the distance between the Radar interpolation data of each Radar target and each AIS interpolation data using the Haversine formula, and compare the calculated distance with a set threshold. If the distance is less than the threshold, the Radar target is considered to be successfully matched with the corresponding AIS target. Before the mapping relationship of the matched data is transmitted to the Radar data interpolation, in the Radar data standardization operation, the temporary identifier of the successfully matched Radar data is converted into the corresponding identifier.
[0189] Step S104: Merge the matched portions of the AIS data and the Radar data into a unified data stream, and perform fusion processing according to a preset algorithm to determine the final trajectory data of the target.
[0190] As described above, the computer-readable storage medium provided in this application embodiment performs time alignment of AIS data and radar data through interpolation processing, enabling the interpolated AIS data and radar data to be accurately matched in the trajectory recognition operator according to the Haversine formula. Through the matching operation of AIS data and radar data, the radar data is given a unified identifier with the AIS data, which solves the problem of confusing target identity information in traditional monitoring methods. This identifier runs through the subsequent processing flow of this method, enabling the fusion method to achieve a perfect combination of the rich identity and low-frequency data of AIS with the real-time position and high-frequency data advantages of radar.
[0191] Embodiments of this application also provide a computer program product capable of implementing all steps of the AIS and radar data fusion method based on the Haversine formula, where the execution subject is a server or client, as described in the above embodiments. When executed by a processor, this computer program / instruction implements the steps of the AIS and radar data fusion method based on the Haversine formula. For example, the computer program / instruction implements the following steps:
[0192] Step S101: Acquire AIS data and extract MMSI information from the AIS data, using it as the unique identifier of the AIS target; for AIS data with the same identifier, apply an interpolation algorithm to process them within a set time window to obtain AIS interpolated data;
[0193] Step S102: Obtain Radar data, which has a temporary identifier; within a set time window, apply an interpolation algorithm to process it to obtain Radar interpolated data, and align the data points of the AIS interpolated data with those of the Radar interpolated data.
[0194] Step S103: Calculate the distance between the Radar interpolation data of each Radar target and each AIS interpolation data using the Haversine formula, and compare the calculated distance with a set threshold. If the distance is less than the threshold, the Radar target is considered to be successfully matched with the corresponding AIS target. Before the mapping relationship of the matched data is transmitted to the Radar data interpolation, in the Radar data standardization operation, the temporary identifier of the successfully matched Radar data is converted into the corresponding identifier.
[0195] Step S104: Merge the matched portions of the AIS data and the Radar data into a unified data stream, and perform fusion processing according to a preset algorithm to determine the final trajectory data of the target.
[0196] As described above, the computer program product provided in this application performs time alignment on AIS data and radar data through interpolation processing, enabling the interpolated AIS data and radar data to be accurately matched in the trajectory recognition operator according to the Haversine formula. Through the matching operation of AIS data and radar data, the radar data is given a unified identifier with the AIS data, which solves the problem of confusing target identity information in traditional monitoring methods. This identifier runs through the subsequent processing flow of this method, enabling the fusion method to achieve a perfect combination of the rich identity and low-frequency data of AIS with the real-time position and high-frequency data advantages of radar.
[0197] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0198] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0199] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0200] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0201] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
Claims
1. An AIS and radar data fusion method based on Haversine formula, characterized in that, The method comprises: Step S1: obtaining AIS data, and extracting MMSI information in the AIS data as a unique identifier of an AIS target; for AIS data of the same identifier, applying an interpolation algorithm to process the AIS data within a set time window to obtain AIS interpolation data; Step S2: obtaining Radar data, the Radar data being provided with a temporary identifier; applying an interpolation algorithm to process the Radar data within a set time window to obtain Radar interpolation data, and aligning data points of the AIS interpolation data and the Radar interpolation data; Step S3: using a Haversine formula to calculate a distance between the Radar interpolation data of each Radar target and each of the AIS interpolation data, and comparing the calculated distance with a set threshold value; if the distance is less than the threshold value, it is considered that the Radar target and the corresponding AIS target are successfully matched; and before the Radar data interpolation in step S2, in a standardization operation of the Radar data, converting the temporary identifier of the successfully matched Radar data into a corresponding identifier; Step S4: merging the matched data of the AIS data and the Radar data into a unified data stream, and performing fusion processing according to a preset algorithm to determine final trajectory data of the target.
2. The Haversine formula based AIS and radar data fusion method according to claim 1, characterized in that, The step of applying an interpolation algorithm to process the AIS data of the same identifier within a set time window to obtain AIS interpolation data further comprises: After interpolation, the AIS interpolation data is stored in the cache as a key identifier; Before interpolation, the AIS interpolation data is found in the cache by identifier, and the new AIS interpolation data is combined to form Radar interpolation data; The step of applying an interpolation algorithm to process the Radar data within a set time window to obtain Radar interpolation data further comprises: After interpolation, the Radar interpolation data is stored in the cache as a key identifier; Before interpolation, the Radar interpolation data is found in the cache by identifier, and the new Radar interpolation data is combined to form Radar interpolation data; After the Radar target and the corresponding AIS target are successfully matched, the matched Radar interpolation data is deleted from the cache.
3. The Haversine formula based AIS and radar data fusion method according to claim 1, characterized in that, The formula for calculating the distance between the Radar interpolation data of each Radar target and each of the AIS interpolation data using the Haversine formula is: where d is the distance between two points on the sphere, r is the radius of the sphere, φ1and φ2are the latitudes of the two points on the sphere, λ1and λ2are the longitudes of the two points on the sphere, Δφ is the difference in latitude between the two points on the sphere, Δφ = φ2- φ1, and Δλ is the difference in longitude between the two points on the sphere, Δλ = λ2- λ1. φ1, Δλ is the difference in longitude between the two points on the sphere, Δλ = λ2- λ1. λ1.
4. The Haversine formula based AIS and radar data fusion method according to claim 1, characterized in that, The step of obtaining AIS data further comprises: For the received AIS data, the longitude, latitude and heading fields in the record are checked one by one; for the longitude, it is judged whether it is within the range of -180° to +180°; for the latitude, it is judged whether it is within the range of -90° to +90°; for the heading field, it is judged whether it is within the range of 0° to 360°; if it is out of range, it is considered that the data is abnormal, and it is filtered out, only the normal data meeting the range requirement is retained; The step of obtaining Radar data further comprises: For the received Radar data, check the longitude, latitude and heading fields in its record one by one; for the longitude, judge whether it is in the range of -180° to +180°; for the latitude, judge whether it is in the range of -90° to +90°; for the heading field, judge whether it is in the range of 0° to 360°; if out of range, consider that the data is abnormal, filter it out, and only keep the normal data meeting the range requirement.
5. The Haversine formula based AIS and radar data fusion method according to claim 1, characterized in that, The step of acquiring AIS data further comprises: Converting the AIS data into a unified Trace object format, which contains identifier, timestamp, latitude and longitude and speed fields; The step of acquiring Radar data further comprises: Converting the Radar data into a unified Trace object format, and the structure of the object is consistent with that of the Trace object of the AIS data; for the Radar data that has been matched with the AIS target, directly assign the corresponding identifier to it when converting.
6. The Haversine formula based AIS and radar data fusion method according to claim 1, characterized in that, The step of aligning the data points of the AIS interpolated data and the Radar interpolated data comprises: setting an external trigger signal to make the AIS and radar devices start recording data at the same time every whole second; and forcibly aligning the AIS data and the Radar data to a fixed time grid when recording data; Further comprising: Calculating the timestamp deviation of the AIS data and the Radar data of the same physical event; Performing time sliding window matching on the track data of the AIS and the radar to find the time offset corresponding to the maximum correlation; If it is detected that there is a continuous clock drift between the devices, automatically add offset compensation in the data processing pipeline.
7. The Haversine formula based AIS and radar data fusion method according to claim 1, characterized in that, The step of performing fusion processing according to a preset algorithm to determine the final track data of the target comprises: for the AIS data and the Radar data in the time window corresponding to each identifier, performing fusion processing according to the following rules: If there is only AIS data in the data, directly select the latest AIS data in the time window as the fusion result; If there is only Radar data, calculate the average value of all Radar data in the time window as the fusion result; If there are both AIS data and Radar data, select the fusion result according to the preconfigured priority strategy: if AIS is configured as the priority, use the latest AIS data; if radar is configured as the priority, use the average value of the Radar data.
8. An AIS and radar data fusion device based on Haversine formula, characterized in that, The device comprises: A first data acquisition module for acquiring AIS data and extracting MMSI information in the AIS data as the unique identifier of the AIS target; for the AIS data of the same identifier, within a set time window, apply an interpolation algorithm to process it to obtain AIS interpolated data; A second data acquisition module for acquiring Radar data, the Radar data having a temporary identifier; within a set time window, apply an interpolation algorithm to process it to obtain Radar interpolated data, and align the data points of the AIS interpolated data and the Radar interpolated data; a trajectory identification module, configured to calculate the distance between the Radar interpolation data of each Radar target and the AIS interpolation data of each AIS target using the Haversine formula, and compare the calculated distance with a set threshold value; if the distance is less than the threshold value, it is considered that the Radar target and the corresponding AIS target are matched successfully; and the mapping relationship of the matched data is delivered to the Radar data interpolation, and in the standardization operation of the Radar data, the temporary identifier of the matched Radar data is converted into the corresponding identifier; a trajectory fusion module, configured to merge the matched data of the AIS data and the Radar data into a unified data stream, and perform fusion processing according to a preset algorithm to determine the final trajectory data of the target.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the steps of the Haversine formula-based AIS and radar data fusion method in any one of claims 1 to 7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the Haversine formula-based AIS and radar data fusion method in any one of claims 1 to 7.
Citation Information
Patent Citations
Inland ship navigation multi-source data fusion method
CN118013453A
Real-time track fusion algorithm and system based on radar and AIS and application
CN119439105A