Efficient PLC process data high-speed acquisition method

By constructing a data acquisition method for array queues and time variables in PLC, combined with the collaborative processing of industrial gateways and fog computing nodes, the real-time and stability problems of PLC data acquisition are solved, and continuous data recording and real-time monitoring are realized at 10ms intervals are realized, which improves the stability and data integrity of industrial production.

CN120295210APending Publication Date: 2025-07-11GUANGZHOU SYC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510402414.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The existing PLC data acquisition methods have problems such as insufficient communication stability, poor real-time performance and low data processing efficiency in industrial environments, which are difficult to meet the needs of high-frequency response and real-time monitoring, especially in complex industrial systems such as metal smelting, which affects the stability and data integrity of the production process.

Method used

By creating two array queues and time variables in the PLC, using timers to realize 10ms interval data storage and acquisition, combining industrial gateways and fog computing nodes for data screening and abnormal detection, using machine learning algorithms for real-time quality evaluation, and implementing adaptive communication strategies and data encryption processing in the host computer to ensure the real-time and integrity of the data.

Benefits of technology

It realizes continuous data recording and real-time monitoring at 10ms intervals, improves data processing efficiency and system stability, ensures data integrity and reliability, and supports refined management and optimization control of the production process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295210A_ABST
    Figure CN120295210A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient PLC process data high-speed acquisition method, and belongs to the field of industrial automation control. Aiming at the problems of insufficient stability, poor real-time performance, low processing efficiency and the like of the existing PLC data acquisition communication, an array queue and a time variable are created in the PLC, a data transmission structure is improved, a data acquisition subprogram is arranged in a high-speed operation cycle program block, and 10ms interval data acquisition is realized by matching with a 10ms timer. Edge equipment and fog computing are utilized to cooperate, a machine learning algorithm is introduced to evaluate data quality, and an upper computer adopts a self-adaptive communication strategy to encrypt key data. In the implementation process, a Siemens 1500 series PLC is selected and matched with TIA Portal software and CMS upper computer software, and through the steps of hardware and software preparation, PLC configuration, upper computer software CMS configuration and the like, 10 ms data high-speed collection is achieved, data processing efficiency is improved, real-time performance is enhanced, data integrity is guaranteed, and powerful support is provided for industrial automatic production.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial automation control, and particularly to an efficient method for high-speed acquisition of PLC process data. Background Art

[0002] As the core of industrial automation control systems, PLCs are widely used in the control and monitoring of various production processes. One of its important functions is to collect the operating data of on-site devices, such as temperature, pressure, speed, etc., for real-time monitoring, fault diagnosis, and optimization control, and can quickly and accurately process sensor and external device signals. With the development of Internet of Things (IoT) technology and the rise of edge computing and cloud computing, in the discrete control industry, more and more enterprises upload PLC data to the cloud for analysis and optimization, and the requirements for PLC data acquisition frequency and real-time performance are increasing day by day.

[0003] The data acquisition of the PLC by the supervisory control and data acquisition (SCADA) system depends on protocols based on Ethernet communication, such as Modbus TCP, OPC UA, EtherNet / IP, Siemens S7Comm, etc., and serial communication protocols such as Profibus, Modbus-RTU / ASCII, etc. However, these protocols have many limitations in the current data acquisition method:

[0004] Insufficient communication stability: Factors such as electromagnetic interference and noise in the industrial environment affect communication stability and easily cause data transmission interruption or errors. For example, in the metal smelting environment with high temperature and strong magnetic field, the communication between the communication and monitoring systems is interfered, resulting in unstable and reliable data acquisition.

[0005] Poor real-time performance: The data transmission rate of the communication protocol itself is limited, and it cannot meet the requirements of high-frequency data response in terms of communication delay, etc. Currently, the general acquisition cycle of the SCADA system is 500 ms, while in some production scenarios such as flow monitoring and pressure monitoring in metal smelting, it is necessary to continuously obtain data interval records with a 10 ms interval to monitor in real time and analyze process parameters based on the real-time data curve. The existing SCADA software cannot meet the high-speed data acquisition requirements within 10 ms.

[0006] Low data processing efficiency: In an industrial automation system, the PLC needs to collect and process a large amount of data. The existing acquisition is usually batch processing. When all data is transmitted to the SCADA system, it needs to be collected one by one according to the process data unit, increasing communication delay, causing network congestion, and reducing the efficiency of the entire system, and unable to quickly respond to the real-time changes of on-site devices. Summary of the Invention

