PLC program processing method, device, equipment and storage medium
Using edge computing equipment to perform data cleaning, encrypted transmission and feature engineering processing on the PLC system solves the reliability, network security and timeliness issues of the PLC system, improves the system's response speed and control accuracy, and enhances the safety of industrial automation production sex and efficiency.
Patent Information
- Application Number
- CN202410884806.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-03
AI Technical Summary
PLC systems face reliability, network security and timeliness issues when executing complex sequence operations. It is difficult to effectively respond to external signals and defend against network attacks, affecting the smoothness and safety of industrial automation production.
Use edge computing devices to collect and initially process data from sensors and input devices of PLC devices, eliminate invalid data and noise, use encrypted transmission and feature engineering processing, and predict and adjust control logic to improve the response speed and security of the system.
It improves the data accuracy and reliability of the PLC system, enhances network security, improves the accuracy and timeliness of control logic, and optimizes the operating efficiency and performance of the production line.
Smart Images

Figure CN118426401B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of programmable logic controllers (PLCs), and in particular to a program processing method, device, computer equipment and storage medium of a PLC. Background Art
[0002] Programmable logic controllers (PLCs) are widely used in industrial automation to control and manage machinery and processes. The program processing method of PLC involves encoding task logic into the control unit to automatically perform complex sequence operations. However, these systems face many technical challenges. For example, reliability is a key requirement for PLC program processing. The system must be able to respond correctly to external signals to ensure the smooth operation and safety of the production line. In addition, with the development of industrial Internet of Things, the network security issues of PLC systems have become increasingly prominent. They need to effectively defend against external network attacks and internal data leaks to ensure the integrity and confidentiality of the control system. Of course, timeliness is also an important challenge in PLC systems. In the field of industrial automation, many processes and reactions are time-sensitive and require PLC systems to respond in a short time. Summary of the invention
[0003] The main purpose of the present invention is to provide a PLC program processing method, device, equipment and storage medium to solve the reliability problems, network security problems and timeliness problems faced by the system when executing complex sequence operations.
[0004] To achieve the above-mentioned object, the present invention provides a PLC program processing method, comprising the following steps: collecting data from multiple sensors and multiple input devices connected to a PLC device through an edge computing device to obtain PLC initial collection data; performing preliminary cleaning on the PLC initial collection data based on the edge computing device to remove invalid data and noise data in the PLC initial collection data to obtain PLC target collection data; encrypting the PLC target collection data and transmitting it to the PLC device through the edge computing device; performing feature engineering processing on the PLC target collection data in response to a PLC control logic adjustment instruction for the PLC device to obtain a first PLC target collection data. LC monitoring production line data features; performing feature construction processing on the first PLC monitoring production line data features to create a second PLC monitoring production line data features; using the first PLC monitoring production line data features and the second PLC monitoring production line data features to predict the output results of the PLC control logic to obtain the prediction result data of the PLC control logic; performing PLC control logic adjustment analysis on the prediction result data of the PLC control logic to obtain the adjustment strategy of the PLC control logic, and adjusting the PLC control logic using the adjustment strategy; performing data processing on the PLC target collection data based on the adjusted PLC control logic through the PLC device.
[0005] Furthermore, data is collected from multiple sensors and multiple input devices connected to the PLC device through an edge computing device to obtain PLC initial collection data, including: using a network scanning tool and protocol to identify the data transmission paths of the multiple sensors and multiple input devices connected to the PLC device; based on the initial data transmission paths of the multiple sensors and multiple input devices connected to the PLC device, the multiple sensors and multiple input devices connected to the PLC device are divided to obtain multiple data acquisition device sets, wherein each data acquisition device set includes at least one sensor and / or at least one input device; path integration is performed on the initial data transmission paths of at least one sensor and / or at least one input device contained in each data acquisition device set to obtain a target data transmission path set corresponding to each data acquisition device set; path optimization analysis is performed on the target data transmission path set corresponding to each data acquisition device set to obtain the optimal path transmission center point corresponding to each data acquisition device set, and an edge computing device is arranged at the optimal path transmission center point; a data connection is established between each sensor and input device contained in the data acquisition device set and its corresponding edge computing device, and the edge computing device is used to perform data collection on the sensors and input devices connected thereto to obtain PLC initial collection data.
[0006] Furthermore, the PLC initial collection data is preliminarily cleaned by the edge computing device, and invalid data and noise data in the PLC initial collection data are eliminated to obtain the PLC target collection data, including: the edge computing device uses the timestamp alignment technology to perform time synchronization processing on the PLC initial collection data to obtain the first initial data of the PLC initial collection data; calculate the first quartile and the third quartile of each data point in the first initial data of the PLC initial collection data; based on the first quartile and the third quartile of the PLC initial collection data, calculate the IQ of the PLC initial collection data R value, the IQR value is equal to the value of the third quartile minus the first quartile; the data points in the PLC initial collection data that are less than the first threshold are determined as outliers, and the data points in the PLC initial collection data that are greater than the second threshold are determined as outliers, and the outliers are eliminated to obtain the second initial data of the PLC initial collection data, wherein the first threshold is the value of the first quartile minus 1.5 times the IQR value, and the second threshold is the value of the third quartile plus 1.5 times the IQR value; a low-pass Butterworth filter is used to smooth the second initial data of the PLC initial collection data, and the PLC initial collection data is eliminated. C obtains the third initial data of the PLC initial collected data by using the noise data in the second initial data of the PLC initial collected data; traverses the third initial data of the PLC initial collected data, identifies the missing part of each data point in the third initial data, and performs null value identification processing on the missing part to obtain the null value identification, and based on the data source of the data point corresponding to the null value identification, divides the data point corresponding to the null value identification into a sensor value missing point and an input device value missing point; based on the data values of the adjacent data points of the input device value missing point, adopts the K-nearest neighbor missing value algorithm to predict and analyze the data values of the adjacent data points, A first predicted data value is obtained, and the first predicted data value is used to replace the null value at the input device value missing point; based on the data values of the related data points of the sensor value missing point, a K-nearest neighbor missing value algorithm is used to predict and analyze the data values of the related data points to obtain a second predicted data value, and the second predicted data value is used to replace the null value at the sensor value missing point; the third initial data after the sensor value missing point and the input device value missing point are replaced is used as the PLC target collected data collected and processed by the edge computing device, wherein the sensor value missing point is consistent with the timestamp of the related data point.
[0007] Furthermore, the PLC target collected data is encrypted and transmitted to the PLC device through the edge computing device, including: performing a handshake connection between the edge computing device and the PLC device, and using a temporary Diffie-Hellman algorithm to exchange keys during the handshake process, wherein the temporary Diffie-Hellman algorithm is used to generate a set of new keys for each session between the edge computing device and the PLC device, wherein the keys include a public key and a private key; the edge computing device sends the temporary edge computing device public key corresponding to this session to the PLC device, and the PLC device sends the temporary PLC device public key corresponding to this session to the edge computing device. computing device; the edge computing device adopts the mathematical principle of Diffie-Hellman key exchange to calculate the temporary PLC device public key and the private key of the edge computing device to obtain the shared key of this session, and uses the shared key to encrypt the PLC target collection data and transmit it to the PLC device; the PLC device adopts the mathematical principle of Diffie-Hellman key exchange to calculate the temporary edge computing device public key and the private key of the PLC device to obtain the shared key of this session, and uses the shared key to decrypt the PLC target collection data to obtain the decrypted PLC target collection data.
[0008] Furthermore, in response to a PLC control logic adjustment instruction for the PLC device, feature engineering processing is performed on the PLC target collection data to obtain a first PLC monitoring production line data feature; feature construction processing is performed on the first PLC monitoring production line data feature to create a second PLC monitoring production line data feature, including: using the PLC device to respond to the PLC control logic adjustment instruction, configuring a time window in a real-time data stream processing framework to process the data stream of the PLC target collection data, and performing real-time feature extraction on the data points in each time window to obtain the first PLC monitoring production line data feature; based on the information gain feature selection algorithm, feature prediction force is performed on the first PLC monitoring production line data feature. Identify and extract multiple first data target features whose prediction power is higher than a preset threshold; create entity relationships for the multiple first data target features to obtain entity relationship data of the multiple first data target features, and reorganize and aggregate the multiple first data target features based on the entity relationship data to obtain a second data target feature; identify nonlinear relationships for the multiple first data target features to obtain nonlinear relationship data of the multiple first data target features, and reorganize and aggregate the multiple first data target features based on the nonlinear relationship data to obtain a third data target feature; integrate the second data target feature and the third data target feature to obtain the second PLC monitoring production line data feature.
[0009] Furthermore, the first PLC monitoring production line data feature and the second PLC monitoring production line data feature are used to predict the output result of the PLC control logic to obtain the prediction result data of the PLC control logic, including: inputting the first PLC monitoring production line data feature and the second PLC monitoring production line data feature into a preset dual-input mechanism PLC control logic result prediction model, wherein the dual-input mechanism PLC control logic result prediction model includes: a first data processing branch and a second data processing branch; the first PLC monitoring production line data feature is standardized by the first data processing branch, and the standardized processing is performed by using a neural network architecture based on a ReLU activation function. The execution result prediction analysis of the PLC control logic is performed on the data features of the first PLC monitoring production line after the processing, so as to obtain the first PLC control logic result analysis data; the second PLC monitoring production line data features are processed by one-hot encoding through the second data processing branch, and the Scikit-learn gradient boosting classifier is used to perform the execution result prediction analysis of the PLC control logic on the second PLC monitoring production line data features after the one-hot encoding processing, so as to obtain the second PLC control logic result analysis data; the first PLC control logic result analysis data and the second PLC control logic result analysis data are processed by logistic regression fusion to obtain the prediction result data of the PLC control logic.
[0010] Furthermore, a PLC control logic adjustment analysis is performed on the prediction result data of the PLC control logic to obtain an adjustment strategy for the PLC control logic, and the PLC control logic is adjusted using the adjustment strategy, including: performance labeling of the prediction result data of the PLC control logic to determine key execution result prediction data that fails to achieve the expected goal; feature analysis of the PLC control logic based on the key execution result prediction data to identify key features in the PLC control logic that affect the execution result; constructing a decision tree model using the key features, and using the decision tree model to evaluate the impact of the key features on the execution result to obtain key feature impact assessment data; analyzing the key feature impact assessment data to identify key adjustment points in the PLC control logic and determine adjustment parameters for the key adjustment points; generating an adjustment strategy for the PLC control logic based on the key adjustment points and the adjustment parameters for the key adjustment points, and adjusting the PLC control logic using the adjustment strategy.
[0011] The present invention also provides a program processing device for PLC, comprising: a collection unit, used to collect data from multiple sensors and multiple input devices connected to the PLC device through an edge computing device to obtain PLC initial collection data; a cleaning unit, used to perform preliminary cleaning on the PLC initial collection data based on the edge computing device, remove invalid data and noise data in the PLC initial collection data, and obtain PLC target collection data; an encryption unit, used to encrypt and transmit the PLC target collection data to the PLC device through the edge computing device; a first adjustment unit, used to perform feature engineering processing on the PLC target collection data in response to a PLC control logic adjustment instruction for the PLC device to obtain a first PLC Monitoring production line data features; performing feature construction processing on the first PLC monitoring production line data features to create second PLC monitoring production line data features; a prediction unit, used to use the first PLC monitoring production line data features and the second PLC monitoring production line data features to predict the output results of the PLC control logic, and obtain the prediction result data of the PLC control logic; a second adjustment unit, used to perform PLC control logic adjustment analysis on the prediction result data of the PLC control logic, obtain the adjustment strategy of the PLC control logic, and adjust the PLC control logic using the adjustment strategy; a processing unit, used to perform data processing on the PLC target collection data based on the adjusted PLC control logic through the PLC device.
[0012] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0013] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0014] The innovative PLC program processing method provided by the present invention first collects data from the connected sensors and input devices through the edge computing device, and realizes the preliminary processing from the initial data collection of the PLC to the data collection of the PLC target. This step effectively cleans and optimizes the data, eliminates invalid data and noise, and improves the accuracy and reliability of the data. Secondly, the processed PLC target collection data is transmitted to the PLC device in an encrypted transmission mode, which helps to ensure the integrity and confidentiality of the data, effectively defend against external network attacks and internal data leakage, and enhance the network security of the system. Then, through feature engineering processing and feature construction processing, the first and second PLC monitoring production line data features are created and optimized. These features are used to predict the output results of the PLC control logic, improve the accuracy and timeliness of the control logic, and enable the system to respond and adjust more quickly. Finally, in terms of PLC control logic adjustment and data processing, the PLC control logic is adjusted and analyzed according to the prediction result data, and the adjustment strategy is formulated and the control logic is adjusted accordingly. This helps to optimize the operation of the production line and improve the efficiency and performance of the system.
[0015] In general, this technical solution effectively solves the challenges of reliability, network security and timeliness in PLC systems through edge computing, data processing, encrypted transmission, feature engineering and logic adjustment. It improves the system's response speed, control accuracy and security as a whole, and provides smarter and more reliable technical support for industrial automation production. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 1 is a schematic diagram of the steps of a program processing method of a PLC in one embodiment of the present invention;
[0017] Figure 2 It is a structural block diagram of a program processing device of a PLC in one embodiment of the present invention;
[0018] Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0019] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0021] Reference Figure 1 The embodiment of the present invention provides a PLC program processing method, comprising the following steps:
[0022] S1, collect data from multiple sensors and multiple input devices connected to the PLC device through the edge computing device to obtain the initial collected data of the PLC.
[0023] S2, based on the edge computing device, preliminarily cleans the PLC initial collected data, removes invalid data and noise data in the PLC initial collected data, and obtains PLC target collected data.
[0024] S3, encrypting and transmitting the PLC target collected data to the PLC device through the edge computing device.
[0025] S4, in response to the PLC control logic adjustment instruction for the PLC device, performing feature engineering processing on the PLC target collection data to obtain the first PLC monitoring production line data feature; performing feature construction processing on the first PLC monitoring production line data feature to create the second PLC monitoring production line data feature.
[0026] S5, using the first PLC monitoring production line data characteristics and the second PLC monitoring production line data characteristics to predict the output result of the PLC control logic, and obtain the prediction result data of the PLC control logic.
[0027] S6, performing PLC control logic adjustment analysis on the prediction result data of the PLC control logic to obtain an adjustment strategy for the PLC control logic, and adjusting the PLC control logic using the adjustment strategy.
[0028] S7, performing data processing on the PLC target collected data based on the adjusted PLC control logic through the PLC device.
[0029] That is, the technical solution provides an innovative PLC program processing method. First, the edge computing device collects data from the connected sensors and input devices, realizing the preliminary processing from the initial PLC data collection to the PLC target data collection. This step effectively cleans and optimizes the data, eliminates invalid data and noise, and improves the accuracy and reliability of the data. Secondly, the processed PLC target collection data is transmitted to the PLC device in an encrypted transmission mode, which helps to ensure the integrity and confidentiality of the data, effectively defend against external network attacks and internal data leakage, and enhance the network security of the system. Then, through feature engineering processing and feature construction processing, the first and second PLC monitoring production line data features are created and optimized. These features are used to predict the output results of the PLC control logic, which improves the accuracy and timeliness of the control logic and enables the system to respond and adjust more quickly. Finally, in terms of PLC control logic adjustment and data processing, the PLC control logic is adjusted and analyzed according to the prediction result data, and the adjustment strategy is formulated and the control logic is adjusted accordingly. This helps to optimize the operation of the production line and improve the efficiency and performance of the system.
[0030] In general, this technical solution effectively solves the challenges of reliability, network security and timeliness in PLC systems through edge computing, data processing, encrypted transmission, feature engineering and logic adjustment. It improves the system's response speed, control accuracy and security as a whole, and provides smarter and more reliable technical support for industrial automation production.
[0031] In one example, data is collected from multiple sensors and multiple input devices connected to a PLC device by an edge computing device to obtain PLC initial collection data, including: using a network scanning tool and a protocol to identify the data transmission paths of the multiple sensors and multiple input devices connected to the PLC device; based on the initial data transmission paths of the multiple sensors and multiple input devices connected to the PLC device, the multiple sensors and multiple input devices connected to the PLC device are divided to obtain multiple data acquisition device sets, wherein each data acquisition device set includes at least one sensor and / or at least one input device; path integration is performed on the initial data transmission paths of at least one sensor and / or at least one input device contained in each data acquisition device set to obtain a target data transmission path set corresponding to each data acquisition device set; path optimization analysis is performed on the target data transmission path set corresponding to each data acquisition device set to obtain the optimal path transmission center point corresponding to each data acquisition device set, and an edge computing device is arranged at the optimal path transmission center point; data connection is established between each sensor and input device contained in the data acquisition device set and its corresponding edge computing device, and the edge computing device is used to perform data collection on the sensors and input devices connected thereto to obtain PLC initial collection data.
[0032] In this example, the edge computing device collects data from the sensors and input devices connected to the PLC device, and the initial collection data of the PLC is obtained. First, through the network scanning tool and protocol identification, the data transmission path of the sensor and input device can be accurately determined, providing accurate basic information for subsequent data collection and processing. Secondly, by dividing and integrating the data transmission paths of the sensor and input device, multiple data collection device sets and their corresponding target data transmission paths are obtained. Such division and integration help optimize the data collection process and improve the efficiency and accuracy of data collection. Next, the target data transmission path of each data collection device set is optimized and analyzed, and the optimal path transmission center point is determined, and the edge computing device is deployed at the center point. This can make data collection more centralized and efficient, reduce data transmission delays and energy consumption, and improve the response speed and reliability of the system. Finally, a data connection is established between the sensor and input device and the edge computing device, and data is collected from these devices through the edge computing device to obtain the initial collection data of the PLC. This data collection method can improve the real-time and accuracy of data collection and provide a high-quality data foundation for subsequent data processing and analysis. In general, this technical solution optimizes and intelligentizes the data collection process of PLC equipment by optimizing the data collection path and deploying edge computing devices. It improves the efficiency and quality of data collection as a whole, provides more reliable and efficient data support for industrial production, and promotes the development and upgrading of industrial automation.
[0033] In one example, the PLC initial collection data is preliminarily cleaned by an edge computing device, invalid data and noise data in the PLC initial collection data are removed, and PLC target collection data is obtained, including: the edge computing device uses a timestamp alignment technology to perform time synchronization processing on the PLC initial collection data to obtain the first initial data of the PLC initial collection data; calculate the first quartile and the third quartile of each data point in the first initial data of the PLC initial collection data; based on the first quartile and the third quartile of the PLC initial collection data, calculate the PLC target collection data. IQR value, the IQR value is equal to the value of the third quartile minus the first quartile; determine the data points in the PLC initial collection data that are less than the first threshold as outliers, and determine the data points in the PLC initial collection data that are greater than the second threshold as outliers, remove the outliers, and obtain the second initial data of the PLC initial collection data, wherein the first threshold is the value of the first quartile minus 1.5 times the IQR value, and the second threshold is the value of the third quartile plus 1.5 times the IQR value; use a low-pass Butterworth filter to smooth the second initial data of the PLC initial collection data, and remove the PLC initial collection data. The noise data in the second initial data of the LC initial collected data is used to obtain the third initial data of the PLC initial collected data; the third initial data of the PLC initial collected data is traversed to identify the missing part of each data point in the third initial data, and the missing part is processed with a null value mark to obtain a null value mark, and based on the data source of the data point corresponding to the null value mark, the data point corresponding to the null value mark is divided into a sensor value missing point and an input device value missing point; based on the data values of the adjacent data points of the input device value missing point, the K-nearest neighbor missing value algorithm is used to predict and analyze the data values of the adjacent data points, A first predicted data value is obtained, and the first predicted data value is used to replace the null value at the input device value missing point; based on the data values of the related data points of the sensor value missing point, a K-nearest neighbor missing value algorithm is used to predict and analyze the data values of the related data points to obtain a second predicted data value, and the second predicted data value is used to replace the null value at the sensor value missing point; the third initial data after the sensor value missing point and the input device value missing point are replaced is used as the PLC target collected data collected and processed by the edge computing device, wherein the sensor value missing point is consistent with the timestamp of the related data point.
[0034] In this example, the PLC initial collection data is preliminarily cleaned by the edge computing device, invalid data and noise data are removed, and finally the PLC target collection data is obtained. First, the time synchronization is processed by the timestamp alignment technology to obtain the first version of the initial data, and then the quartiles of the data points are calculated, and then the IQR value is calculated to identify outliers. The outliers are determined according to the threshold and removed to obtain the second version of the data. Then, the low-pass Butterworth filter is used to smooth the second version of the data to remove noise and obtain the third version of the data. Subsequently, the third version of the data is traversed to identify the missing parts and perform null value identification processing, and the data points are divided into sensor value missing points and input device value missing points. For the input device value missing points, the K-nearest neighbor missing value algorithm is used for prediction analysis to obtain the first predicted data value and replace the null value. For the sensor value missing points, the K-nearest neighbor missing value algorithm is also used for prediction analysis to obtain the second predicted data value and replace the null value. After these processes, the cleaned and predicted PLC target collection data is obtained, in which the sensor value missing points are consistent with the timestamps of the relevant data points. Overall, this technical solution effectively cleans and optimizes the initial PLC collection data through time synchronization processing, outlier identification and elimination, smoothing processing, missing data prediction and replacement, and finally obtains more accurate and reliable PLC target collection data. This data processing method improves data quality, reduces the impact of noise and outliers, and fills in the missing data through predictive analysis, providing a more complete and accurate data foundation for subsequent data analysis and application.
[0035] In one example, the PLC target collected data is encrypted and transmitted to the PLC device through the edge computing device, including: performing a handshake connection between the edge computing device and the PLC device, and using a temporary Diffie-Hellman algorithm to exchange keys during the handshake process, wherein the temporary Diffie-Hellman algorithm is used to generate a set of new keys for each session between the edge computing device and the PLC device, wherein the keys include a public key and a private key; the edge computing device sends the temporary edge computing device public key corresponding to this session to the PLC device, and the PLC device sends the temporary PLC device public key corresponding to this session to the edge computing device; the edge computing device adopts the mathematical principle of Diffie-Hellman key exchange to calculate the temporary PLC device public key and the private key of the edge computing device to obtain the shared key of this session, and uses the shared key to encrypt the PLC target collection data and transmit it to the PLC device; the PLC device adopts the mathematical principle of Diffie-Hellman key exchange to calculate the temporary edge computing device public key and the private key of the PLC device to obtain the shared key of this session, and uses the shared key to decrypt the PLC target collection data to obtain the decrypted PLC target collection data.
[0036] In this example, the handshake connection between the edge computing device and the PLC device and the temporary Diffie-Hellman algorithm are used to exchange keys, thereby achieving security protection for the encrypted transmission and decryption processing of the PLC target collected data. First, during the handshake connection process, the edge computing device and the PLC device use the temporary Diffie-Hellman algorithm to generate a new set of keys, including public keys and private keys, to ensure that each session has an independent key. The edge computing device and the PLC device send the temporary public key corresponding to this session to each other for key exchange. Subsequently, the edge computing device uses the Diffie-Hellman key exchange principle to calculate the temporary PLC device public key and the edge computing device private key to generate the shared key for this session, which is used for data encryption and transmission to the PLC device. The PLC device also uses the Diffie-Hellman key exchange principle to calculate the combination of the temporary edge computing device public key and the PLC device private key during the handshake process to generate the shared key for this session, which is used to receive encrypted data and decrypt it. The entire technical solution realizes secure session key generation and data transmission encryption and decryption processes through the use of handshake connections and temporary Diffie-Hellman algorithms, ensuring the confidentiality and integrity of the PLC target collected data during transmission. The new key generated for each session combines mathematical principles to ensure security, while encrypted transmission and decryption processing ensure the security and credibility of data. The entire technical solution establishes a secure and reliable encryption transmission mechanism for communication between PLC devices and edge computing devices, effectively protecting the privacy and confidentiality of data.
[0037] In one example, in response to a PLC control logic adjustment instruction for the PLC device, feature engineering processing is performed on the PLC target collection data to obtain a first PLC monitoring production line data feature; feature construction processing is performed on the first PLC monitoring production line data feature to create a second PLC monitoring production line data feature, including: using the PLC device to respond to the PLC control logic adjustment instruction, configuring a time window in a real-time data stream processing framework to process the data stream of the PLC target collection data, and performing real-time feature extraction on the data points in each time window to obtain the first PLC monitoring production line data feature; based on the information gain feature selection algorithm, feature prediction is performed on the first PLC monitoring production line data feature. Force identification, extracting multiple first data target features whose prediction force is higher than a preset threshold; creating entity relationships for the multiple first data target features to obtain entity relationship data of the multiple first data target features, and reorganizing and aggregating the multiple first data target features based on the entity relationship data to obtain a second data target feature; performing nonlinear relationship identification on the multiple first data target features to obtain nonlinear relationship data of the multiple first data target features, and reorganizing and aggregating the multiple first data target features based on the nonlinear relationship data to obtain a third data target feature; integrating the second data target feature and the third data target feature to obtain the second PLC monitoring production line data feature.
[0038] In this example, the control logic adjustment instructions of the PLC device are used to perform feature engineering on the PLC target collection data, and the first PLC monitoring production line data features are obtained. Through feature construction processing, the second PLC monitoring production line data features are created. This process includes configuring a time window in the real-time data stream processing framework, processing the data stream and extracting real-time features, so as to obtain the first PLC monitoring production line data features. Using the information gain feature selection algorithm, the first data target feature is identified for predictive power, and multiple features with predictive power higher than the preset threshold are extracted. Next, entity relationships are created for these features to form entity relationship data of multiple first data target features. Based on the entity relationship data, reorganization and aggregation are performed to obtain the second data target feature. Subsequently, nonlinear relationships are identified for multiple first data target features to obtain nonlinear relationship data of these features. Reorganization and aggregation are performed based on the nonlinear relationship data to obtain the third data target feature. Finally, the second data target feature and the third data target feature are integrated to obtain the second PLC monitoring production line data features. The effect of the entire technical solution is that through feature engineering and feature construction, the PLC target collection data in the real-time data stream is deeply processed and analyzed, thereby extracting features with high predictive power. Through the creation and reorganization aggregation of relationships between entities, as well as the identification and reorganization aggregation of nonlinear relationships, the data features are further refined and processed to obtain more comprehensive and useful second PLC monitoring production line data features. This series of processing steps effectively improves the quality and availability of data features, providing a better foundation and support for subsequent data analysis and application.
[0039] In one example, the first PLC monitoring production line data feature and the second PLC monitoring production line data feature are used to predict the output result of the PLC control logic to obtain the predicted result data of the PLC control logic, including: inputting the first PLC monitoring production line data feature and the second PLC monitoring production line data feature into a preset dual-input mechanism PLC control logic result prediction model, wherein the dual-input mechanism PLC control logic result prediction model includes: a first data processing branch and a second data processing branch; the first PLC monitoring production line data feature is standardized by the first data processing branch, and the standardized processing is processed by a neural network architecture based on a ReLU activation function; The first PLC monitoring production line data features after processing are used to perform PLC control logic execution result prediction analysis to obtain first PLC control logic result analysis data; the second PLC monitoring production line data features are processed by the second data processing branch, and the Scikit-learn gradient boosting classifier is used to perform PLC control logic execution result prediction analysis on the second PLC monitoring production line data features after the one-hot encoding processing to obtain second PLC control logic result analysis data; the first PLC control logic result analysis data and the second PLC control logic result analysis data are processed by logistic regression fusion to obtain the prediction result data of the PLC control logic.
[0040] In this example, by comprehensively utilizing the data features of the first PLC monitoring production line and the data features of the second PLC monitoring production line, the output result of the PLC control logic is predicted to obtain the prediction result data of the PLC control logic. First, the data features of the first PLC monitoring production line and the data features of the second PLC monitoring production line are input into the preset dual-input mechanism PLC control logic result prediction model, which includes a first data processing branch and a second data processing branch. The data features of the first PLC monitoring production line are standardized by the first data processing branch, and the neural network structure based on the ReLU activation function is used to perform the execution result prediction analysis of the PLC control logic on the standardized features to obtain the first PLC control logic result analysis data. At the same time, the data features of the second PLC monitoring production line are uniquely encoded by the second data processing branch, and then the Scikit-learn gradient boosting classifier is used to perform the execution result prediction analysis of the PLC control logic on the encoded features to obtain the second PLC control logic result analysis data. Finally, the first PLC control logic result analysis data and the second PLC control logic result analysis data are subjected to logistic regression fusion processing to obtain the prediction result data. The effect of the entire technical solution is that it predicts and analyzes the output results of the PLC control logic by comprehensively utilizing multiple data processing branches and different prediction and analysis methods. This multi-level, multi-angle analysis method improves the accuracy and stability of PLC control logic predictions and provides a more reliable basis for data processing and decision-making in industrial production processes. By processing and comprehensively utilizing different data features, the technical solution improves the system's intelligence level and decision-making efficiency, and helps improve the operating efficiency and quality management level of the production line.
[0041] In one example, a PLC control logic adjustment analysis is performed on the prediction result data of the PLC control logic to obtain an adjustment strategy for the PLC control logic, and the PLC control logic is adjusted using the adjustment strategy, including: performance labeling of the prediction result data of the PLC control logic to determine key execution result prediction data that does not achieve the expected goal; feature analysis of the PLC control logic based on the key execution result prediction data to identify key features in the PLC control logic that affect the execution result; constructing a decision tree model using the key features, and using the decision tree model to evaluate the impact of the key features on the execution result to obtain key feature impact assessment data; analyzing the key feature impact assessment data to identify key adjustment points in the PLC control logic and determine adjustment parameters for the key adjustment points; generating an adjustment strategy for the PLC control logic based on the key adjustment points and the adjustment parameters for the key adjustment points, and adjusting the PLC control logic using the adjustment strategy.
[0042] In this example, the prediction result data of the PLC control logic is adjusted and analyzed to develop a suitable adjustment strategy and apply it to the PLC control logic. First, the prediction result data is performance-labeled to identify the key execution result prediction data that did not achieve the expected goals. The effect of this step is to help identify the key data with problems in the execution results, providing specific goals and directions for subsequent adjustments.
[0043] Next, feature analysis is performed based on the key execution result prediction data to identify the key features that affect the execution results. Through this process, we can gain an in-depth understanding of which features play a key role in the execution results of the PLC control logic, providing a basis for subsequent adjustments. Subsequently, a decision tree model is constructed using key features to evaluate the impact of these features on the execution results and obtain key feature impact assessment data. The effect of this step is to establish a clear model to understand the relationship between features and results, which helps to find the key features that have the greatest impact on the execution results. After analyzing the key feature impact assessment data, the key adjustment points in the PLC control logic are identified and the adjustment parameters are determined. Through this process, we are able to find the key points that need to be adjusted and the corresponding adjustment parameters, providing specific guidelines for optimizing the PLC control logic. Finally, based on the key adjustment points and the adjustment parameters of the key adjustment points, an adjustment strategy is generated and applied to the PLC control logic. The effect of the entire technical solution is to optimize the execution effect of the PLC control logic and improve the performance and stability of the system by deeply analyzing the execution results, identifying key features and adjustment points, proposing adjustment strategies and making adjustments. This approach can help identify potential problems in advance and make timely adjustments, allowing the system to more effectively adapt to and respond to various situations during operation, thereby improving the operating efficiency and quality management level of the production line.
[0044] Reference Figure 2 The embodiment of the present invention provides a program processing device of a PLC, comprising the following steps:
[0045] The collection unit 1 is used to collect data from multiple sensors and multiple input devices connected to the PLC device through the edge computing device to obtain the initial collection data of the PLC.
[0046] A cleaning unit 2 is used to perform preliminary cleaning on the PLC initial collection data based on the edge computing device, remove invalid data and noise data in the PLC initial collection data, and obtain PLC target collection data;
[0047] An encryption unit 3 is used to encrypt and transmit the PLC target collected data to the PLC device through the edge computing device;
[0048] The first adjustment unit 4 is used for performing feature engineering processing on the PLC target collection data to obtain the first PLC monitoring production line data feature in response to the PLC control logic adjustment instruction for the PLC device; performing feature construction processing on the first PLC monitoring production line data feature to create the second PLC monitoring production line data feature;
[0049] A prediction unit 5, configured to predict an output result of a PLC control logic by using the first PLC monitoring production line data feature and the second PLC monitoring production line data feature to obtain prediction result data of the PLC control logic;
[0050] The second adjustment unit 6 is used to perform a PLC control logic adjustment analysis on the prediction result data of the PLC control logic, obtain an adjustment strategy for the PLC control logic, and adjust the PLC control logic using the adjustment strategy;
[0051] The processing unit 7 is used to perform data processing on the PLC target collected data based on the adjusted PLC control logic through the PLC device.
[0052] In this embodiment, for the specific implementation of each unit in the above device embodiment, please refer to the above method embodiment, which will not be repeated here.
[0053] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0054] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.
[0055] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0056] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
[0057] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0058] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A PLC program processing method, characterized in that: The following steps are involved: Collect data from multiple sensors and multiple input devices connected to the PLC device through the edge computing device to obtain the initial collected data of the PLC; Based on the edge computing device, the PLC initial collected data is preliminarily cleaned to remove invalid data and noise data in the PLC initial collected data to obtain PLC target collected data; The PLC target collected data is encrypted and transmitted to the PLC device through the edge computing device; In response to a PLC control logic adjustment instruction for the PLC device, feature engineering processing is performed on the PLC target collection data to obtain a first PLC monitoring production line data feature; feature construction processing is performed on the first PLC monitoring production line data feature to create a second PLC monitoring production line data feature; Predicting the output result of the PLC control logic by using the first PLC monitoring production line data feature and the second PLC monitoring production line data feature to obtain the prediction result data of the PLC control logic; Performing a PLC control logic adjustment analysis on the prediction result data of the PLC control logic to obtain an adjustment strategy for the PLC control logic, and adjusting the PLC control logic using the adjustment strategy; Performing data processing on the PLC target collected data based on the adjusted PLC control logic by the PLC device; The first PLC monitoring production line data feature and the second PLC monitoring production line data feature are used to predict the output result of the PLC control logic to obtain the predicted result data of the PLC control logic, including: inputting the first PLC monitoring production line data feature and the second PLC monitoring production line data feature into a preset dual-input mechanism PLC control logic result prediction model, wherein the dual-input mechanism PLC control logic result prediction model includes: a first data processing branch and a second data processing branch; the first PLC monitoring production line data feature is standardized by the first data processing branch, and the standardized data feature is processed by a neural network architecture based on a ReLU activation function. The first PLC monitoring production line data feature is used to perform a prediction analysis on the execution result of the PLC control logic to obtain the first PLC control logic result analysis data; the second PLC monitoring production line data feature is processed by one-hot encoding through the second data processing branch, and the Scikit-learn gradient boosting classifier is used to perform a prediction analysis on the execution result of the PLC control logic on the second PLC monitoring production line data feature after the one-hot encoding process to obtain the second PLC control logic result analysis data; the first PLC control logic result analysis data and the second PLC control logic result analysis data are processed by logistic regression fusion to obtain the prediction result data of the PLC control logic; Among them, in response to the PLC control logic adjustment instruction for the PLC device, the PLC target collection data is subjected to feature engineering processing to obtain the first PLC monitoring production line data feature; the first PLC monitoring production line data feature is subjected to feature construction processing to create the second PLC monitoring production line data feature, including: using the PLC device to respond to the PLC control logic adjustment instruction, configuring a time window in a real-time data stream processing framework to process the data stream of the PLC target collection data, and performing real-time feature extraction on the data points in each time window to obtain the first PLC monitoring production line data feature; based on the information gain feature selection algorithm, feature prediction force recognition is performed on the first PLC monitoring production line data feature. Specifically, extract multiple first data target features whose prediction power is higher than a preset threshold; create entity relationships for the multiple first data target features to obtain entity relationship data of the multiple first data target features, and reorganize and aggregate the multiple first data target features based on the entity relationship data to obtain a second data target feature; identify nonlinear relationships for the multiple first data target features to obtain nonlinear relationship data of the multiple first data target features, and reorganize and aggregate the multiple first data target features based on the nonlinear relationship data to obtain a third data target feature; integrate the second data target feature and the third data target feature to obtain the second PLC monitoring production line data feature.
2. The program processing method according to claim 1, characterized in that: The edge computing device collects data from multiple sensors and multiple input devices connected to the PLC device to obtain the initial PLC collection data, including: Using a network scanning tool and a protocol to identify data transmission paths of a plurality of sensors and a plurality of input devices connected to the PLC device; Based on the initial data transmission paths of the multiple sensors and the multiple input devices connected to the PLC device, the multiple sensors and the multiple input devices connected to the PLC device are divided to obtain multiple data acquisition device sets, wherein each data acquisition device set includes at least one sensor and / or at least one input device; Performing path integration on initial data transmission paths of at least one sensor and / or at least one input device included in each data acquisition device set to obtain a target data transmission path set corresponding to each data acquisition device set; Performing path optimization analysis on the target data transmission path set corresponding to each data acquisition device set to obtain the optimal path transmission center point corresponding to each data acquisition device set, and arranging an edge computing device at the optimal path transmission center point; Establish a data connection between each sensor and input device included in the data acquisition device set and its corresponding edge computing device, and use the edge computing device to collect data from the sensors and input devices connected to it to obtain PLC initial collection data.
3. The program processing method according to claim 1, characterized in that: The PLC initial collection data is preliminarily cleaned by the edge computing device, and invalid data and noise data in the PLC initial collection data are removed to obtain PLC target collection data, including: The edge computing device uses a timestamp alignment technology to perform time synchronization processing on the PLC initial collection data to obtain first initial data of the PLC initial collection data; Calculating the first quartile and the third quartile of each data point in the first initial data of the PLC initial collected data; calculating the IQR value of the PLC initial collected data based on the first quartile and the third quartile of the PLC initial collected data, wherein the IQR value is equal to the value of the third quartile minus the first quartile; Determine data points in the PLC initial collected data that are smaller than a first threshold as outliers, and determine data points in the PLC initial collected data that are larger than a second threshold as outliers, remove the outliers, and obtain second initial data of the PLC initial collected data, wherein the first threshold is the value of the first quartile minus 1.5 times the IQR value, and the second threshold is the value of the third quartile plus 1.5 times the IQR value; Using a low-pass Butterworth filter, smoothing the second initial data of the PLC initially collected data, removing noise data in the second initial data of the PLC initially collected data, and obtaining the third initial data of the PLC initially collected data; Traversing the third initial data of the PLC initially collected data, identifying the missing part of each data point in the third initial data, performing null value identification processing on the missing part to obtain a null value identification, and based on the data source of the data point corresponding to the null value identification, dividing the data point corresponding to the null value identification into a sensor value missing point and an input device value missing point; Based on the data values of the adjacent data points of the input device value missing point, a K-nearest neighbor missing value algorithm is used to perform a prediction analysis on the data values of the adjacent data points to obtain a first predicted data value, and the first predicted data value is used to replace the null value at the input device value missing point; Based on the data values of the data points related to the missing sensor value point, a K-nearest neighbor missing value algorithm is used to predict and analyze the data values of the related data points to obtain a second predicted data value, and the second predicted data value is used to replace the null value at the missing sensor value point; The third initial data after replacing the sensor value missing points and the input device value missing points is used as the PLC target collection data collected and processed by the edge computing device, wherein the sensor value missing points are consistent with the timestamps of the relevant data points.
4. The program processing method according to claim 1, characterized in that: The PLC target collected data is encrypted and transmitted to the PLC device through the edge computing device, including: Performing a handshake connection between the edge computing device and the PLC device, and performing key exchange using a temporary Diffie-Hellman algorithm during the handshake process, wherein the temporary Diffie-Hellman algorithm is used to generate a new set of keys for each session between the edge computing device and the PLC device, wherein the keys include a public key and a private key; The edge computing device sends the temporary edge computing device public key corresponding to the current session to the PLC device, and the PLC device sends the temporary PLC device public key corresponding to the current session to the edge computing device; The edge computing device uses the mathematical principle of Diffie-Hellman key exchange to calculate the temporary PLC device public key and the private key of the edge computing device to obtain a shared key for this session, and uses the shared key to encrypt the PLC target collection data and transmit it to the PLC device; The PLC device uses the mathematical principle of Diffie-Hellman key exchange to calculate the public key of the temporary edge computing device and the private key of the PLC device to obtain the shared key of this session, and uses the shared key to decrypt the PLC target collection data to obtain the decrypted PLC target collection data.
5. The program processing method according to claim 1, characterized in that: Performing a PLC control logic adjustment analysis on the prediction result data of the PLC control logic to obtain an adjustment strategy for the PLC control logic, and adjusting the PLC control logic using the adjustment strategy, including: Performing performance annotation on the predicted result data of the PLC control logic to determine key execution result predicted data that failed to achieve the expected goal; Performing feature analysis on the PLC control logic based on the key execution result prediction data to identify key features in the PLC control logic that affect the execution result; By constructing a decision tree model using the key features, and using the decision tree model to evaluate the impact of the key features on the execution results, key feature impact evaluation data is obtained; Analyzing the key feature impact assessment data, identifying key adjustment points in the PLC control logic, and determining adjustment parameters of the key adjustment points; Based on the key adjustment points and the adjustment parameters of the key adjustment points, an adjustment strategy for the PLC control logic is generated, and the PLC control logic is adjusted using the adjustment strategy.
6. A program processing device for PLC, characterized in that: The following steps are involved: The collection unit is used to collect data from multiple sensors and multiple input devices connected to the PLC device through the edge computing device to obtain the initial collection data of the PLC. A cleaning unit, configured to perform preliminary cleaning on the PLC initial collection data based on the edge computing device, remove invalid data and noise data in the PLC initial collection data, and obtain PLC target collection data; An encryption unit, used to encrypt and transmit the PLC target collected data to the PLC device through the edge computing device; A first adjustment unit is used to perform feature engineering processing on the PLC target collection data to obtain a first PLC monitoring production line data feature in response to a PLC control logic adjustment instruction for the PLC device; perform feature construction processing on the first PLC monitoring production line data feature to create a second PLC monitoring production line data feature; A prediction unit, used to predict the output result of the PLC control logic by using the first PLC monitoring production line data characteristics and the second PLC monitoring production line data characteristics to obtain the prediction result data of the PLC control logic; A second adjustment unit is used to perform a PLC control logic adjustment analysis on the prediction result data of the PLC control logic, obtain an adjustment strategy for the PLC control logic, and adjust the PLC control logic using the adjustment strategy; a processing unit, configured to perform data processing on the PLC target collected data based on the adjusted PLC control logic through the PLC device; The first PLC monitoring production line data feature and the second PLC monitoring production line data feature are used to predict the output result of the PLC control logic to obtain the predicted result data of the PLC control logic, including: inputting the first PLC monitoring production line data feature and the second PLC monitoring production line data feature into a preset dual-input mechanism PLC control logic result prediction model, wherein the dual-input mechanism PLC control logic result prediction model includes: a first data processing branch and a second data processing branch; the first PLC monitoring production line data feature is standardized by the first data processing branch, and the standardized data feature is processed by a neural network architecture based on a ReLU activation function. The first PLC monitoring production line data feature is used to perform a prediction analysis on the execution result of the PLC control logic to obtain the first PLC control logic result analysis data; the second PLC monitoring production line data feature is processed by one-hot encoding through the second data processing branch, and the Scikit-learn gradient boosting classifier is used to perform a prediction analysis on the execution result of the PLC control logic on the second PLC monitoring production line data feature after the one-hot encoding process to obtain the second PLC control logic result analysis data; the first PLC control logic result analysis data and the second PLC control logic result analysis data are processed by logistic regression fusion to obtain the prediction result data of the PLC control logic; Among them, in response to the PLC control logic adjustment instruction for the PLC device, the PLC target collection data is subjected to feature engineering processing to obtain the first PLC monitoring production line data feature; the first PLC monitoring production line data feature is subjected to feature construction processing to create the second PLC monitoring production line data feature, including: using the PLC device to respond to the PLC control logic adjustment instruction, configuring a time window in a real-time data stream processing framework to process the data stream of the PLC target collection data, and performing real-time feature extraction on the data points in each time window to obtain the first PLC monitoring production line data feature; based on the information gain feature selection algorithm, feature prediction force recognition is performed on the first PLC monitoring production line data feature. Specifically, extract multiple first data target features whose prediction power is higher than a preset threshold; create entity relationships for the multiple first data target features to obtain entity relationship data of the multiple first data target features, and reorganize and aggregate the multiple first data target features based on the entity relationship data to obtain a second data target feature; identify nonlinear relationships for the multiple first data target features to obtain nonlinear relationship data of the multiple first data target features, and reorganize and aggregate the multiple first data target features based on the nonlinear relationship data to obtain a third data target feature; integrate the second data target feature and the third data target feature to obtain the second PLC monitoring production line data feature.
7. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
