Internet-of-things sensing data disconnection continuous transmission method and device based on PLC collector

By using a circular linked list in the PLC collector to store sensor data and sample and compress data at intervals when the network is disconnected, the high cost and network congestion problems of the PLC collector and the edge gateway are solved, and efficient data transmission and low-cost data transmission are achieved.

CN120567375APending Publication Date: 2025-08-29CPI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510618695.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-14
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

In the prior art, when the PLC collector is disconnected from the edge gateway, there are problems such as high equipment costs, network congestion and data loss uncontrollable.

Method used

The sensor data is stored using a circular linked list, and the data is compressed by sampling and sampling at intervals when the network is disconnected, reducing the sampling frequency, using the new sampling value to cover the earliest sampling value, and then recovering the sampling count after the network connection is restored.

Benefits of technology

The efficiency of disconnection transmission is improved by about 215%, and the hardware cost is reduced by about 60%, ensuring that data is not distorted and avoiding network congestion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120567375A_ABST
    Figure CN120567375A_ABST
Patent Text Reader

Abstract

The invention provides an internet-of-things sensing data disconnection continuous transmission method and device based on a PLC collector. The method comprises the following steps: storing collected sensor data by adopting a circular linked list; each sensor corresponds to one circular linked list; when the network is disconnected, the data is compressed by sampling the circular linked list at intervals, and the sampling frequency is reduced; and when the network disconnection time is too long and the interlaced sampling reaches a set standard, covering the sampling value with the earliest sampling time by using a new sampling value. The method has the advantages that in practical application, compared with similar products, under the condition that data details are not affected, the offline continuous transmission completion efficiency is improved by about 215%, and the hardware cost is reduced by about 60%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical fields of Internet of Things, automation control, data acquisition, big data, etc., and specifically relates to a method and device for resuming transmission of IoT sensor data after network disconnection based on a PLC collector. Background Art

[0002] like Figure 1 As shown in the figure, existing industrial IoT sensor data collection and upload systems include PLC collectors (programmable logic controllers), edge gateways, sensors, and message queues. The PLC collector typically uses a low-cost MCU microcontroller, which monitors network connectivity through external interrupts and network heartbeats. It also uses an ADC (analog-to-digital converter) to digitally sample external sensors, process the data, and report it to the edge gateway. The PLC collector and edge gateway can be connected via various methods, including 4G, wired, and Wi-Fi, and network instability is common.

[0003] When a network outage occurs between the PLC collector and the edge gateway, existing technologies mainly cache sensor data during the outage in large quantities and then send the data in batches after the network is reconnected. This type of technical solution can partially solve the problem of data loss, but there are the following problems: (1) It requires a large-capacity data buffer storage area, resulting in high equipment costs; (2) After the network is reconnected, a large amount of data is reported instantly, which can easily cause network congestion and information storms; (3) Network congestion and information storms can easily cause data loss during critical time periods, and data loss is uncontrollable, resulting in data distortion. Summary of the Invention

[0004] The purpose of this application is to overcome the defects of the existing technology, which is high cost and easy to cause network congestion.

[0005] To achieve the above objectives, this application proposes a method for resuming IoT sensor data transmission after network disconnection based on a PLC collector, comprising:

[0006] A circular linked list is used to store the collected sensor data; each sensor corresponds to a circular linked list;

[0007] When a network outage occurs, the data is compressed by sampling the circular linked list at alternate points and the sampling frequency is reduced;

[0008] When the network disconnection time is too long and the sampling interval reaches the set standard, the new sampling value is used to overwrite the sampling value with the earliest sampling time.

[0009] As an improvement to the above method, in the circular linked list, a production pointer is used to point to a node to which data is currently to be written, and a consumption pointer is used to point to a node to which data is currently to be read;

[0010] After collecting sensor data, the PLC collector writes the data to the node pointed to by the production pointer, sets the node as unconsumed, and moves the production pointer to the next node;

[0011] When the PLC collector reports sensor data, it reads the data of the node pointed to by the consumption pointer and reports it, sets the node as consumed, and moves the consumption pointer to the next node.

[0012] As an improvement to the above method, the alternate point sampling is:

[0013] Step 1: Initialize the movement count m to 1;

[0014] Step 2: Move the production pointer to the next node, read the data of the node m+1 away from the current production pointer, set the data of this node to be empty; use the data of this node to overwrite the data of the node pointed by the current production pointer; move the count m plus 1;

[0015] Step 3: Repeat step 2 until the data of the production pointer interval m+1 nodes is empty.

[0016] As an improvement to the above method, the sampling period of the PLC collector is clock period×sampling count.