[0007] The object of the present invention is to provide an efficient high-speed acquisition method for PLC process data, which significantly improves the real-time performance of data acquisition, realizes data recording at intervals of 10 ms, and comprehensively enhances the data processing capacity of the system, providing a solid guarantee for the efficient operation of industrial automation production. To overcome the problems in the prior art that in complex industrial systems such as metal smelting and other automatic control production lines, key data such as temperature, flow rate, and pressure involved in the production process play a decisive role in real-time monitoring of process parameters, optimizing the production process, and improving product quality. At present, when the PLC communicates with the host computer, the conventional data acquisition method is that the host computer batch-scans the process data unit and reads it cyclically. In this way, important data and ordinary data are collected mixedly. When the number of communication data variables is large, it is very easy to cause adverse phenomena such as slow acquisition speed and data loss, and it is difficult to meet the strict requirements of real-time data acquisition and other problems.

[0008] The present invention is achieved through the following technical solutions:

[0009] An efficient high-speed acquisition method for PLC process data, comprising the following steps:

[0010] Step S1: Create 2 array queues and 2 groups of time variables in the PLC, store the process data in the array queues, set the queue length to 100, and define them as queue 1 and queue 2 respectively; place the data acquisition subroutine in the program block of the PLC high-speed operation cycle, set the scanning time of this high-speed cycle program to 5 ms, create a 10 ms timer in the subroutine, and use the rising edge of the timer to periodically trigger and write the current data into the queue, so that the queue data interval is 10 ms; use the data acquisition software to take values in the 2 queues in the order of queue 1 - queue 2 - queue 1 - queue 2 -..., with an acquisition interval of 1 second. After the data acquisition software acquires the data, according to the start acquisition time and the end acquisition time, mark the data in the time series database at intervals of 10 ms, combine, splice, and sort them, and display them in the trend chart control through the data parsing function of the host computer;

[0011] Step S2: The PLC fills the data into queue 1 in sequence. When filling the first data, record the start recording time. When reaching the maximum capacity of the queue, record the end time. Then fill it into queue 2. After queue 2 is full, continue to fill queue 1 and overwrite the previous data and clear the length of queue 1 to 0, and cycle in turn; the host computer software alternately acquires queue 1 and queue 2 within the set maximum interval time of 1 second, and automatically eliminates duplicate data using the data screening function integrated in the software;

[0012] Step S3: Deploy an industrial gateway with sufficient computing power and storage resources near the PLC. Install data acquisition software in the gateway to perform preliminary screening, aggregation, and anomaly detection on the 10ms data transmitted from the PLC. Deploy fog computing nodes in the local network for data aggregation and distribution, and collaborative processing. When the edge device detects an abnormal trend, send a warning signal to the PLC and the host computer through the fog computing node.

[0013] Step S4: Package the machine learning algorithm into an FB function block. Use this algorithm to calculate the moving average using a fixed-size memory area, and determine whether it is abnormal based on the deviation between the new value and the moving average. During the data acquisition process, use this algorithm to perform real-time quality assessment on the acquired data, and determine whether the data meets the preset normal range. If the data exceeds the normal range, mark and record it.

[0014] Step S5: The host computer ensures a high-speed acquisition rate for real-time data packets. For non-critical ordinary data, automatically adjust the data transmission rate or data frame size according to factors such as the real-time network signal strength.

[0015] Step S6: Encrypt the key process data during the high-speed data acquisition process.

[0016] Further, as an improvement to the technical solution of the present invention, the PLC is a Siemens 1500 series PLC, and the following configurations are performed through the TIAPortal software: Open the TIA Portal to create a project, add an S7-1500 PLC device and name it, configure the network so that the PLC and the host computer are in the same network; Add a data type named "DataC" in the PLC data type, and its elements include 2 sub-structures, each sub-structure has a start recording time, an end recording time, and an array of process data; Add a global DB type data block DB503 in the program block, cancel the "optimized block access" option, and define the data packet variables for interaction with the host computer; Set the PLC security access level to "complete", and allow PUT / GET communication access from remote partners; Add an OB organization block as a cyclic interrupt, set the cycle time to 5ms, create a subroutine to write a 10ms timer for data recording, and call the subroutine in the cyclic interrupt OB organization block to achieve 10ms high-speed data acquisition.

[0017] Further, as an improvement to the technical solution of the present invention, the host computer is the CMS host computer software, and the configuration steps are as follows: Install the CMS software and the database MySQL and configure the IP address for communication with the PLC; Create an external device, that is, the PLC, in the variable management, and configure the variables in the data block into the CMS according to the data block DB503 in the PLC; Configure the polling acquisition task, with a maximum cycle of no more than 1 second; Start the PLC program and use the monitoring function of the CMS to view the data transmission situation.

[0018] Further as an improvement of the technical solution of the present invention, the data acquisition software is SIOT, which is used to obtain values in two array queues created by the PLC in a specific order, and to perform preliminary processing on the data transmitted by the PLC in the industrial gateway.

