A method and apparatus for automatically generating PLC program variable monitoring information
By combining unsupervised machine learning and expert knowledge, refined PLC program variable monitoring information is generated, which solves the problems of excessively long monitoring variable dictionaries and unclear correlations in existing technologies, and enables rapid detection of subtle anomalies and improves monitoring efficiency.
Patent Information
- Application Number
- CN202211723874.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-12-30
AI Technical Summary
In existing technologies for monitoring PLC program variables, manual monitoring can easily overlook subtle anomalies, while machine learning methods generate excessively long and ambiguous monitoring variable dictionaries, resulting in a heavy workload and an unfriendly experience for development and testing personnel.
By combining unsupervised machine learning and expert knowledge, a refined dictionary of monitoring variables is generated through feature extraction and calculation of feature importance scores. This is achieved by using the isolated forest algorithm and expert knowledge to monitor highly correlated variables in real time, thereby reducing the number of monitoring variables and improving detection accuracy.
It enables the rapid generation of variable monitoring lists, detects subtle anomalies, improves the security and efficiency of monitoring, and reduces the workload of development and testing personnel.
Smart Images

Figure CN116068954B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of PLC program variable monitoring and anomaly detection technology, specifically relating to a method and apparatus for automatically generating PLC program variable monitoring information. Background Technology
[0002] In the era of Industry 4.0, data-driven industrial control programs and industrial equipment product optimization, production, and services are inseparable. In particular, with the development of cloud computing technology, the concepts of cloud configuration and cloud monitoring have emerged. Real-time monitoring of industrial PLC equipment through cloud servers can better preserve and integrate historical monitoring data. The value of this large amount of historical data still needs to be further developed and utilized.
[0003] Furthermore, the increasing complexity of industrial control systems places higher demands on advanced monitoring of complex program systems, especially in the field of PLC program variable monitoring. In most cases, real-time customized monitoring of program variables by human monitoring personnel based on prior expert knowledge often overlooks subtle anomalies and variables highly correlated with equipment operating status. Additionally, there are machine learning-based methods for anomaly detection. These methods extract features, learn from them, and find important features. However, they require anomaly detection on multiple variables related to these features, resulting in excessively long monitoring variable dictionaries with unclear correlations between variables, making them less user-friendly for development and testing personnel.
[0004] Therefore, an intelligent automated monitoring system is needed, and a method for automatically generating PLC program variable monitoring information is proposed.
[0005] Therefore, in view of the technical defects of the existing technology, it is necessary to propose a technical solution to solve the technical problems existing in the existing technology. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of existing technologies, adapt to practical application needs, and provide a method and apparatus for automatically generating PLC program variable monitoring information. Based on the integration of historical monitoring data, features are extracted from the dataset. Unsupervised machine learning methods are used to detect subtle abnormal features. Combined with expert knowledge, refined variable monitoring information is automatically generated. The feature importance scores of all extracted features are calculated for further analysis to identify variables highly correlated with equipment operating status, which are then added to the monitoring variable dictionary. Industrial platform software then monitors the variables in the monitoring variable dictionary in real time. When dealing with complex program systems, this invention can generate a variable monitoring list more quickly, while supplementing variables related to equipment anomalies that are easily overlooked by expert knowledge. This helps development and monitoring personnel identify problems more quickly during testing, detect more subtle anomalies, and improve safety.
[0007] In order to solve the technical problems existing in the prior art, the technical solution of the present invention is as follows:
[0008] The method for automatically generating PLC program variable monitoring information includes at least the following steps:
[0009] Step S1: Collect and preprocess historical time-series variable data packets to obtain historical datasets;
[0010] Step S2: Feed the historical dataset to the feature extraction module for feature extraction calculation and obtain the feature set;
[0011] Step S3: Calculate the feature importance score for all features in the feature set;
[0012] Step S4: Based on feature importance scores, the isolated forest algorithm, and expert knowledge calculation and analysis, highly correlated variables are selected and added to the monitoring variable dictionary as monitoring information. The variables in this variable dictionary are then used for real-time monitoring on the industrial platform software.
[0013] As a further improvement, in the above-mentioned method for automatically generating PLC program variable monitoring information, the data categories in S1 include the values of PLC variables, sensor data monitoring the status of equipment, etc., at different times within the equipment operating cycle, and each data packet is divided into datasets according to the time span of the minimum operating cycle of the equipment.
[0014] As a further improvement, in the above-mentioned method for automatically generating PLC program variable monitoring information, the feature extraction module in S2 adopts a cluster-based unsupervised learning method to extract latent features based on the local and global standard deviations of the data.
[0015] As a further improvement, in the above-mentioned method for automatically generating PLC program variable monitoring information, in step S3, based on the idea of interpretable artificial intelligence, the standard deviation and Pearson correlation coefficient of all features in the feature set are calculated. Based on these two values, feature importance is scored, and the feature importance score of feature x is defined as f(x). The specific calculation formula is as follows:
[0016]
[0017] Where σ represents the standard deviation, r is the Pearson correlation coefficient between the feature and the program results, and n is the size of the feature set.
[0018] As a further improvement, in the above-mentioned method for automatically generating PLC program variable monitoring information, S4 includes the following steps:
[0019] S4-1, calculates the abnormality score of the abnormal cycle of the device through the isolated forest algorithm. If the abnormality score is greater than τ, it is defined as an abnormal cycle, where τ is a predefined value.
[0020] S4-2 defines the feature importance score of feature x as f(x). Analyze all variables during abnormal periods. If feature x exists... j and x k , where x j It is determined by variable v i The features obtained from the calculation, and feature x k Not belonging to variable v i The features obtained from the calculation, and f(x) j )>δf(x k ), then v i Define the variable to be monitored and add it to the monitoring variable dictionary, where δ is a predefined value;
[0021] S4-3 If expert knowledge indicates that some variables are particularly relevant, they are added to the monitoring variable dictionary.
[0022] Preferably, in S4-1, the outlier score of the device cycle χ calculated by the isolated forest algorithm for all collected device cycle data is calculated using the following formula:
[0023]
[0024] Where e is the average path length of all trees in the generated isolated forest, and c is the normalization factor for comparing forests of different sizes.
[0025] This invention also discloses a device for automatically generating PLC program variable monitoring information, comprising at least:
[0026] The data acquisition module is used to collect and preprocess historical time-series variable data packets to obtain historical datasets;
[0027] The feature extraction module is used to perform feature extraction calculations on historical datasets and obtain feature sets;
[0028] The feature importance score calculation module is used to calculate the feature importance score for all features in the feature set;
[0029] The monitoring information calculation module is used to calculate and analyze highly correlated variables based on feature importance scores, isolated forest algorithms, and expert knowledge, and add them to the monitoring variable dictionary as monitoring information. The variables in this variable dictionary are then used for real-time monitoring on the industrial platform software.
[0030] As a further improvement, the feature importance score calculation module calculates the standard deviation and Pearson correlation coefficient of all features in the feature set, and scores the feature importance based on the standard deviation and Pearson correlation coefficient. The feature importance score of feature x is defined as f(x), and the specific calculation formula is as follows:
[0031]
[0032] Where σ represents the standard deviation, r is the Pearson correlation coefficient between the feature and the program results, and n is the size of the feature set.
[0033] As a further improvement, the data processing of the monitoring information calculation module includes the following steps:
[0034] S4-1, calculates the abnormality score of the abnormal cycle of the device through the isolated forest algorithm. If the abnormality score is greater than τ, it is defined as an abnormal cycle, where τ is a predefined value.
[0035] S4-2, Analyze all variables during abnormal periods, if a characteristic x exists. j and x k , where x j It is determined by variable v i The features obtained from the calculation, and feature x k Not belonging to variable v i The features obtained from the calculation, and f(x) j If )>δf(xk), then v i Define the variable to be monitored and add it to the monitoring variable dictionary, where δ is a predefined value;
[0036] S4-3, based on expert knowledge, indicates that some variables are particularly relevant and are added to the monitoring variable dictionary as monitoring information.
[0037] As a further improvement, in S4-1, the outlier score of the device cycle χ calculated by the isolated forest algorithm for all collected device cycle data is calculated using the following formula:
[0038]
[0039] Where e is the average path length of all trees in the generated isolated forest, and c is the normalization factor for comparing forests of different sizes.
[0040] Compared with the prior art, the present invention has at least the following beneficial effects:
[0041] 1. This invention combines machine learning and unsupervised clustering for feature extraction and subsequent computation without requiring any other expert prior knowledge or data assumptions, thus exhibiting better versatility and automation in PLC program variable monitoring.
[0042] 2. Unlike traditional methods that add multiple variables related to important features to the monitoring dictionary, this invention refines the monitoring variable dictionary by calculating the importance scores of all features and using the isolated forest algorithm to find abnormal cycles and then finding a single variable with higher relevance. This improves the accuracy of variable finding and reduces the workload of development and testing personnel.
[0043] 3. This invention has a certain degree of scalability. It can extract corresponding important variables from the calculated important features as a supplement to the results, making the generated list of monitoring variables more comprehensive. Attached Figure Description
[0044] Figure 1 This is a flowchart of a method for automatically generating PLC program variable monitoring information according to the present invention;
[0045] Figure 2 Example graph showing the results of feature importance score calculation;
[0046] Figure 3 A structural block diagram of a device for automatically generating monitoring information of PLC program variables;
[0047] Figure 4 This is a system framework diagram of the present invention applied to a real platform software. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] See Figure 1 See Figure 1 The diagram shows a flowchart of a method for automatically generating PLC program variable monitoring information according to the present invention, which specifically includes the following steps:
[0050] Step S1: Collect and preprocess historical time-series variable data packets to obtain historical datasets;
[0051] Step S2: Feed the historical dataset to the feature extraction module for feature extraction calculation and obtain the feature set;
[0052] Step S3: Calculate the feature importance score for all features in the feature set;
[0053] Step S4: Based on feature importance scores, the isolated forest algorithm, and expert knowledge calculation and analysis, highly correlated variables are selected and added to the monitoring variable dictionary as monitoring information. The variables in this variable dictionary are then used for real-time monitoring on the industrial platform software.
[0054] Preferably, in the above-mentioned method for automatically generating PLC program variable monitoring information, the data categories in S1 include PLC variables, sensor data monitoring the status of equipment, and other values at different times within the equipment operating cycle, and each data packet is divided into datasets according to the time span of the minimum operating cycle of the equipment.
[0055] Preferably, in the above-mentioned method for automatically generating PLC program variable monitoring information, the feature extraction module in S2 adopts a cluster-based unsupervised learning method and extracts latent features based on the local and global standard deviations of the data. This combination of deep neural networks and unsupervised clustering allows for the learning of nonlinear latent features without requiring any additional expert knowledge or data assumptions, resulting in better versatility and automation in PLC program variable monitoring.
[0056] Preferably, in the above-mentioned method for automatically generating PLC program variable monitoring information, in step S3, based on the idea of interpretable artificial intelligence, the standard deviation and Pearson correlation coefficient of all features in the feature set are calculated, and feature importance is scored based on these two values. The feature importance score of feature x is defined as f(x), and the specific calculation formula is as follows:
[0057]
[0058] Where σ represents the standard deviation, r is the Pearson correlation coefficient between the feature and the program results, and n is the size of the feature set.
[0059] Preferably, in the above-mentioned method for automatically generating PLC program variable monitoring information, step S4 includes the following steps:
[0060] S4-1, calculates the abnormality score of the abnormal cycle of the device through the isolated forest algorithm. If the abnormality score is greater than τ, it is defined as an abnormal cycle, where τ is a predefined value.
[0061] S4-2 defines the feature importance score of feature x as f(x). Analyze all variables during abnormal periods. If feature x exists... j and x k , where x j It is determined by variable v i The features obtained from the calculation, and feature x k Not belonging to variable v i The features obtained from the calculation, and f(x) j )>δf(x k ), then v i Define the variable to be monitored and add it to the monitoring variable dictionary, where δ is a predefined value;
[0062] S4-3: If expert knowledge indicates that some variables are particularly relevant, they are added to the monitoring variable dictionary.
[0063] Preferably, in S4-1, the outlier score of the device cycle χ calculated by the isolated forest algorithm for all collected device cycle data is calculated using the following formula:
[0064]
[0065] Where e is the average path length of all trees in the generated isolated forest, and c is the normalization factor for comparing forests of different sizes.
[0066] First, for different PLC programs, obtain different variables, denoted as n as the number of variables. Then, in step S1, obtain the historical dataset V = {v1, ..., v} for each device cycle. n}, then all datasets are represented as Y = {V1, ..., V}. l After feature extraction from all historical datasets in step S2, multiple features can be obtained, denoted as feature set X = {x1, ..., x2}. m}. Where m≠n.
[0067] Next, through step S3, the feature importance scores of all features in the feature set X are calculated to obtain the feature importance score set F = {f(x1), ..., f(x2)}. m The standard deviation and Pearson correlation coefficient are used to score the importance of a feature to reflect its significance. Based on the analysis of the feature's volatility and correlation, the lower the standard deviation, the lower the volatility, the lower the feature's discriminative power, and the smaller the feature's impact on the equipment's stable state. Furthermore, the Pearson correlation coefficient also reflects the degree of correlation between the feature and the equipment's operating results. Figure 2 The image shown is a partial example of the feature importance score calculation results in this example. In this embodiment, it can be seen that feature 9 is more important than other features.
[0068] Then, proceed to step S4, as follows:
[0069] In step S4-1, an isolated forest is generated from all data Y, and outliers are calculated for each period. Where e is the average path length of all trees in the isolated forest, and c is the normalization factor for comparing forests of different sizes. The calculated outliers tend to be between 0 and 1. The larger the outlier, the greater the probability of an anomaly in the current cycle. In this example, τ = 0.55 is predefined, that is, the periodic dataset V with outliers greater than 0.55 is defined as anomaly periodic data.
[0070] In step S4-2, all variables v in the abnormal periodic data are traversed. i Find the variable v iThe feature set χ={x is calculated as a parameter p , ..., x q}, where 1≤p≤q≤m, and this set χ is a subset of X but not necessarily continuous, then the feature importance score set of set χ is ξ={f(x p ), ..., f(x) q There exists f(x)} j )∈ξ,f(x k )∈F-ξ, and f(x) j )>δf(x k In this example, δ = 2 is predefined. If the variable vi meets the above description, then vi is defined as the variable to be monitored and added to the monitoring variable dictionary R;
[0071] In step S4-3, among the variables other than the monitoring variable dictionary R, some expert knowledge indicates that certain variables are highly correlated with program results and equipment anomalies, so these variables are added to the monitoring variable dictionary R.
[0072] Finally, proceed to step S5, where the variables in the monitoring variable dictionary R are monitored in real time on the industrial platform software.
[0073] See Figure 3 The diagram shown is a structural block diagram of a device for automatically generating PLC program variable monitoring information according to the present invention, which includes at least:
[0074] The data acquisition module is used to collect and preprocess historical time-series variable data packets to obtain historical datasets;
[0075] The feature extraction module is used to perform feature extraction calculations on historical datasets and obtain feature sets;
[0076] The feature importance score calculation module is used to calculate the feature importance score for all features in the feature set;
[0077] The monitoring information calculation module is used to calculate and analyze highly correlated variables based on feature importance scores, isolated forest algorithms, and expert knowledge, and add them to the monitoring variable dictionary as monitoring information. The variables in this variable dictionary are then used for real-time monitoring on the industrial platform software.
[0078] Specifically, such as Figure 4 The diagram shown illustrates the system framework of the method and apparatus for automatically generating PLC program variable monitoring information in a real-world platform software application.
[0079] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.
[0080] It should be understood that the exemplary embodiments described herein are illustrative and not restrictive. Although one or more embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art will understand that various changes in form and detail may be made without departing from the spirit and scope of the invention as defined by the appended claims.
Claims
1. A method for automatically generating PLC program variable monitoring information, characterized in that, At least the following steps are included: Step S1: Collect and preprocess historical time-series variable data packets to obtain historical datasets; Step S2: Feed the historical dataset to the feature extraction module for feature extraction calculation and obtain the feature set; Step S3: Calculate the feature importance score for all features in the feature set; Step S4: Based on feature importance scores, the isolated forest algorithm, and expert knowledge calculation and analysis, highly correlated variables are selected as monitoring information and added to the monitoring variable dictionary. The variables in this variable dictionary are then used for real-time monitoring on the industrial platform software. In step S3, the standard deviation and Pearson correlation coefficient of all features in the feature set are calculated. Based on the standard deviation and Pearson correlation coefficient, feature importance is scored, and the features are defined. Feature importance score The specific calculation formula is as follows: ; in, Indicates standard deviation, The Pearson correlation coefficient between this feature and the program results. The size of the feature set.
2. The method for automatically generating PLC program variable monitoring information according to claim 1, characterized in that, In step S1, the categories of historical data include at least PLC variables and sensor data monitoring the status of equipment. Each data packet is divided into datasets according to the time span of the minimum operating cycle of the equipment.
3. The method for automatically generating PLC program variable monitoring information according to claim 1, characterized in that, In step S2, the feature extraction module adopts a cluster-based unsupervised learning method and extracts latent features based on the local and global variance of the data.
4. The method for automatically generating PLC program variable monitoring information according to claim 1, characterized in that, Step S4 includes the following steps: S4-1, calculates the anomaly score for the device's abnormal cycle using the Isolation Forest algorithm; the anomaly score is greater than... This is defined as an abnormal cycle. For predefined values; S4-2, Analyze all variables during abnormal periods, if characteristics exist. and ,in It is determined by variables The features obtained from the calculation, and the features Not a variable The features obtained from the calculation, and Then Define the variables that need to be monitored and add them to the monitoring variable dictionary. For predefined values; S4-3, based on expert knowledge, indicates that some variables are particularly relevant and are added to the monitoring variable dictionary as monitoring information.
5. The method for automatically generating PLC program variable monitoring information according to claim 4, characterized in that, In S4-1, the device cycle time calculated using the isolated forest algorithm is generated from all collected device cycle time data. The abnormal score is calculated using the following formula: ; Where e is the average path length of all trees in the generated isolated forest, and c is the normalization factor for comparing forests of different sizes.
6. The device for automatically generating PLC program variable monitoring information as used in any of the methods described in claims 1-5, characterized in that, At least including: The data acquisition module is used to collect and preprocess historical time-series variable data packets to obtain historical datasets; The feature extraction module is used to perform feature extraction calculations on historical datasets and obtain feature sets; The feature importance score calculation module is used to calculate the feature importance score for all features in the feature set; The monitoring information calculation module is used to calculate and analyze highly correlated variables based on feature importance scores, isolated forest algorithms, and expert knowledge, and add them to the monitoring variable dictionary as monitoring information. The variables in this variable dictionary are then used for real-time monitoring on the industrial platform software.
7. The device for automatically generating PLC program variable monitoring information according to claim 6, characterized in that, In the feature importance score calculation module, the standard deviation and Pearson correlation coefficient of all features in the feature set are calculated. Based on the standard deviation and Pearson correlation coefficient, feature importance is scored, and the feature is defined. Feature importance score The specific calculation formula is as follows: ; in, Indicates standard deviation, The Pearson correlation coefficient between this feature and the program results. The size of the feature set.
8. The device for automatically generating PLC program variable monitoring information according to claim 6, characterized in that, The data processing of the monitoring information calculation module includes the following steps: S4-1, calculates the anomaly score for the device's abnormal cycle using the Isolation Forest algorithm; the anomaly score is greater than... This is defined as an abnormal cycle. For predefined values; S4-2, Analyze all variables during abnormal periods, if characteristics exist. and ,in It is determined by variables The features obtained from the calculation, and the features Not a variable The features obtained from the calculation, and Then Define the variables that need to be monitored and add them to the monitoring variable dictionary. For predefined values; S4-3, based on expert knowledge, indicates that some variables are particularly relevant and are added to the monitoring variable dictionary as monitoring information.
9. The device for automatically generating PLC program variable monitoring information according to claim 8, characterized in that, In S4-1, the device cycle time calculated using the isolated forest algorithm is generated from all collected device cycle time data. The abnormal score is calculated using the following formula: ; Where e is the average path length of all trees in the generated isolated forest, and c is the normalization factor for comparing forests of different sizes.
Citation Information
Patent Citations
Abnormality detection method and device for wafer etching process
CN114417737A
False comment detection method and system based on feature fusion and screening, and medium
CN114492423A