[0017] As an improvement to the above method, reducing the sampling frequency is to double the sampling count.

[0018] As an improvement to the above method, the method further includes:

[0019] When the network is restored, the sampling count is restored to the original value.

[0020] As an improvement to the above method, the setting standard is that the sampling period of the PLC collector reaches one sample per day.

[0021] As an improvement to the above method, the method further includes:

[0022] Initially, when the amount of data collected by the PLC collector reaches 30% of the number of nodes in the circular linked list, data reporting is started.

[0023] The present application also provides a device for resuming transmission of IoT sensor data after disconnection based on a PLC collector, the device comprising a PLC collector; the PLC collector performs the above method when collecting and reporting data

[0024] Compared with the prior art, the advantages of this application are:

[0025] In actual applications, compared with similar products, the efficiency of resuming transmission after network disconnection is improved by about 215% and the hardware cost is reduced by about 60% without affecting data details (the test environment is: the network is disconnected for 7 days, the edge gateway is connected to 5 PLC collectors and 30 sensors). BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 The figure shows the functional block diagram of PLC data reporting;

[0027] Figure 2 The figure shows the timing diagram of data reporting from the PLC collector;

[0028] Figure 3 The figure shows a schematic diagram of a method for resuming transmission of IoT sensor data after disconnection based on a PLC collector.

[0029] Figure 4 The figure shows a schematic diagram of sampling at alternate points;

[0030] Figure 5 The figure shows a schematic diagram of discarding the data that has not been consumed for the longest time. DETAILED DESCRIPTION

[0031] The technical solution of this application is described in detail below with reference to the accompanying drawings.

[0032] The present invention is applicable to scenarios where an edge gateway is disconnected during data collection and reporting by IoT devices. In this scenario, the present invention ensures at extremely low cost that the reported data is undistorted or minimally distorted after the network is reconnected, while also ensuring that adverse situations such as network storms that block network communications do not occur.

[0033] like Figure 2 As shown, the core component PLC collector of the present invention mainly deploys four tasks: edge network care trip detection task, sensor value timing sampling task, sensor value reporting task and sensor data processing task.

[0034] Edge network heartbeat detection task: The edge gateway broadcasts heartbeats to all network devices at regular intervals. The PLC collector uses interrupt mode to listen to the edge network heartbeat broadcast. If no heartbeat broadcast is heard within one minute, it is considered that the edge gateway network connection has been disconnected (the network flag fN is set to 1 at this time. Subsequently, as long as the edge network heartbeat is received, the network flag fN can be set to 0). In this case, the PLC collector will no longer report sensor data to the edge gateway until the next edge network heartbeat broadcast is heard.

[0035] Sensor value timing sampling task: The PLC collector relies on this task to regularly sample the values ​​of the connected sensors, with a sampling period of T. This task updates the collected sensor data to the data linked table node.

[0036] Sensor value reporting task: The PLC collector periodically initiates the data reporting task. In this task, the PLC collector reads the sensor information that needs to be uploaded from the memory and then reports it to the edge gateway in the form of a message queue.

[0037] Sensor data processing task: The PLC collector processes and merges the collected sensor data according to the actual network situation. This task is encapsulated as a subtask in the "Sensor Value Timing Sampling Task" and is not started separately. It is discussed in detail below.

[0038] like Figure 3 As shown, the present invention implements the network disconnection and resuming transmission function by deploying the network disconnection and resuming transmission method on the PLC collector. The terms involved in the method are described as follows:

[0039] Data production: refers to the PLC collector sampling the sensor according to the "sensor value timing sampling task". The sampling period is T. The sensor value obtained by sampling and the current time are stored (or refreshed) in the corresponding value of the linked list node pointed to by the production pointer pP;

[0040] Data consumption: refers to the PLC collector processing the corresponding value of the linked list node pointed to by the consumption pointer pC according to the "Sensor Value Reporting Task". The relationship between the start cycle and sampling cycle of the "Sensor Value Reporting Task" is cT = T × sC;

[0041] Data reporting: refers to the process of sending data to the edge gateway through the message queue after the PLC collector completes data consumption. The data reporting process automatically adjusts the data reporting cycle through the sampling count sC. The actual data consumption cycle cT = T × sC (sampling count). The present invention does not need to use the handshake protocol. The PLC collector adopts a one-way data transmission mode (data loss is allowed). If the edge gateway does not receive the data sent this time, it is considered that the data is lost.

[0042] Data linked list: refers to the construction of a circular linked list data structure for each sensor in the PLC collector, which is used to store the sampling data and other information of the corresponding sensor;