[0019] Further as an improvement of the technical solution of the present invention, the encryption processing of the key process data adopts the AES encryption algorithm, and the encryption key is dynamically generated and updated through the key management system to ensure the security and confidentiality of the data during the transmission process.

[0020] Further as an improvement of the technical solution of the present invention, before the machine learning algorithm is used, it is trained with historical production data, and the algorithm parameters are adjusted during the training process to enable the algorithm to accurately adapt to the actual situation of the production process and equipment operation, so as to improve the accuracy of abnormal data judgment.

[0021] Further as an improvement of the technical solution of the present invention, the data transmission between the fog computing node and the industrial gateway adopts the MQTT protocol, which has the characteristics of lightweight, low power consumption, message publishing / subscribing mode, etc., and can effectively reduce the data transmission delay and ensure the stability and reliability of data transmission.

[0022] Further as an improvement of the technical solution of the present invention, the time series database adopts InfluxDB, which is optimized for time series data storage, supports high write and query rates, and is used to efficiently store and manage the data marked at 10ms intervals, facilitating subsequent data query and analysis.

[0023] Further as an improvement of the technical solution of the present invention, the data communication between the PLC and the upper computer adopts a redundant network architecture. When the main network fails, the standby network automatically switches to ensure the continuity of data communication and avoid data transmission interruption caused by network failures.

[0024] Further as an improvement of the technical solution of the present invention, when the data acquisition software collects data, it performs real-time verification on the collected data, ensures the accuracy of the data through the CRC verification algorithm, and if the verification fails, the data is collected again.

[0025] In summary, the present invention has the following beneficial effects:

[0026] Improve data processing efficiency: Integrate edge devices and fog computing, reduce the computing burden of the upper computer, improve data processing efficiency, can continuously collect high-speed data at 10ms, can quickly respond to the real-time changes of on-site devices, realize refined management and optimized control of the production process, and provide ideas for the upper computer to achieve high-speed acquisition of PLC data.

[0027] Enhance the real-time performance of the system: Release the communication resources of the host computer system, be able to obtain the latest status information of on-site devices in a timely manner, realize the real-time monitoring and control of the production process by the host computer, reduce production risks, and improve the stability and reliability of the system.

[0028] Ensure data integrity and reliability: The data caching and synchronization mechanism ensures the integrity of key data, avoids data loss caused by communication problems, improves the reliability of data collection, and provides accurate data support for subsequent data analysis and decision-making. Brief Description of the Drawings

[0029] By reading the following detailed description of the non-restrictive embodiments with reference to the accompanying drawings, other features, objects, and advantages of the present invention will become more apparent:

[0030] Figure 1 It is the data structure diagram of the embodiment of the present invention;

[0031] Figure 2 It is the data record schematic diagram of the embodiment of the present invention;

[0032] Figure 3 It is the data transmission flow chart of the embodiment of the present invention;

[0033] Figure 4 It is the data sorting diagram of the embodiment of the present invention;

[0034] Figure 5 It is the data splicing schematic diagram of the embodiment of the present invention;

[0035] Figure 6 It is the schematic diagram of the adaptive communication strategy of the embodiment of the present invention. Detailed Embodiments

[0036] To make the objectives, features, and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are described clearly and completely. Obviously, the embodiments described below are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0037] Refer to Figures 1 to 6 , An efficient method for high-speed acquisition of PLC process data, including the following steps:

[0038] Innovative data transmission architecture: Inside the PLC, two array queues and two sets of precise time variables are carefully constructed, namely the start collection time of the queue data and the end collection time of the queue data. Process data will be stored in the array queues in an orderly manner. The length of each queue is set to 100, and they are respectively marked as Queue 1 and Queue 2. The data collection subroutine is cleverly embedded in the program block of the PLC's high-speed operation cycle, and the scan time of this high-speed cycle program is precisely set to 5 ms. In the subroutine, a 10-ms timer is innovatively created. By means of the rising edge of this timer, the data writing operation is periodically triggered, thereby ensuring that the data in the queue is stored at intervals of 10 ms in sequence. In this way, a queue with a length of 100 can completely store 100 data with an interval of 10 ms. Subsequently, using professional data collection software, data retrieval operations are carried out in the two queues in a specific order of Queue 1 - Queue 2 - Queue 1 - Queue 2 -..., and the retrieval interval is set to 1 second each time. This method can not only fully meet the requirements of the performance of the conventional collection cycle, but also greatly reduce the communication burden, significantly improve the data processing efficiency, effectively relieve the network congestion situation, and further enhance the real-time performance of data collection. After the collection software successfully collects the data, it uses an advanced continuous process data parsing function. According to the pre-recorded start collection time and end collection time, the data is accurately marked in the time series database at intervals of 10 ms. After rigorous combination, splicing, and sorting processes, the continuous recording of 10-ms data is finally achieved. Through the data parsing function of the host computer (specifically referring to the CMS host computer software developed by SYC Company here), these data are visually displayed in the trend graph control, providing users with clear and intuitive data visualization effects.

