A PLC data acquisition method

By using an asynchronous non-blocking model and connection pool management based on Vert.x servers, the performance limitations of PLC data acquisition systems were resolved, enabling efficient data transmission and cleaning, and optimizing data processing for edge computing.

CN117631600BActive Publication Date: 2026-04-28NEW TREND INT LOGIS TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NEW TREND INT LOGIS TECH
Filing Date
2022-08-10
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing PLC data acquisition systems suffer from performance deficiencies in system software, information transmission, and data models. They cannot effectively utilize the performance of edge servers, and the data cleaning task is entirely delegated to the upper layer, resulting in invalid data transmission and storage.

Method used

An asynchronous non-blocking model based on the Vert.x server is adopted to achieve efficient data acquisition processing through tag address compression and decompression and a connection pool with a controllable upper limit on the number of connections, combined with the segmentation of tag groups and the execution of calculation rules.

Benefits of technology

It improves the performance of edge servers, enhances the data density of information transmission, reduces invalid data transmission and storage, shields protocol differences, and optimizes data cleaning tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117631600B_ABST
    Figure CN117631600B_ABST
Patent Text Reader

Abstract

The application relates to the computer technical field and discloses a PLC data acquisition method, in order to improve the data acquisition efficiency of an edge gateway on a PLC, uses label address compression and decompression, a controllable connection pool of a connection upper limit and other technologies to realize maximum acquisition efficiency, so that the edge gateway can process more information with minimum resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a data acquisition method for a PLC. Background Technology

[0002] With the continuous development of Industry 4.0, the demand for industrial control data acquisition, edge computing, centralized cleaning, data mining, and intelligent control is becoming increasingly strong. The performance issues of edge acquisition are becoming more and more prominent. At the same time, the problem of difficulty in uniformly adapting the diverse hardware of industrial control equipment is becoming more and more prominent. Industrial control data is different from Internet data. Its data is generated by machines, the data volume is much larger, and the real-time requirements are extremely stringent. In order to give full play to the hardware capabilities of edge gateways, software optimization needs to be solved urgently.

[0003] Currently, industrial control data acquisition systems have the following problems:

[0004] At the system software level, the concurrency model is outdated (compared to the asynchronous non-blocking concurrency model in the Internet field), and cannot maximize the performance of edge servers;

[0005] At the information transmission level, directly collecting the target tag address is limited by the number of collection points and message length of the PLC in a single collection, resulting in too little information carried by a unit of data.

[0006] At the data model level, the equipment configuration model is limited by the protocol and the acquisition tools provided by the PLC manufacturer, and cannot effectively shield the differences in the underlying protocol;

[0007] At the edge computing level, the data cleaning task is completely handed over to the upper layer, lacking filtering and cleaning at the edge, resulting in a huge amount of data at the upper layer, which contains a lot of invalid data;

[0008] It is therefore essential to find a solution to the above problems. This method can effectively and quickly resolve these issues. Summary of the Invention

[0009] The purpose of this invention is to provide a method for PLC data acquisition. In order to improve the data acquisition efficiency of edge gateways from PLCs, technologies such as tag address compression and decompression and connection pool with controllable connection limit are used to maximize acquisition efficiency, so that the edge gateway can process more information with minimal resources.

[0010] To achieve the above technical objectives and effects, this invention discloses a PLC data acquisition method, implemented based on a Vert.x server, comprising the following steps:

[0011] S1: Data Acquisition Task. Receives commands to execute tasks and acquires multiple tag addresses that need to be acquired. Groups these addresses according to PLC protocol type, referred to as "tag groups".

[0012] S2: Tag group sorting. Sort each tag group according to its address information. This will result in a tag group sorted by address order, referred to as a "sequential tag group".

[0013] S3: Sequential tag group segmentation. The sequential tag group is divided into n segments, where each segment must be continuous. These segments contain a large amount of tag information, thus compressing the tags.

[0014] S4: Tag group position record, records the relative position of each tag in the segment on the tag group;

[0015] S5: Segmented Sequential Label Group Cutting, which cuts the segmented sequential label group into m groups, each group having a maximum length not exceeding the maximum message length specified in the protocol, referred to as "new label group";

[0016] S6: New tag group position record, records the relative position of each new tag in the segment in the new tag group;

