Gateway adaptive caching method and system based on multi-protocol industrial data

By employing dynamic priority calculation and hierarchical caching mechanisms, the problems of data loss and parsing errors in multi-protocol data stream processing in industrial gateways are solved, achieving high reliability and consistent storage of critical data and enhancing the system's robustness in harsh environments.

CN121771284BActive Publication Date: 2026-05-01HANGZHOU HERMES TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU HERMES TECH CO LTD
Filing Date
2026-03-02
Publication Date
2026-05-01

Smart Images

  • Figure CN121771284B_ABST
    Figure CN121771284B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field and discloses a gateway adaptive caching method and system based on multi-protocol industrial data, which comprises the following steps: receiving multi-protocol data frames and standardizing the multi-protocol data frames into a unified metadata structure; combining device role weight, data time decay function and network link state to dynamically calculate a caching priority; writing data into a high-reliability persistent area, a medium-time-efficiency transition area or a low-priority temporary storage area; periodically executing a recovery and migration strategy based on the priority and a time-efficiency window; and uploading data according to the priority when a link is recovered. The system comprises multi-protocol access, analysis standardization, dynamic priority calculation, hierarchical caching management, recovery scheduling and uploading control units. Through a three-dimensional dynamic priority model and hierarchical storage with physical isolation, the application significantly improves caching reliability, data freshness and system robustness.
Need to check novelty before this filing date? Find Prior Art

Description

A Gateway Adaptive Caching Method and System for Multi-Protocol Industrial Data Technical Field

[0001] This invention belongs to the field of computer technology, specifically relating to a gateway adaptive caching method and system based on multi-protocol industrial data. Background Technology

[0002] With the rapid development of the Industrial Internet of Things (IIoT), multi-protocol heterogeneous devices are widely deployed in manufacturing, energy, and process control scenarios. Industrial gateways, as data hubs connecting field devices and upper-level systems, undertake crucial functions such as protocol conversion, data aggregation, and edge caching. In complex industrial environments, caching mechanisms are commonly used to address issues such as network jitter, cloud unavailability, or inter-device communication delays, ensuring data continuity and system robustness. However, cached data itself is highly susceptible to factors such as sudden equipment failures, electromagnetic interference, or aging storage media, leading to data block corruption, loss, or timestamp errors, seriously threatening the reliability of subsequent analysis, control decisions, and historical traceability.

[0003] Gateway adaptive caching methods for multi-protocol industrial data focus on achieving efficient, reliable, and low-overhead data storage and recovery mechanisms on edge nodes with heterogeneous protocols (such as Modbus, OPCUA, CAN, Profinet, etc.). The core objective of this approach is to ensure the integrity, consistency, and recoverability of cached data through the collaborative capabilities of local or neighboring nodes, without relying on a central cloud platform, thereby supporting a highly available industrial edge computing architecture.

[0004] While simple local redundant writes or periodic uploads to the cloud can ensure cache security, the former cannot cope with the overall failure of the storage medium, while the latter leads to high bandwidth consumption, long latency, and unavailability risks in weak network environments due to frequent cloud access. Some solutions introduce checksums or single hash values ​​for data verification, but lack protection against the temporal correlation between data blocks, making it difficult to detect tampering or partial overwriting errors. Others attempt to improve fault tolerance using erasure coding, but centrally store all coded fragments on a single point gateway; if that node fails, the entire data unit may still become unrecoverable. Especially in distributed industrial environments, when multiple gateways work together, existing methods fail to effectively utilize the storage resources of neighboring nodes to build a lightweight, self-healing cache network, resulting in limited data reliability and system resilience. Summary of the Invention

[0005] This invention provides a gateway adaptive caching method and system based on multi-protocol industrial data, aiming to solve the technical problem that industrial cached data is easily damaged or lost due to equipment failure or network interference. Existing industrial gateways generally use fixed-size circular buffers or static priority queues for local caching when processing multi-protocol data streams from heterogeneous devices. When field equipment experiences sudden failures, communication links are momentarily interrupted, or the main control server experiences response delays, such static caching mechanisms cannot dynamically perceive the importance, timeliness, and contextual relevance of data. This leads to critical process data being overwritten, low-priority redundant data remaining for extended periods, or data parsing errors occurring after communication is restored due to inconsistent cache structures. Ultimately, this results in blind spots in production monitoring, inaccurate control commands, or failure of historical data tracing.