[0043] Linked list node: refers to the basic unit that makes up the data linked list, which mainly encapsulates field information such as "sensor value", "sampling time", "consumption flag", "sampling count", and "pointer";

[0044] Sampling count: refers to the number of times the information of the node in the linked list is refreshed before it is consumed. The sampling count is represented by sC;

[0045] Consumption flag: used to indicate whether the value of the linked list node has been consumed (reported to the edge gateway);

[0046] Network disconnection detection: refers to the PLC collector accumulating the number of consecutive heartbeat losses of the edge gateway through the "Edge Network Heartbeat Detection Task". If the number of consecutive losses exceeds the limit, it is considered to be disconnected.

[0047] Example 1

[0048] The method for resuming IoT sensor data transmission after network disconnection based on PLC collector includes:

[0049] Based on empirical estimates of the maximum number of days of network outage, cD, we estimate that in the extreme case (only reporting hourly sensor data, that is, caching one sample per hour), the length of each sensor's data cache list (sampling list) is N = cD × 1 (number of nodes) × 24 (number of hours per day). Assuming the maximum number of days of network outage is 30, the length of the data cache list corresponding to a single sensor is 30 × 1 × 24 = 720.

[0050] The sensor sampling period is set to T. During the sampling period, AD completes the sampling of sensors 1 to n in sequence. The sampling data of each sensor is stored in the data linked list in the form of a linked list node structure.

[0051] The data linked list is generated in the form of a circular linked list. The pointers corresponding to the current production and consumption of each sensor are recorded through the production pointer array and the consumption pointer array to complete the production and consumption of sensor sampling data.

[0052] A linked list node mainly consists of: sensor value, sampling time, consumption flag fC, sampling count sC, and linked list pointer. The consumption flag fC is used to indicate whether the data of this node has been consumed (reported), and the sampling count sC indicates the number of times the sensor data of this node has been refreshed.

[0053] According to experience, it is more appropriate to start the "sensor value reporting task" about T×sC×N×30% later than the "sensor value scheduled sampling task". That is, when about 30% of the nodes in the data linked list have completed data refresh, it is more appropriate to start data reporting at this time.

[0054] The data production process is the process of collecting sensor data and then updating the sampled data to the linked list nodes. The data production process adopts the following strategy:

[0055] 1. Normal situation (production pointer pP!=consumption pointer pC): The linked list node pointed to by the production pointer pP is refreshed according to the latest sampling data and sampling time, and the consumption flag fC is set to 0.

[0056] 2. Special case (production pointer pP == consumption pointer pC, i.e., production pointer pP catches up with consumption pointer pC): This case is when the data consumption speed is lower than the production speed. Specifically, we need to check the network disconnection flag fN to divide it into the following three cases for discussion:

[0057] 2.1. Network-connected (fN == 0): In this case, the sampling count is multiplied by sC = sC × 2, thereby reducing the data production frequency. The PLC collector sampling period is fixed to the number of embedded device clock cycles, that is, the sampling period remains unchanged, and the sampled data is refreshed every fixed period. The sampling frequency can be adjusted by adjusting the size of the sampling counter sC of the linked list node. For example, when the current node's sampling count is 5 during network connection, it is refreshed 5 times before the sampled data is considered ready. However, when the current node's sampling count is set to 10 during network disconnection, it is refreshed 10 times before the sampled data is considered ready, thus achieving the effect of slowing down data refresh.

[0058] 2.2, Network disconnection (fN==1): In this case, data compression is required by sampling the linked list nodes at alternate points. Figure 4 For example, define a temporary pointer pT = pP. The pT pointer traverses the linked list in increments of 2, while the pP pointer moves in increments of 1, i.e., pP = pP + 1 and pT = pT + 2. This traverses nodes D, F, H, J, L, and N, overwriting the node pointed to by pT with the information of the node pointed to by pP. The current sampling count sC is saved as a snapshot of the sampling count before the network disconnection in sCH, and the sampling count is multiplied by 1, i.e., sC = sC × 2, thereby reducing the frequency of data production. If the network disconnection persists, after data compression, the production pointer pP will catch up with the consumption pointer pC. At this time, data compression can be performed again, and the sampling count is multiplied by 1, and the cycle continues.

[0059] The strategy is summarized as follows:

[0060] Step 1: Initialize the movement count m to 1;

[0061] Step 2: Move the production pointer to the next node, read the data of the node m+1 away from the current production pointer, set the data of this node to be empty; use the data of this node to overwrite the data of the node pointed by the current production pointer; move the count m plus 1;

[0062] Step 3: Repeat step 2 until the data of the production pointer interval m+1 nodes is empty.

