Platform data acquisition low-delay method and system based on PLC (Programmable Logic Controller) equipment

By initializing the basic database information on the PLC device platform, starting the platform's minimum acquisition cycle timer, creating concurrent data acquisition tasks, and using polling to perform data acquisition, the problems of high delay and difficult maintenance of PLC device data acquisition are solved, and the data acquisition effect with low latency and high maintenance is achieved.

CN119536115APending Publication Date: 2025-02-28XIAN AEROSPACE AUTOMATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411701592.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

In the prior art, PLC equipment data acquisition delay is high, and software maintenance based on multi-time task mode is difficult, resulting in the problem of high delay.

Method used

By initializing the basic database information on the PLC device platform, starting the platform minimum acquisition cycle timer, creating the PLC device platform minimum data acquisition cycle, and generating multiple concurrent data acquisition tasks based on each PLC device, data acquisition is performed using polling method, and the collected target data is output.

Benefits of technology

It realizes lower data acquisition delay in most business scenarios, reduces the delay phenomenon in the PLC data acquisition method based on timer, and improves the maintainability of PLC equipment data acquisition software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119536115A_ABST
    Figure CN119536115A_ABST
Patent Text Reader

Abstract

The invention provides a platform data acquisition low-delay method and system based on PLC equipment, and the method comprises the steps: carrying out the initialization of the basic information of a database after a data acquisition instruction is received; starting a platform minimum acquisition period timer, and creating a PLC platform minimum data acquisition period; creating a corresponding collection task based on each PLC to generate a plurality of concurrent tasks; after the current task is executed, the PLC collects data according to blocks or points on the basis of the counter in a polling mode; and after the data acquisition is completed, outputting the acquired target data. According to the method, only one timer is set to time all the data acquisition tasks, the starting time of the data acquisition tasks is a multiple of the minimum acquisition period, and the data acquisition tasks are executed when the number of execution periods of the platform participates in modular operation and is zero. The data acquisition tasks are created concurrently, and the data acquisition tasks meeting the acquisition conditions are extracted from the background when the foreground tasks are completed, so that the data acquisition efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a low-latency method and system for data acquisition based on a PLC device platform. Background Art

[0002] Programmable logic controller (PLC) is a digital operation electronic system designed for use in industrial environments. PLC is usually connected to various sensors through analog input modules or digital input modules. For example, temperature sensors, pressure sensors, liquid level sensors, etc. convert continuously changing physical quantities into corresponding electrical signals and transmit them to PLC through analog input modules. Digital sensors such as limit switches and photoelectric switches transmit the switch status (open or closed) to PLC in the form of binary digital signals through digital input modules.

[0003] The A / D (analog to digital) converter inside the PLC converts the received analog electrical signal into a digital quantity so that the PLC can perform digital operations and processing. For digital quantity signals, the PLC directly performs logical judgment and processing. The PLC program performs preliminary processing on the collected sensor data according to the preset logic and algorithm, such as data filtering, unit conversion, etc., to obtain accurate and usable physical quantity data.

[0004] The collection of single PLC point data is related to the platform's scheduling of data collection for different PLC devices. The delay of data collection on the PLC device platform is closely related to the amount of information collected by a single PLC point and the amount of PLC devices connected. The larger the amount of information collected by a single PLC, the greater the possibility of delay in single PLC information collection. The more PLC devices are connected, the longer it takes for the device platform to switch tasks, and the greater the possibility of delay in single PLC device information collection. Therefore, in most business scenarios, the data collection delay is higher, and the maintenance of PLC device data collection software based on multiple scheduled tasks is difficult. Summary of the invention

[0005] The present application provides a low-latency method and system for data collection based on a PLC device platform to solve the problems of high data collection delay in current business scenarios, and the difficulty in maintaining the PLC device data collection software based on multiple scheduled tasks and relatively high delay.

[0006] In a first aspect, the present application provides a low-latency method for data acquisition based on a PLC device platform, the method comprising:

[0007] After receiving the data collection instruction, the basic information of the database is initialized;

[0008] Start the platform minimum collection cycle timer, and create the PLC device platform minimum data collection cycle;

[0009] Create corresponding data acquisition tasks based on each PLC device to generate multiple concurrent tasks;

[0010] Confirm whether the current task of the PLC device has been completed;

[0011] After the current task is completed, the PLC device collects data in blocks or points based on the counter in a polling manner;

[0012] After data collection is completed, the collected target data is output.