[0006] As one embodiment of the present invention, the gateway adaptive caching method based on multi-protocol industrial data includes the following steps: receiving data frames from different industrial devices in real time through a multi-protocol access interface, wherein the data frames include a protocol type identifier, a unique device identifier, a timestamp, a data payload, and a checksum; parsing and standardizing the data frames to generate standardized data units with a unified metadata structure, wherein the unified metadata structure includes a data source identifier, acquisition time, data type, numerical sequence, integrity flag, and original protocol version information; and calculating the dynamic caching priority of the standardized data unit based on its metadata, combined with a preset device role weight table, a data type time decay function, and the current network link status. The standardized data unit and its dynamic cache priority value are written into a hierarchical cache storage area, which is divided into three physically isolated storage areas: a high-reliability persistent area, a medium-time transition area, and a low-priority temporary storage area. A cache space reclamation strategy is periodically executed. Based on the remaining capacity threshold of each storage area, the priority value of the data unit, and its residence time, data units in the low-priority temporary storage area are selectively discarded, and data units in the medium-time transition area are migrated to the high-reliability persistent area. When the host computer communication link is detected to be restored or the preset upload period is reached, data units are read from the high-reliability persistent area in descending order of priority, encapsulated into data packets conforming to the target transmission protocol, and sent to the remote server. At the same time, the upload confirmation status of the data unit is updated.

[0007] Furthermore, the multi-protocol access interface supports at least three industrial communication protocols, including but not limited to ModbusRTU, CANopen, and ProfinetIO. Its hardware layer adopts a reconfigurable physical layer chip, which dynamically switches the level standard, baud rate, and frame format parameters through configuration registers to adapt to the electrical characteristics of different fieldbuses.

[0008] Furthermore, the protocol parsing and format standardization specifically include: identifying the protocol type identifier in the data frame and calling the corresponding protocol parsing engine; verifying the checksum to determine the integrity of the data frame, and if the verification fails, marking the integrity flag as abnormal and recording the error count; extracting the unique identifier of the device and matching it with a preset device asset list to obtain the functional role code of the device in the production line; converting the numerical sequence into a unified floating-point number or integer array according to a predefined data type mapping table, and attaching a timestamp of the acquisition time as a time series reference.

[0009] Furthermore, the equipment role weight table is a key-value pair structure, where the key is the equipment functional role code and the value is a real number weight between 0.1 and 1.0. This weight is determined by the criticality of the equipment in the process flow. The weight value of the main control PLC equipment is set to 1.0, and the weight value of the auxiliary sensing node is set to 0.3.

[0010] Furthermore, the time-decrease function of the data type is defined as an exponential decay model, and its expression is: ,in This represents the time difference between the current system time and the data acquisition time, in seconds. This is the attenuation coefficient, applicable to process variables such as temperature and pressure. The value is 0.002 per second, and it is for switch status signals. The value is 0.005 per second.

[0011] Furthermore, the current network link status is obtained in real time through the link quality monitoring module. This module continuously measures the uplink packet loss rate, round-trip time, and bandwidth utilization. When the packet loss rate exceeds 5% or the round-trip time is greater than 500 milliseconds, the link is determined to be in a degraded state. At this time, the dynamic buffer priority value of all newly received data units is multiplied by a compensation factor greater than 1, and the compensation factor is 1.5.

[0012] Furthermore, the formula for calculating the dynamic cache priority value P is as follows: ,in Assigning weights to device roles. This represents the time-decrease function value for the data type. This is a link state compensation factor; when the link is normal... The value is 1 when the link deteriorates. It is 1.5.

[0013] Furthermore, the hierarchical cache storage area is implemented using non-volatile storage media. The high-reliability persistent area occupies 60% of the total cache capacity, the medium-time transition area occupies 30%, and the low-priority temporary storage area occupies 10%. The high-reliability persistent area adopts a log structure writing method to ensure that data can be recovered after power failure. The medium-time transition area adopts a circular overwrite strategy, but overwriting is only allowed when the high-reliability persistent area is not full and there is no higher-priority data to be written. The low-priority temporary storage area adopts a first-in-first-out strategy and does not have power failure protection.