[0063] 2.3. Extreme case of network disconnection (fN==1, cannot be compressed): In this case, the actual number of days of network disconnection is greater than the estimated number of days of network disconnection (the sampling time between adjacent nodes is less than 24 hours). In this case, the cache data is cached by abandoning the node that has not reported for the longest time. Figure 5 For example, the original production pointer pP and consumption pointer pC both point to node B. In the next data production cycle, the production pointer pP and consumption pointer pC both point to node C, and the data of node C is refreshed, and the original data of node C is discarded.

[0064] Data consumption is the process of reporting collected sensor data to the edge gateway. The data consumption process adopts the following strategies:

[0065] 1. Normal situation (consumption pointer pC is behind production pointer pP): data is reported according to the normal cycle;

[0066] 2. Abnormal situation (consumption pointer pC >= production pointer pP): If the node pointed to by the pC pointer already has sampled data, it will be consumed directly; otherwise, it will wait for the next cycle to consume. Because the sampling period is T and the consumption period cT = T × sC, the abnormal situation will be eliminated.

[0067] 3. Abnormal situation recovery (device recovery from disconnected state): Check whether there is a value in the sampling count snapshot sCH that is not disconnected. If there is a value, synchronize the specific value to the sC sampling count to restore the previous network state, and then clear the value of sCH.

[0068] In order to further save memory resources and development costs and improve software operation efficiency during the actual implementation of the present invention, a two-dimensional array can be used to replace the data linked list, and array subscripts can be used to replace various pointers.

[0069] Example 2

[0070] The present application also provides a device for resuming transmission of IoT sensor data after network disconnection based on a PLC collector, which includes a PLC collector; the above method is executed when the PLC collector collects and reports data.

[0071] Finally, it should be noted that the above embodiments are intended only to illustrate the technical solutions of this application and are not intended to limit the scope of the present invention. Although this application has been described in detail with reference to the embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions to the technical solutions of this application do not depart from the spirit and scope of the technical solutions of this application and should be encompassed by the claims of this application.

Claims

1. A method for resuming transmission of IoT sensor data after network disconnection based on a PLC collector, comprising: A circular linked list is used to store the collected sensor data; each sensor corresponds to a circular linked list; When a network outage occurs, the data is compressed by sampling the circular linked list at alternate points and the sampling frequency is reduced; When the network disconnection time is too long and the sampling interval reaches the set standard, the new sampling value is used to overwrite the sampling value with the earliest sampling time.

2. The method for resuming transmission of IoT sensor data after disconnection based on a PLC collector according to claim 1 is characterized in that: In the circular linked list, a production pointer is used to point to a node where data is currently to be written, and a consumption pointer is used to point to a node where data is currently to be read; After collecting sensor data, the PLC collector writes the data to the node pointed to by the production pointer, sets the node as unconsumed, and moves the production pointer to the next node; When the PLC collector reports sensor data, it reads the data of the node pointed to by the consumption pointer and reports it, sets the node as consumed, and moves the consumption pointer to the next node.

3. The method for resuming transmission of IoT sensor data after disconnection based on a PLC collector according to claim 2 is characterized in that: The alternate point sampling is: Step 1: Initialize the movement count m to 1; Step 2: Move the production pointer to the next node, read the data of the node m+1 away from the current production pointer, set the data of this node to be empty; use the data of this node to overwrite the data of the node pointed by the current production pointer; move the count m plus 1; Step 3: Repeat step 2 until the data of the production pointer interval m+1 nodes is empty.

4. The method for resuming transmission of IoT sensor data after disconnection based on a PLC collector according to claim 1 is characterized in that: The sampling period of the PLC collector is clock period×sampling count.

5. The method for resuming transmission of IoT sensor data after disconnection based on a PLC collector according to claim 4 is characterized in that: The reducing of the sampling frequency is to double the sampling count.

6. The method for resuming transmission of IoT sensor data after disconnection based on a PLC collector according to claim 5 is characterized in that: Also includes: When the network is restored, the sampling count is restored to the original value.

7. The method for resuming transmission of IoT sensor data after disconnection based on a PLC collector according to claim 1 is characterized in that: The setting standard is that the sampling period of the PLC collector reaches one sample per day.

8. The method for resuming transmission of IoT sensor data after network disconnection based on a PLC collector according to claim 1 is characterized in that: Also includes: Initially, when the amount of data collected by the PLC collector reaches 30% of the number of nodes in the circular linked list, data reporting is started.

9. A device for resuming transmission of IoT sensor data after disconnection based on a PLC collector, characterized in that: The device includes a PLC collector; the PLC collector executes the method according to any one of claims 1 to 8 when collecting and reporting data.