[0013] In some possible implementations, starting the platform minimum acquisition cycle timer includes:

[0014] Determine the minimum acquisition cycle of PLC devices supported by the platform;

[0015] The platform periodically starts data collection tasks according to the platform's minimum collection cycle.

[0016] In some possible implementations, creating a corresponding data acquisition task based on each PLC device to generate multiple concurrent tasks includes:

[0017] Create a data acquisition task for each PLC device;

[0018] Check whether the PLC device is executing tasks;

[0019] After the current task is completed, a new data collection task is executed.

[0020] In some possible implementations, after the data collection task is created, the following steps are further included:

[0021] Classify the data collection tasks according to the collection method and collection cycle;

[0022] After classification, data collection is performed when the collection conditions are met.

[0023] In some possible implementations, data collection when the collection conditions are met includes:

[0024] When the number of platform execution cycles participating in the modulo operation is 0, the point information and block information can participate in the execution of the data collection task.

[0025] In some possible implementations, point information and block information can participate in the execution of data collection tasks including:

[0026] When the addresses are continuous points or blocks, data collection is performed according to the block information;

[0027] When the address is a discontinuous point, data is collected according to the point information.

[0028] In some possible implementations, after the current task is completed, the following steps are included:

[0029] Collect the point or block information that meets the collection conditions in the PLC device, and use polling to collect the point information and block information in the PLC device.

[0030] In some possible implementations, whether the point information or block information meets the collection condition is determined by a counter in the PLC collection point information preparation module;

[0031] After the acquisition task is completed, the existing task execution status is marked in the corresponding PLC device list.

[0032] In a second aspect, the present application provides a low-latency data acquisition system based on a PLC device platform, wherein the system is configured as follows:

[0033] After receiving the data collection instruction, the basic information of the database is initialized;

[0034] Start the platform minimum collection cycle timer, and create the PLC device platform minimum data collection cycle;

[0035] Create corresponding data acquisition tasks based on each PLC device to generate multiple concurrent tasks;

[0036] Confirm whether the current task of the PLC device has been completed;

[0037] After the current task is completed, the PLC device collects data in blocks or points based on the counter in a polling manner;

[0038] After data collection is completed, the collected target data is output.

[0039] In some possible implementations, the system includes:

[0040] The platform minimum acquisition cycle timer module is used to determine the minimum acquisition cycle of the PLC device supported by the platform;

[0041] Concurrent task creation module, used to create data acquisition tasks for each PLC device;

[0042] A PLC acquisition point information preparation module is used to provide point or block information to be collected for each corresponding PLC device;

[0043] The PLC device acquisition task module is used to collect information on points or blocks in the PLC device that meet the acquisition conditions.

[0044] It can be known from the above technical content that the present application provides a low-latency method and system for data acquisition based on a PLC device platform, the method including initializing the basic information of the database after receiving the data acquisition instruction; starting the platform minimum acquisition cycle timer, and creating the minimum data acquisition cycle of the PLC device platform; generating multiple concurrent tasks based on the corresponding acquisition task created for each PLC device; confirming whether the current task of the PLC device has been executed; after the current task is executed, the PLC device performs data acquisition in blocks or points based on the counter in a polling manner; after the data acquisition is completed, the collected target data is output. The present application only sets one timer to time all data acquisition tasks. The timer is used to determine the minimum acquisition cycle of the PLC device. The start time of each data acquisition task is a multiple of the minimum acquisition cycle. When the number of platform execution cycles participating in the modulo operation is 0, the data acquisition task is executed. This application creates data collection tasks concurrently, and the background is always preparing to collect data. When the foreground task is completed, the data collection task that meets the collection conditions is extracted from the background to avoid switching of a large number of tasks or threads that will increase memory and performance consumption, thereby improving data collection efficiency. This application can maximize the use of computer resources by periodically starting collection tasks. Compared with the timer-based PLC data collection method, the data collection delay is lower in most business scenarios, which improves the phenomenon of data aggregation to be collected by a specific timer, and the task-based PLC device data collection software is more maintainable. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0046] Figure 1 A flow chart of a low-latency method for data acquisition based on a PLC device platform provided in some embodiments of this application;

[0047] Figure 2 A structural diagram of point or block data preparation provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] The following embodiments are described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following embodiments do not represent all implementations consistent with the present application. They are only examples of systems and methods consistent with some aspects of the present application as detailed in the claims.