[0014] Furthermore, the cache space reclamation strategy is executed every 10 seconds. Its specific logic is as follows: if the utilization rate of the low-priority temporary storage area exceeds 80%, the oldest data unit is deleted in ascending order of priority until the utilization rate drops to 50%; if the residence time of a data unit in the medium-term transition area exceeds the upper limit of the time window corresponding to its data type, and its priority value is higher than the threshold of the current lowest priority data unit in the high-reliability persistent area, it is migrated to the high-reliability persistent area; otherwise, it is downgraded to the low-priority temporary storage area.

[0015] Furthermore, the upload confirmation status includes three states: not uploaded, sent, and confirmed. Only after the remote server returns a confirmation response containing the unique sequence number of the data unit will the status be updated to confirmed, and the corresponding storage space be released from the high-reliability persistent area.

[0016] This invention provides a gateway adaptive caching system based on multi-protocol industrial data, comprising:

[0017] The system includes a multi-protocol data access unit, a protocol parsing and standardization unit, a dynamic priority calculation unit, a hierarchical cache management unit, a cache reclamation and scheduling unit, and a data upload control unit.

[0018] The multi-protocol data access unit is used to receive data frames from different industrial devices in real time; the protocol parsing and standardization unit is used to parse the data frames and standardize their formats to generate standardized data units.

[0019] The dynamic priority calculation unit is used to calculate the dynamic cache priority value based on the metadata of the standardized data unit, the device role weight table, the data type time-limit decay function, and the current network link status.

[0020] The hierarchical cache management unit is used to write the standardized data unit and its dynamic cache priority value into the hierarchical cache storage area, and manage the data read and write operations of the three storage areas.

[0021] The cache reclamation scheduling unit is used to periodically execute cache space reclamation strategies to discard or migrate low-priority data.

[0022] The data upload control unit is used to read data units from the high-reliability persistent zone in priority order and upload them to the remote server when the communication link is restored.

[0023] Furthermore, the hierarchical cache storage area is jointly composed of the flash memory array inside the embedded microcontroller and the external serial NOR Flash chip. The high-reliability persistent area is mapped to the protected sector of the external NOR Flash, and the medium-time transition area and the low-priority temporary storage area are mapped to the erasable pages of the internal flash memory.

[0024] Furthermore, the system also includes a link quality monitoring unit, which continuously assesses the packet loss rate, latency, and bandwidth status of the uplink network link through ICMP probe packets and TCP connection keep-alive mechanism, and feeds back the assessment results to the dynamic priority calculation unit in real time.

[0025] Furthermore, the device role weight table is stored in a read-only memory and can be modified through a secure firmware update interface. Modification operations require digital signature verification.

[0026] Furthermore, the upper limit of the data type timeout window is preset for different data types: 300 seconds for analog data, 60 seconds for digital status, and 1800 seconds for event-triggered messages.

[0027] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0028] 1. This invention achieves fine-grained allocation and adaptive scheduling of cache resources by constructing a three-dimensional dynamic priority model based on device roles, data timeliness, and network status.

[0029] 2. The physical isolation design of the hierarchical cache storage area ensures high reliability of critical data storage in the event of power failure or failure, avoiding the loss of important data caused by the overwrite mechanism of traditional ring buffer.

[0030] 3. The cache reclamation strategy introduces a dual judgment of time window and priority threshold, which effectively prevents low-value data from occupying storage space for a long time and improves cache hit rate and data freshness.

[0031] 4. The link state awareness mechanism enables the gateway to proactively upgrade the data cache level when the network deteriorates, enhancing the system's robustness in harsh communication environments.

[0032] 5. The overall solution significantly reduces the probability of damage and loss of industrial data at the edge due to equipment or network anomalies, ensuring the integrity, consistency and timeliness of production process data, and providing a high-quality data foundation for upper-level monitoring, analysis and control decisions. Attached Figure Description

[0033] Figure 1 is a schematic diagram of the overall technical solution architecture of the gateway adaptive caching method and system based on multi-protocol industrial data proposed in this invention.

[0034] Figure 2 is a schematic diagram of the core principle framework of the three-dimensional dynamic cache priority calculation model based on device role, data timeliness and network status in this invention;

[0035] Figure 3 is a logical flow diagram of the multi-protocol data access and standardization processing stage in this invention;

[0036] Figure 4 is a logical framework diagram of the hierarchical cache storage area structure and data writing / migration strategy in this invention;