[0039] Optimize data acquisition mechanism: The data structure designed by the present invention includes 2 queues. The PLC first methodically fills the data into queue 1 in sequence. At the moment of filling the first data, the current time is immediately recorded as the start recording time. When queue 1 reaches the maximum capacity (i.e., the queue length is 100), the current time is accurately recorded again as the end time of recording. Then, the data is filled into queue 2. Similarly, when the first data is filled and the maximum capacity is reached, the start collection time and the end collection time are recorded respectively. When queue 2 is also full, it continues to return to queue 1 for data filling. At this time, the data stored last time will be overwritten, and the length of queue 1 will be cleared, and so on. The CMS software intelligently alternates the data in queue 1 and queue 2 within the set maximum interval time of 1 second. When the communication efficiency is high, the CMS software may record duplicate data. However, through the efficient data screening function integrated in the software, these duplicate data can be automatically and accurately eliminated. This carefully designed data acquisition mechanism can ensure the continuous collection of data, effectively guarantee the continuity of production process data and the traceability of 10ms data, and provide a reliable data basis for subsequent data analysis and decision-making.

[0040] Deploy edge devices and fog computing collaborative system: Deploy industrial gateways with powerful computing power and sufficient storage resources in ideal locations close to PLCs. SIOT, SYC's data acquisition software, was successfully installed in the gateway to perform preliminary screening, efficient aggregation, and accurate anomaly detection on the 10ms data collected from PLCs. At the same time, fog computing nodes are reasonably deployed in the local network to be responsible for data aggregation and distribution to achieve collaborative processing. This collaborative mode can significantly reduce data transmission delays and effectively reduce network bandwidth usage. When edge devices detect abnormal trends, they can immediately send early warning signals to the host computer and PLC through fog computing nodes so that corresponding measures can be taken in time to ensure the safe and stable operation of the production process.

[0041] Introducing artificial intelligence and machine learning intelligent algorithms: The carefully selected machine learning algorithms are cleverly encapsulated into FB function blocks. The algorithm relies on a fixed-size memory area to accurately calculate the moving average value and intelligently judge whether the data is abnormal based on the deviation between the new value and the moving average value. In the entire process of data collection, this simple and efficient machine learning algorithm is fully utilized to conduct real-time quality assessment of the collected data. Determine whether the data meets the normal range preset based on the actual production process and equipment operation. Once the data is found to be out of the normal range, it is very likely that an abnormality has occurred in the actual production process. At this time, the system will automatically mark the data and record it in detail, providing a valuable reference for subsequent in-depth fault diagnosis and process optimization.

[0042] Research and Development of Host Computer Adaptive Communication Strategy: For the acquisition of real-time data packets, the host computer must ensure a high-speed acquisition rate to ensure the real-time and accuracy of data and meet the immediate needs of key data in the production process. For other non-critical ordinary data, the host computer can intelligently and automatically adjust the data transmission rate or data frame size according to simple and easily obtainable factors such as the real-time network signal strength. Through this adaptive adjustment strategy, stable and reliable data transmission can be achieved in different network environments, effectively avoiding data loss caused by communication problems and ensuring the stable operation of the entire data acquisition system.

[0043] Strengthen Data Security and Protection System: During the process of high-speed data acquisition, in order to effectively prevent data from being maliciously stolen or tampered with during transmission, the present invention particularly performs encryption processing on key process data. Advanced encryption algorithms are used to encrypt and protect the data to ensure the authenticity and integrity of the collected data, provide a solid and reliable guarantee for subsequent data use, eliminate data security risks, and maintain the security and stability of industrial production data.

[0044] Through the above solutions, the present invention can achieve the following beneficial effects:

[0045] Improve Data Processing Efficiency: Integrating edge devices and fog computing, reducing the computing burden on the host computer, improving data processing efficiency, enabling continuous acquisition of 10ms high-speed data, quickly responding to real-time changes in on-site devices, realizing refined management and optimized control of the production process, and providing ideas for the host computer to achieve high-speed acquisition of PLC data.

[0046] Enhance System Real-time Performance: Release the communication resources of the host computer system, be able to obtain the latest status information of on-site devices in a timely manner, realize real-time monitoring and control of the production process by the host computer, reduce production risks, and improve the stability and reliability of the system.

[0047] Guarantee Data Integrity and Reliability: The data caching and synchronization mechanism ensures the integrity of key data, avoids data loss caused by communication problems, improves the reliability of data acquisition, and provides accurate data support for subsequent data analysis and decision-making.

[0048] Embodiment:

[0049] Use Siemens 1500 series PLC, create a data acquisition subroutine in the PLC, and perform data acquisition through the host computer software CMS to realize continuous transmission of PLC data to CMS at 10ms intervals. The specific implementation steps are as follows:

[0050] Hardware and Software Preparation

[0051] In terms of hardware:

[0052] Select the Siemens S7-1500 PLC as the core control device. It has powerful computing capabilities and rich communication interfaces, capable of meeting the performance requirements of high-speed data acquisition. At the same time, prepare a computer with stable performance for running relevant software and implementing the upper computer function. The computer configuration should meet the operating requirements of the TIA Portal software and the CMS upper computer software.

[0053] Ensure that the connection cables of all hardware devices are intact and comply with industrial standards. For example, for the network cable connecting the PLC and the computer, select a reliable Cat5e or Cat6 network cable to ensure the stability of data transmission.

[0054] In terms of software:

[0055] Install the TIA Portal software, which is the main tool for Siemens PLC programming and configuration. During the installation process, strictly follow the prompts of the software installation wizard. Pay attention to selecting the software version that matches the PLC model. After installation, perform necessary software activation and authorization operations to ensure that the software can be used normally.

[0056] Install the CMS upper computer software developed by SYC Company and the supporting MySQL database. When installing the CMS software, also follow the guidance of the installation wizard and set the appropriate installation path. When installing the MySQL database, pay attention to configuring parameters such as the character set and port number of the database. It is recommended to use the default character set UTF-8 and set the port number to 3306 (if this port is not occupied) to ensure compatibility with the CMS software. After installation, conduct joint debugging of the CMS software and the MySQL database to ensure that they can communicate and store data normally.

[0057] PLC Configuration

[0058] Create a project:

[0059] Open the TIA Portal software and click the "New Project" button in the main interface of the software. In the popped-up project creation dialog box, enter a project name with clear identification, such as "PLC_10ms_Data_Acquisition", to facilitate subsequent project management and identification. At the same time, select a suitable project file storage path. It is recommended to store it in a location with sufficient disk space and easy access, such as a folder specifically set up for industrial projects. After completing the settings, click the "OK" button to complete the project creation.

[0060] Add a PLC device:

[0061] Enter the device configuration interface, find the S7-1500 PLC device series in the hardware directory, and select the specific model 6ES7517-3AP00-0AB0. This model of PLC is highly compatible with the data acquisition requirements of the present invention in terms of performance and functions. After selecting the device, add it to the project and name the device "CPU1500". This naming should be concise and unique to facilitate device identification and management in the project.

[0062] Configure the network:

[0063] In the network configuration interface, create a new subnet. Set the IP address of the PLC to 192.168.1.31 and the subnet mask to 255.255.255.0. At the same time, ensure that the IP address of the host computer (the computer running the CMS software) is in the same network segment as the PLC. For example, it can be set to 192.168.1.40. During the process of setting the IP address, pay attention to avoiding IP address conflicts. You can check the used IP addresses in the current network through a network scanning tool. After the settings are completed, conduct a network connectivity test. You can use the ping command and enter "ping 192.168.1.31" in the command prompt window of the computer. If a response from the PLC can be received, it indicates that the network connection is normal.

[0064] Add data structures:

[0065] In the "PLC Data Types" folder under the CPU1500 device, add a new data type. Name this type "DataC", and its elements contain 2 sub-structures. Each sub-structure defines the start recording time, the end recording time, and the process data array respectively. The data types of the start recording time and the end recording time are selected as the system default time format, such as the DATE_AND_TIME type; the data type of the process data array is defined according to the actual data types to be collected. For example, if analog data such as temperature and pressure are to be collected, a REAL type array can be selected. The length of the array is determined according to actual needs, but it needs to match parameters such as the subsequent queue length to ensure the consistency of data storage and processing.

[0066] Create a data block for communication with the host computer:

[0067] In the program block under the CPU1500 device, add a new data block (DB block). When creating the DB block, select the global DB for the type and set the number to 503. The selection of the number should avoid conflicts with the numbers of existing DB blocks in the project. After creation, right-click on DB503 in the program block and select "Properties" in the pop-up dialog box. In the property settings, uncheck the "Optimized block access" option. This operation is to ensure that the host computer software CMS can access the variables in this data block in a traditional way and improve the compatibility of data interaction. Open the DB503 data block and define the data packet variables for interaction with CMS according to the previously defined "DataC" data type. Select "Data1" for the data type to complete the definition of the data interface for communication between the PLC and the host computer CMS. The CMS software will subsequently collect data packets from the data block DB503.

[0068] Set PLC security:

[0069] Right-click on the device name "CPU1500" and select "Properties". In the pop-up property window, switch to the "Protection" tab. In the "Access level" setting, select "Full", which will grant the highest access rights to the device. At the same time, check the "Allow PUT / GET communication access from remote partners (PLC\HMI\OPC...)" to ensure that remote devices such as the host computer can perform data interaction with the PLC through the standard communication protocol. After setting, save and close the property window.