[0049] Programmable logic controller (PLC) is a digital operation electronic system designed for use in industrial environments. PLC is usually connected to various sensors through analog input modules or digital input modules. For example, temperature sensors, pressure sensors, liquid level sensors, etc. convert continuously changing physical quantities into corresponding electrical signals and transmit them to PLC through analog input modules. Digital sensors such as limit switches and photoelectric switches transmit the switch status (open or closed) to PLC in the form of binary digital signals through digital input modules.

[0050] The A / D (analog to digital) converter inside the PLC converts the received analog electrical signal into a digital quantity so that the PLC can perform digital operations and processing. For digital quantity signals, the PLC directly performs logical judgment and processing. The PLC program performs preliminary processing on the collected sensor data according to the preset logic and algorithm, such as data filtering, unit conversion, etc., to obtain accurate and usable physical quantity data.

[0051] The collection of single PLC point data is related to the platform's scheduling of data collection for different PLC devices. The delay of data collection on the PLC device platform is closely related to the amount of information collected by a single PLC point and the amount of PLC devices connected. The greater the amount of information collected by a single PLC, the greater the possibility of delay in single PLC information collection. The more PLC devices connected, the longer it takes for the device platform to switch tasks, and the greater the possibility of delay in single PLC device information collection. Therefore, in most business scenarios, the data collection delay is higher, and the task-based collection software for PLC device data requires frequent maintenance, affecting the user experience.

[0052] Therefore, the present application provides a low-latency method and system for data acquisition based on a PLC device platform. The present application only sets a timer to time all data acquisition tasks. The timer is used to determine the minimum acquisition cycle of the PLC device. The start time of each data acquisition task is a multiple of the minimum acquisition cycle. When the number of platform execution cycles involved in the modulo operation is 0, the data acquisition task is executed. The present application creates data acquisition tasks concurrently, and the background is always preparing to collect data. When the foreground task is completed, the data acquisition task that meets the acquisition conditions is extracted from the background, avoiding the switching of a large number of tasks or threads, which will increase memory and performance consumption, and improve data acquisition efficiency.

[0053] like Figure 1 As shown, some embodiments of the present application provide a low-latency method for data acquisition based on a PLC device platform, the method comprising:

[0054] After receiving the data collection instruction, the basic information of the database is initialized;

[0055] Start the platform minimum collection cycle timer, and create the PLC device platform minimum data collection cycle;

[0056] Create corresponding data acquisition tasks based on each PLC device to generate multiple concurrent tasks;

[0057] Confirm whether the current task of the PLC device has been completed;

[0058] After the current task is completed, the PLC device collects data in blocks or points based on the counter in a polling manner;

[0059] After data collection is completed, the collected target data is output.

[0060] This application uses the platform minimum collection cycle timing, concurrent task creation, PLC collection point information preparation and PLC device collection tasks. At the same time, the combination of the above four methods can achieve low latency data collection after PLC device platformization.

[0061] In some embodiments, starting the platform minimum acquisition cycle timer includes:

[0062] Determine the minimum acquisition cycle of PLC devices supported by the platform;

[0063] The platform periodically starts data collection tasks according to the platform's minimum collection cycle.

[0064] The startup cycle of each data collection task is n times (n is greater than 0) the minimum collection cycle of the platform. By performing a modulo operation on the number of execution cycles of the platform, when the operation value is 0, it is determined that the collection point information of the data collection task is ready, and the data collection task is pulled from the background to the foreground for data collection. In this application, the current task is processed in the foreground, and whether the data collection preparation work is ready is confirmed in the background.

[0065] In some embodiments, creating a corresponding data acquisition task based on each PLC device to generate multiple concurrent tasks includes:

[0066] Create a data acquisition task for each PLC device;

[0067] Check whether the PLC device is executing tasks;

[0068] After the current task is completed, a new data collection task is executed.

[0069] The processing speed of the PLC device processor is slower than that of the PLC device integration platform, and it is easy to cause acquisition errors in concurrent mode.

[0070] When there are many devices on the PLC device integration platform, starting the collection task and using multiple timers or multiple threads to collect device data will cause a sudden increase in the number of timers or threads. The switching of multiple timers or threads will increase the consumption of system performance, thereby reducing the efficiency of data collection. Therefore, this application adopts a single timer method, relying on the system default optimal number of threads to create multiple concurrent tasks, and the background prepares the collection point information. When the collection conditions are met, the data collection task is executed to improve the data collection efficiency. Since this solution adopts the combination of the system default optimal number of threads and a single timer, and collects data with concurrent tasks, it avoids the problem that the switching of a large number of timers or threads will increase memory and performance consumption.