[0037] Figure 5 is a flowchart of the periodic execution logic of the cache space reclamation scheduling mechanism in this invention;

[0038] Figure 6 is a schematic diagram of the multi-level interaction relationship and data flow between the high-reliability persistent zone data upload control and link status feedback in this invention. Detailed Implementation

[0039] Please refer to Figures 1 to 6. This invention provides a gateway adaptive caching method and system based on multi-protocol industrial data, aiming to solve the problems of cached data corruption, loss, or parsing errors caused by sudden equipment failures, momentary interruptions in communication links, or delays in the response of the main control server in industrial settings. Existing industrial gateways generally use fixed-capacity circular buffers or static priority queues for local data temporary storage, which cannot dynamically adjust the caching strategy according to the importance of the data source, the timeliness of the data itself, and the current network communication status. This results in key process variables being covered by low-value redundant data under high load or abnormal operating conditions, causing blind spots in production monitoring, inaccurate control commands, or failure of historical traceability. To overcome the above defects, this embodiment constructs a complete adaptive caching mechanism, which achieves high reliability, high timeliness, and high consistency assurance for edge-side industrial data through six core links: multi-protocol access, standardized processing, dynamic priority calculation, hierarchical storage management, periodic recycling scheduling, and link-aware uploading.

[0040] The gateway adaptive caching method based on multi-protocol industrial data includes the following steps:

[0041] S1, receives data frames from different industrial devices in real time through a multi-protocol access interface. The data frames include a protocol type identifier, a unique device identifier, a timestamp, a data payload, and a checksum.

[0042] S2, perform protocol parsing and format standardization on the data frame to generate a standardized data unit with a unified metadata structure. The unified metadata structure includes data source identifier, acquisition time, data type, numerical sequence, integrity flag and original protocol version information.

[0043] S3. Based on the metadata of the standardized data unit, combined with the preset device role weight table, data type time decay function and current network link status, calculate the dynamic cache priority value of the standardized data unit.

[0044] S4, write the standardized data unit and its dynamic cache priority value into the hierarchical cache storage area, which is divided into three physically isolated storage areas: a high-reliability persistent area, a medium-time-sensitive transition area, and a low-priority temporary storage area.

[0045] S5 periodically executes a cache space reclamation strategy. Based on the remaining capacity threshold of each storage area, the priority value of the data unit and its residence time, it selectively discards data units in the low-priority temporary storage area and performs a migration determination to the high-reliability persistent area for data units in the medium-term transition area.

[0046] S6, when the upper computer communication link is restored or the preset upload period is reached, reads the data unit from the high-reliability persistent area in descending order of priority, encapsulates it into a data packet conforming to the target transmission protocol and sends it to the remote server, and updates the upload confirmation status of the data unit at the same time.

[0047] In step S1, the multi-protocol access interface continuously monitors multiple physical communication channels, which support at least three industrial communication protocols, including Modbus RTU, CANopen, and ProfinetIO. The hardware layer employs a reconfigurable physical layer chip, whose internal register group is configured with level standards, baud rates, frame start / end symbols, checksum methods, and bit width parameters to dynamically adapt to the electrical characteristics of different fieldbuses such as RS485, CAN bus, or Ethernet. When a channel receives a complete data frame, it immediately extracts the protocol type identifier field from the frame header. This field is a fixed-length binary code used for subsequent calls to the corresponding protocol parsing engine. Simultaneously, the frame reception time is recorded as an auxiliary timestamp, and the entire original frame, along with the receiving channel index, is sent to the protocol parsing and normalization unit. All receiving operations are completed within the interrupt service routine, ensuring real-time performance under high throughput and preventing frame loss due to main loop delays.

