DCS system internal fault positioning method and system
By combining LOF and OCSVM exception detection algorithms and K-Means clustering algorithms, combining contour coefficients to optimize clustering results, and arranging event data in chronological order, the problem of inaccurate fault positioning in the existing technology is solved and the fault detection accuracy is improved and system stability.
Patent Information
- Application Number
- CN202410792951.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-11-12
AI Technical Summary
The existing fault positioning methods have failed to effectively solve the shortcomings of clustering algorithms in application, resulting in inaccurate fault positioning, affecting the stability and reliability of the system.
Combining the LOF and OCSVM exception detection algorithms to eliminate abnormal data, using the K-Means algorithm to combine the contour coefficients for clustering, select the best cluster number, and arrange the event data in chronological order to troubleshoot faults.
It improves the accuracy of fault detection, enhances the stability and reliability of the system, reduces calculation costs, and improves the applicability and generalization capabilities of the algorithm.
Smart Images

Figure CN118940072A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of fault location, and in particular to a method and system for locating internal faults of a DCS system. Background Art
[0002] The technical means of fault location through clustering algorithms are relatively common in the industrial field, but clustering algorithms have their own characteristics, and the data characteristics of each field are different. Appropriate clustering algorithms should be selected according to the data characteristics of their respective fields. Common clustering algorithms include K-Means, DBSCAN, hierarchical clustering, etc. Each algorithm has its advantages and disadvantages. For example, it is sensitive to abnormal data, difficult to process high-dimensional data, difficult to process large batches of data, etc., so some technical means should be used to make up for these shortcomings. For example, if it is sensitive to abnormal data, the abnormal data can be removed first through the anomaly detection algorithm, and then clustering can be performed; for high-dimensional data, dimensionality reduction techniques such as PCA, t-SNE, etc. can be used to reduce the data dimension; for large batches of data, distributed computing technology can be used to improve processing efficiency.
[0003] However, most of the existing fault location methods do not take into account the shortcomings of clustering algorithms in applications, which may lead to inaccurate fault location and unpredictable consequences. Therefore, when designing and implementing a fault location system, in addition to selecting appropriate data features and clustering algorithms, it is also necessary to tune and improve the algorithm for specific application scenarios to ensure the accuracy and reliability of the system.
[0004] The present invention discloses a method and system for locating internal faults in a DCS system, and solves the following technical problems: first, by combining the two abnormality detection algorithms of LOF and OCSVM, abnormal data in event data in the DCS system are eliminated, thereby making up for the deficiency of the K-Means algorithm in being sensitive to abnormal data; second, the K-Means algorithm is combined with the silhouette coefficient to achieve the best clustering on the DCS event data; third, the event data in each cluster is arranged in chronological order to obtain a continuous event set; finally, according to the sorted event data, the faults in the DCS system are checked. Compared with the prior art, the method for locating internal faults in a DCS system proposed by the present invention can improve the accuracy of fault detection and enhance the stability of the system. Summary of the invention
[0005] In view of the above-mentioned problems, the present invention is proposed.
[0006] Therefore, the problem to be solved by the present invention is: how to solve the problem that most of the existing fault location methods do not take into account the shortcomings of clustering algorithms in applications.
[0007] To solve the above technical problems, the present invention provides the following technical solution: A method for locating internal faults in a DCS system, including detecting abnormal data by combining two abnormal data detection algorithms, namely LOF and OCSVM, in the DCS system event data, taking the intersection of the detection results of the LOF algorithm and the OCSVM detection results and removing them from the DCS system event database; using the K-Means algorithm combined with the silhouette coefficient to cluster the remaining event data, calculating the silhouette coefficient under different clustering numbers K multiple times, and selecting the K value with the highest silhouette coefficient as the optimal clustering number; arranging the event data in the K clusters after clustering in the order of events; and troubleshooting according to the K arranged event sets one by one.
[0008] As a preferred solution of the method for locating internal faults in a DCS system described in the present invention, wherein: the LOF refers to the Local Outlier Factor algorithm, which calculates the dispersion degree of each sample, calculates the ratio of the dispersion degree of each sample to the samples in the neighborhood, and if it is greater than a given threshold, the sample is determined to be abnormal data. Five definitions are made for LOF, including Definition 1, Definition 2, Definition 3, Definition 4, and Definition 5; Definition 1 includes obtaining the k-distance d k (m) of the sample point m. In the data set D, the distance between two sample points m and n is d(m,n). If it satisfies that there are at least k points n′∈S{x≠m} not including m in the set D such that d(m,n′)≤d(m,n), and at most k - 1 points n′∈S{x≠m} not including m in the set D such that d(m,n′)<d(m,n), then d k (m) = d(m,n); Definition 2 includes that the reachable distance from the sample point n to m is expressed as:
[0009] distance k (m,n) = max{distance k (m), d(m,n)}
[0010]
[0011] where distance k (m,n) is the k-th reachable distance from the sample point n to m, distance k (m) is the k-distance of the sample point m, st. is to satisfy the condition, d(m,n) is the distance between the sample point n and m, x m is the abscissa of the sample point m, x n is the abscissa of the sample point n, y m is the ordinate of the sample point m, y nis the ordinate of sample point n; the kth reachable distance from sample point n to m is at least the kth distance from sample point m, and the reachable distances from the k points closest to sample point m to m are all d k (m); The k-distance domain of the sample point m included in the definition 3 is expressed as:
[0012] N k (m)={q∈D\{m}∣d(m,q≤distance k (m))}
[0013] Among them, N k (m) is the k-distance domain of sample point m, q is any sample point in the data set D except sample point m, d(m,q≤distance k (m)) is the distance from sample point m that is less than or equal to the kth distance of sample point m.
[0014] As a preferred solution of the method for locating internal faults of a DCS system described in the present invention, wherein: the local reachable density of the sample point m included in the definition 4 is expressed as:
[0015]
[0016] Among them, lrd k (m) is the local reachability density of sample point m, and n is the sample point in the k-distance domain of sample point m. The local reachability density of sample point m represents the average reachable distance from all sample points in the k-th domain of m to m. If the sample points around sample point m are sparsely distributed, the k-distance domain of m is large. For sample point n in the k-distance domain of sample point m, the probability that m is in the k-distance domain of n is small. k The probability of (m,n)=d(m,n) is large, and the local reachable density of m is small. On the contrary, if the sample points around the sample point m are densely distributed, the local reachable density of m is large, and the local reachable density explains the density of the local area of the sample point; the definition 5 includes the local outlier factor expressed as:
[0017]
[0018] Among them, LOF k (m) is the local outlier factor of sample point m, lrd k (n) is the local reachable density of sample point n.
[0019] As a preferred solution of the method for locating internal faults of a DCS system described in the present invention, the OCSVM refers to a single-class support vector machine algorithm, which performs feature mapping. Assume that the input data set is Map the data to the high-order feature space R through the mapping function φ(x) p ; Set the optimization goal, OCSVM finds the optimal hyperplane by solving the optimization problem as:
[0020]
[0021] Among them, w is the weight vector in the feature space, ξ i is a slack variable, ρ is the bias of the hyperplane, v∈(0,1] is a parameter that controls the proportion of abnormal data, I is the number of sample points in the data set, and i is the index of each data point from 1 to I during the traversal process; the constraints of the optimization problem are expressed as:
[0022] (w·φ(x i ))≥ρ-ξ i ,ξ≥0,i=1,2,...,I
[0023] Among them, φ(x i ) is to convert the data point x i Mapping function mapped to high-dimensional feature space; by introducing Lagrange multipliers, the optimization problem is converted into a dual problem, expressed as:
[0024]
[0025]
[0026]
[0027] Among them, α i is the Lagrange multiplier, j is the index of the data point different from i, φ(x j ) is to convert the data point x j Mapping function mapped to high-dimensional feature space; through the kernel function, avoid explicit calculation of high-dimensional feature mapping, thereby simplifying the calculation expression as:
[0028] K(x i ,x j )=φ(x i )·φ(x j )
[0029]
[0030]
[0031]
[0032] Among them, K(x i ,x j ) is the kernel function; after solving the optimization problem, we get the Lagrange multiplier αi The decision function used to construct the decision is expressed as:
[0033]
[0034] If f(x)≥0, x is judged as normal data, otherwise, it is judged as abnormal data; the final result set of abnormal data detected is P, satisfying P∈L and P∈O, where L is the result set of the LOF algorithm and O is the result set of the OCSVM algorithm.
[0035] As a preferred solution of the method for locating internal faults in a DCS system described in the present invention, the K-Means algorithm includes selecting a K value, determining the number of clusters K to be divided; randomly selecting K data points as initial centroids μ1, μ2, ..., μ k ; For each data point x i Assigned to the cluster where the nearest centroid is located, the distance between the data point and the centroid is calculated using the Euclidean distance expressed as:
[0036] cluster(x i ) = argmin l ||x i -μ l || 2
[0037] Among them, ||x i -μ j || 2 For data point x i With the center of mass μ l The Euclidean distance of cluster(x i ) is the distance between the data point and the centroid; recalculate the centroid of each cluster, the centroid is the average value of all data points in the cluster, expressed as:
[0038]
[0039] Among them, C l are all data points in the lth cluster, |C l ∣ is the number of data points in cluster l; repeat the operation until the centroid no longer changes or the maximum number of iterations is reached. The goal of K-Means is to minimize the sum of squared distances from all data points to the centroid of the cluster to which they belong, that is, the sum of squared errors, expressed as:
[0040]
[0041] Among them, SSE is the sum of squared errors; for the clustering results of each K value, the silhouette coefficient is calculated to measure the compactness and separation of the clustering results. The value is between -1 and 1, and the closer it is to 1, the better the clustering effect.
[0042] As a preferred solution of the method for locating internal faults of a DCS system described in the present invention, the silhouette coefficient includes: for each sample point c, calculating the average distance with other points in the cluster to obtain a(c); for each sample point c, calculating the average distance with all points of the nearest other clusters to obtain b(c); calculating the silhouette coefficient of each sample point according to the formula; calculating the average value of the silhouette coefficients of all sample points to obtain the silhouette coefficient of the entire clustering result, which is expressed as:
[0043]
[0044] Among them, a(c) is the average distance from sample c to other points in its cluster, b(c) is the average distance from sample c to other clusters of its nearest neighbors, and s(c) is the average silhouette coefficient of all sample points. The average silhouette coefficients corresponding to different K values are compared, and the K value with the highest average silhouette coefficient is selected as the optimal number of clusters.
[0045] As a preferred solution of the method for locating internal faults of a DCS system described in the present invention, the arrangement in event order includes arranging the event data of K clusters in time order to obtain K event sets. The troubleshooting includes: Troubleshoot.
[0046] Another object of the present invention is to provide a system for locating a DCS system internal fault, which can solve the problem of locating a DCS system internal fault by constructing a DCS system internal fault locating system.
[0047] In order to solve the above technical problems, the present invention provides the following technical solutions: a DCS system internal fault location system, comprising an abnormal data detection module, a clustering module, a sorting module and a fault troubleshooting module; the abnormal data detection module is used to perform abnormal data detection in the DCS system event data in combination with the two abnormal data detection algorithms LOF and OCSVM, taking the intersection of the LOF algorithm detection result and the OCSVM detection result and removing them from the DCS system event database; the clustering module is used to cluster the remaining event data using the K-Means algorithm combined with the silhouette coefficient, repeatedly calculating the silhouette coefficient under different clustering numbers K values, and selecting the K value with the highest silhouette coefficient as the optimal clustering number; the sorting module is used to arrange the event data in the K clusters after clustering in the order of events; the fault troubleshooting module is used to troubleshoot faults one by one according to the K arranged event sets.
[0048] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method for locating internal faults of a DCS system when executing the computer program.
[0049] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for locating internal faults of a DCS system.
[0050] The beneficial effects of the present invention are as follows: the internal fault location method of a DCS system provided by the present invention compensates for the shortcomings of the K-Means clustering algorithm itself through an anomaly detection algorithm. First, the K-Means algorithm is very sensitive to abnormal data points, and the abnormal points will significantly affect the position of the centroid, causing the clustering results to deviate from the actual situation, thereby reducing the clustering effect. Eliminating these abnormal points can make the centroid more accurately represent the center position of normal data, thereby improving the representativeness and accuracy of clustering. Secondly, abnormal data points will cause the convergence speed of the K-Means algorithm to slow down and increase the calculation cost. By pre-eliminating abnormal data, the amount of calculation can be reduced, the convergence speed of the algorithm can be accelerated, and the operating efficiency can be improved; by combining the LOF and OCSVM anomaly detection algorithms to optimize the anomaly detection results, the accuracy and robustness of anomaly detection can be improved. Each algorithm has its unique advantages and disadvantages when detecting abnormal data. By combining the results of the two algorithms, their respective advantages can be comprehensively utilized to make up for the shortcomings of a single algorithm. For example, the LOF algorithm is good at detecting local density differences, while the OCSVM algorithm identifies anomalies by learning global features. The combination of the two can capture local and global anomalies at the same time, increasing the accuracy of anomaly detection; using specific parameter optimization methods to optimize anomaly detection and clustering. First, optimizing parameters can improve the performance and accuracy of the algorithm, making it better adaptable to data sets of different types and complexities. By adjusting parameters, the algorithm can be made more flexible, thereby adapting to different data distributions, noise levels and anomaly types, and improving the applicability and generalization ability of the algorithm. Secondly, optimizing parameters can improve the stability and robustness of the algorithm, reduce the sensitivity of the algorithm to initial values and data distribution, and make it more reliable and stable in an environment with greater uncertainty and variability. Compared with the prior art, the DCS system internal fault location method and system proposed in the present invention have good robustness, can accurately locate faults, improve the efficiency and accuracy of fault location, and improve the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0052] Figure 1The present invention provides a flow chart of a method for locating a fault in a DCS system according to a first embodiment of the present invention.
[0053] Figure 2 This is a structural diagram of a DCS system internal fault location system provided by the second embodiment of the present invention.
[0054] Figure 3 A flow chart of a DCS system internal fault locating method provided by a third embodiment of the present invention.
[0055] Figure 4 The third embodiment of the present invention provides a method for locating a fault in a DCS system, and provides data content of event data in the DCS system.
[0056] Figure 5 A flowchart of a method for locating internal faults in a DCS system using kernel density to optimize anomaly detection algorithm parameters is provided in the third embodiment of the present invention.
[0057] Figure 6 A schematic diagram of a DCS system internal fault location method combined with LOF and OCSVM anomaly detection algorithms provided by a third embodiment of the present invention.
[0058] Figure 7 A schematic diagram of achieving optimal clustering using a K-Means algorithm for locating internal faults in a DCS system provided by a third embodiment of the present invention.
[0059] Figure 8 A flowchart of a method for locating and resolving faults according to clustering results of a method for locating internal faults of a DCS system provided in a third embodiment of the present invention. DETAILED DESCRIPTION
[0060] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0061] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0062] Example 1
[0063] Reference Figure 1, which is the first embodiment of the present invention, and provides a method for locating internal faults in a DCS system, comprising: performing abnormal data detection in the DCS system event data by combining the two abnormal data detection algorithms of LOF and OCSVM, taking the intersection of the detection result of the LOF algorithm and the detection result of the OCSVM and removing them from the DCS system event database; clustering the remaining event data by using the K-Means algorithm combined with the silhouette coefficient, calculating the silhouette coefficient under different clustering numbers K values for multiple times, and selecting the K value with the highest silhouette coefficient as the optimal clustering number; arranging the event data in the K clusters after clustering in the order of events; and troubleshooting the faults one by one according to the K arranged event sets.
[0064] S1. In the DCS system event data, the two abnormal data detection algorithms LOF and OCSVM are combined to perform abnormal data detection, and the intersection of the LOF algorithm detection result and the OCSVM detection result is taken and removed from the DCS system event database.
[0065] The LOF algorithm is a density-based unsupervised abnormal data monitoring algorithm, which is mainly suitable for abnormal data monitoring in low-dimensional local area space. The idea of the algorithm is to first calculate the discreteness of each sample, and then calculate the discreteness ratio of each sample to the samples in its field. If it is greater than a given threshold, the sample is judged as abnormal data. The description of the algorithm relies on the following definitions:
[0066] Definition 1: Get the k distance d of sample point m k (m).
[0067] In the data set D, the distance between two sample points m and n is d(m,n) if:
[0068] (1) In the set D, there are at least k points n′∈S{x≠m} that do not include m, satisfying d(m,n′)≤d(,m,n).
[0069] (2) In the set D, there are at most k-1 points n′∈S{x≠m} that do not include m, satisfying d(m,n′) <d(m,n)。
[0070] Then d k (m) = d(m,n).
[0071] Definition 2: The reachable distance from sample point n to m is expressed as:
[0072] distance k (m,n)=max{distance k (m),d(m,n)}
[0073]
[0074] Among them, distance k (m,n) is the kth reachable distance from sample point n to m, distance k (m) is the kth distance of sample point m, st. satisfies the condition, d(m,n) is the distance between sample points n and m, x m is the horizontal coordinate of sample point m, x n is the horizontal coordinate of sample point n, y m is the ordinate of sample point m, y n is the ordinate of sample point n.
[0075] The kth reachable distance from sample point n to m is at least the kth distance from sample point m, and the reachable distances from the k points closest to sample point m to m are all d k (m).
[0076] Definition 3: The k-distance domain of a sample point m is expressed as:
[0077] N k (m)={q∈D\{m}∣d(m,q≤distance k (m))}
[0078] Among them, N k (m) is the k-distance domain of sample point m, q is any sample point in the data set D except sample point m, d(m,q≤distance k (m)) is the distance from sample point m that is less than or equal to the kth distance of sample point m.
[0079] Definition 4: The local reachable density of sample point m is expressed as:
[0080]
[0081] Among them, lrd k (m) is the local reachability density of sample point m, and n is the sample point in the k-distance field of sample point m.
[0082] The local reachability density of sample point m represents the average reachable distance from all sample points in the kth domain of m to m. If the sample points around sample point m are sparsely distributed, the k-distance domain of m is large. For sample point n in the k-distance domain of sample point m, the probability that m is in the k-distance domain of n is small, and the distance k The probability that (m,n)=d(m,n) is large, and the local reachable density of m is small; conversely, if the sample points around sample point m are densely distributed, the local reachable density of m is large. In short, the local reachable density explains the density of the local area of the sample point.
[0083] Definition 5: The local outlier factor is expressed as:
[0084]
[0085] Among them, LOF k (m) is the local outlier factor of sample point m, lrd k (n) is the local reachable density of sample point n.
[0086] It is known from the local outlier factor algorithm that if the ratio of the local reachable density of the k nearest neighbor samples of the sample point m to the local reachable density of m is closer to 1, it means that the m point is more similar to its neighborhood points; if the ratio of the local reachable density of the k nearest neighbor samples of the sample point m to the local reachable density of m is less than 1, it means that the density of m is greater than the density of its neighborhood points; if the ratio of the local reachable density of the k nearest neighbor samples of the sample point m to the local reachable density of m is greater than 1, it means that the density of m is less than the density of its neighborhood points and can be regarded as an isolated point, then the possibility that the sample point m is an abnormal data is greater.
[0087] The basic idea of the OCSVM single-class support vector machine algorithm is to map the input data from the original space to a high-dimensional feature space through a mapping function, and find a hyperplane in the feature space so that the distance between the hyperplane and most of the data points is maximized, and the hyperplane is as close to the origin as possible. The core of OCSVM is to find the optimal hyperplane by solving an optimization problem. Its formula is derived as follows:
[0088] Perform feature mapping and assume that the input data set is Map the data to the high-order feature space R through the mapping function φ(x) p .
[0089] Setting the optimization goal, OCSVM finds the optimal hyperplane by solving the optimization problem:
[0090]
[0091] Among them, w is the weight vector in the feature space, ξ i is a slack variable used to tolerate a certain error, ρ is the bias of the hyperplane, v∈(0,1] is a parameter that controls the proportion of abnormal data, I is the number of sample points in the data set, and i is the index of each data point from 1 to I during the traversal process.
[0092] The constraints of the above optimization problem are expressed as:
[0093] (w·φ(x i ))≥ρ-ξ i ,ξ≥0,i=1,2,...,I
[0094] Among them, φ(x i) is to convert the data point x i A mapping function that maps to a high-dimensional feature space. These constraints ensure that most data points are correctly classified as normal.
[0095] By introducing Lagrange multipliers, the above optimization problem can be transformed into its dual problem, which can be expressed as:
[0096]
[0097]
[0098]
[0099] Among them, α i is the Lagrange multiplier, j is the index of the data point different from i, φ(x j ) is to convert the data point x j Mapping function to high-dimensional feature space.
[0100] By using kernel functions, we can avoid explicitly calculating high-dimensional feature maps, thereby simplifying the calculation:
[0101] K(x i ,x j )=φ(x i )·φ(x j )
[0102]
[0103]
[0104]
[0105] Among them, K(x i ,x j ) is the kernel function.
[0106] After solving the optimization problem, we get the Lagrange multiplier α i It can be used to construct a decision function expressed as:
[0107]
[0108] If f(x) ≥ 0, x is judged as normal data, otherwise, it is judged as abnormal data.
[0109] The final result set of abnormal data detected is P, which satisfies P∈L and P∈O, where L is the result set of the LOF algorithm and O is the result set of the OCSVM algorithm. The LOF algorithm is good at detecting abnormal points with different local densities and can find data points that are abnormal in the local environment, while the OCSVM algorithm is good at detecting abnormal points in the global scope. LOF and OCSVM perform anomaly detection from the local and global perspectives respectively. The complementarity enables the intersection results to better cover various types of abnormal points. A single algorithm may produce false positives. By taking the intersection of the results of the two algorithms, the false positives that may be caused by a single algorithm can be reduced.
[0110] S2. Use the K-Means algorithm combined with the silhouette coefficient to cluster the remaining event data, calculate the silhouette coefficient under different clustering numbers K values multiple times, and select the K value with the highest silhouette coefficient as the optimal clustering number.
[0111] The main steps of the K-Means algorithm are as follows:
[0112] Step 1: Select the K value and determine the number of clusters K to be divided.
[0113] Step 2: Randomly select K data points as the initial centroids μ1, μ2, ..., μ k .
[0114] Step 3: For each data point x i Assigned to the cluster where the nearest centroid is located, the distance between the data point and the centroid is calculated using the Euclidean distance expressed as:
[0115] cluster(x i ) = argmin l ||x i -μ l || 2
[0116] Among them, ||x i -μ j || 2 For data point x i With the center of mass μ l The Euclidean distance of cluster(x i ) is the distance between the data point and the centroid.
[0117] Step 4: Recalculate the centroid of each cluster. The centroid is the average value of all data points in the cluster, expressed as:
[0118]
[0119] Among them, C l are all data points in the lth cluster, |C l ∣ is the number of data points in cluster l;
[0120] Step 5: Repeat steps 3 and 4 until the centroid no longer changes or the maximum number of iterations is reached. The goal of K-Means is to minimize the sum of squared distances from all data points to the centroid of their clusters, that is, the sum of squared errors, expressed as,
[0121]
[0122] Here, SSE is the sum of squared errors.
[0123] For each K value clustering result, calculate its silhouette coefficient. The silhouette coefficient measures the compactness and separation of the clustering results. The value is between -1 and 1. The closer to 1, the better the clustering effect. The specific calculation steps are as follows:
[0124] For each sample point c, calculate the average distance to other points in the cluster and get a(c).
[0125] For each sample point c, calculate the average distance between it and all points in the nearest other clusters to obtain b(c).
[0126] The silhouette coefficient of each sample point is calculated according to the formula.
[0127] Calculate the average of the silhouette coefficients of all sample points to get the silhouette coefficient of the entire clustering result.
[0128] The calculation formula is as follows:
[0129]
[0130] Among them, a(c) is the average distance from sample c to other points in its cluster, b(c) is the average distance from sample c to other clusters of its nearest neighbors, and s(c) is the average of the silhouette coefficients of all sample points.
[0131] The average silhouette coefficients corresponding to different K values are compared, and the K value with the highest average silhouette coefficient is selected as the optimal number of clusters. The higher the average silhouette coefficient, the better the clustering effect.
[0132] S3. Arrange the event data in the K clusters after clustering in order of events.
[0133] Arrange the event data of K clusters in chronological order to obtain K event sets
[0134]
[0135] S4. According to the K arranged event sets, troubleshoot the faults one by one.
[0136] According to K ordered event sets Troubleshoot.
[0137] Example 2
[0138] Reference Figure 2 , which is the second embodiment of the present invention, is different from the previous embodiment in that it provides a DCS system internal fault location system, including: an abnormal data detection module, a clustering module, a sorting module and a fault troubleshooting module.
[0139] The abnormal data detection module is used to detect abnormal data in the DCS system event data by combining the LOF and OCSVM abnormal data detection algorithms, taking the intersection of the LOF algorithm detection results and the OCSVM detection results and removing them from the DCS system event database.
[0140] The clustering module is used to cluster the remaining event data using the K-Means algorithm combined with the silhouette coefficient, calculate the silhouette coefficient under different clustering numbers K values multiple times, and select the K value with the highest silhouette coefficient as the optimal clustering number.
[0141] The sorting module is used to arrange the event data in the K clusters after clustering in event order.
[0142] The fault troubleshooting module is used to troubleshoot faults one by one according to the K arranged event sets.
[0143] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0144] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0145] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0146] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0147] Example 3
[0148] Reference Figure 3 to Figure 8 , which is the third embodiment of the present invention, and which is different from the first two embodiments in that it is used to verify and illustrate the technical effects adopted in the present invention, so as to verify the real effects of this method.
[0149] The present invention proposes a method and system for locating internal faults in a DCS system. The specific process of fault locating is shown in the attached figure. Figure 3 shown.
[0150] The event data content in the unifyDB database of the DCS system is as shown in the attached Figure 4 As shown. The data content of the event data includes the hid attribute of QString type, the time attribute of QDateTime type, the ac attribute of int type, the type attribute of int type, the severity attribute of int type, the tagName attribute of QString type, the eventText attribute of QString type, the description attribute of QString type, and the altDescription attribute of QString type. Among them, tagName and hid are the unique identifiers of an event point in the DCS system; time is the time when the event occurs; ac indicates the state of the event, which is divided into alm, clr, and other; type indicates the type of the event, and the event types are divided into process alarm (PA), system alarm (SY), operator operation record (OA), SOE event (SQ), DPU generated event (PG), user online editing event (EA), and others (OT).
[0151] For event data, we first use the LOF algorithm and the OCSVM algorithm to detect abnormal data. The key parameters of the LOF algorithm are K (number of neighbors), and the key parameters of the OCSVM are kernel function, ν (abnormal rate) and γ (kernel function parameter). The kernel functions mainly include linear kernel, RBF kernel (Gaussian radial basis function), polynomial kernel, etc. The optimal parameters of the abnormal data detection algorithm are determined by calculating the density of the remaining data. The specific process is as follows. Figure 5 As shown. The core idea of this method is: use each set of parameters to run the anomaly detection algorithm, detect and remove abnormal data, retain the remaining data, calculate the density of the remaining data, and the parameter with the largest density is the optimal parameter of the algorithm. Use kernel density estimation (KDE) to calculate the probability density of the data. The calculation method is:
[0152]
[0153] in, is the estimated density at point x, I is the number of data points, h is the bandwidth parameter that controls the degree of smoothing, and K is the kernel function. The optimal parameters of the LOF and OCSVM algorithms are determined as shown in the attached figure. Figure 6 As shown, the intersection of the abnormal data detected by the LOF algorithm and the abnormal data detected by the OCSVM algorithm is taken as the final result, and these abnormal data are removed from the database.
[0154] In a DCS system, the occurrence of a fault or accident usually leads to a series of related events, which may include a sharp change in sensor readings, abnormal controller responses, triggering of alarm signals, etc. These event data are characterized by time concentration, high correlation and similar features. All events occur in a short period of time, and there is an obvious causal relationship between the events. The sensor readings and control signals caused by the accident have similar abnormal characteristics. Through the clustering algorithm, these event data will be identified as a cluster because they have high similarity in the feature space. This clustering result can help engineers quickly locate the root cause of the accident and take effective countermeasures. Before clustering the data, we must first determine a reasonable range of clustering number K values. For each K value, run the M-Means algorithm, calculate the silhouette coefficient for the clustering results of each K value, and determine which K value has the highest silhouette coefficient, which means that the wrestling effect under this K value is the best. The clustering effect is shown in the attached figure. Figure 7 As shown in the figure. The data in the clusters after clustering are often a series of event data caused by accidents. This is because accidents usually lead to drastic changes in multiple points in the system, and these changes have a high degree of time concentration and similarity. Clustering algorithms can effectively identify and group these related data, providing strong support for fault location and analysis.
[0155] After reaching the best clustering, extract the data in each cluster from the clustering results, sort the data of each cluster by time, ensure that the data is arranged in the order of occurrence, and find the time areas with dense occurrence in the time-sorted data. These areas usually correspond to the period of system failure, identify potential fault intervals, check the designed equipment and sensors, and determine which equipment or sensors may be the source of the fault. Finally, perform fault recovery and prevention measures based on the fault analysis results. The specific process of locating and solving faults is shown in the attached figure. Figure 8 shown.
[0156] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for locating internal faults in a DCS system, characterized in that: include, In the DCS system event data, the two abnormal data detection algorithms LOF and OCSVM are combined to detect abnormal data, and the intersection of the LOF algorithm detection result and the OCSVM detection result is taken and removed from the DCS system event database; The remaining event data are clustered using the K-Means algorithm combined with the silhouette coefficient. The silhouette coefficients under different clustering numbers K are calculated multiple times, and the K value with the highest silhouette coefficient is selected as the optimal clustering number. Arrange the event data in the K clusters after clustering in order of events; According to the K arranged event sets, troubleshoot the faults one by one.
2. A DCS system internal fault location method according to claim 1, characterized in that: The LOF refers to the local outlier factor algorithm, which calculates the discreteness of each sample and the discreteness ratio of each sample to the samples in the field. If it is greater than a given threshold, the sample is determined to be abnormal data. LOF is defined in five ways, including definition one, definition two, definition three, definition four and definition five. The said definition one includes obtaining the k-distance d k (m) of the sample point m. In the data set D, the distance between two sample points m and n is d(m, n). If it satisfies that there are at least k points n' ∈ S{x≠m} not including m in the set D such that d(m, n') ≤ d(m, n), and at most k - 1 points n' ∈ S{x≠m} not including m in the set D such that d(m, n') < d(m, n), then d k (m) = d(m, n); The definition 2 includes that the reachable distance from sample point n to m is expressed as, distance k (m,n)=max{distance k (m),d(M,n)} Among them, distance k (m,n) is the kth reachable distance from sample point n to m, distance k (m) is the kth distance of sample point m, st. satisfies the condition, d(m,n) is the distance between sample points n and m, x m is the horizontal coordinate of sample point m, x n is the horizontal coordinate of sample point n, y m is the ordinate of sample point m, y n is the ordinate of sample point n; The kth reachable distance from sample point n to m is at least the kth distance from sample point m, and the reachable distances from the k points closest to sample point m to m are all d k (m); The definition 3 includes that the k-distance field of the sample point m is expressed as, N k (m)={q∈D\{m}∣d(m,q≤distance k (m))} Among them, N k (m) is the k-distance domain of sample point m, q is any sample point in the data set D except sample point m, d(m,q≤distance k (m)) is the distance from sample point m that is less than or equal to the kth distance of sample point m.
3. A DCS system internal fault location method as claimed in claim 2, characterized in that: The definition 4 includes that the local reachable density of sample point m is expressed as, Among them, lrd k (m) is the local reachability density of sample point m, n is the sample point in the k-distance field of sample point m; The local reachability density of sample point m represents the average reachable distance from all sample points in the kth domain of m to m. If the sample points around sample point m are sparsely distributed, the k-distance domain of m is large. For sample point n in the k-distance domain of sample point m, the probability that m is in the k-distance domain of n is small. k The probability of (m,n)=d(m,n) is large, and the local reachable density of m is small. On the contrary, if the sample points around the sample point m are densely distributed, the local reachable density of m is large, and the local reachable density explains the density of the local area of the sample point; The definition 5 includes the local outlier factor expressed as, Among them, LOF k (m) is the local outlier factor of sample point m, lrd k (n) is the local reachable density of sample point n.
4. A DCS system internal fault location method as claimed in claim 3, characterized in that: The OCSVM refers to a single-class support vector machine algorithm for feature mapping. Suppose the input data set is Map the data to the high-order feature space R through the mapping function φ(x) p ; Setting the optimization goal, OCSVM finds the optimal hyperplane by solving the optimization problem, expressed as, Among them, w is the weight vector in the feature space, ξ i is the slack variable, ρ is the bias of the hyperplane, v∈(0,1] is a parameter that controls the proportion of abnormal data, I is the number of sample points in the data set, and i is the index of each data point from 1 to I during the traversal process; The constraints of the optimization problem are expressed as, (w·φ(x i ))≥r-ξ i ,ξ≥0,i=1,2,...,I Among them, φ(x i ) is to convert the data point x i Mapping function to high-dimensional feature space; By introducing Lagrange multipliers, the optimization problem is transformed into a dual problem, which can be expressed as: Among them, α i is the Lagrange multiplier, j is the index of the data point different from i, φ(x j ) is to convert the data point x j Mapping function to high-dimensional feature space; By using the kernel function, we avoid explicitly calculating high-dimensional feature maps, thereby simplifying the calculation expression as follows: K(x i ,x j )=φ(x i )·φ(x j ) Among them, K(x i ,x j ) is the kernel function; After solving the optimization problem, we get the Lagrange multiplier α i The decision function used to construct is expressed as, If f(x)≥0, x is judged as normal data, otherwise, it is judged as abnormal data; The final result set of abnormal data detected is P, satisfying P∈L and P∈O, where L is the result set of the LOF algorithm and O is the result set of the OCSVM algorithm.
5. A DCS system internal fault location method as claimed in claim 4, characterized in that: The K-Means algorithm includes selecting a K value and determining the number of clusters K to be divided; Randomly select K data points as the initial centroids μ1,μ2,...,μ k ; For each data point x i Assigned to the cluster where the nearest centroid is located, and the distance between the data point and the centroid is calculated using the Euclidean distance, expressed as, chuster(x i )=argmin l ||x i -μ l || 2 Among them, ||x i -μ j || 2 For data point x i With the center of mass μ l The Euclidean distance of cluster(x i ) is the distance between the data point and the centroid; Recalculate the centroid of each cluster. The centroid is the average value of all data points in the cluster, expressed as, Among them, C l are all data points in the lth cluster, |C l ∣ is the number of data points in cluster l; Repeat the operation until the centroid no longer changes or the maximum number of iterations is reached. The goal of K-Means is to minimize the sum of squared distances from all data points to the centroid of the cluster to which they belong, that is, the sum of squared errors, expressed as, Where SSE is the sum of squared errors; For the clustering results of each K value, the silhouette coefficient is calculated to measure the compactness and separation of the clustering results. The value is between -1 and 1. The closer it is to 1, the better the clustering effect.
6. A DCS system internal fault location method as claimed in claim 5, characterized in that: The silhouette coefficient includes calculating the average distance between each sample point c and other points in the cluster to obtain a(c); For each sample point c, calculate the average distance between it and all points in the nearest other clusters to obtain b(c); Calculate the silhouette coefficient of each sample point according to the formula; Calculate the average value of the silhouette coefficients of all sample points to get the silhouette coefficient of the entire clustering result, expressed as, Among them, a(c) is the average distance from sample c to other points in its cluster, b(c) is the average distance from sample c to other clusters of its nearest neighbors, and s(c) is the average value of the silhouette coefficients of all sample points; The average silhouette coefficients corresponding to different K values are compared, and the K value with the highest average silhouette coefficient is selected as the optimal number of clusters.
7. A DCS system internal fault location method as claimed in claim 6, characterized in that: The arranging in order of events includes arranging the event data of the K clusters in time order to obtain K event sets The troubleshooting includes: Troubleshoot.
8. A system using a DCS system internal fault location method as claimed in any one of claims 1 to 7, characterized in that: Including, abnormal data detection module, clustering module, sorting module and troubleshooting module; The abnormal data detection module is used to perform abnormal data detection in the DCS system event data by combining the two abnormal data detection algorithms of LOF and OCSVM, taking the intersection of the LOF algorithm detection result and the OCSVM detection result and removing them from the DCS system event database; The clustering module is used to cluster the remaining event data using the K-Means algorithm combined with the silhouette coefficient, calculate the silhouette coefficient under different clustering numbers K values multiple times, and select the K value with the highest silhouette coefficient as the optimal clustering number; The sorting module is used to arrange the event data in the K clusters after clustering in the order of events; The fault troubleshooting module is used to troubleshoot faults one by one according to the K arranged event sets.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of a DCS system internal fault locating method according to any one of claims 1 to 7 are implemented.
10. 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 a DCS system internal fault locating method according to any one of claims 1 to 7 are implemented.
