Method and system for synchronizing data of bulk goods in different locations of a supply chain
By dynamically adjusting data collection and transmission strategies based on cloud configuration and vehicle status prediction through edge gateways, the problem of low data transmission efficiency in remote locations is solved, and efficient data synchronization in complex network environments is achieved.
Patent Information
- Application Number
- CN202611403826.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-10
- Publication Date
- 2026-11-20
AI Technical Summary
Existing technologies lack the ability to adjust in advance during the synchronization of cross-regional data for bulk commodities in the supply chain, resulting in low efficiency of cross-regional data transmission. In particular, in complex network environments, problems such as duplicate transmission, network congestion, and reduced data synchronization accuracy are prone to occur.
By receiving instance configurations from the cloud through the edge gateway, obtaining the current status of the target vehicle and predicting the network type, determining the data collection and transmission strategy, and combining caching and retransmission mechanisms, a continuous but non-continuous data synchronization mode is formed.
It significantly improves the effective throughput and end-to-end efficiency of data synchronization, reduces redundant transmission, saves bandwidth resources, and enhances stability and adaptability in complex logistics environments.
Smart Images

Figure CN123145266A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, and in particular relates to a method and system for synchronizing cross-regional data of bulk commodities in the supply chain. Background Technology
[0002] As the bulk commodity supply chain continues to extend to cross-regional procurement, off-site warehousing, multimodal transport, and nationwide sales, commodity information is scattered across different regions and entities, easily leading to problems such as untimely status updates and severe information silos. This, in turn, affects inventory assessment, transportation scheduling, price response, and risk control. Therefore, it is necessary to establish an off-site data synchronization mechanism to uniformly collect, transmit in real time, and centrally manage key business data distributed across procurement locations, warehousing locations, transportation routes, and delivery locations.
[0003] In existing technologies, the transportation chain for bulk goods is long, involves many nodes, and spans a large time span. Data synchronization across different locations is not continuously completed under a stable network environment, but rather repeatedly interrupted and resumed under various changing network conditions. Current data synchronization methods typically treat network interruptions as random events, relying on a unified retransmission mechanism after connection recovery. This can easily lead to a sudden increase in transmission pressure in a short period, consuming limited bandwidth and causing problems such as repeated transmissions, network congestion, and reduced accuracy and timeliness of data synchronization across different locations.
[0004] In summary, the process of synchronizing cross-regional data of bulk commodities in the supply chain suffers from low data transmission efficiency due to the lack of advance adjustment capabilities in existing synchronization methods. Summary of the Invention
[0005] This application provides a method and system for synchronizing cross-regional data of bulk commodities in the supply chain, which can solve the problem in related technologies where the lack of advance adjustment capability in existing synchronization methods leads to low efficiency in cross-regional data transmission during the synchronization of cross-regional data of bulk commodities in the supply chain.
[0006] In a first aspect, embodiments of this application provide a method for synchronizing cross-regional data of bulk commodities in a supply chain, applied to an edge gateway, including: Receive the instance configuration of the target batch of goods sent from the cloud; wherein, the instance configuration includes metadata, expected event sequence, and network coverage map, and the expected event sequence includes each event type, the expected time window corresponding to each event, and the geographical location range corresponding to each event; The current state of the target vehicle is obtained, and based on the current state and the network coverage map in the instance configuration, the network type within a future time window is predicted to obtain the prediction result; wherein, the target vehicle is a transportation vehicle carrying the target cargo, the current state of the target vehicle includes the current position, current time and current direction of movement of the target vehicle, and the prediction result is the trend of network type change within a future time window; Based on the prediction results, the collection and transmission strategies for each priority data of the target batch are determined; wherein, the collection strategy includes collection frequency, compression strategy, and caching strategy; Based on the collection strategy of each priority data, a data packet set is obtained; if the network is available, according to the sending strategy of each priority data, each priority data packet in the data packet set is sent to the cloud, and an acknowledgment message returned by the cloud is received; wherein, the data packet set includes each priority data packet and the sequence number corresponding to each priority data packet, and the acknowledgment message is a cumulative acknowledgment or a cumulative acknowledgment and a selective acknowledgment, the cumulative acknowledgment and the selective acknowledgment are used to determine the sequence number of the lost data packet; If the confirmation message is either the cumulative confirmation or the selective confirmation, the lost data packet is queried and extracted from the data packet set according to the confirmation message, and the lost data packet is resent to the cloud.
[0007] The technical solutions described in this application embodiment have at least the following technical effects: The supply chain bulk commodity cross-regional data synchronization method provided in this application first receives the instance configuration of the target batch of goods (including metadata, expected event sequences, and network coverage maps, where the expected event sequences include event types, expected time windows for each event, and geographical locations for each event) sent from the cloud via an edge gateway. It then initializes the edge gateway based on the instance configuration, enabling it to not only passively transmit data but also possess contextual awareness capabilities throughout the entire lifecycle of the batch of goods. Next, the edge gateway obtains the current state of the target vehicle (including its current location, time, and direction of movement) and, based on the current state and the network coverage map in the instance configuration, predicts the network type within the future time window. This prediction result helps to understand the trend of network type changes within the future time window, transforming the data synchronization process from a reactive response to a proactive prediction, significantly reducing transmission interruptions and efficiency losses caused by network fluctuations. Finally, based on the prediction result, it determines the collection strategy for each priority data point of the target batch (including collection frequency, compression strategy, etc.). The edge gateway employs various strategies (including caching and sending) to optimize the use of limited network resources, thereby preventing delays in critical data due to bandwidth contention and effectively improving the overall data synchronization throughput. Next, based on the collection strategy for each priority data segment, the edge gateway acquires a set of data packets (including each priority data packet and its corresponding sequence number). If the network is available, it sends each priority data packet in the set to the cloud according to the sending strategy for each priority data segment, and receives confirmation messages (cumulative confirmation or cumulative and selective confirmation) from the cloud. This helps determine whether the cloud has received the complete set of data packets. Finally, if the confirmation message is cumulative or selective confirmation, the edge gateway queries and extracts lost data packets from the data packet set based on the confirmation message and resends the lost data packets to the cloud. This allows the edge gateway to accurately identify lost data packets without retransmitting all data, reducing redundant transmission, saving bandwidth resources, accelerating packet loss recovery, and improving end-to-end data synchronization efficiency and integrity. This method forms a continuous but not network-dependent data synchronization mode by caching when the network is unavailable, sending data according to a strategy after the network is restored, and combining a retransmission mechanism. This significantly enhances the stability and adaptability of edge gateways in complex logistics environments (such as cross-regional transportation and weak coverage areas).
[0008] Secondly, embodiments of this application provide a supply chain bulk commodity remote data synchronization system, applied to an edge gateway, comprising: An initialization unit is used to receive instance configurations for a target batch of goods sent from the cloud; wherein, the instance configuration includes metadata, expected event sequences, and a network coverage map, and the expected event sequences include each event type, the expected time window corresponding to each event, and the geographical location range corresponding to each event; The prediction unit is used to obtain the current state of the target vehicle and predict the network type within a future time window based on the current state and the network coverage map in the instance configuration, and obtain the prediction result; wherein, the target vehicle is a transportation vehicle carrying the target cargo, the current state of the target vehicle includes the current position, current time and current direction of movement of the target vehicle, and the prediction result is the trend of network type change within a future time window; The strategy determination unit is used to determine the collection strategy and transmission strategy of each priority data of the target batch based on the prediction results; wherein, the collection strategy includes collection frequency, compression strategy and caching strategy; The data acquisition and transmission unit is used to acquire a set of data packets based on the acquisition strategy of each priority data packet; if the network is available, it sends each priority data packet in the set of data packets to the cloud according to the transmission strategy of each priority data packet, and receives the confirmation message returned by the cloud; wherein, the set of data packets includes each priority data packet and the sequence number corresponding to each priority data packet, and the confirmation message is a cumulative confirmation or a cumulative confirmation and a selective confirmation, wherein the cumulative confirmation and the selective confirmation are used to determine the sequence number of the lost data packet; The retransmission unit is used to query and extract the lost data packet from the data packet set according to the confirmation message if the confirmation message is the cumulative confirmation or the selective confirmation, and retransmit the lost data packet to the cloud.
[0009] Thirdly, embodiments of this application provide an edge gateway, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in any of the embodiments of the first aspect.
[0010] It is understood that the beneficial effects of the second and third aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart illustrating a method for synchronizing bulk commodity data across different locations in a supply chain, as provided in an embodiment of this application. Figure 2This is an example diagram illustrating the strategy mapping representation in a method for synchronizing bulk commodity data across different locations in the supply chain, provided in an embodiment of this application. Figure 3 This is a schematic diagram of the transmission process during the normal network phase in a method for synchronizing bulk commodity data across different locations in the supply chain, provided in an embodiment of this application. Figure 4 This is a schematic diagram of the batch retransmission process when the network is disconnected and then restored in the cross-regional data synchronization method for bulk commodities in the supply chain provided in an embodiment of this application. Figure 5 This is a schematic diagram of the process of actively pulling data from the cloud in the method for synchronizing bulk commodity data in a different location in the supply chain, as provided in an embodiment of this application. Detailed Implementation
[0013] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0014] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0015] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0016] In related technologies, during the remote data synchronization of bulk commodities in the supply chain, the same batch of goods typically undergoes multiple transportation and operational stages, including shipping, port loading and unloading, rail transport, road transshipment, and factory receiving. The network conditions in different regions vary significantly across these stages and constantly change with the transportation location. For example, loading and unloading ports usually have good network environments, while ocean shipping may experience prolonged periods of low bandwidth or even no network access. Intermittent network outages or instability are common along railway lines and in some inland areas. Due to the long transportation chain, numerous nodes, and large time span of bulk commodities, remote data synchronization is not completed continuously under a stable network environment but requires repeated interruptions and recoveries under varying network conditions. Existing data synchronization methods typically treat network interruptions as random events, relying more on a unified retransmission mechanism after connection recovery, lacking proactive utilization of transportation routes and network change patterns. As a result, before entering areas with weak or no network, the system continues to collect and accumulate a large amount of data in the usual way. After the network is restored, the historical data cached during the offline period is uploaded in a concentrated manner, which causes a sudden increase in transmission pressure in a short period of time, occupies limited bandwidth, and leads to problems such as repeated transmission, low retransmission efficiency and network congestion.
[0017] Meanwhile, the data synchronized across different locations for bulk cargo typically exhibits significant differences in urgency. For example, information concerning cargo anomalies, location changes, transportation safety, or critical operational milestones often requires priority delivery, while general logs, statistics, or less timely data can be sent later. However, existing synchronization methods generally lack the ability to dynamically differentiate and process data based on its importance. Especially in scenarios with deteriorating network conditions or after a recent connection restoration, important and ordinary data are easily transmitted together, affecting not only the timely delivery of critical data but also further reducing overall synchronization efficiency. Particularly in multimodal transport scenarios, if a near-full retransmission is used every time a connection is restored, not only will a large amount of data already received by the cloud be repeatedly uploaded, but it may also prevent truly missing critical data from being quickly identified and prioritized for completion, thereby reducing the accuracy and timeliness of cross-regional data synchronization.
[0018] To address the aforementioned issues, this application provides a method and system for cross-regional data synchronization of bulk commodities in the supply chain. In this method, an edge gateway first receives the instance configuration of the target batch of goods (including metadata, expected event sequences, and a network coverage map; the expected event sequences include event types, expected time windows for each event, and geographical location ranges for each event) sent from the cloud. Initialization is performed based on the instance configuration, enabling the edge gateway to not only passively transmit data but also possess contextual awareness capabilities throughout the entire lifecycle of the batch of goods. Then, the edge gateway obtains the current state of the target vehicle (including its current location, current time, and current direction of movement) and, based on the current state and the network coverage map in the instance configuration, predicts the network type within a future time window. This prediction result helps to understand the trend of network type changes within the future time window, transforming the data synchronization process from a reactive response to a proactive prediction, significantly reducing transmission interruptions and efficiency losses caused by network fluctuations. Finally, based on the prediction result, the collection strategy (including collection frequency, compression strategy, and caching strategy) for each priority data of the target batch is determined. The sending strategy facilitates more efficient use of limited network resources, thereby avoiding delays in critical data due to bandwidth contention and effectively improving the overall data synchronization throughput. Next, the edge gateway, based on the collection strategy for each priority data type, obtains a set of data packets (including each priority data packet and its corresponding sequence number). If the network is available, it sends each priority data packet in the set to the cloud according to the sending strategy for each priority data type, and receives confirmation messages (cumulative confirmation or cumulative and selective confirmation) from the cloud. This helps determine whether the cloud has received the complete set of data packets. Finally, if the confirmation message is cumulative or selective confirmation, the edge gateway queries and extracts lost data packets from the set based on the confirmation message and resends the lost data packets to the cloud. This allows the edge gateway to accurately identify lost data packets without retransmitting all data, thereby reducing redundant transmission, saving bandwidth resources, accelerating packet loss recovery, and improving end-to-end data synchronization efficiency and integrity. This method forms a continuous but not network-dependent data synchronization mode by caching when the network is unavailable, sending data according to a strategy after the network is restored, and combining a retransmission mechanism. This significantly enhances the stability and adaptability of edge gateways in complex logistics environments (such as cross-regional transportation and weak coverage areas).
[0019] The supply chain bulk commodity remote data synchronization method provided in this application embodiment can be applied to an edge gateway. In this case, the edge gateway is the execution subject of the supply chain bulk commodity remote data synchronization method provided in this application embodiment. This application embodiment does not impose any restrictions on the specific type of edge gateway.
[0020] For example, an edge gateway may include a data acquisition device, a status sensing device, and a control device communicatively connected to the data acquisition device and the status sensing device. The data acquisition device is capable of collecting transportation, status, and operational data related to the target shipment, and may include GPS / AIS positioning equipment, temperature and humidity sensors, weighbridges, industrial cameras, gas leak sensors / liquid level sensors, vibration sensors, pressure sensors, etc.; the status sensing device is capable of collecting current operating status data, and may include GPS / AIS positioning equipment, inertial navigation systems, vehicle-mounted positioning terminals, electronic compasses, etc.; the control device is capable of data processing and controlling the data acquisition device and the status sensing device, and may include industrial controllers, embedded processors, single-board computers, edge computing servers, CPUs, ARM processors, etc.
[0021] To better understand the method for synchronizing bulk commodity data across different locations in the supply chain provided in this application, the specific implementation process of the method for synchronizing bulk commodity data across different locations in the supply chain provided in this application will be described below by way of example.
[0022] Figure 1 This illustration shows a schematic flowchart of a method for synchronizing bulk commodity data across different locations in a supply chain, as provided in an embodiment of this application. The method includes: S100 receives instance configurations for the target batch of goods sent from the cloud. Instance configurations include metadata, expected event sequences, and a network coverage map. The expected event sequences include each event type, the expected time window for each event, and the geographical location range for each event.
[0023] It can be understood that the cloud is a remote computing platform used to receive, store, and process large-scale, cross-regional synchronized data of goods, and is responsible for instance configuration generation, data verification, missing data identification, and event sequencing. The cloud can be: a public cloud platform, such as a backend system deployed on public cloud infrastructure, which can be a cloud server cluster, container platform, cloud database, cloud microservice system, etc.; a private cloud platform, such as a cloud platform built and deployed by an enterprise in its own data center or dedicated server room, which can be an enterprise private cloud cluster, local data center server cluster, dedicated virtualization platform, dedicated database and application server, etc.; a hybrid cloud platform, where some capabilities are deployed in the public cloud and some capabilities are deployed locally within the enterprise, such as template management and message distribution in the public cloud, while data processing involving financial or sensitive business is placed in the private cloud.
[0024] Metadata can include the target lot identifier, the type of goods (such as crude oil, iron ore, grain, coal, etc.), and the mode of transport (such as sea, rail, road or multimodal transport).
[0025] The expected event sequence is a list of critical logistics events from start to finish, arranged chronologically. Each event includes the event type (e.g., loading completed, departure, canal transit, arrival, unloading completed, factory entry), the expected time window for the event (start and end UTC times), and the geographical area for the event (circular area or convex polygon, represented by latitude and longitude coordinates).
[0026] A network coverage map divides the entire transportation route into several continuous areas (such as port areas, near-shore 30 nautical miles, ocean, canal sections, and railway mountain areas). Each area is marked with its boundary (polygon, a set of latitude and longitude coordinates), network type (such as 5G / 4G / satellite communication / no network), and network performance parameters (bandwidth B (kbps), latency RRT (ms), packet loss rate P (%)). This data can come from maritime map services, operator coverage data, or historical measurements.
[0027] For example, after a batch of bulk goods has been traded, a transportation arrangement has been signed, or it has entered the execution phase, users can provide the cloud with basic business information and transportation plan information corresponding to that batch of goods. This includes information such as the type of goods, origin, destination, planned transportation route, mode of transport, planned departure time, planned transshipment points, and known fixed operational points (such as loading port, unloading port, factory entry point, etc.). Users can manually input this information on the cloud interface or select the transportation route through a visual interface.
[0028] If a standard template matching the transportation plan for this batch of goods exists in the cloud-based template library, the cloud can directly call that pre-set template. Pre-set templates can be pre-established by the platform operator and are suitable for common, relatively fixed transportation corridors and modes. Examples include fixed sea routes, fixed railway train segments, common port-to-factory transportation channels, and common multimodal transport links.
[0029] If the template cannot perfectly match the current transportation plan, but there is a similar preset template, the cloud can generate a derived template based on that template and adjust the differences. Adjustments can include adding new events, deleting events that are no longer passed through, modifying the event time window, modifying some geographical ranges, and modifying the network environment.
[0030] If a user believes that the preset template cannot meet the transportation needs of this batch of goods, they can create their own template in the cloud interface, or modify a preset template to form a custom template suitable for the current batch of goods.
[0031] Based on the user's input, the cloud performs template instantiation for this batch of goods, transforming the template from a general template into a configuration specific to this batch. The cloud can assign a globally unique batch identifier (target batch ID) to this batch of goods (target batch). The event time descriptions in the template may use general relative time expressions, such as 0 to 4 hours after shipment, 3 to 7 days after departure, and 2 hours before or after arrival. The cloud can convert these relative time windows into absolute time windows based on the planned shipment time, so that each event corresponds to a specific UTC time range after conversion. The cloud can generate a unique identifier (i.e., event ID) for each event and fill the template with the user's input information to generate an instance configuration for this batch of goods. The instance configuration for this batch of goods can include the target batch ID, goods type, transportation method, expected event sequence (including each event ID, each event type, the expected time window corresponding to each event, and the geographical location range corresponding to each event), network coverage map, and default synchronization strategy (such as data collection interval, whether data is compressed, etc.).
[0032] For known transport nodes and means of transport before shipment, the cloud can directly identify the corresponding edge gateways, which may include origin node gateways (such as loading port weighbridge gateways, mine shipment gateways), first-leg transport vehicle gateways (such as ship-mounted gateways, vehicle-mounted gateways), destination node gateways (unloading port receiving gateways, factory entry gateways), and known transit fixed node gateways. For edge gateways that may be added later (such as unloading ports temporarily changed due to weather or strikes, or backup warehouses), the cloud does not immediately issue instance configurations, but rather issues them some time before the goods actually arrive at the node (such as several hours in advance).
[0033] The cloud can push instance configurations to each target edge gateway via a secure communication channel (such as TLS-encrypted MQTT or HTTP / 2 protocol). After distribution, the cloud waits for a confirmation message from the edge gateway. If no confirmation message is received, the cloud retains the task to be distributed and will resend it after the edge gateway comes online.
[0034] Edge gateway initialization: The edge gateway can parse the instance configuration into a locally recognizable data structure and store it in local non-volatile memory, so that the configuration content of the target batch can still be recovered after power failure, restart, or temporary loss of connection. The edge gateway can read the expected event sequence from the instance configuration, establish a local event record for each event, and organize the events according to the expected time window to form an event scheduling order, so as to determine which event stage it is currently in and whether it has entered the expected time range of a certain event during subsequent operation. For the geographical location range in the instance configuration, the edge gateway can further build a local location matching structure, so that it can quickly determine the current transportation segment or event range based on the current location during subsequent operation. The edge gateway can initialize the data acquisition device's acquisition frequency, compression rules, caching strategy, etc., according to the default synchronization strategy.
[0035] If the current edge gateway is not the initial gateway for this batch of goods, but rather a gateway added midway, the edge gateway can query the cloud for the completed event status and related synchronization status of the previous responsible segment based on the target batch identifier in the instance configuration, or obtain the latest handover information related to the target batch from the handover node. Based on the status of the previous responsible segment, the edge gateway can determine the starting event position, starting sequence status, and the current time window for connection after local initialization, thereby avoiding issues such as event gaps, sequence misalignments, or duplicate collection and transmission in relay scenarios.
[0036] This step enables the edge gateway to obtain a structured understanding and unified scheduling basis for the entire process of target cargo transportation during the initialization phase, thereby achieving standardization and scenario awareness in the data collection and synchronization process.
[0037] S200: Obtain the current state of the target vehicle and, based on the current state and the network coverage map in the instance configuration, predict the network type within a future time window to obtain the prediction result. The target vehicle is the transportation tool carrying the target cargo; its current state includes its current location, current time, and current direction of movement; and the prediction result represents the trend of network type changes within the future time window.
[0038] It is understandable that the same batch of goods may be transported by different target vehicles in different transportation segments (such as ships, trains, trucks, etc.), and the edge gateway on each target vehicle independently obtains the current status of its own vehicle.
[0039] For example, the state perception device can be integrated into an edge gateway or exist as an external module. It can obtain the current position, current time, and current direction of movement of the target vehicle through various sensing and positioning methods: For the current position, the state perception device can collect data through a satellite positioning system, such as a GPS / AIS positioning device, periodically receive satellite signals and calculate the current latitude and longitude coordinates; in scenarios where satellite signals are limited (such as tunnels and warehouses), it can be supplemented by an inertial navigation unit (IMU) for short-term position estimation, or compensated by combining base station positioning and Wi-Fi positioning; For the current time, the state perception device can use the UTC time provided by the satellite positioning system as a high-precision time source, or synchronize with the cloud time through a network time synchronization protocol (such as NTP) and maintain the clock locally; For the current direction of movement, the state perception device can calculate the heading angle based on continuous positioning points (i.e., obtain the direction of movement from the difference between two consecutive position coordinates), or directly measure the orientation through a built-in electronic compass (magnetometer). In dynamic scenarios, it can also integrate gyroscope data from the IMU to improve the stability and real-time performance of orientation measurement.
[0040] If the status sensing device is a built-in module (such as a GPS / IMU module integrated on the gateway motherboard), it can be directly connected to the edge gateway's processor via a serial port (UART), I²C, SPI, or USB interface. The status sensing device can continuously send the collected data to the edge gateway using polling or interrupt methods. If it is an external device (such as an independent positioning terminal, vehicle terminal, etc.), it can establish a communication link with the edge gateway via wired (such as RS232, RS485, Ethernet) or wireless (such as Bluetooth, Wi-Fi, LoRa, etc.). The status sensing device can transmit the collected data to the edge gateway via TCP / UDP protocol or lightweight messaging protocol (such as MQTT).
[0041] In simple scenarios, the edge gateway can employ a uniform linear extrapolation model to estimate the position at several future time points based on the current direction and speed. The current position can be projected onto the planned transportation path, and forward extrapolation can be performed along the path at the current speed. When the precise path is unknown, linear or piecewise linear predictions can be made based on the current direction of movement. The edge gateway can divide a future time window (e.g., two hours) into several consecutive time slices (e.g., every 5 or 10 minutes) and calculate the corresponding predicted position coordinates for each time slice.
[0042] The edge gateway can match the predicted location coordinates of each time slice with the network coverage map (e.g., judging if the point is inside a polygon or the nearest area), determine the network area where each predicted location coordinate falls (e.g., port area, nearshore, ocean, mountainous area, etc.), and find the network type corresponding to the corresponding area (e.g., 5G, 4G, satellite communication, no network) and the parameters such as bandwidth, latency and packet loss rate corresponding to the network type. The network type of each time slice is arranged in chronological order to form a network state sequence that changes over time (i.e., prediction result).
[0043] This step enhances the edge gateway's ability to predict network environment fluctuations, thereby transforming data synchronization from a passive response to network changes to proactive prediction and advance adjustment.
[0044] In one possible implementation, step S200 involves predicting the network type within a future time window based on the current state and the network coverage map in the instance configuration, obtaining the prediction result, including: S210, Calculate the position of each time point within the future time window based on the current state.
[0045] It's understandable that the future time window T can be set as a rolling forecast window of 30 minutes to 6 hours. Within this future time window, time can be discretized and sampled to form multiple forecast time points. Time step size. It can be set to 1 minute / 5 minutes / 10 minutes. For example, the future time window T=2 hours, the time step... =5 minutes, then the number of time points is 120 / 5=24.
[0046] For example, we can assume the current time is Current location is Current direction of motion (0~360°), the current velocity v can be obtained by the difference of historical positions.
[0047] For each point in time within the future time window (Right now Edge gateways can calculate time points. Displacement distance: ; Calculate displacement components using a geographic approximation model (a planar approximation may be used for small areas): , Update the time point based on the current location. Location: , where R is the Earth's radius.
[0048] Since the actual transport follows the planned transport path, further adjustments can be made, meaning the edge gateway can... Projecting onto the planned transportation route, if it deviates from the route, it can be corrected to the nearest path node; if it enters a specific area (port / canal), the regional trajectory model can replace the straight line model.
[0049] S220, based on the network coverage map and the location of each time point within the future time window, determine the network type for each time point within the future time window.
[0050] For example, the edge gateway can insert all polygonal regions in the network coverage map into an R-tree index structure for fast querying. This involves storing the bounding rectangle (MBR) of each region, performing fast MBR filtering before precise point-in-polygon determination during the query. This mechanism can reduce query complexity from O(N) to O(log N).
[0051] For each point in time and its location within the future time window ( , Edge gateways can query and match data in the R-tree. The set of candidate regions intersecting the outer rectangles The candidate region set is evaluated one by one, which can be done using algorithms that determine whether a point is inside a polygon (such as ray casting / winding number). Does it fall within the candidate region? inside, if Then the time point can be determined. Candidate Region And extract candidate regions from the network coverage map. The corresponding network type is the time point. The network type. If If it does not belong to any region, the edge gateway can expand the matching based on the nearest neighbor region.
[0052] Edge gateways can time-series splice the network types at each point in time to form a network state sequence. ,in, For time points Network type.
[0053] S230, merge time points of the same network type and consecutive time into a time period to obtain the prediction result. The prediction result includes at least one network type.
[0054] For example, the edge gateway can initialize variables such as the start time of the current segment. Current segment network type The result set is Starting from the second time point, traverse the network state sequence point by point (i=2→n) to determine the time point. of Whether or not If they are the same, they can be considered to be in the same network segment, no segment switch is performed, and the traversal continues. If they are different, it indicates that the current segment has ended, and the end time of the current segment is [time value missing]. And generate a network time period record. ,Will Add to the results collection.
[0055] The start time of the new segment can be updated. and network type From a time point To begin, the network state sequence is re-traversed point by point, and the above process is repeated. The resulting set consists of several consecutive time periods and their corresponding network types.
[0056] The above steps enable the edge gateway to move beyond simply sensing the network at a single point and to predict the overall network environment over a period of time. By clearly defining network switching boundaries and duration information, it is possible to plan ahead and dynamically adjust data collection and transmission strategies, thereby reducing transmission interruptions and resource waste caused by network mutations.
[0057] S300 determines the data collection and transmission strategies for each priority level of the target shipment based on the prediction results. The collection strategy includes collection frequency, compression strategy, and caching strategy.
[0058] It is understandable that priority data can be categorized into high-priority, medium-priority, and low-priority data. High-priority data can be uploaded to the cloud immediately and may include abnormal data and event data. Abnormal data may include cargo anomaly alarm data, such as excessive temperature, leakage, moisture, abnormal pressure, etc.; transportation safety alarm data, such as abnormal hatch opening, abnormal vibration, capsizing risk, deviation from the route, etc.; and equipment failure or communication anomaly data. Event data may include event completion data, such as loading completion, departure, arrival, unloading completion, and factory entry completion.
[0059] Medium-priority data can be continuously synchronized, but does not necessarily need to be uploaded immediately. It can include location data, movement direction data, routine temperature and humidity data, routine operating status data, periodic weighing data, equipment operating parameters, etc.
[0060] Low-priority data can be uploaded later and may include video screenshots, historical logs, raw sensor long-term records, debugging information, statistical reports, and non-critical image data.
[0061] After the data acquisition device collects raw data, the edge gateway can determine which data belongs to which priority based on data content, event type, or threshold rules. For example, if the temperature sensor collects the current temperature (e.g., 24°C) every 30 minutes and the temperature does not exceed the temperature threshold (which can be preset), the edge gateway classifies it as medium-priority data; if the temperature sensor collects a temperature of 68°C, exceeding the temperature threshold, the edge gateway classifies it as high-priority data (i.e., abnormal data).
[0062] For example, the edge gateway can dynamically determine the collection strategy for data of different priorities based on the network type at different times. For instance, if the network type is 5G / 4G, the edge gateway can increase the collection frequency of high-priority and medium-priority data based on the initial collection frequency, while allowing low-priority data to be collected synchronously; it can adopt a light compression or no compression strategy to reduce computational overhead; and it can appropriately reduce cache strength to improve data integrity. If the network type is satellite communication, the edge gateway can moderately reduce the collection frequency of medium and low-priority data, adopt standard compression algorithms (such as LZ-type or incremental compression), and enable a caching mechanism. If the network type is no network, the edge gateway can reduce the collection frequency of high and medium-priority data, suspend the collection of low-priority data, adopt a high compression ratio strategy, and write all data to a local cache (such as a ring cache or persistent storage).
[0063] Different transmission strategies can be pre-set for different network types. For example, for 5G / 4G networks, the edge gateway can adopt a real-time or near-real-time transmission strategy, allowing concurrent transmission through multiple channels; for satellite communication networks, the edge gateway can prioritize the transmission of high-priority data, delaying the transmission of medium and low-priority data or continuing to buffer it; for networks without a network, the edge gateway can pause transmission, only perform local buffering, and record the queue of data to be transmitted.
[0064] The edge gateway can organize the above-mentioned acquisition and transmission strategies according to time windows, forming a strategy scheduling table that changes over time. During operation, the edge gateway can dynamically switch the corresponding strategy based on the current time or triggering conditions (such as entering a certain network area), and send the strategy parameters to the data acquisition device and communication module for execution.
[0065] Through this step, the edge gateway can implement differentiated and dynamic collection and transmission control for data of different priorities, thereby achieving optimal resource allocation and improving data synchronization efficiency.
[0066] In one possible implementation, step S300 involves determining the data collection and transmission strategies for each priority level of the target shipment based on the prediction results, including: S310, based on the network type and policy mapping table in the prediction results, determine the data collection strategy for each priority level.
[0067] For example, for each time period in the prediction results, the edge gateway can use the network type corresponding to the time period as an index to look up the collection policy corresponding to each priority data in the policy mapping table. An example diagram of the policy mapping table is shown below. Figure 2 As shown.
[0068] The edge gateway can structure and combine the collection strategies of all priority data in each time period to form a time-collection strategy mapping table. During operation, it determines the time period based on the current time, extracts the collection strategy corresponding to the time period from the time-collection strategy mapping table, and sends the collection strategy to the data acquisition device.
[0069] This step enables data acquisition to dynamically adapt to the network environment, ensuring that high-priority data is prioritized under any network conditions, reducing invalid acquisition and resource waste, thereby improving overall data synchronization efficiency and system stability.
[0070] S320: Based on the network type in the prediction results, determine the sliding window size of the transmission strategy. The sliding window size controls the amount of data transmitted, and the transmission strategy includes preset transmission rules and a sliding window mechanism.
[0071] For example, preset sending rules may include sending high-priority data to the cloud immediately if there is unsent high-priority data in the cache and the network is available. High-priority data is not subject to sliding window restrictions and directly enters the sending channel, ensuring that urgent data is transmitted with the lowest possible latency. When the high-priority data cache is empty, medium-priority data is processed. Medium-priority data is controlled by a sliding window; if the window is full, sending is paused, and ACKs are awaited to avoid congestion on low-bandwidth links. Low-priority data is sent when there is no pending high-priority or medium-priority data and network bandwidth is sufficient (e.g., 5G / 4G). Low-priority data is also controlled by a sliding window.
[0072] For each time period in the prediction results: in addition to obtaining the network type based on the network coverage map, the corresponding network performance parameters (i.e., bandwidth B, latency RRT, packet loss rate P) can also be obtained. The edge gateway can calculate the base window size for each time period based on fundamental network transmission principles (similar to TCP). ,because The unit is bits, while the unit for window size is the number of data packets. Convert to packet size. Assuming a single packet size is S (KB), convert it to bits (S × 1024 × 8 bits). The formula for calculating the base window size is: ,in, This represents the base window size. For example, if a 4G network has a bandwidth of B = 10000kbps, a latency RTT = 50ms, and a packet size of S = 1KB, then the base window size is... This means that the basic window can hold 61 data packets.
[0073] The edge gateway can adjust the base window size for each time period based on the packet loss rate. The higher the packet loss rate, the smaller the window, in order to improve link stability. ,in, This is the corrected window size. Window boundaries are preset based on network type, such as the maximum window size for 5G / 4G. It can be 100~200, the maximum window size for satellite communication. It can be 10~20. The corrected window size for each time period is constrained based on the network type. , where W is the size of the sliding window.
[0074] Sliding window mechanism (for low to medium priority data): For each event, the edge gateway can independently maintain a sliding window. ,in This is the starting sequence number of the current window. The sliding window can be read from the cache. The system processes data packets, sends these data packets to the cloud, adds copies of these data packets to the pending confirmation queue, and starts a retransmission timer for each data packet.
[0075] When the edge gateway receives an ACK from the cloud, it removes the confirmed data from the pending confirmation queue, releases cache space, and updates... =ACK+1, the window slides forward, allowing the transmission of new data packets. If a data packet is not acknowledged within a set time (e.g., 60 seconds), the edge gateway can determine that a timeout has occurred, re-add the data packet to the transmission queue while maintaining the original sequence number, and reset the retransmission timer; if the number of retransmissions exceeds the threshold, the edge gateway can mark it as abnormal, report it to the cloud, or trigger link diagnostics.
[0076] This step enables the data transmission volume to be matched with the actual transmission capacity in different network environments. It improves the concurrent data transmission capacity and link utilization in high-bandwidth networks, effectively suppresses congestion and excessive retransmission in low-bandwidth or high-latency networks, and ensures the low-latency transmission requirements of high-priority data, thereby improving the overall transmission efficiency, stability and reliability of the data synchronization process.
[0077] In one possible implementation, the method for synchronizing bulk commodity data across different locations in the supply chain is characterized by further comprising: S301, get the current cache usage rate.
[0078] For example, the edge gateway can maintain a variable in the caching module. (i.e., the number of bytes currently used), the total cache capacity is (Fixed value), triggered on each write or release. Update, i.e., write data packets Release data packets And calculate the current cache utilization: ,in, This represents the current cache utilization rate.
[0079] S302 adjusts the collection frequency of data for each priority level based on the current cache occupancy rate.
[0080] For example, after each data acquisition device completes its data collection, when the edge gateway is about to write the data packet to the cache, it can compare the current cache occupancy rate with a high-water mark threshold (e.g., 80%) and a low-water mark threshold (e.g., 30%). A high watermark threshold indicates that the system is under high load, the cache space is nearing saturation, and current data packets are still allowed to be written (to prevent direct data loss). The edge gateway can extend the sampling frequency for the next collection cycle, such as extending the current sampling frequency for each priority data to 1.5 times. A low watermark threshold... A high water level threshold indicates that the system is under moderate load, the cache space is becoming strained, and the current collection frequency of data at each priority level should be maintained. A low water level threshold indicates that the system is under low load, with sufficient cache space. The edge gateway can restore the collection frequency of data of each priority level (gradually shortening the cycle). That is, it can gradually restore the collection frequency to the default value or the value in the collection strategy determined based on the prediction results. The restoration process can be carried out in a gradual manner (such as reducing the collection interval by 10% each time) to avoid sudden traffic surges.
[0081] The above process forms a dynamic adjustment mechanism with hysteresis characteristics to avoid frequent fluctuations in the sampling frequency around the threshold.
[0082] S303 determines the cache coverage strategy for each priority level of data based on the current cache occupancy rate.
[0083] For example, high-priority data is protected with the highest level of protection. Regardless of the current cache occupancy rate, directly overwriting unreleased data is prohibited. When a high-load condition occurs, if the high-priority cache partition has no writable space, the edge gateway can trigger a blocking and waiting mechanism, that is, suspend the writing of new data until existing data is sent and confirmed, thereby releasing the space and ensuring that critical business data is not lost.
[0084] If the current cache utilization is at a low load, the edge gateway uses append-only writing for low-priority data, that is, it does not perform cache overwrite operations, thereby ensuring complete data storage.
[0085] If the current cache utilization is at a medium load, for medium priority data, the data packet with the smallest sequence number in the set of sent but unacknowledged data packets that are not in the retransmission window can be selected from the medium priority cache partition to overwrite the data packet with the smallest sequence number, so as to free up space; for low priority data, the data packet with the smallest sequence number in the low priority cache partition can be directly overwritten based on the first-in-first-out (FIFO) principle.
[0086] If the current cache occupancy rate is under high load, for medium priority data, the coverage range can be expanded to include the set of data packets that have been sent but not acknowledged and are not in the current sliding window, and the data packet with the smallest sequence number can be covered first. For low priority data, the data packet with the smallest column number in the low priority cache partition can be covered directly, thereby quickly releasing cache space.
[0087] Through this step, the edge gateway can dynamically select whether to overwrite historical data based on different data priorities when cache resources are limited, thereby achieving a balance between prioritizing the protection of critical data and giving up non-critical data resources. This ensures that the system still has stable data collection and transmission capabilities under high-load network and sudden data scenarios.
[0088] S400 acquires a set of data packets based on the collection strategy for each priority data type. If the network is available, it sends each priority data packet in the set to the cloud according to the sending strategy for each priority data type, and receives an acknowledgment message from the cloud. The data packet set includes each priority data packet and its corresponding sequence number. The acknowledgment message is either a cumulative acknowledgment or a combination of cumulative and selective acknowledgments. Cumulative and selective acknowledgments are used to determine the sequence number of a lost data packet.
[0089] It can be understood that cumulative acknowledgment (ACK) indicates that all data packets up to a certain sequence number have been successfully received; cumulative acknowledgment and selective acknowledgment (ACK and SACK) indicate that, in addition to cumulative acknowledgment, the sequence numbers of the discrete data packets that have been successfully received are additionally identified, thereby clarifying which data packets have been received and which are missing.
[0090] For example, the data acquisition device can perform differentiated acquisition of data with different priorities according to the acquisition strategy issued by the edge gateway, and preprocess the acquired data locally (such as formatting and compression encoding), and encapsulate it according to a unified data packet structure. Multiple data packets can be arranged into a data packet set in chronological order or priority order.
[0091] The data acquisition device can send data packet sets to the edge gateway via a communication interface (such as a serial port or Ethernet). The edge gateway parses and verifies the data packet sets (e.g., verifying sequence number continuity and data integrity), and writes them into the corresponding buffer queues (e.g., high-priority buffer partitions, medium-priority buffer partitions, and low-priority buffer partitions) according to priority. Simultaneously, it establishes a sequence number-data packet mapping relationship for subsequent acknowledgment and retransmission. The edge gateway can monitor the current network status in real time and schedule the data packet sets according to the corresponding sending strategy based on the current network status.
[0092] The cloud can maintain an `expected_seq` for each event, initially set to 1. When the cloud receives a data packet with a sequence number equal to `expected_seq`, it increments `expected_seq` by 1 and sends an ACK to the edge gateway, where ACK = `expected_seq` - 1 (i.e., the largest consecutively received sequence number). For example, if data packets 1, 2, 3, and 4 are received, then ACK = 4. If the cloud receives non-consecutive data packets (e.g., data packets 1, 2, 4, and 5, with packet 3 missing), in addition to sending a cumulative acknowledgment ACK = 2 to the edge gateway, it will also append a SACK block to the acknowledgment message, with SACK = 4 and 5.
[0093] This step enables closed-loop control from data acquisition, encapsulation, transmission to confirmation feedback, which not only ensures the orderliness and traceability of data transmission, but also provides support for a precise retransmission mechanism, thereby improving the reliability and efficiency of overall data synchronization.
[0094] In one possible implementation, in step S400, according to the sending strategy for each priority data, each priority data packet in the data packet set is sent to the cloud, including: The edge gateway divides the target shipment into multiple anticipated events based on instance configuration, and switches the corresponding event to the execution state when the event meets the trigger conditions of the time window or geographical location. In the event execution state, the edge gateway independently generates a sequence number system for that event and performs data collection, caching, and transmission processing based on the event's sliding window mechanism. During data transmission, each data packet carries the target shipment identifier, event identifier, and event sequence number for cloud-based event-level data archiving and sequence-level confirmation processing.
[0095] S410: Based on the transmission strategy, determine the sequence number within the sliding window, and extract the data packets corresponding to all sequence numbers within the sliding window from the data packet set.
[0096] For example, for each event, the edge gateway can immediately send the high-priority data of the event to the cloud via the communication channel according to preset sending rules. After all the high-priority data has been sent, the edge gateway can know all the sequence numbers in the current sliding window based on the sliding window mechanism.
[0097] The edge gateway can traverse the data packets in the medium-priority cache partition and read the sequence number of each data packet in the medium-priority cache partition. For each data packet sequence number, it determines whether the sequence number of the data packet belongs to the sequence number in the sliding window. If it does, the data packet is added to the medium-priority transmission candidate set, and the data packets in the medium-priority transmission candidate set can be sorted in ascending order of sequence number.
[0098] If it does not belong to the priority cache partition, the edge gateway can traverse the data packets in the low-priority cache partition and read the sequence number of each data packet in the low-priority cache partition. For each data packet sequence number, it determines whether the sequence number of the data packet belongs to the sequence number in the sliding window. If it does, the data packet is added to the low-priority transmission candidate set, and the data packets in the low-priority transmission candidate set can be sorted in ascending order of sequence number.
[0099] S420: Add copies of all data packets corresponding to the sequence numbers within the sliding window to the pending confirmation queue.
[0100] For example, the edge gateway can maintain an unacknowledged queue to store data packets that have been sent but not yet acknowledged by the cloud. Each unacknowledged record in the unacknowledged queue may include a target batch identifier, a current event identifier (i.e., event ID), the sequence number of the data packet to be acknowledged, a copy, a sending timestamp, a retransmission count, a retransmission counter, and a priority. This queue can be implemented using a linked list, a queue, or an ordered structure by sequence number.
[0101] For each data packet within the sliding window, the edge gateway can generate a copy of the data packet when reading the original data packet. The copy has the same content as the original data packet, but is logically stored independently for subsequent confirmation and retransmission control, thus avoiding affecting the original data in the cache.
[0102] The edge gateway can construct a record to be confirmed for each replica, initialize the retransmission count to 0, initialize the retransmission counter with the timeout period (e.g., 1-3 seconds for 5G / 4G, 30-60 seconds for satellite communication), and insert each record to be confirmed into the queue in ascending order of sequence number.
[0103] This step enables the edge gateway to centrally track and manage the status of sent but unacknowledged data packets. By employing a replication mechanism, sending control and cached data are decoupled, avoiding impact on the original cached data. This improves the reliability, controllability, and recovery capabilities of the data transmission process in complex network environments.
[0104] S430 sends the data packets corresponding to all serial numbers within the sliding window to the cloud.
[0105] For example, the edge gateway can add each data packet in the medium-priority transmission candidate set to the transmission queue in ascending order of sequence number, and under the constraint of the preset transmission rules, append each data packet in the low-priority transmission candidate set to the transmission queue in ascending order of sequence number.
[0106] Before sending, the edge gateway can detect the current network status. If the network is available, it enters the sending phase; otherwise, it pauses sending and waits for the network to recover. The edge gateway can encapsulate each data packet in the sending queue into a transmission message according to a predetermined format (including target batch identifier, event ID, sequence number, priority identifier, data content, etc.); call the communication interface (such as based on MQTT, HTTP / 2, or TCP protocol) to establish or reuse a connection; send the encapsulated data packet to the cloud, and record the sending timestamp for subsequent timeout judgment.
[0107] After each data packet is successfully sent, the edge gateway can mark the data packet status as sent and awaiting confirmation, and simultaneously update the sliding window. .
[0108] By prioritizing and sending data packets within the sliding window, and dynamically controlling them based on network status, the edge gateway can effectively utilize remaining bandwidth to send low-priority data while ensuring the priority transmission of medium-priority data. The sliding window mechanism also limits the size of data in transit, thereby avoiding network congestion and disordered transmission, and improving the stability, continuity, and bandwidth utilization efficiency of data transmission.
[0109] For S500, if the acknowledgment message is a cumulative acknowledgment or a selective acknowledgment, the system queries and retrieves the lost data packets from the data packet set based on the acknowledgment message, and then resends the lost data packets to the cloud.
[0110] For example, the edge gateway can maintain a complete list of sequence numbers for the set of currently sent data packets. By performing a difference operation on this list of sequence numbers and the set of acknowledged sequence numbers in ACK and SACK, the unacknowledged sequence numbers, i.e., the sequence numbers of lost data packets, can be obtained.
[0111] The edge gateway can perform an index lookup in the sequence number-packet mapping table based on the sequence number of lost packets. To improve retrieval efficiency, a hash index or ordered linked list structure can be used to store the packet set, reducing the lookup complexity to near constant time or logarithmic time. After the query is completed, the edge gateway retrieves the lost packets from the corresponding cache partition and adds them to the retransmission queue.
[0112] Edge gateways can schedule the transmission of lost data packets based on the transmission strategy corresponding to the current network status. For example, if the current network conditions are good (such as 5G / 4G), retransmission can be performed immediately to ensure data integrity; if the network conditions are poor (such as satellite communication), lost data packets can be prioritized and transmitted over ordinary data.
[0113] After retransmission, the edge gateway can mark the lost data packet as awaiting secondary confirmation and continue waiting for a new round of confirmation messages from the cloud. If it is still not confirmed, it will retransmit again or perform degradation processing according to the retransmission count threshold and time interval policy. At the same time, the sending window and cache state are updated to help the system maintain the closed-loop consistency of sending-confirmation-retransmission.
[0114] This step enables accurate identification and efficient recovery of lost data packets, thereby significantly reducing data transmission packet loss rate and improving the integrity and reliability of cross-regional data synchronization in the supply chain.
[0115] In one possible implementation, please refer to Figure 3 In step S500, based on the confirmation message, the lost data packets are queried and extracted from the data packet set, including: In actual operation, because the prediction results are output in the form of time periods, and these time periods may span the time window boundaries of two or more expected events, the edge gateway may be in the execution or switching phase of multiple events within a future time window. At this time, the data collection and transmission processes corresponding to different events may overlap for a short period, causing the confirmation queue to contain data packets from multiple events simultaneously.
[0116] Specifically, the edge gateway's pending acknowledgment queue is logically partitioned and managed according to event identifiers, but at the physical level, it may be in a parallel or overlapping state. That is, at any given time, there are multiple sub-queues corresponding to events in the queue structure, and each sub-queue maintains its own sequence number, sending status, and acknowledgment status for its event. In this case, the edge gateway can logically isolate and process the pending acknowledgment queues independently through event identifiers. The acknowledgment message for each event corresponds to its own sequence number space, thereby ensuring that the data acknowledgment, packet loss detection, and retransmission processes between different events do not interfere with each other, achieving reliable data synchronization under cross-event concurrency conditions.
[0117] S510: Based on the event identifier in the acknowledgment message, query all data packets with the event identifier from the pending acknowledgment queue.
[0118] For example, based on the event ID in the confirmation message, the edge gateway can directly locate the corresponding event's subset of the pending confirmation queue in the pending confirmation queue, and extract all pending confirmation records from the subset of the pending confirmation queue, thereby achieving event-level data isolation query and avoiding data interference between different events.
[0119] S520 determines the sequence number of the lost data packet based on cumulative acknowledgments and selective acknowledgments.
[0120] For example, based on cumulative acknowledgments (ACK), the edge gateway can determine the range of data packets [1, ACK] that have been successfully received by the cloud; based on selective acknowledgments (SACK), the edge gateway can determine the data packets that have been successfully received by the cloud but are not consecutive; therefore, the actual set of sequence numbers of data packets successfully received by the cloud is [1, ACK]. SACK.
[0121] The edge gateway can iterate through the sequence numbers of all pending data packets in the subset of the pending confirmation queue for this event. If the sequence number of the pending data packet does not belong to [1, ACK], then... SACK can determine that the data packet to be acknowledged corresponding to the sequence number is a lost data packet.
[0122] This step enables rapid isolation and confirmation of the scope at the event level, and accurate identification of lost data packet sequence numbers, thereby improving the accuracy and efficiency of packet loss detection, reducing cross-event interference, and enhancing the reliability and recovery capability of data transmission in complex network environments.
[0123] S530 retrieves the lost data packet from the pending acknowledgment queue based on the sequence number of the lost data packet.
[0124] For example, the edge gateway can extract the corresponding copy of the lost data packet from the subset of the event confirmation queue based on the sequence number of the lost data packet obtained in the previous step, and add the copy of the lost data packet to the retransmission queue or determine the copy of the lost data packet as high-priority data and add it to the sending queue.
[0125] S540, removes the data packets corresponding to cumulative acknowledgments and selective acknowledgments from the pending acknowledgment queue.
[0126] For example, after completing the retrieval of lost packets, the edge gateway can remove the sequence number set [1, ACK] from the subset of the event acknowledgment queue. The data packet corresponding to SACK.
[0127] These steps enable the rapid extraction of lost data packets from the event-level pending acknowledgment queue. By combining cumulative acknowledgment and selective acknowledgment, successfully received data packets are promptly removed. This achieves dynamic consistency maintenance of the pending acknowledgment queue and continuous forward movement of the sliding window, reducing invalid retransmissions and redundant storage, and improving data synchronization efficiency and transmission reliability in complex network environments.
[0128] In one possible implementation, please refer to Figure 4 Methods for synchronizing bulk commodity data across different locations in the supply chain also include: S501: If the triggering condition is met, a synchronization status is sent to the cloud. The triggering condition is detecting that the network has recovered from a disconnection state. The synchronization status includes the target batch identifier and the maximum sequence number collected for each event.
[0129] For example, the edge gateway can continuously monitor the status of the communication link, which may include the current network connection status (disconnected / available), changes in network type (e.g., no network → 4G / 5G), and heartbeat communication response status. When it is detected that the network status has recovered from a disconnected state to an available state, or when a heartbeat request is sent and a response is successfully received from the cloud, it can be determined that the triggering condition has been met and the synchronization process can be initiated.
[0130] The edge gateway can iterate through the local cache on an event-by-event basis. For each event, it counts the maximum sequence number (max_seq) successfully collected in the data cache corresponding to that event ID. A synchronization state can be constructed based on the target batch identifier and the maximum sequence number for each event level. The synchronization state can include the target batch identifier, each event identifier, and the maximum sequence number corresponding to each event.
[0131] Edge gateways can send synchronization status to the cloud via reliable communication channels such as TLS-encrypted MQTT, HTTP / 2, or TCP long connections.
[0132] By summarizing the progress of each data collection according to the event dimension and sending the synchronization status to the cloud at the moment of network recovery, the cloud can quickly obtain the latest data boundaries of each event, thereby providing an accurate basis for subsequent differentiated retransmission and breakpoint resumption, avoiding full data retransmission, and improving data synchronization efficiency and bandwidth utilization during the network recovery phase.
[0133] S502 receives the retransmission message from the cloud. The retransmission message includes the retransmission sequence number for each event.
[0134] For example, the cloud can maintain an event-level data reception status storage structure at the target batch level, such as target batch identifier → batch-level index, event identifier → event-level data management space, and data packet sequence number.
[0135] When the cloud receives a data packet from the edge gateway, it can map the current data packet to the independent data management space corresponding to the current event (the event corresponding to the event identifier) based on the target batch identifier and event identifier carried in the data packet. Within this space, the cloud maintains two core state variables for the event: the continuous reception sequence number contiguous_seq and the non-contiguous reception sequence number set received_set (which contains the sequence numbers of all successfully received data packets for the event, including both continuous and non-contiguous parts).
[0136] For the current data packet, the cloud can write its sequence number into the `received_set` corresponding to the event, marking that the data packet with that sequence number has been successfully received, regardless of whether it is consecutive. Using the `contiguous_seq` of the current event as a baseline, it can be determined whether subsequent sequence numbers already exist in `received_set`. If the sequence number corresponding to `contiguous_seq+1` already exists in `received_set`, it indicates that the data packets arrived consecutively in order. `contiguous_seq` is then incremented by 1, and the process continues to check if a new `contiguous_seq+1` still exists in `received_set`. This process continues iteratively until a sequence number is found that is not present in `received_set`, thus forming a new maximum consecutive reception boundary.
[0137] The aforementioned update mechanism is executed in real time when each data packet arrives. The two core state variables can continuously reflect the latest consistency status of the cloud's reception of event data and provide basic data support for subsequent calculation of synchronization status differences and generation of retransmission requests.
[0138] For each event, the cloud can locate the event's independent data management space in the local storage system based on the target batch identifier and the event identifier. The cloud directly reads contiguous_seq and received_set from the event's data management space and defines the continuously received portion as the interval [1, contiguous_seq], indicating that all data packets within this range have been successfully received continuously and without any omissions. At the same time, the sequence numbers within this continuous interval are removed from received_set to obtain a non-contiguous supplementary set.
[0139] The cloud can align the maximum sequence number (max_seq) collected for the event with the contiguous sequence number (contiguous_seq) of the event to determine the theoretically corresponding data range, i.e., the range (contiguous_seq, max_seq]. This range represents the range of data that the edge gateway has but the cloud may not have fully received. The cloud then removes the sequence numbers already present in the received_set from this range to obtain the set of missing data packet sequence numbers for the event, missing_seq. This set only contains the data packet sequence numbers that the cloud has not yet received but that the edge gateway has collected.
[0140] The cloud constructs a retransmission structure for each event, binding the event identifier with the corresponding missing_seq and encapsulating it according to the event dimension to form structured retransmission information. The cloud aggregates the retransmission information of all events and the target batch identifier, generates a retransmission message, and sends the retransmission message to the edge gateway through a reliable communication channel.
[0141] Through the above process, the cloud can accurately generate the minimum retransmission set based on the difference between the event-level reception status and the edge acquisition progress, avoiding full retransmission and realizing an efficient and low-bandwidth data recovery mechanism.
[0142] S503 extracts the corresponding data packet from the data packet set based on the supplementary transmission message and sends the corresponding data packet to the cloud.
[0143] For example, after receiving a retransmission message from the cloud, the edge gateway parses the message content and extracts the target batch identifier, event identifier, and missing_seq corresponding to each event. Based on the target batch identifier and event identifier, the local cache can locate the storage area for the corresponding event. This storage area stores all data packet records generated during the collection and initial transmission of the event, organized using sequence numbers as indexes.
[0144] The edge gateway performs a retrieval operation for each sequence number in `missing_seq`, retrieving the corresponding data packet from the storage area of the corresponding event using the sequence number index. If the data packet is still within the cache validity period, the retrieval is successful. After all the corresponding data packets in `missing_seq` have been retrieved, the edge gateway can reorder these data packets according to their sequence numbers to ensure that the retransmitted data maintains the same order structure as the original acquisition during transmission. The reorganized retransmitted data packets are marked as retransmitted and sent, and added to the transmission queue.
[0145] During transmission, the edge gateway can send retransmission data packets to the cloud one by one or in batches through a reliable communication channel, and set the retransmission data packets as high-priority data, so that the retransmission data is not limited by the conventional sliding window or only occupies the resources of an independent retransmission window. At the same time, each retransmission data packet carries the target batch identifier, the original sequence number and the event identifier when it is sent, so that the cloud can accurately match and update the status.
[0146] After receiving the supplementary data packet, the cloud writes it into the data management space of the corresponding event and updates the set of continuous and non-continuous receiving sequence numbers, thereby gradually narrowing down the range of missing sequence numbers until all missing data is completed.
[0147] Through this step, the edge gateway can accurately extract the corresponding data packets from the local cache and perform targeted retransmission, thereby achieving breakpoint recovery-style data synchronization, avoiding full retransmission, and improving data transmission efficiency and bandwidth utilization during the network recovery phase.
[0148] In one possible implementation, please refer to Figure 5 Methods for synchronizing bulk commodity data across different locations in the supply chain also include: For each event in the expected sequence of events: S10: Obtain the current time and determine whether the current time exceeds the delay time based on the expected time window.
[0149] For example, the cloud can read the current time from the operating system's time service or a high-precision time synchronization service (such as an NTP server), standardize and convert the current time to a millisecond or second-level timestamp, and write the current time into the cloud scheduling context for subsequent event-level calculations.
[0150] The cloud can read the expected time window for each event from the instance configuration. , ]in, The scheduled time for the start of event data collection or uploading. This is the theoretical deadline for completing the collection or upload of event data. The cloud can set uniform or event-level latency tolerance thresholds for the system. It can be a fixed value (such as 1 hour or 30 minutes) or a value that is dynamically adjusted based on the network type (such as increasing the value under a satellite network). This is to adapt to uncertainties such as network jitter, satellite communication delays, and disconnection of edge nodes.
[0151] The cloud can calculate the delay time of events, that is... and set the current time and In comparison, if This can be considered as the event still being within the normal reception period. This indicates that the event has entered a state beyond the delay time.
[0152] This step enables the cloud to determine in real time whether each event exceeds the expected data completion cycle, thereby achieving time-dimensional monitoring and timeout identification of the data transmission process.
[0153] S20: If the request exceeds the limit, a directed retransmission request is sent to the edge gateway. The directed retransmission request includes the target batch identifier, the event identifier, and the retransmission sequence number.
[0154] For example, the cloud can read the set of continuous and non-continuous received sequence numbers for the corresponding event from the data management space based on the target batch identifier and the event identifier. This, combined with the maximum sequence number `max_seq` reported or recorded by the edge gateway during the synchronization phase, determines the theoretical receiving range (`contiguous_seq`, `max_seq`). For each sequence number within this range, the cloud can iterate through `received_set` to determine if the sequence number belongs to `received_set`. If not, the sequence number is added to `missing_seq`.
[0155] The cloud can construct a corresponding targeted retransmission structure for this event, bind the event identifier with the missing_seq, and encapsulate it according to the event dimension to form structured retransmission information. The retransmission information of all events and the target batch identifier are aggregated to generate a targeted retransmission request, which is then sent to the edge gateway through a reliable communication channel.
[0156] This step enables the cloud to proactively and accurately send retransmission commands to the edge gateway, thereby transforming the traditional passive waiting mode for retransmission into a proactive recovery mechanism based on time-driven and data difference-driven approaches. This improves the efficiency of overdue data replenishment and reduces the risk of long-term data loss.
[0157] S30: Receive the data packet corresponding to the retransmission sequence number sent by the edge gateway.
[0158] For example, the process of extracting the data packet corresponding to the retransmission sequence number after the edge gateway receives the directed retransmission request is the same as step S503, and will not be described in detail here.
[0159] Similarly, after receiving the data packet corresponding to the retransmission sequence number, the cloud writes it into the data management space of the corresponding event and updates the set of continuous and non-continuous received sequence numbers, thereby gradually narrowing down the range of missing sequence numbers until all missing data is completed.
[0160] These steps enable the cloud to proactively identify missing states in data transmission and directly initiate targeted retransmission requests to the edge gateway. This transforms the traditional passive waiting-for-retransmission mode into an active pull-to-fill mechanism, effectively shortening the data gap repair time, improving the recovery efficiency of event data integrity in cross-network environments, and enhancing the data synchronization reliability of the system in long-distance, intermittent communication scenarios.
[0161] Active fetching is initiated by the cloud and is suitable for scenarios where data is overdue. Batch retransmission is initiated by the edge gateway and is suitable for scenarios recovering from disconnection. The two complement each other and work together to ensure data integrity.
[0162] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0163] Corresponding to the cross-regional data synchronization method for bulk commodities in the supply chain described in the above embodiments, this application also provides a cross-regional data synchronization system for bulk commodities in the supply chain. Each unit of the system can implement each step of the cross-regional data synchronization method for bulk commodities in the supply chain.
[0164] The system includes: The initialization unit is used to receive the instance configuration of the target batch of goods sent from the cloud. The instance configuration includes metadata, expected event sequence, and network coverage map. The expected event sequence includes each event type, the expected time window for each event, and the geographical location range for each event.
[0165] The prediction unit is used to obtain the current state of the target vehicle and, based on the current state and the network coverage map in the instance configuration, predict the network type within a future time window to obtain the prediction result. The target vehicle is the transport vehicle carrying the target cargo; its current state includes its current location, current time, and current direction of movement; and the prediction result represents the trend of network type changes within the future time window.
[0166] The strategy determination unit is used to determine the data collection and transmission strategies for each priority level of the target shipment based on the prediction results. The collection strategy includes collection frequency, compression strategy, and caching strategy.
[0167] The data acquisition and transmission unit is used to acquire a set of data packets based on the acquisition strategy for each priority data packet. If the network is available, it sends each priority data packet in the data packet set to the cloud according to the transmission strategy for each priority data packet, and receives the confirmation message returned by the cloud. The data packet set includes each priority data packet and its corresponding sequence number. The confirmation message is a cumulative confirmation or a combination of cumulative and selective confirmations. Cumulative and selective confirmations are used to determine the sequence number of lost data packets.
[0168] The retransmission unit is used to query and retrieve lost data packets from the data packet set based on the confirmation message if the confirmation message is a cumulative confirmation or a selective confirmation, and then retransmit the lost data packets to the cloud.
[0169] It should be noted that the information interaction and execution process between the above-mentioned units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0170] This application also provides an edge gateway, which includes a data acquisition device, a status sensing device, and a control device communicatively connected to the data acquisition device and the status sensing device. The control device of this embodiment includes at least one processor, at least one memory, and a computer program stored in the at least one memory and executable on the at least one processor. When the processor executes the computer program, it causes the edge gateway to perform the steps in any of the above-described embodiments of the supply chain bulk commodity remote data synchronization method, or causes the edge gateway to perform the functions of each unit in the above-described device embodiments.
[0171] For example, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the control device of the edge gateway.
[0172] The control device for the edge gateway can be an industrial controller, embedded processor, single-board computer, edge computing server, CPU, ARM processor, etc. The edge gateway may include, but is not limited to, processors and memory, and may include more or fewer components, or combinations of certain components, or different components, such as input / output devices, network access devices, buses, etc.
[0173] The processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices. A general-purpose processor can be a microprocessor or any conventional processor.
[0174] In some embodiments, the memory may be an internal storage unit of the edge gateway's control device, such as the edge gateway's hard drive or memory. In other embodiments, the memory may be an external storage device of the edge gateway, such as a plug-in hard drive, smart memory card (SMC), secure digital card (SD) card, flash card, etc., equipped on the edge gateway. Furthermore, the memory may include both internal storage units and external storage devices of the edge gateway. The memory is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory can also be used to temporarily store data that has been output or will be output.
[0175] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0176] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for synchronizing bulk commodity data across different locations in a supply chain, applied to an edge gateway, characterized in that: include: Receive the instance configuration of the target batch of goods sent from the cloud; wherein, the instance configuration includes metadata, expected event sequence, and network coverage map, and the expected event sequence includes each event type, the expected time window corresponding to each event, and the geographical location range corresponding to each event; The current state of the target vehicle is obtained, and based on the current state and the network coverage map in the instance configuration, the network type within a future time window is predicted to obtain the prediction result; wherein, the target vehicle is a transportation vehicle carrying the target cargo, the current state of the target vehicle includes the current position, current time and current direction of movement of the target vehicle, and the prediction result is the trend of network type change within a future time window; Based on the prediction results, the collection and transmission strategies for each priority data of the target batch are determined; wherein, the collection strategy includes collection frequency, compression strategy, and caching strategy; Based on the collection strategy of each priority data, a data packet set is obtained; if the network is available, according to the sending strategy of each priority data, each priority data packet in the data packet set is sent to the cloud, and an acknowledgment message returned by the cloud is received; wherein, the data packet set includes each priority data packet and the sequence number corresponding to each priority data packet, and the acknowledgment message is a cumulative acknowledgment or a cumulative acknowledgment and a selective acknowledgment, the cumulative acknowledgment and the selective acknowledgment are used to determine the sequence number of the lost data packet; If the confirmation message is either the cumulative confirmation or the selective confirmation, the lost data packet is queried and extracted from the data packet set according to the confirmation message, and the lost data packet is resent to the cloud.
2. The method for synchronizing bulk commodity data across different locations in the supply chain as described in claim 1, characterized in that, The step of predicting the network type within a future time window based on the current state and the network coverage map in the instance configuration, and obtaining the prediction result, includes: Based on the current state, calculate the position of each time point within the future time window; Based on the network coverage map and the location of each time point within the future time window, determine the network type for each time point within the future time window; By merging time points of the same network type and consecutive time periods into a time period, a prediction result is obtained; wherein, the prediction result includes at least one network type.
3. The method for synchronizing bulk commodity data across different locations in the supply chain as described in claim 1, characterized in that, The step of determining the collection and transmission strategies for each priority data point of the target shipment based on the prediction results includes: Based on the network type and policy mapping table in the prediction results, determine the data collection strategy for each priority level; Based on the network type in the prediction results, the sliding window size of the sending strategy is determined; wherein, the sliding window size is used to control the amount of data transmitted, and the sending strategy includes preset sending rules and a sliding window mechanism.
4. The method for synchronizing bulk commodity data across different locations in the supply chain as described in claim 3, characterized in that, The method further includes: Get the current cache usage rate; Based on the current cache occupancy rate, the collection frequency of data for each priority level is adjusted; Based on the current cache occupancy rate, determine the cache coverage strategy for each priority level of data.
5. The method for synchronizing bulk commodity data across different locations in the supply chain as described in claim 3, characterized in that, The step of sending each priority data packet in the data packet set to the cloud according to the sending strategy for each priority data includes: According to the sending strategy, the sequence number within the sliding window is determined, and the data packets corresponding to all sequence numbers within the sliding window are extracted from the data packet set; Add copies of all data packets corresponding to the sequence numbers within the sliding window to the confirmation queue; Send the data packets corresponding to all serial numbers within the sliding window to the cloud.
6. The method for synchronizing bulk commodity data across different locations in a supply chain as described in claim 5, characterized in that, The step of querying and retrieving the lost data packet from the data packet set based on the confirmation message includes: Based on the event identifier in the confirmation message, query all data packets with the event identifier from the queue to be confirmed; The sequence number of the lost data packet is determined based on the cumulative acknowledgment and the selective acknowledgment. The lost data packet is extracted from the queue to be confirmed based on its sequence number. Remove the data packets corresponding to the cumulative acknowledgments and the selective acknowledgments from the queue of pending acknowledgments.
7. The method for synchronizing bulk commodity data across different locations in the supply chain as described in claim 1, characterized in that, The method further includes: If the triggering condition is met, a synchronization status is sent to the cloud; wherein, the triggering condition is detecting that the network has recovered from the disconnection state, and the synchronization status includes the target batch identifier and the maximum sequence number collected for each event; Receive the retransmission message from the cloud; wherein the retransmission message includes the retransmission sequence number for each event; Based on the retransmission message, the corresponding data packet is extracted from the data packet set and sent to the cloud.
8. A method for synchronizing bulk commodity data across different locations in a supply chain, applied in the cloud, characterized in that: include: Send the instance configuration of the target batch to the edge gateway; wherein, the instance configuration includes metadata, expected event sequence, and network coverage map, and the expected event sequence includes each event type, the expected time window corresponding to each event, and the geographical location range corresponding to each event; The system receives a set of data packets sent by the edge gateway. The set of data packets is acquired by the edge gateway based on a collection strategy for each priority data segment, and sent according to a transmission strategy for each priority data segment when the network is available. The set of data packets includes each priority data packet and its corresponding sequence number. The collection and transmission strategies for each priority data segment of the target cargo batch are determined by the edge gateway based on prediction results. The collection strategy includes collection frequency, compression strategy, and caching strategy. The prediction results are obtained by the edge gateway acquiring the current state of the target vehicle and predicting the network type within a future time window based on the current state and the network coverage map in the instance configuration. The current state of the target vehicle includes its current location, current time, and current direction of movement. The prediction results represent the trend of network type changes within a future time window. A confirmation message is sent to the edge gateway; wherein the confirmation message is a cumulative confirmation or a combination of cumulative and selective confirmations, and the cumulative and selective confirmations are used to determine the sequence number of the lost data packet; The edge gateway receives lost data packets returned by the edge gateway; wherein the lost data packets are retrieved by the edge gateway from the data packet set according to the confirmation message when the confirmation message is the cumulative confirmation and the selective confirmation.
9. The method for synchronizing bulk commodity data across different locations in a supply chain as described in claim 8, characterized in that, The method further includes: For each event in the expected sequence of events: Obtain the current time and determine whether the current time exceeds the delay time based on the expected time window; If the request exceeds the limit, a directed retransmission request is sent to the edge gateway; wherein, the directed retransmission request includes the target batch identifier, the event identifier, and the retransmission sequence number; Receive the data packet corresponding to the retransmission sequence number sent by the edge gateway.
10. A supply chain bulk commodity remote data synchronization system, applied to an edge gateway, characterized in that, include: An initialization unit is used to receive instance configurations for a target batch of goods sent from the cloud; wherein, the instance configuration includes metadata, expected event sequences, and a network coverage map, and the expected event sequences include each event type, the expected time window corresponding to each event, and the geographical location range corresponding to each event; The prediction unit is used to obtain the current state of the target vehicle and predict the network type within a future time window based on the current state and the network coverage map in the instance configuration, and obtain the prediction result; wherein, the target vehicle is a transportation vehicle carrying the target cargo, the current state of the target vehicle includes the current position, current time and current direction of movement of the target vehicle, and the prediction result is the trend of network type change within a future time window; The strategy determination unit is used to determine the collection strategy and transmission strategy of each priority data of the target batch based on the prediction results; wherein, the collection strategy includes collection frequency, compression strategy and caching strategy; The data acquisition and transmission unit is used to acquire a set of data packets based on the acquisition strategy of each priority data packet; if the network is available, it sends each priority data packet in the set of data packets to the cloud according to the transmission strategy of each priority data packet, and receives the confirmation message returned by the cloud; wherein, the set of data packets includes each priority data packet and the sequence number corresponding to each priority data packet, and the confirmation message is a cumulative confirmation or a cumulative confirmation and a selective confirmation, wherein the cumulative confirmation and the selective confirmation are used to determine the sequence number of the lost data packet; The retransmission unit is used to query and extract the lost data packet from the data packet set according to the confirmation message if the confirmation message is the cumulative confirmation or the selective confirmation, and retransmit the lost data packet to the cloud.