[0048] In step S2, the protocol parsing and standardization unit first calls the corresponding parsing engine based on the protocol type identifier. For Modbus RTU frames, it parses the function code, register address, data length, and register value; for CANopen frames, it parses the COB-ID, SDO / PDO identifier, object dictionary index, and sub-index; for ProfinetIO frames, it parses the IRT cycle identifier, slot channel mapping, and process data object. During parsing, the frame tail checksum is verified synchronously. If the verification fails, the integrity flag is set to abnormal, and the error count for the corresponding device is incremented in the device error counter, which is used for subsequent health assessment. If the verification passes, the unique device identifier is extracted. This identifier is a globally unique hexadecimal string, which is matched with the device asset list pre-stored in read-only memory to obtain the functional role code of the device in the production line topology, such as "main control PLC", "temperature sensor", "safety emergency stop button", etc. Subsequently, the original numerical sequence is converted into a unified format according to a predefined data type mapping table: analog quantities such as temperature and pressure are converted into IEEE 754 single-precision floating-point arrays, digital quantities such as switch states are converted into Boolean integers, and event messages retain the original byte stream but are appended with event type tags. Finally, the data source identifier, acquisition time (taken from the frame timestamp, or the reception time if none), unified format numerical sequence, integrity flag, and original protocol version information are encapsulated into a standardized data unit. This unit is a fixed-length structure, facilitating efficient subsequent storage and retrieval.

[0049] In step S3, the dynamic priority calculation unit receives the standardized data unit and initiates the priority calculation process. This process first queries the device role weight table for the weight value of the corresponding functional role code. This table is a key-value pair structure, where the key is the role code and the value is a real number between 0.1 and 1.0. The weight value of the main control PLC device is set to 1.0, key actuators such as servo drives are set to 0.8, ordinary sensing nodes such as temperature and humidity probes are set to 0.5, and auxiliary status indicator lights are set to 0.3. Next, the data type aging decay function value is calculated. This function uses an exponential decay model, and its expression is: ,in This represents the time difference between the current system time and the data acquisition time, in seconds. This is the attenuation coefficient, applicable to process variables such as temperature and pressure. The value is 0.002 per second, and it is for switch status signals. The value is 0.005 per second, and it is used for event-triggered messages such as alarms or reset signals. The value is 0.0005 per second. Next, obtain the current network link state compensation factor. This factor is provided in real time by the link quality monitoring unit. The link quality monitoring unit continuously measures the uplink packet loss rate, round-trip time, and bandwidth utilization by periodically sending ICMP probe packets and maintaining TCP keep-alive connections. When the packet loss rate exceeds 5% or the round-trip time is greater than 500 milliseconds, the link is determined to be in a degraded state. The value should be 1.5; otherwise... The final dynamic cache priority value is 1. Through formula The calculation shows that this value is a positive real number, typically ranging from 0 to 1.5, and is used to guide subsequent cache area allocation decisions.

[0050] In step S4, the hierarchical cache management unit receives standardized data units and their dynamic cache priority values ​​P, and performs a write operation. The hierarchical cache storage area is composed of the flash memory array inside the embedded microcontroller and an external serial NOR Flash chip, with a total capacity of 16 megabytes. Among them, the high-reliability persistent area occupies 60%, or 9.6 megabytes, and is mapped to the write-protected sector of the external NOR Flash. It adopts a log structure writing method, appending a new entry and updating the tail pointer with each write. After power failure, all valid data can be recovered by scanning the log header. The medium-time transition area occupies 30%, or 4.8 megabytes, and is mapped to the erasable pages of the internal flash memory. It adopts a circular overwrite strategy, but old data is only allowed to be overwritten when the high-reliability persistent area is not full and there is no higher-priority data to be written. The low-priority temporary storage area occupies 10%, or 1.6 megabytes, and is also located in the internal flash memory. It adopts a first-in-first-out strategy, does not have power failure protection, and the data is automatically cleared after power failure.

[0051] The write logic is as follows: if P is greater than or equal to 0.7, the data is written to the high-reliability persistent area; if P is between 0.3 and 0.7, the data is written to the medium-term transition area; if P is less than 0.3, the data is written to the low-priority temporary storage area. Each data unit is appended with a unique sequence number, a write timestamp, and an initial upload status of "not uploaded" when written, and an index table is created to support fast lookup and status updates.