[0071] In some embodiments, after the data collection task is created, the method further includes:

[0072] Classify the data collection tasks according to the collection method and collection cycle;

[0073] After classification, data collection is performed when the collection conditions are met.

[0074] In some embodiments, collecting data when the collection conditions are met includes:

[0075] When the number of platform execution cycles participating in the modulo operation is 0, the point information and block information can participate in the execution of the data collection task.

[0076] In this application, the point information or block information has an independent counter, and the platform execution cycle number is operated modulo. When the operation value is 0, the point or block participates in data collection, and the modulus is converted from the point or block collection cycle.

[0077] The present application only sets a reference timer combined with a counter, thereby avoiding the time for switching multiple timer tasks, avoiding a surge in timers, or the phenomenon of data to be collected by a specific timer being accumulated.

[0078] In some embodiments, point information and block information may be involved in the execution of data collection tasks including:

[0079] When the addresses are continuous points or blocks, data collection is performed according to the block information;

[0080] When the address is a discontinuous point, data is collected according to the point information.

[0081] In some embodiments, after the current task is completed, the method includes:

[0082] Collect the point or block information that meets the collection conditions in the PLC device, and use polling to collect the point information and block information in the PLC device.

[0083] In some embodiments, whether the point information or block information meets the collection condition is determined by a counter in the PLC collection point information preparation module;

[0084] After the data acquisition task is completed, the existing task execution status is marked in the corresponding PLC device list.

[0085] In some embodiments, the present application also provides a low-latency data acquisition system based on a PLC device platform, wherein the system is configured as follows:

[0086] After receiving the data collection instruction, the basic information of the database is initialized;

[0087] Start the platform minimum collection cycle timer, and create the PLC device platform minimum data collection cycle;

[0088] Create corresponding data acquisition tasks based on each PLC device to generate multiple concurrent tasks;

[0089] Confirm whether the current task of the PLC device has been completed;

[0090] After the current task is completed, the PLC device collects data in blocks or points based on the counter in a polling manner;

[0091] After data collection is completed, the collected target data is output.

[0092] In some embodiments, the system includes:

[0093] The platform minimum acquisition cycle timer module is used to determine the minimum acquisition cycle of the PLC device supported by the platform;

[0094] Concurrent task creation module, used to create data acquisition tasks for each PLC device;

[0095] The PLC acquisition point information preparation module is used to provide point or block information to be collected for each corresponding PLC device.

[0096] The PLC device acquisition task module is used to collect information on points or blocks in the PLC device that meet the acquisition conditions.

[0097] The platform minimum collection cycle timer module is used to determine the minimum collection cycle of the PLC device supported by the platform. The platform will periodically start the PLC collection task according to the platform minimum collection cycle.

[0098] The concurrent task creation module uses concurrent mode to create a data collection task for each PLC device. Whether the newly created PLC task ends directly is determined by detecting whether the PLC has tasks in execution. This method can maximize the use of platform hardware resources and will not cause task backlogs. Using the data collection task mode and performing data collection through the thread pool can minimize the delay of data collection.

[0099] PLC collection point information preparation module, which provides point or block information to be collected for each corresponding PLC device. The information to be collected is formed as follows Figure 2 The timer in the PLC acquisition point information preparation module is used to record when the point or block information participates in the execution of the data acquisition task. When the number of platform execution cycles participating in the modulo operation is 0, the point and block information can participate in the execution of the acquisition task.

[0100] PLC device acquisition task module, this PLC device acquisition task collects information on points or blocks in the PLC device that meet the acquisition conditions, and uses polling to collect point information and block information in the PLC device. Whether the point information or block information meets the acquisition conditions is determined by the counter in the PLC acquisition point information preparation module. After the data acquisition task is executed, the existing task execution status is marked in the corresponding PLC device list.