[0070] Write a program:

[0071] Add a new OB organization block (OB30) to the program block of the PLC. In the selection of the organization block type, specify it as a cyclic interrupt type and set the cyclic time to 5 ms. This setting is to ensure that the data acquisition subroutine can be triggered and executed at 10 ms intervals to meet the time accuracy requirements for data acquisition.

[0072] Create a subroutine and write a 10 ms timer in the subroutine. The timer can be implemented by calling the timer instruction inside the PLC and setting the timing time of the timer to 10 ms. When the timer is triggered, perform a data recording operation and write the currently acquired data into a pre-defined queue. When writing the data recording program, pay attention to the storage order of the data and the index management of the queue to ensure that the data is accurately stored in the corresponding queue position.

[0073] Call the above-written subroutine in the cyclic interrupt OB30 to achieve the 10ms high-speed data acquisition function in this way. After the program is written, conduct a comprehensive syntax check and logic test. You can use the simulation function built in the TIA Portal software to simulate the operating environment of the PLC, check the execution of the program under different conditions, and ensure the correctness and stability of the program.

[0074] Configuration of the host computer software CMS

[0075] Installation and network configuration:

[0076] Install the CMS host computer software into the computer according to the CMS software installation guide. After the installation is completed, open the CMS software. In the network configuration interface of the software, set the IP address to 192.168.1.40 to ensure that it is in the same network segment as the PLC's IP address and ensure that the two can communicate normally. At the same time, configure the connection parameters between the CMS software and the MySQL database, including the database server address (usually the local computer IP address 127.0.0.1), port number (3306), database name, username, and password, etc., to ensure that the CMS software can correctly connect to the MySQL database for data storage and reading operations.

[0077] Variable management configuration:

[0078] In the variable management module of the CMS software, create an external device and select Siemens as the device type. During the device configuration process, according to the data block DB503 created in the PLC, configure the variables in the data block into the CMS software one by one. When configuring variables, it is necessary to ensure that the parameters such as variable name, data type, and address are exactly the same as the settings in the PLC to ensure the accurate mapping and interaction of data. For example, for the process data array variable in DB503, a variable with the same data type and array length should be created in the CMS software.

[0079] Polling acquisition task configuration:

[0080] In the task configuration interface of the CMS software, configure the polling acquisition task. Set the maximum acquisition period not to exceed 1 second, and the specific period can be fine-tuned according to the actual production environment and data update frequency requirements. When setting the acquisition task, it is also necessary to specify the data source for acquisition, that is, the variable corresponding to the PLC configured in the variable management before. At the same time, parameters such as the priority and timeout of the task can be set to optimize the execution efficiency and stability of the acquisition task.

[0081] System debugging and verification:

[0082] After completing all the above configurations, start the PLC program to ensure that the PLC is in a normal operating state. At the same time, start the CMS host computer software and observe the data reception in the software interface. Use the monitoring function of the CMS software to view in real time whether the data sent from the PLC is transmitted at the expected 10-ms interval and whether the data content is accurate. During the debugging process, if data transmission anomalies are found, troubleshoot and resolve them by checking aspects such as network connections, PLC program logic, and CMS software configurations. For example, if data is lost or severely delayed, check whether the network bandwidth is insufficient or whether there is network interference; if the data content is incorrect, check whether the variable configurations are correct and whether there are loopholes in the data acquisition and processing logic in the PLC program. Through repeated debugging and verification, ensure that the entire system can stably and efficiently achieve high-speed 10-ms data acquisition of the PLC and accurately transmit the data to the CMS host computer software.

[0083] Through the above detailed and optimized steps, not only can high-speed 10-ms data acquisition of the PLC be achieved and the data be transmitted to the CMS host computer software, but also for high-speed data acquisition between other brands of PLCs and host computers, based on understanding the core principle of the present invention, similar implementation ideas can be referred to for specific implementation. Only appropriate adjustments need to be made to parts such as hardware connections, software configurations, and program writing according to the characteristics and communication protocols of different brands of PLCs.

[0084] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0085] Excellent improvement in data processing efficiency: Through an innovative data transmission architecture, combined with the edge device and fog computing cooperation system, the data processing tasks originally concentrated on the host computer are reasonably dispersed. The industrial gateway and fog computing nodes share the work of preliminary data screening, aggregation, and anomaly detection, greatly reducing the computing load of the host computer. This distributed processing mode significantly improves the data processing efficiency, enabling the system to smoothly and continuously collect high-speed data at 10-ms intervals. Facing the massive data generated by the real-time changes of on-site equipment, it can quickly respond and process, providing strong support for the refined management of the production process. Production managers can accurately adjust production process parameters based on this accurate and timely data to achieve in-depth optimization of the production process, thereby improving product quality and production efficiency. For example, in the metal smelting process, the smelting parameters can be accurately adjusted according to the real-time collected data such as temperature, flow rate, and pressure to improve the metal purity and product qualification rate.