[0052] In step S5, the cache reclamation scheduling unit triggers a reclamation policy every 10 seconds. This policy first checks the usage rate of the low-priority temporary storage area. If it exceeds 80%, it traverses all data units in that area in ascending priority order (i.e., from smallest to largest P value), deleting the oldest data units sequentially until the usage rate drops to 50%. The deletion operation includes clearing data content, releasing index entries, and updating the area usage counter. Subsequently, it traverses each data unit in the intermediate time-lapse transition area and calculates its residence time. (Current system time minus the write timestamp) and compared with the upper limit of the time window for the data type corresponding to this data unit. The upper limit of the time window for analog data is 300 seconds, for digital status it is 60 seconds, and for event-triggered messages it is 1800 seconds. If If the limit is exceeded, the priority value P is further checked to see if it is higher than the threshold of the lowest priority data unit in the high-reliability persistent area (this threshold is obtained in real time by maintaining a min-heap). If it is satisfied, the data unit is migrated to the high-reliability persistent area, and its original location is marked as free; otherwise, it is downgraded and written to a low-priority temporary storage area (if there is insufficient space, it is discarded directly). The migration operation requires reallocation of storage addresses, updating indexes and status flags to ensure data consistency.

[0053] In step S6, the data upload control unit continuously monitors the status of the communication link with the host computer. When the link quality monitoring unit reports that the link has returned to normal (packet loss rate less than 2% and latency less than 200 milliseconds) or the system clock reaches the preset upload cycle (e.g., every 30 seconds), the upload process is initiated. This process first reads all data units with an upload status of "not uploaded" from the high-reliability persistent area in descending order of priority (P value from largest to smallest). During the reading process, a secondary integrity check is performed on each unit. If any abnormality such as storage medium bit flipping is found, it is marked as "damaged" and skipped. Subsequently, the valid data units are encapsulated into data packets according to the target transmission protocol (such as MQTT or HTTP), and a sequence number, timestamp, and checksum are appended. The data packets are sent to the remote server through the uplink network interface. If an acknowledgment response is received from the server within the preset timeout period (e.g., two seconds), and the response contains a matching sequence number, the upload status of the data unit is updated to "acknowledged," and the storage space it occupies in the high-reliability persistent area is released. The log tail pointer and area usage counter are also updated. If no confirmation is received, the status will remain "sent" and the data will be retransmitted in the next upload cycle. After a maximum of three retransmissions, the data will be marked as "upload failed" and logged.

[0054] The implementation of the above method relies on a complete hardware and software collaborative system. The gateway adaptive caching system based on multi-protocol industrial data includes a multi-protocol data access unit, a protocol parsing and standardization unit, a dynamic priority calculation unit, a hierarchical cache management unit, a cache reclamation scheduling unit, a data upload control unit, and a link quality monitoring unit. The multi-protocol data access unit consists of a reconfigurable physical layer chip, a multi-channel transceiver buffer, and an interrupt controller, responsible for receiving and initially encapsulating raw frames. The protocol parsing and standardization unit consists of multiple protocol parsing engine modules, an equipment asset list query module, and a data type mapping module, running in a real-time operating system task to ensure parsing latency does not exceed 5 milliseconds. The dynamic priority calculation unit integrates an equipment role weight table, a time-degradation function calculator, and a link status interface; its calculation process is executed on a dedicated coprocessor, avoiding the occupation of main CPU resources. The hierarchical cache management unit directly controls the flash memory controller, achieving physical isolation access and wear leveling for the three storage areas. The cache reclamation scheduling unit runs as an independent timer task, with each execution not exceeding 20 milliseconds, without affecting main data stream processing. The data upload control unit is deeply integrated with the network protocol stack, supporting breakpoint resumption and traffic shaping. The link quality monitoring unit obtains raw link metrics through the underlying network driver and updates the compensation factor once per second. .

[0055] The device role weight table is stored in a secure sector of read-only memory and can only be modified via the firmware update interface. This interface requires uploaded update packages to contain a digital signature. The system uses a pre-set public key to verify the signature's validity. Only after successful verification can the new weight table be written, preventing unauthorized tampering. The upper limit of the data type's validity window is also fixed in the configuration area and cannot be modified at runtime, ensuring policy consistency. The unique sequence number of all data units is generated by a 64-bit monotonically increasing counter, ensuring uniqueness throughout its entire lifecycle and used for server-side deduplication and order verification.

[0056] Through the collaborative operation of the above methods and systems, this invention achieves intelligent cache management of multi-protocol industrial data. During equipment failures or network outages, critical data is retained in a high-reliability persistent area due to its high priority, preventing overwriting; low-value data is promptly cleaned up in the temporary storage area to free up space; after network recovery, high-priority data is uploaded first, ensuring monitoring continuity. Real-world testing shows that, under simulated 500-millisecond link interruption and sudden equipment restart scenarios, the critical process data integrity rate of this solution reaches 99.8%, a 42% improvement compared to traditional ring buffers, and the data freshness (average latency) is reduced to 1.2 seconds, meeting industrial real-time requirements.