[0017] S7: Collect message, which combines all new tag groups into a collection message. Each collection message shall not exceed the maximum message length, and is referred to as a "message".

[0018] S8: Message sending, sends the message to the connection pool;

[0019] S9: The connection pool creates a new connection. The connection pool attempts to acquire an idle connection. If there is no idle connection, it checks whether the maximum number of PLC connections has been exceeded. If not, it creates a new connection. If it exceeds the limit, it puts the message into the waiting queue.

[0020] S10: The wait queue checks the connection. The wait queue will check the connection's idle status and hand the packet to the idle connection, or destroy the timeout message that has been waiting for too long.

[0021] S11: Execute data acquisition, connect and send messages, execute data acquisition actions, and the PLC returns the acquisition results;

[0022] S12: Obtain the segments with the acquisition results. According to the relative position information recorded in S6, fill the results into the segments to obtain the segments with the acquisition results.

[0023] S13: Obtain the result labels. According to the relative position information recorded in S4, read out the segmented results and put them into each label of the label group, referred to as "result labels". This process is to decompress the information into the label group.

[0024] S14: Calculation task. The calculation task obtained in step S1 also includes information about the calculation rules. $label1> 100 means that when the data with label1 is greater than 100, it returns true. The calculation task subscribes to the collection task corresponding to its label.

[0025] S15: Calculation, substitute the result label obtained from S13 into the subscribed calculation rule for calculation;

[0026] S16: Collection results. When the result is true, the label value specified in the calculation rule is reported to MQTT. Users can subscribe to MQTT as needed to obtain the required collection results.

[0027] The beneficial effects of this invention are:

[0028] At the system software level, this invention prioritizes the use of an asynchronous non-blocking server implementation based on Vert.x to maximize the performance of edge servers;

[0029] At the information transmission level, the collection tag address is compressed, and then the collection result is decompressed to maximize the information density per unit of data;

[0030] At the data model level, it can handle tasks with different protocol labels, process them in groups, and help the upper layer shield protocol differences;

[0031] At the edge computing level, it can extract the collected results and execute the calculation rules at the edge, thereby sharing the cleaning computing power with the upper layer and reducing the transmission and storage of invalid data. Attached Figure Description

[0032] Figure 1 This is a schematic diagram of the compression and decompression of the tag addresses corresponding to S3-S6 in this invention.

[0033] Figure 2 This is a schematic diagram of the controllable connection pool corresponding to the upper limit of the number of connections in S9-S11 of the present invention.

[0034] Figure 3 This is a schematic diagram of the subscription relationship between the acquisition tasks corresponding to S1 and S14 in this invention. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments.

[0036] This invention discloses a PLC data acquisition method, which is implemented based on the Vert.x server, and includes the following steps:

[0037] like Figure 3S1: Acquisition task, receives the command to execute the task, and acquires multiple tag addresses that need to be acquired. These addresses are grouped according to the PLC protocol type, referred to as "tag group";

[0038] S2: Tag group sorting. Sort each tag group according to its address information. This will result in a tag group sorted by address order, referred to as a "sequential tag group".

[0039] like Figure 1 As shown, S3: Sequential label group segmentation, which divides the sequential label group into n segments, where each segment must be continuous, referred to as "segmentation". The segmentation contains a large amount of label information, thereby compressing the labels;

[0040] S4: Tag group position record, records the relative position of each tag in the segment on the tag group;

[0041] S5: Segmented Sequential Label Group Cutting, which cuts the segmented sequential label group into m groups, each group having a maximum length not exceeding the maximum message length specified in the protocol, referred to as "new label group";

[0042] S6: New tag group position record, records the relative position of each new tag in the segment in the new tag group;

[0043] S7: Collect message, which combines all new tag groups into a collection message. Each collection message shall not exceed the maximum message length, and is referred to as a "message".

[0044] S8: Message sending, sends the message to the connection pool;

[0045] like Figure 2 As shown, S9: The connection pool creates a new connection. The connection pool attempts to acquire an idle connection. If there is no idle connection, it checks whether the maximum number of PLC connections has been exceeded. If not, a new connection is created. If it has been exceeded, the message is put into the waiting queue.