[0086] Significantly enhance the system's real-time performance: The unique data acquisition subroutine and timer mechanism built inside the PLC, along with the host computer's adaptive communication strategy, ensure the rapid transmission and reception of data. The high-speed data acquisition interval of 10 ms enables the host computer to obtain the latest status information of on-site devices almost in real time. This is of great significance for the real-time monitoring and control of the production process. Production operators can promptly detect abnormal situations during equipment operation and quickly take corresponding measures. Taking chemical production as an example, when abnormal fluctuations in pressure or flow occur, the host computer can detect and issue an alarm within an extremely short time. Operators can promptly adjust the production process to avoid safety accidents caused by the continuous development of abnormal situations, reduce production risks, greatly improve the stability and reliability of the system, and ensure the safe and efficient operation of the production process.

[0087] Fully guarantee data integrity and reliability: The carefully designed data caching and synchronization mechanism, such as the data storage and replacement methods of the two queues in the PLC, combined with the data screening function of the CMS software, effectively avoids data loss caused by communication problems. In a complex industrial environment, communication interference occurs frequently, and the mechanism of the present invention ensures the integrity of key data. At the same time, key process data is encrypted using advanced encryption algorithms to prevent data from being stolen or tampered with during transmission, ensuring the authenticity of the data. This provides an accurate and reliable data basis for subsequent data analysis and decision-making. Enterprises can make more scientific and reasonable plans based on these high-quality data, avoid decision-making mistakes caused by data errors or omissions, and enhance the competitiveness and economic benefits of the enterprise.

[0088] Powerful network adaptability and stability: The host computer's adaptive communication strategy intelligently adjusts the transmission rate or data frame size of non-critical ordinary data according to factors such as real-time network signal strength. When the network condition is poor, it gives priority to ensuring the high-speed acquisition of key real-time data packets to ensure that the production process is not affected. This strategy effectively avoids data loss or transmission interruption caused by network fluctuations, enabling the system to operate stably in different network environments. Whether inside an industrial plant with complex network signals or in a remote data transmission scenario, it can ensure the reliability of the data acquisition system and guarantee the continuity of industrial production.

[0089] Efficient anomaly monitoring and early warning capabilities: The introduced artificial intelligence and machine learning intelligent algorithms perform real-time quality assessment and anomaly judgment on the collected data. Based on the normal range preset according to the actual production process and equipment operation conditions, the algorithm can keenly detect abnormal fluctuations in the data. Once an anomaly is detected, the system immediately marks and records the data, and at the same time, through the collaborative system composed of edge devices and fog computing nodes, quickly sends warning signals to the host computer and PLC. This enables enterprises to discover problems in the early stage when anomalies occur in the production process, take targeted measures to handle them, avoid small problems from evolving into serious faults, reduce equipment maintenance costs, increase the service life of equipment, and ensure the continuity and stability of production.

[0090] Flexible system scalability and compatibility: The technical solutions adopted in the present invention, such as the deployment of edge devices and fog computing nodes, the application of the data acquisition software SIOT, and the collaboration with the host computer CMS software, have good scalability and compatibility. As the production scale of the enterprise expands or technology is upgraded, it is convenient to add devices such as industrial gateways and fog computing nodes to expand the data processing and acquisition capabilities of the system. At the same time, this solution can be effectively integrated with PLCs and other industrial automation devices of different brands and models, adapting to diverse industrial production scenarios, and providing a flexible and reliable solution for the intelligent upgrading and transformation of enterprises.