Claims

1. A gateway adaptive caching method for multi-protocol industrial data, characterized in that, include: Data frames from different industrial devices are received in real time through a multi-protocol access interface. The data frames include a protocol type identifier, a unique device identifier, a timestamp, a data payload, and a checksum. The data frame is parsed and its format is standardized to generate a standardized data unit with a unified metadata structure. The unified metadata structure includes data source identifier, acquisition time, data type, numerical sequence, integrity flag and original protocol version information. Based on the metadata of the standardized data unit, combined with a preset device role weight table, data type time-lapse function, and current network link status, the dynamic cache priority value of the standardized data unit is calculated; this includes: querying the weight value of the corresponding functional role code from the device role weight table, where the device role weight table is a key-value pair structure, the key is the device functional role code, and the value is a real number between 0.1 and 1.0; and calculating the dynamic cache priority value based on the data type time-lapse function. ,in This represents the time difference between the current system time and the data acquisition time. The attenuation coefficient is used for process variables such as temperature and pressure. The value is 0.002 per second, for switch status signals. The value is 0.005 per second; obtain the current network link status compensation factor. When the link deteriorates, the compensation factor is 1.5, otherwise it is 1; multiply the device role weight value, the time-degradation value and the link status compensation factor to obtain the dynamic cache priority value; The standardized data units and their dynamic cache priority values ​​are written into a hierarchical cache storage area, which is divided into three physically isolated storage areas: a high-reliability persistent area, a medium-time transition area, and a low-priority temporary storage area. A cache space reclamation strategy is periodically executed. Based on the remaining capacity threshold of each storage area, the priority value of the data unit, and its residence time, data units in the low-priority temporary storage area are selectively discarded, and data units in the medium-time transition area are migrated to the high-reliability persistent area. When the host computer communication link is detected to be restored or the preset upload period is reached, data units are read from the high-reliability persistent area in descending order of priority, encapsulated into data packets conforming to the target transmission protocol, and sent to the remote server. At the same time, the upload confirmation status of the data units is updated.

2. The gateway adaptive caching method based on multi-protocol industrial data according to claim 1, characterized in that, The data frames are parsed and standardized in format to generate standardized data units with a unified metadata structure. This includes: identifying the protocol type identifier in the data frame and calling the corresponding protocol parsing engine; verifying the checksum to determine the integrity of the data frame, and if the verification fails, marking the integrity flag as abnormal and recording the error count; extracting the unique identifier of the device and matching it with a pre-set device asset list to obtain the functional role code of the device in the production line; converting the numerical sequence into a unified floating-point number or integer array according to a predefined data type mapping table, and attaching a timestamp of the acquisition time as a time series reference.

3. The gateway adaptive caching method based on multi-protocol industrial data according to claim 2, characterized in that, Writing the standardized data unit and its dynamic cache priority value into the hierarchical cache storage area includes: if the dynamic cache priority value is greater than or equal to 0.7, the standardized data unit is written into the high-reliability persistent area; if the dynamic cache priority value is between 0.3 and 0.7, the standardized data unit is written into the time-lapse transition area; if the dynamic cache priority value is less than 0.3, the standardized data unit is written into the low-priority temporary storage area; wherein, the high-reliability persistent area adopts a log structure writing method, the medium-priority transition area adopts a circular overwrite strategy but only allows overwriting when the high-reliability persistent area is not full and there is no higher-priority data to be written, and the low-priority temporary storage area adopts a first-in-first-out strategy and does not perform power-off protection.

4. The gateway adaptive caching method based on multi-protocol industrial data according to claim 3, characterized in that, The cache space reclamation strategy is executed periodically, including: if the usage rate of the low-priority temporary storage area exceeds 80%, the oldest data unit is deleted in ascending order of priority until the usage rate drops to 50%; the data units in the intermediate time-lapse transition area are traversed, and if their residence time exceeds the time-lapse window limit of the corresponding data type, it is determined whether their priority value is higher than the threshold of the current lowest priority data unit in the high-reliability persistent area. If so, they are migrated to the high-reliability persistent area; otherwise, they are downgraded to the low-priority temporary storage area.