[0101] It can be seen from the above embodiments that the present application provides a low-latency method and system for data acquisition based on a PLC device platform, the method including initializing the basic information of the database after receiving the data acquisition instruction; starting the platform minimum acquisition cycle timer, and creating the minimum data acquisition cycle of the PLC device platform; generating multiple concurrent tasks based on the corresponding acquisition task created for each PLC device; confirming whether the current task of the PLC device has been completed; after the current task is completed, the PLC device performs data acquisition in blocks or points based on the counter in a polling manner; after the data acquisition is completed, the collected target data is output. The present application only sets one timer to time all data acquisition tasks, and the timer is used to determine the minimum acquisition cycle of the PLC device. The start time of each data acquisition task is a multiple of the minimum acquisition cycle. When the number of platform execution cycles participating in the modulo operation is 0, the data acquisition task is executed. This application creates data collection tasks concurrently, and the background is always preparing to collect data. When the foreground task is completed, the data collection task that meets the collection conditions is extracted from the background to avoid switching of a large number of tasks or threads that will increase memory and performance consumption, thereby improving data collection efficiency. This application can maximize the use of computer resources by periodically starting collection tasks. Compared with the timer-based PLC data collection method, the data collection delay is lower in most business scenarios, and the task-based PLC device data collection software is more maintainable.

[0102] Similar parts between the embodiments provided in this application can be referenced to each other. The specific implementation methods provided above are only a few examples under the general concept of this application and do not constitute a limitation on the protection scope of this application. For those skilled in the art, any other implementation methods expanded based on the scheme of this application without creative work belong to the protection scope of this application.

Claims

1. A low-latency data acquisition method based on PLC equipment platform, characterized in that: The method comprises: After receiving the data collection instruction, the basic information of the database is initialized; Start the platform minimum collection cycle timer, and create the PLC device platform minimum data collection cycle; Create corresponding data acquisition tasks based on each PLC device to generate multiple concurrent tasks; Confirm whether the current task of the PLC device has been completed; After the current task is completed, the PLC device collects data in blocks or points based on the counter in a polling manner; After data collection is completed, the collected target data is output.

2. The low-latency method for data acquisition based on a PLC device platform according to claim 1 is characterized in that: Starting the platform minimum collection cycle timer includes: Determine the minimum acquisition cycle of PLC devices supported by the platform; The platform periodically starts data collection tasks according to the platform's minimum collection cycle.

3. The low-latency method for data acquisition based on a PLC device platform according to claim 1 is characterized in that: Create corresponding data acquisition tasks for each PLC device to generate multiple concurrent tasks including: Create a data acquisition task for each PLC device; Check whether the PLC device is executing tasks; After the current task is completed, a new data collection task is executed.

4. The low-latency method for data acquisition based on a PLC device platform according to claim 3 is characterized in that: After the data collection task is created, the following steps are also included: Classify the data collection tasks according to the collection method and collection cycle; After classification, data collection is performed when the collection conditions are met.

5. The low-latency method for data acquisition based on a PLC device platform according to claim 4 is characterized in that: Data collection when the collection conditions are met includes: When the number of platform execution cycles participating in the modulo operation is 0, the point information and block information participate in the execution of the data collection task.

6. The low-latency method for data acquisition based on a PLC device platform according to claim 5 is characterized in that: Point information and block information participate in the execution of data collection tasks including: When the addresses are continuous points or blocks, data collection is performed according to the block information; When the address is a discontinuous point, data is collected according to the point information.

7. The low-latency method for data acquisition based on a PLC device platform according to claim 1 is characterized in that: After the current task is completed, it includes: Collect the point or block information that meets the collection conditions in the PLC device, and use polling to collect the point information and block information in the PLC device.

8. The low-latency method for data acquisition based on a PLC device platform according to claim 1 is characterized in that: The method further comprises: Whether the point information or block information meets the collection conditions is determined by the counter in the PLC collection point information preparation module; After the data acquisition task is completed, the existing task execution status is marked in the corresponding PLC device list.

9. A low-latency data acquisition system based on a PLC device platform, characterized in that: The system is configured to: After receiving the data collection instruction, the basic information of the database is initialized; Start the platform minimum collection cycle timer, and create the PLC device platform minimum data collection cycle; Create corresponding data acquisition tasks based on each PLC device to generate multiple concurrent tasks; Confirm whether the current task of the PLC device has been completed; After the current task is completed, the PLC device collects data in blocks or points based on the counter in a polling manner; After data collection is completed, the collected target data is output.

10. The low-latency data acquisition system based on PLC equipment platform according to claim 9 is characterized in that: The system comprises: The platform minimum acquisition cycle timer module is used to determine the minimum acquisition cycle of the PLC device supported by the platform; Concurrent task creation module, used to create data collection tasks for each PLC device; A PLC acquisition point information preparation module is used to provide point or block information to be collected for each corresponding PLC device; The PLC device acquisition task module is used to collect information on points or blocks in the PLC device that meet the acquisition conditions.