[0091] The above has introduced in detail the technical solutions provided by the embodiments of the present invention. Specific examples are used in this article to elaborate on the principles and implementation manners of the embodiments of the present invention. The descriptions of the above embodiments are only applicable to helping understand the principles of the embodiments of the present invention; at the same time, for those of ordinary skill in the art, according to the embodiments of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. An efficient high-speed acquisition method for PLC process data, characterized in that It includes the following steps: Step S1: Create two array queues and two groups of time variables in the PLC, store the process data in the array queues, set the queue length to 100, and define them as Queue 1 and Queue 2 respectively; Place the data acquisition subroutine in the program block of the PLC high-speed operation cycle, set the scanning time of this high-speed cycle program to 5 ms, create a 10-ms timer in the subroutine, and use the rising edge of the timer to periodically trigger and write the current data into the queue, so that the queue data interval is 10 ms; Use the data acquisition software to obtain values in the two queues in the order of Queue 1 - Queue 2 - Queue 1 - Queue 2 -..., with an acquisition interval of 1 second. After the acquisition software acquires the data, according to the start acquisition time and the end acquisition time, mark the data in the time series database at 10-ms intervals, combine, splice, sort, and display it in the trend graph control through the host computer data parsing function; Step S2: The PLC fills the data into Queue 1 in sequence. When filling the first data, record the start recording time. When reaching the maximum capacity of the queue, record the end time. Then fill it into Queue 2. After Queue 2 is full, continue to fill Queue 1 and overwrite the previous data, and clear the length of Queue 1 to 0, and cycle in turn; The host computer software alternately acquires Queue 1 and Queue 2 within the set maximum interval time of 1 second, and uses the data screening function integrated in the software to automatically eliminate duplicate data; Step S3: Deploy an industrial gateway with sufficient computing power and storage resources near the PLC, install the data acquisition software in the gateway, and perform preliminary screening, aggregation, and anomaly detection on the 10-ms data transmitted from the PLC; Deploy fog computing nodes in the local network for data aggregation and data distribution, and cooperate for processing; When the edge device detects an abnormal trend, send a warning signal to the PLC and the host computer through the fog computing node; Step S4: Package the machine learning algorithm into an FB function block, and use this algorithm to calculate the moving average using a fixed-size memory area, and judge whether it is abnormal based on the deviation between the new value and the moving average; During the data acquisition process, use this algorithm to perform real-time quality assessment on the acquired data, judge whether the data meets the preset normal range, and mark and record it if the data exceeds the normal range; Step S5: The host computer ensures a high-speed acquisition rate for real-time data packets. For non-critical ordinary data, automatically adjust the data transmission rate or data frame size according to factors such as the real-time network signal strength; Step S6: During the high-speed data acquisition process, encrypt the key process data.

2. An efficient high-speed PLC process data acquisition method according to claim 1, characterized in that: The PLC mentioned above is a Siemens 1500 series PLC, which is configured as follows through the TIAPortal software: Open TIAPortal to create a project, add an S7-1500 PLC device and name it, configure the network so that the PLC and the host computer are in the same network; Add a data type named "DataC" in the PLC data type, the elements of which contain 2 sub-structures, and each sub-structure has a start recording time, a recording end time, and a process data array; Add a global DB type data block DB503 in the program block, cancel the "Optimized block access" option, and define the data packet variables for interacting with the host computer; Set the PLC security access level to "Full", and allow PUT / GET communication access from remote partners; Add an OB organization block as a cyclic interrupt, set the cycle time to 5ms, create a subroutine to write a 10ms timer for data recording, and call the subroutine in the cyclic interrupt OB organization block to achieve 10ms high-speed data acquisition.

3. An efficient method for high-speed acquisition of PLC process data according to claim 1, characterized in that: The host computer mentioned above is the CMS host computer software, and the configuration steps are as follows: Install the CMS software and the database MySQL and configure the IP address for communication with the PLC; Create an external device in the variable management, that is, the PLC, and configure the variables in the data block into the CMS according to the data block DB503 in the PLC; Configure the polling acquisition task, and the maximum period does not exceed 1 second; Start the PLC program and use the monitoring function of CMS to view the data transmission situation.

4. An efficient high-speed PLC process data acquisition method according to claim 1, characterized in that: The data acquisition software mentioned above is SIOT, which is used to retrieve values from 2 array queues created by the PLC in a specific order, and to perform preliminary processing on the data transmitted by the PLC in the industrial gateway.

5. An efficient PLC process data high-speed acquisition method according to claim 1, characterized in that: The encryption process for the key process data uses the AES encryption algorithm, and the encryption key is dynamically generated and updated through the key management system.

6. An efficient high-speed PLC process data acquisition method according to claim 1, characterized in that: Before using the machine learning algorithm, it is trained with historical production data, and the algorithm parameters are adjusted during the training process to enable the algorithm to accurately adapt to the actual situation of the production process and equipment operation.

7. An efficient PLC process data high-speed acquisition method according to claim 1, characterized in that: The data transmission between the fog computing node and the industrial gateway uses the MQTT protocol.

8. An efficient PLC process data high-speed acquisition method according to claim 1, characterized in that: The time series database uses InfluxDB, which is optimized for time series data storage, supports high write and query rates, and is used to efficiently store and manage data marked at 10ms intervals.

9. An efficient high-speed PLC process data acquisition method according to claim 1, characterized in that: The data communication between the PLC and the host computer uses a redundant network architecture. When the main network fails, the standby network automatically switches to ensure the continuity of data communication.

10. An efficient high-speed PLC process data acquisition method according to claim 1, characterized in that: When the data acquisition software acquires data, it performs real-time verification on the acquired data, and ensures the accuracy of the data through the CRC verification algorithm. If the verification fails, the data is re-acquired.