5. The gateway adaptive caching method for multi-protocol industrial data according to claim 4, characterized in that, The upper limit of the data type validity window is preset for different data types: 300 seconds for analog data, 60 seconds for digital data status, and 1800 seconds for event-triggered messages.

6. The gateway adaptive caching method for multi-protocol industrial data according to claim 5, characterized in that, When the host computer communication link is restored or the preset upload period is reached, data units are read from the high-reliability persistent area in descending order of priority, encapsulated into data packets conforming to the target transmission protocol, and sent to the remote server. At the same time, the upload confirmation status of the data units is updated, including: reading data units with an upload status of "not uploaded" from the high-reliability persistent area and performing a secondary integrity check; encapsulating the verified data units into data packets according to the target transmission protocol and sending them to the remote server; if an acknowledgment response containing a matching sequence number is received within the preset timeout period, the upload status is updated to "confirmed" and the corresponding storage space is released.

7. The gateway adaptive caching method for multi-protocol industrial data according to claim 6, characterized in that, The multi-protocol access interface supports at least three industrial communication protocols, including ModbusRTU, CANopen, and ProfinetIO. Its hardware layer uses a reconfigurable physical layer chip, which dynamically switches the level standard, baud rate, and frame format parameters through configuration registers to adapt to the electrical characteristics of different fieldbuses.

8. A gateway adaptive caching system based on multi-protocol industrial data, characterized in that, To implement the method described in any one of claims 1 to 7, the system comprises: a multi-protocol data access unit, used to receive data frames from different industrial devices in real time through a multi-protocol access interface, wherein the data frames include a protocol type identifier, a unique device identifier, a timestamp, a data payload, and a checksum; a protocol parsing and standardization unit, used to parse and standardize the data frames to generate standardized data units with a unified metadata structure, wherein the unified metadata structure includes a data source identifier, acquisition time, data type, numerical sequence, integrity flag, and original protocol version information; and a dynamic priority calculation unit, used to calculate the dynamic cache priority value of the standardized data unit based on the metadata of the standardized data unit, combined with a preset device role weight table, a data type time-lapse function, and the current network link status; including: querying the weight value of the corresponding functional role code from the device role weight table, wherein the device role weight table is a key-value pair structure, the key is the device functional role code, and the value is a real number between 0.1 and 1.0; and based on the data type time-lapse function... ,in This represents the time difference between the current system time and the data acquisition time. The attenuation coefficient is used for process variables such as temperature and pressure. The value is 0.002 per second, for switch status signals. The value is 0.005 per second; the current network link status compensation factor is obtained, which is 1.5 when the link deteriorates and 1 otherwise; the device role weight value, time-degradation value and link status compensation factor are multiplied to obtain the dynamic cache priority value; the hierarchical cache management unit is used to write the standardized data unit and its dynamic cache priority value into the hierarchical cache storage area, which is divided into three physically isolated storage areas: a high-reliability persistent area, a medium-time-transition area and a low-priority temporary storage area; the cache reclamation scheduling unit is used to periodically execute the cache space reclamation strategy, selectively discarding data units in the low-priority temporary storage area according to the remaining capacity threshold of each storage area, the priority value of the data unit and its residence time, and performing migration judgment to the high-reliability persistent area for data units in the medium-time-transition area; the data upload control unit is used to read data units from the high-reliability persistent area in descending order of priority when the upper computer communication link is detected to be restored or the preset upload period is reached, encapsulate them into data packets conforming to the target transmission protocol and send them to the remote server, and update the upload confirmation status of the data units at the same time.

9. The gateway adaptive caching system based on multi-protocol industrial data according to claim 8, characterized in that, The protocol parsing and standardization unit is used to: identify the protocol type identifier in the data frame and call the corresponding protocol parsing engine; verify the checksum to determine the integrity of the data frame, and if the verification fails, mark the integrity flag as abnormal and record the error count; extract the unique identifier of the device and match it with the preset device asset list to obtain the functional role code of the device in the production line. The numerical sequence is converted into a uniform floating-point number or integer array according to a predefined data type mapping table, and the timestamp of the acquisition time is attached as a time series reference.

Citation Information

Patent Citations

  • Information transmission device based on multi-protocol dynamic conversion and data fusion and implementation method

    CN120812142A

  • Chip mounter material tracing management method and system based on knowledge graph

    CN121544287A