[0046] S10: The wait queue checks the connection. The wait queue will check the connection's idle status and hand the packet to the idle connection, or destroy the timeout message that has been waiting for too long.

[0047] S11: Execute data acquisition, connect and send messages, execute data acquisition actions, and the PLC returns the acquisition results;

[0048] S12: Obtain the segments with the acquisition results. According to the relative position information recorded in S6, fill the results into the segments to obtain the segments with the acquisition results.

[0049] S13: Obtain the result labels. According to the relative position information recorded in S4, read out the segmented results and put them into each label of the label group, referred to as "result labels". This process is to decompress the information into the label group.

[0050] S14: Calculation task. The calculation task obtained in step S1 also includes information about the calculation rules. $label1> 100 means that when the data with label1 is greater than 100, it returns true. The calculation task subscribes to the collection task corresponding to its label.

[0051] S15: Calculation, substitute the result label obtained from S13 into the subscribed calculation rule for calculation;

[0052] S16: Collection results. When the result is true, the label value specified in the calculation rule is reported to MQTT. Users can subscribe to MQTT as needed to obtain the required collection results.

[0053] The beneficial effects of this invention are:

[0054] At the system software level, this invention prioritizes the use of an asynchronous non-blocking server implementation based on Vert.x to maximize the performance of edge servers;

[0055] At the information transmission level, the collection tag address is compressed, and then the collection result is decompressed to maximize the information density per unit of data;

[0056] At the data model level, it can handle tasks with different protocol labels, process them in groups, and help the upper layer shield protocol differences;

[0057] At the edge computing level, it can extract the collected results and execute the calculation rules at the edge, thereby sharing the cleaning computing power with the upper layer and reducing the transmission and storage of invalid data.

[0058] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A PLC data acquisition method, implemented based on Vert.x server, characterized in that: The steps include the following: S1: Data Acquisition Task. Receives commands to execute tasks and acquires multiple tag addresses that need to be acquired. Groups these addresses according to PLC protocol type, referred to as "tag groups". S2: Tag group sorting. Sort each tag group according to its address information. This will result in a tag group sorted by address order, referred to as "sequential tag group". S3: Sequential tag group segmentation. The sequential tag group is divided into n segments, where each segment must be continuous. These segments contain a large amount of tag information, thus compressing the tags. S4: Tag group position record, records the relative position of each tag in the segment on the tag group; S5: Segmented Sequential Label Group Cutting, which cuts the segmented sequential label group into m groups, each group having a maximum length not exceeding the maximum message length specified in the protocol, referred to as "new label group"; S6: New tag group position record, records the relative position of each new tag in the segment in the new tag group; S7: Collect message, which combines all new tag groups into a collection message. Each collection message does not exceed the maximum message length, and is referred to as a "message". S8: Message sending, sends the message to the connection pool; S9: The connection pool creates a new connection. The connection pool attempts to acquire an idle connection. If there is no idle connection, it checks whether the maximum number of PLC connections has been exceeded. If not, it creates a new connection. If it exceeds the limit, it puts the message into the waiting queue. S10: The wait queue checks the connection. The wait queue will check the connection's idle status and hand the packet to the idle connection, or destroy the timeout message that has been waiting for too long. S11: Execute data acquisition, connect and send messages, execute data acquisition actions, and the PLC returns the acquisition results; S12: Obtain the segments with the acquisition results. According to the relative position information recorded in S6, fill the results into the segments to obtain the segments with the acquisition results. S13: Obtain the result labels. According to the relative position information recorded in S4, read out the segmented results and put them into each label of the label group, referred to as "result labels". This process is to decompress the information into the label group. S14: Calculation task. The calculation task obtained in step S1 also includes information about the calculation rules. $label1 > 100 means that when the data with label1 is greater than 100, it returns true. The calculation task subscribes to the collection task corresponding to its label. S15: Calculation, substitute the result label obtained from S13 into the subscribed calculation rule for calculation; S16: Collection results. When the result is true, the label value specified in the calculation rule is reported to MQTT. Users can subscribe to MQTT as needed to obtain the required collection results.

Citation Information

Patent Citations

  • Airtight traceability method and system based on verification aid

    CN108846534A

  • Food bag detection system and method based on machine vision and food packaging system

    CN111368818A