Wind power output clustering method and system based on DTW-Kmedoids algorithm
Through the improved DTW-Kmedoids algorithm and elbow rule to determine the cluster number, the problem of limited nonlinear data processing effects and unstable clustering results in wind power output scenario generation is solved, and more representative wind power output scenario generation and higher quality clustering results are achieved.
Patent Information
- Application Number
- CN202411767787.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The existing wind power output scenario generation method has limited effect when processing nonlinear data, the generated scenarios are poorly represented, and are sensitive to initial parameters, resulting in unstable cluster results and lack of automated cluster optimization criteria and systematic clustering effect evaluation mechanism.
The improved DTW-Kmedoids algorithm is used to adapt to the nonlinear characteristics of the wind power output curve through dynamic time bending distance measurement, and the optimal cluster number is automatically determined in combination with the elbow rule, a typical wind power output scene curve is generated, and a clustering effect evaluation index system is established.
It improves the representativeness and stability of wind power output scenarios, ensures that the generated typical scenarios can fully cover data diversity, and provides more accurate and reliable data support for grid scheduling and planning.
Smart Images

Figure CN119807791A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of wind power output scene generation, and in particular to a wind power output clustering method and system based on a DTW-Kmedoids algorithm. Background Art
[0002] Existing wind power output scenario generation methods usually use clustering and time series similarity analysis techniques, including K-means and K-medoids clustering algorithms, dynamic time warping (DTW) distance and other methods. K-means clustering method is widely used and suitable for big data segmentation and center scenario generation, but it is sensitive to initial conditions and has limited effect when processing nonlinear data. K-medoids selects actual samples as center points, which is suitable for small-scale data but has a high dependence on the selection of initial center points. The DTW algorithm performs well in time series similarity calculations, especially for nonlinear change analysis of wind power output, but the amount of calculation is large when combined with clustering algorithms. Although these technical means can generate certain typical wind power output scenarios, they are insufficient in dealing with data complexity and nonlinear characteristics.
[0003] Although existing methods have achieved certain results in scene generation, they still have shortcomings. First, traditional clustering methods have limited effect on processing nonlinear data, and the generated scenes are not representative enough; second, existing methods are sensitive to initial parameters, especially lack of stability in the selection of center points and number of clusters, resulting in unstable clustering results. At the same time, the selection of the number of clusters is crucial, but existing methods lack automated optimization criteria, making it difficult to ensure that the generated typical scenes can fully cover data diversity. In addition, most existing technologies have not introduced a systematic clustering effect evaluation mechanism, making it difficult to make a comprehensive assessment of clustering quality.
[0004] Therefore, how to effectively handle the nonlinear characteristics of data, optimize the selection of cluster numbers and systematically evaluate the clustering effect when generating representative wind power output scenarios is an urgent problem that technicians in this field need to solve.
[0005] This scheme aims to address the shortcomings of existing wind power output scenario generation methods and proposes a typical scenario generation method based on improved dynamic time warping distance (DTW) and Kmedoids clustering algorithm to achieve more representative wind power output scenario construction. First, the present invention introduces DTW distance calculation to adapt to the nonlinear characteristics of wind power output curves, and dynamically matches time series to improve the accuracy of similarity measurement; secondly, the improved Kmedoids algorithm combines the elbow rule to determine the optimal number of clusters in the clustering process to ensure that the number of generated scenarios is reasonable and representative. In addition, this scheme establishes a set of clustering effect evaluation indicators to systematically analyze and optimize clustering results, thereby improving the quality and stability of typical scenarios. Through this scheme, we strive to solve the problems of poor representativeness of typical scenarios, unreasonable selection of cluster numbers, and difficulty in evaluating clustering effects in the prior art, and provide more accurate and reliable data support for wind power output scheduling and planning of power systems. Summary of the invention
[0006] In view of the above-mentioned problems, the present invention is proposed.
[0007] Therefore, the problem to be solved by the present invention is: how to solve the problem that traditional clustering methods have limited effect in processing nonlinear data and the generated scenes are not representative enough; the existing methods are sensitive to initial parameters, especially lack stability in the selection of center points and number of clusters, resulting in unstable clustering results. At the same time, the selection of the number of clusters is crucial, but the existing methods lack automated optimization criteria, making it difficult to ensure that the generated typical scenes can fully cover the diversity of data. In addition, most of the existing technologies have not introduced a systematic clustering effect evaluation mechanism, making it difficult to make a comprehensive assessment of the clustering quality.
[0008] To solve the above technical problems, the present invention provides the following technical solutions: a wind power output clustering method based on the DTW-Kmedoids algorithm, comprising: interpolation, dimensionality reduction, normalization and smoothing of wind power historical data; using the dynamic time warping DTW algorithm for distance measurement, using the Kmedoids clustering algorithm for iteration to obtain clustering results, and outputting the center curve of each cluster; for clustering results with different numbers of clusters, calculating the sum of squared errors of each cluster, and determining the optimal number of clusters using the elbow rule; generating a typical wind power output scenario curve based on the clustering results under the optimal number of clusters, and establishing a clustering effect evaluation index system.
[0009] As a preferred solution of the wind power output clustering method based on the DTW-Kmedoids algorithm described in the present invention, the interpolation, dimensionality reduction, standardization and smoothing processing include using a cubic spline interpolation method to complete the missing data in the historical wind power output data; performing dimensionality reduction processing on the data, averaging the wind power output values within the same hour as the hourly wind power output value, and obtaining a 24-hour wind power output curve within the day, recorded as Pt24 = {P1,P2,...,P 24}; Normalize the data, divide the wind power output data by the total installed capacity of the wind turbine to obtain the wind power output normalized value; use the mean smoothing method to smooth the data, remove the short-term fluctuations and noise in the wind power output curve, and input the 24-hour wind power output curve P t24 , smoothing threshold θ s and smoothing times N s , calculate the absolute value of the difference between two consecutive data, recorded as ΔP i =P i -P i-1 , if ΔP i Less than the smoothing threshold θ s , no smoothing is performed and the data remain unchanged. If ΔP i Less than the smoothing threshold θ s , then for the data point P i Perform smoothing and update P i The value of is expressed as:
[0010]
[0011] Repeat the steps until the number of smoothing times reaches N s , output the smoothed historical wind power output curve P.
[0012] As a preferred solution of the wind power output clustering method based on the DTW-Kmedoids algorithm described in the present invention, wherein: the output of the central curve of each cluster includes using the dynamic time warping distance DTW algorithm to calculate the similarity between each wind power output curve, generating a distance matrix, and based on the distance matrix, performing multiple iterations through the Kmedoids clustering algorithm to optimize the position of the central curve of each cluster, and obtaining a clustering result including the optimal number of clusters and the central curve of each cluster; using the dynamic time warping distance DTW algorithm to calculate the DTW distance between any two wind power output curves; randomly selecting K curves from the data set as the initial cluster center points, expressed as:
[0013] C={C1,C2,....,C K}
[0014] Among them, C k is a historical wind power output curve P j The complete time series of ; calculate each curve P j The DTW distance to all center curves, j Assign to the center C with the smallest DTW distance k The cluster is represented by:
[0015]
[0016] Among them, Dis(P j ,C k ) is P j and C k DTW distance between them; for each cluster k, a new central curve is reselected in the cluster so that the average DTW distance between the central curve and other curves in the cluster is minimized, expressed as:
[0017]
[0018] Among them, N k is the number of curves in cluster k; repeat the iteration and gradually optimize the position of the central curve until the central curve is no longer updated or reaches the preset upper limit of iterations; after the iteration, output the central curve C of each cluster k .
[0019] As a preferred solution of the wind power output clustering method based on the DTW-Kmedoids algorithm described in the present invention, the DTW distance includes if there are two historical wind power output curves, namely P j = {P j,1 ,P j,2 ,...,P j,24} and P k = {P k,1 ,P k,2 ,...,P k,24}; Construct a cost matrix and define a 24×24-dimensional cost matrix d, where each element d(m,n) represents the Euclidean distance between time m and n, expressed as:
[0020]
[0021] Among them, P j,m P j The point at the mth moment of the curve, P k,n P k The point at the nth moment of the curve; construct a cumulative distance matrix, define the cumulative distance matrix D, record the minimum cumulative distance on the path, and when initialized, set the cumulative distance of the starting point D(1,1) = d(1,1), and set the elements of the first row and the first column to the cumulative distance to each point, and calculate the cumulative distance D(m,n) at any position, expressed as:
[0022] D(m,n)=d(m,n)+min(D1,D2,D3)
[0023] Among them, D1 = D(m-1,n), which represents the distance from the top to (m,n), D2 = D(m,n-1), which represents the distance from the left to (m,n), and D3 = D(m-1,n-1), which represents the distance from the upper left to (m,n); determine the optimal traversal path, find an optimal traversal path W from the upper left corner to the lower right corner, and each point on the path represents P j and P k The alignment relationship between the two sequences minimizes the alignment error. The optimal crossing path W is a point set, which is expressed as:
[0024] W={(m1,n1),(m2,n2),...,(m L ,n L )}
[0025] Where L is the path length; the path needs to satisfy boundary conditions, monotonicity conditions and continuity conditions; the boundary condition means that the path starts at (1,1) and ends at (24,24); the monotonicity condition means that m and n in the path cannot be retracted and must satisfy m l+1 ≥m l And n l+1 ≥n l ; The continuity condition means that adjacent points on the path can only move in the horizontal, vertical or diagonal direction; backtracking along the cumulative distance matrix D, the shortest path that meets the condition is the optimal traversal path W; calculating the DTW distance, the sequence P j and P k The DTW distance Dis(P j ,P k ) is defined as the average distance of all points on the optimal traversal path W, expressed as:
[0026]
[0027] Among them, Dis(P j ,P k ) is P j and P k The DTW distance between them.
[0028] As a preferred solution of the wind power output clustering method based on the DTW-Kmedoids algorithm described in the present invention, wherein: the determination of the optimal number of clusters includes, for each possible number of clusters K, after completing the Kmedoids clustering, calculating the sum of square errors SSE of each cluster, that is, the sum of squares of distances from the data point to the center of the cluster to which it belongs, expressed as:
[0029]
[0030] If the SSE value is small, it means that the clustering result is tight; calculate the SSE value corresponding to the clustering result for different cluster numbers, and make an elbow diagram with the cluster number K as the horizontal axis and the SSE value as the vertical axis; determine the optimal cluster number K based on the elbow diagram best , the K value corresponding to the elbow is the optimal number of clusters.
[0031] As a preferred solution of the wind power output clustering method based on the DTW-Kmedoids algorithm described in the present invention, wherein: the generation of the typical wind power output scenario curve includes determining the optimal number of clusters K according to best DTW-Kmedoids is used to cluster the historical wind power output data to obtain the clustering results. The central curve of each cluster is used as the typical wind power output scenario curve to form a typical wind power output scenario set Ω P ; Construct a clustering effect evaluation index system to quantitatively evaluate the clustering effect.
[0032] As a preferred solution of the wind power output clustering method based on the DTW-Kmedoids algorithm described in the present invention, the clustering effect evaluation index system includes the average distance within the cluster, the average distance within the cluster Intra k If it is small, it means that the data points in the cluster are densely distributed and the clustering effect is good, which can be expressed as:
[0033]
[0034] Among them, Intra k is the average distance within a cluster, C k is the center curve of cluster k, N k is the number of curves in cluster k; the larger the average distance Inter between clusters, the higher the separation between different clusters, expressed as:
[0035]
[0036] Where M is the number of cluster combinations, which is equal to the number of combinations of any two selected from K clusters, C k and C l are the central curves of cluster k and cluster l respectively; the i-th historical wind power curve P i24 The silhouette coefficient SC i It is expressed as:
[0037]
[0038] Among them, α i is the average DTW distance between sample i and other curves in the same cluster, β i is the average DTW distance between sample i and the nearest curve in other clusters; by calculating the average silhouette coefficient of all samples Evaluate the quality of the entire clustering, expressed as:
[0039]
[0040] The average distance within the cluster is Intra k , average distance between clusters Inter, average silhouette coefficient The three indicators constitute the clustering effect evaluation index system.
[0041] Another object of the present invention is to provide a system of a wind power output clustering method based on the DTW-Kmedoids algorithm, which can solve a wind power output clustering problem based on the DTW-Kmedoids algorithm by constructing a wind power output clustering system.
[0042] To solve the above technical problems, the present invention provides the following technical solutions: a wind power output clustering system based on the DTW-Kmedoids algorithm, comprising a data processing module, a clustering module, an optimal cluster number determination module and a system establishment module; the data processing module is used to perform interpolation, dimension reduction, standardization and smoothing on wind power historical data; the clustering module is used to use the dynamic time warping DTW algorithm for distance measurement, use the Kmedoids clustering algorithm for iteration, obtain clustering results, and output the center curve of each cluster; the optimal cluster number determination module is used to calculate the sum of square errors of each cluster for clustering results of different cluster numbers, and determine the optimal cluster number by the elbow rule; the system establishment module is used to generate a typical wind power output scenario curve according to the clustering results under the optimal cluster number, and establish a clustering effect evaluation index system.
[0043] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the wind power output clustering method based on the DTW-Kmedoids algorithm are implemented.
[0044] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a wind power output clustering method based on a DTW-Kmedoids algorithm as described above.
[0045] The beneficial effects of the present invention are as follows: a wind power output clustering method based on the DTW-Kmedoids algorithm provided by the present invention introduces a dynamic time warping (DTW) distance algorithm, which can adapt to the nonlinear changes of the wind power output curve, and improves the accuracy of the similarity measurement by dynamically matching the time series, making the generated typical scenes more representative. The improved Kmedoids clustering algorithm reduces the sensitivity of the initial conditions, making the cluster center points more representative, and thus the generated wind power output scenes have better stability, which can provide more reliable data support for power grid scheduling and planning. The elbow rule is used to determine the optimal number of clusters, which effectively solves the problem of relying on empirical judgment for the selection of the number of clusters in traditional clustering methods, ensuring that the generated scenes can effectively cover the diversity of wind power output, while avoiding excessive or insufficient clustering, and improving the rationality of the scenes. The present invention establishes a systematic clustering effect evaluation index, comprehensively analyzes and optimizes the generated typical scenes, and improves the reliability and applicability of the clustering process while ensuring the quality of the scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] 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.
[0047] Figure 1 A flow chart of a wind power output clustering method based on the DTW-Kmedoids algorithm provided in the first embodiment of the present invention.
[0048] Figure 2 An overall flow chart of a wind power output clustering method based on the DTW-Kmedoids algorithm provided in the first embodiment of the present invention.
[0049] Figure 3 A structural diagram of a wind power output clustering system based on the DTW-Kmedoids algorithm provided in the second embodiment of the present invention. DETAILED DESCRIPTION
[0050] 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.
[0051] 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.
[0052] Example 1, reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, and this embodiment provides a wind power output clustering method based on the DTW-Kmedoids algorithm, including: interpolating, reducing dimension, scalarizing and smoothing historical wind power data; using the dynamic time warping DTW algorithm for distance measurement, using the Kmedoids clustering algorithm for iteration to obtain clustering results, and outputting the center curve of each cluster; for clustering results with different numbers of clusters, calculating the sum of squared errors of each cluster, and determining the optimal number of clusters using the elbow rule; generating a typical wind power output scenario curve based on the clustering results under the optimal number of clusters, and establishing a clustering effect evaluation index system.
[0053] The technical field to which the present invention belongs is wind power output scenario generation, with a particular focus on extracting representative wind power output scenarios through clustering algorithms to support grid dispatch and optimization. Wind power output scenario generation technology aims to analyze the characteristics of wind power output and provide reliable power forecasting and dispatching data through typical scenario construction to improve the controllability of wind power output and the stability of the power system. This field involves multiple technical directions such as data processing, cluster analysis, and time series similarity measurement, and is widely used in the planning and dispatching decisions of wind power systems.
[0054] S1. Perform interpolation, dimension reduction, standardization and smoothing on historical wind power data. Figure 2 shown.
[0055] S1.1. For the missing data in the historical wind power output data, the cubic spline interpolation method is used to complete them.
[0056] S1.2. Reduce the dimension of the data. The power data acquisition system usually collects data at a sampling interval of 5 minutes. The dimension of the historical wind power output data obtained is too high, which increases the complexity of the algorithm. Therefore, the wind power output value in the same hour is averaged as the wind power output value of that hour, and the 24-hour wind power output curve within the day is obtained, which is recorded as P t24 = {P1,P2,...,P 24}.
[0057] S1.3. Normalize the data. Divide the wind power output data by the total installed capacity of the wind turbine to obtain the wind power output normalized value.
[0058] S1.4. Use the mean smoothing method to smooth the data and remove the short-term fluctuations and noise in the wind power output curve, making the time series more stable, thereby improving the effect of subsequent clustering, as follows:
[0059] S1.4.1. Input 24-hour wind power output curve P t24 , smoothing threshold θs and smoothing times N s .
[0060] S1.4.2. Calculate the absolute value of the difference between two consecutive data points, recorded as ΔP i =P i -P i-1 .
[0061] S1.4.3, if ΔP i Less than the smoothing threshold θ s , no smoothing is performed and the data remains unchanged. i Less than the smoothing threshold θ s , then for the data point P i Perform smoothing and update P i The mathematical expression of the value is as follows:
[0062]
[0063] S1.4.4, repeat S1.4.2 to S1.4.4 until the number of smoothing reaches N s , output the smoothed historical wind power output curve P.
[0064] S2. Use the dynamic time warping (DTW) algorithm to measure the distance, use the Kmedoids clustering algorithm to iterate, obtain the clustering results, and output the center curve of each cluster.
[0065] The dynamic time warping distance (DTW) algorithm is used to calculate the similarity between wind power output curves and generate a distance matrix. Based on this, the Kmedoids clustering algorithm is used for multiple iterations to optimize the center curve position of each cluster. Finally, a clustering result containing the optimal number of clusters and the center curve of each cluster is obtained.
[0066] S2.1. Calculate the DTW distance between any two wind power output curves using the dynamic time warping distance (DTW) algorithm, as follows:
[0067] Assume that there are two historical wind power output curves, namely P j = {P j,1 ,P j,2 ,...,P j,24} and P k = {P k,1 ,P k,2 ,...,P k,24},
[0068] S2.1.1. Construct the cost matrix:
[0069] Define a 24×24 dimensional cost matrix d, where each element d(m,n) represents the Euclidean distance between time points m and n, reflecting the matching cost of the sequence at different time points. Its mathematical expression is as follows:
[0070]
[0071] S2.1.2. Construct a cumulative distance matrix:
[0072] Define the cumulative distance matrix D to record the minimum cumulative distance on the path. When initializing, let the cumulative distance of the starting point D(1,1) = d(1,1), and set the elements of the first row and first column to the cumulative distance to each point to ensure that the path can extend from the starting point to the edge of the matrix. Then calculate the cumulative distance D(m,n) at any position, and its mathematical expression is as follows:
[0073] D(m,n)=d(m,n)+min(D1,D2,D3)
[0074] Among them, D1 = D(m-1,n), which represents the distance from the top to (m,n); D2 = D(m,n-1), which represents the distance from the left to (m,n); D3 = D(m-1,n-1), which represents the distance from the upper left to (m,n) (usually the continuation of the best alignment path).
[0075] S2.1.3. Determine the optimal crossing path:
[0076] The core of DTW distance is to find an optimal traversal path W from the upper left corner to the lower right corner, where each point on the path represents P j and P k The alignment relationship between the two sequences is such that the alignment error between the two sequences is minimized. The optimal crossing path W is a point set, and its mathematical expression is as follows:
[0077] W={(m1,n1),(m2,n2),...,(m L ,n L )}
[0078] Where L is the path length, and the path must meet the following conditions:
[0079] Boundary conditions: The path starts at (1,1) and ends at (24,24).
[0080] Monotonicity condition: m and n in the path cannot be reversed and must satisfy m l+1 ≥m l And n l+1 ≥n l .
[0081] Continuity condition: Adjacent points on a path can only move in the horizontal, vertical or diagonal direction.
[0082] Backtracking along the cumulative distance matrix D, the shortest path that meets the above conditions is the optimal traversal path W.
[0083] S2.1.4. Calculate the DTW distance:
[0084] Sequence P j and P k The DTW distance Dis(P j ,P k ) is defined as the average distance of all points on the optimal traversal path W, and its mathematical expression is as follows:
[0085]
[0086] S2.2. Randomly select K curves from the data set as the initial cluster center points, expressed as C = {C1, C2, ...., C K}, where each C k is a historical wind power output curve P j complete time series.
[0087] S2.3, using the method of S2.1, calculate each curve P j The DTW distance from all center curves is j Assign to the center C with the smallest DTW distance k The mathematical expression of the cluster is as follows:
[0088]
[0089] S2.4. For each cluster k, reselect a new central curve C within the cluster k , so that the average DTW distance between the central curve and other curves in the cluster is the smallest. Its mathematical expression is as follows:
[0090]
[0091] Among them, N k is the number of curves in cluster k.
[0092] S2.5. Repeat S2.3 and S2.4 to gradually optimize the position of the center curve until the center curve is no longer updated or the preset upper limit of the number of iterations is reached.
[0093] S2.6. After the iteration, output the center curve C of each cluster k .
[0094] S3. For clustering results with different numbers of clusters, the sum of squared errors of each cluster is calculated, and the optimal number of clusters is determined using the elbow rule.
[0095] For clustering results with different numbers of clusters, the sum of squared errors (SSE) of each cluster is calculated, and the elbow rule is used to determine the optimal number of clusters based on the SSE calculation results.
[0096] S3.1. For each possible number of clusters K, after completing Kmedoids clustering, calculate the sum of squared errors (SSE) of each cluster, that is, the sum of squared distances from each data point to the center of the cluster to which it belongs. The mathematical expression is as follows:
[0097]
[0098] Among them, the smaller the SSE value, the tighter the clustering result.
[0099] S3.2. Calculate the SSE values corresponding to the clustering results for different numbers of clusters, and make an elbow diagram with the number of clusters K as the horizontal axis and the SSE value as the vertical axis.
[0100] S3.3. Determine the optimal number of clusters K based on the elbow graph best In the elbow graph, find the "elbow" position of the SSE value, that is, the point where the rate of decrease of the SSE value slows down significantly. The K value at the elbow position is the optimal number of clusters K best , because at this point the effect of increasing the number of clusters on the SSE value decreases. Although continuing to increase the number of clusters after this point can reduce SSE, the compactness within each cluster is limited, and it is difficult to significantly improve the clustering effect. Therefore, it can be considered that the K value corresponding to this elbow is the optimal number of clusters.
[0101] S4. Based on the clustering results under the optimal number of clusters, a typical wind power output scenario curve is generated, and a clustering effect evaluation index system is established.
[0102] According to the clustering results under the optimal number of clusters, a typical wind power output scenario curve is generated, and a clustering effect evaluation index system is established.
[0103] S4.1. According to the optimal number of clusters K determined in S3 best DTW-Kmedoids is used to cluster the historical wind power output data to obtain the clustering results. The central curve of each cluster is used as the typical wind power output scenario curve to form a typical wind power output scenario set Ω P .
[0104] S4.2. Construct a clustering effect evaluation index system to quantitatively evaluate the clustering effect. The index system specifically includes the following indicators:
[0105] S4.2.1, Intra-cluster Distance:
[0106] Average distance within a cluster kIt is used to measure the similarity between the data points in each cluster and its central curve. The smaller the average distance within the cluster, the denser the distribution of data points in the cluster, and the better the clustering effect. Its mathematical expression is as follows:
[0107]
[0108] Among them, C k is the center curve of cluster k; N k is the number of curves in cluster k.
[0109] S4.2.2, Inter-cluster Distance:
[0110] The average inter-cluster distance Inter is used to measure the degree of separation between different clusters. The larger the average inter-cluster distance, the higher the degree of separation between different clusters, and the more recognizable the clustering results. Its mathematical expression is as follows:
[0111]
[0112] Where M is the number of cluster combinations, which is equal to the number of combinations of any two selected from K clusters; C k and C l are the center curves of cluster k and cluster l respectively.
[0113] S4.2.3, Silhouette Coefficient:
[0114] The silhouette coefficient is used to measure the overall clustering effect. The i-th historical wind power curve P i24 The silhouette coefficient SC of (hereinafter referred to as sample i) i The mathematical expression is as follows:
[0115]
[0116] Among them, α i is the average DTW distance between sample i and other curves in the same cluster; β i is the average DTW distance between sample i and the nearest curves in other clusters.
[0117] Silhouette coefficient SC i The value range is [-1,1]. A value close to 1 indicates a good clustering effect, a value close to 0 indicates that the sample is on the cluster boundary, and a negative value indicates that the sample is more suitable to be assigned to other clusters. The quality of the entire clustering can be evaluated by calculating the average silhouette coefficient SC of all samples. The mathematical expression is as follows:
[0118]
[0119] The average distance within the cluster is Intrak , average distance between clusters Inter, average silhouette coefficient The three indicators constitute the clustering effect evaluation index system, which can evaluate the quality of clustering results from multiple angles such as intra-cluster compactness, inter-cluster separation and overall clustering quality, ensuring that the generated typical wind power output scenario curve has high representativeness and accuracy.
[0120] The point of the present invention is to propose a method for generating wind power output scenarios based on an improved dynamic time warping (DTW) distance metric and a Kmedoids clustering algorithm. This method can handle the nonlinear characteristics of wind power output data, and automatically determine the optimal number of clusters in combination with the elbow rule, so that the generation of typical scenarios is more representative and reasonable. At the same time, this scheme designs a clustering effect evaluation index system to systematically evaluate the clustering results, thereby improving the quality and stability of typical scenarios. This scheme significantly improves the generation effect of wind power output scenarios by optimizing the distance metric, clustering algorithm and result evaluation mechanism, providing accurate and reliable support for the grid connection of new energy and power system scheduling, and has high technical innovation and practical value.
[0121] Example 2, reference Figure 3 , which is the second embodiment of the present invention, is different from the previous embodiment in that it provides a wind power output clustering system based on the DTW-Kmedoids algorithm, including: a data processing module 100, a clustering module 200, an optimal cluster number determination module 300 and a system establishment module 400.
[0122] The data processing module 100 is used to perform interpolation, dimension reduction, standardization and smoothing on the wind power historical data.
[0123] The clustering module 200 is used to use the dynamic time warping DTW algorithm to measure the distance, use the Kmedoids clustering algorithm to iterate, obtain the clustering result, and output the center curve of each cluster.
[0124] The optimal cluster number determination module 300 is used to calculate the sum of square errors of each cluster for clustering results of different cluster numbers, and determine the optimal cluster number by using the elbow rule.
[0125] The system establishment module 400 is used to generate a typical wind power output scenario curve according to the clustering results under the optimal number of clusters, and to establish a clustering effect evaluation index system.
[0126] 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.
[0127] 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.
[0128] 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.
[0129] 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.
[0130] 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 wind power output clustering method based on DTW-Kmedoids algorithm, characterized by: include, Perform interpolation, dimension reduction, standardization and smoothing on historical wind power data; The dynamic time warping (DTW) algorithm is used for distance measurement, and the Kmedoids clustering algorithm is used for iteration to obtain clustering results and output the center curve of each cluster. For clustering results with different numbers of clusters, the sum of squared errors of each cluster is calculated, and the elbow rule is used to determine the optimal number of clusters; According to the clustering results under the optimal number of clusters, a typical wind power output scenario curve is generated, and a clustering effect evaluation index system is established.
2. The wind power output clustering method based on the DTW-Kmedoids algorithm according to claim 1, characterized in that: The interpolation, dimensionality reduction, normalization and smoothing processing include using a cubic spline interpolation method to complete the missing data in the historical wind power output data; The data is processed by dimension reduction, and the wind power output values within the same hour are averaged as the hourly wind power output value to obtain the 24-hour wind power output curve within the day, which is recorded as P t24 = {P1,P2,...,P 24 }; The data is normalized to per unit, and the wind power output data is divided by the total installed capacity of the wind turbine to obtain the per unit value of wind power output; The mean smoothing method is used to smooth the data to remove short-term fluctuations and noise in the wind power output curve. The 24-hour wind power output curve P is input. t24 , smoothing threshold θ s and smoothing times N s , calculate the absolute value of the difference between two consecutive data, recorded as ΔP i =P i -P i-1 , if ΔP i Less than the smoothing threshold θ s , no smoothing is performed and the data remain unchanged. If ΔP i Less than the smoothing threshold θ s , then for the data point P i Perform smoothing and update P i The value of is expressed as, Repeat the steps until the number of smoothing times reaches N s , output the smoothed historical wind power output curve P.
3. The wind power output clustering method based on the DTW-Kmedoids algorithm according to claim 2, characterized in that: Outputting the center curve of each cluster includes using a dynamic time warping distance (DTW) algorithm to calculate the similarity between wind power output curves, generating a distance matrix, and performing multiple iterations through a Kmedoids clustering algorithm based on the distance matrix to optimize the center curve position of each cluster, thereby obtaining a clustering result including an optimal number of clusters and a center curve of each cluster; The DTW distance between any two wind power output curves is calculated using the dynamic time warping distance DTW algorithm; Randomly select K curves from the data set as the initial cluster center points, expressed as, C={C1,C2,....,C K } Among them, C k is a historical wind power output curve P j The complete time series of Calculate each curve P j The DTW distance from all center curves is j Assign to the center C with the smallest DTW distance k The cluster where it is located is represented by, Among them, Dis(P j ,C k ) is P j and C k The DTW distance between them; For each cluster k, a new central curve is reselected within the cluster so that the average DTW distance between the central curve and other curves in the cluster is minimized, expressed as, Among them, N k is the number of curves in cluster k; Repeat the iterations to gradually optimize the position of the center curve until the center curve is no longer updated or the preset upper limit of iteration times is reached; After the iteration, the center curve C of each cluster is output. k .
4. The wind power output clustering method based on the DTW-Kmedoids algorithm according to claim 3, characterized in that: The DTW distance includes if there are two historical wind power output curves, namely P j = {P j,1 ,P j,2 ,...,P j,24 } and P k = {P k,1 ,P k,2 ,...,P k,24 }; Construct the cost matrix and define a 24×24 dimensional cost matrix d, where each element d(m,n) represents the Euclidean distance between time m and n, expressed as, Among them, P j,m P j The point at the mth moment of the curve, P k,n P k The point of the curve at the nth moment; Construct a cumulative distance matrix, define the cumulative distance matrix D, record the minimum cumulative distance on the path, and when initializing, set the cumulative distance of the starting point D(1,1) = d(1,1), and set the elements of the first row and the first column to the cumulative distance to each point. Calculate the cumulative distance D(m,n) at any position, expressed as, D(m,n)=d(m,n)+min(D1,D2,D3) Among them, D1 = D(m-1,n), which means the distance from the top to (m,n), D2 = D(m,n-1), which means the distance from the left to (m,n), and D3 = D(m-1,n-1), which means the distance from the upper left to (m,n); Determine the optimal traversal path and find an optimal traversal path W from the upper left corner to the lower right corner. Each point on the path represents P. j and P k The alignment relationship between the two sequences minimizes the alignment error. The optimal crossing path W is a point set, expressed as: <h2 style=";text-align:left;direction:ltr">W = {(m1,n1),(m2,n2),...,(m<h2 style=";text-align:left;direction:ltr"> L <h2 style=";text-align:left;direction:ltr"> ,n<h2 style=";text-align:left;direction:ltr"> L <h2 style=";text-align:left;direction:ltr"> )} Where L is the path length; The path needs to satisfy boundary conditions, monotonicity conditions, and continuity conditions; The boundary condition means that the path starts at (1,1) and ends at (24,24); The monotonicity condition means that m and n in the path cannot fall back, and must satisfy m l+1 ≥m l And n l+1 ≥n l ; The continuity condition means that adjacent points on the path can only move in the horizontal, vertical or diagonal direction; Backtrack along the cumulative distance matrix D, and the shortest path that meets the conditions is the optimal traversal path W; Calculate the DTW distance, sequence P j and P k The DTW distance Dis(P j ,P k ) is defined as the average distance of all points on the optimal traversal path W, expressed as, Among them, Dis(P j ,P k ) is P j and P k The DTW distance between them.
5. A wind power output clustering method based on DTW-Kmedoids algorithm as claimed in claim 4, characterized in that: Determining the optimal number of clusters includes, for each possible number of clusters K, calculating the sum of squared errors SSE of each cluster after completing Kmedoids clustering, that is, the sum of squared distances from the data point to the center of the cluster to which it belongs, expressed as: If the SSE value is small, it means that the clustering results are tight; Calculate the SSE values corresponding to the clustering results for different numbers of clusters, and make an elbow diagram with the number of clusters K as the horizontal axis and the SSE value as the vertical axis; Determine the optimal number of clusters K based on the elbow graph best , the K value corresponding to the elbow is the optimal number of clusters.
6. A wind power output clustering method based on DTW-Kmedoids algorithm as claimed in claim 5, characterized in that: The generating of the typical wind power output scenario curve includes determining the optimal cluster number K best DTW-Kmedoids is used to cluster the historical wind power output data to obtain the clustering results. The central curve of each cluster is used as the typical wind power output scenario curve to form a typical wind power output scenario set Ω P ; A clustering effect evaluation index system is constructed to quantitatively evaluate the clustering effect.
7. A wind power output clustering method based on DTW-Kmedoids algorithm as claimed in claim 6, characterized in that: The clustering effect evaluation index system includes the average distance within the cluster, the average distance within the cluster k If it is small, it means that the data points in the cluster are closely distributed and the clustering effect is good, which is expressed as: Among them, Intra k is the average distance within a cluster, C k is the center curve of cluster k, N k is the number of curves in cluster k; The larger the average distance Inter between clusters, the higher the separation between different clusters, which can be expressed as: Where M is the number of cluster combinations, which is equal to the number of combinations of any two selected from K clusters, C k and C l are the center curves of cluster k and cluster l respectively; The i-th historical wind power curve P i24 The silhouette coefficient SC i It is expressed as, Among them, α i is the average DTW distance between sample i and other curves in the same cluster, β i is the average DTW distance between sample i and the nearest curves in other clusters; By calculating the average silhouette coefficient of all samples Evaluate the quality of the entire clustering, expressed as, The average distance within the cluster is Intra k , average distance between clusters Inter, average silhouette coefficient The three indicators constitute the clustering effect evaluation index system.
8. A system using a wind power output clustering method based on a DTW-Kmedoids algorithm as claimed in any one of claims 1 to 7, characterized in that: It includes a data processing module (100), a clustering module (200), an optimal cluster number determination module (300) and a system establishment module (400); The data processing module (100) is used to perform interpolation, dimension reduction, standardization and smoothing processing on wind power historical data; The clustering module (200) is used to use a dynamic time warping (DTW) algorithm to measure distance, use a Kmedoids clustering algorithm to iterate, obtain clustering results, and output a center curve of each cluster; The optimal cluster number determination module (300) is used to calculate the sum of square errors of each cluster for clustering results of different cluster numbers, and determine the optimal cluster number using the elbow rule; The system establishment module (400) is used to generate a typical wind power output scenario curve according to the clustering result under the optimal number of clusters, and to establish a clustering effect evaluation index system.
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 wind power output clustering method based on a DTW-Kmedoids algorithm 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 wind power output clustering method based on a DTW-Kmedoids algorithm according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and system for determining typical scene of rural energy supply and consumption
CN115293924A
Wind power typical scene construction method and system under multi-characteristic quantity index based on improved K-means algorithm
CN115344996A
Typical scene construction method based on ISDPC-K-means clustering
CN116451906A
Energy storage optimal configuration method and device considering inertia constraint, equipment and medium
CN118971071A
Method and system for predicting a day-ahead wind power of wind farms
US20230136352A1
Cited By
New energy station real-time data acquisition method and system based on edge calculation
CN120879962A
An edge-computing-based real-time data acquisition method and system for a new energy station
CN120879962B
Cigar tobacco stacking fermentation stack core temperature analysis method and device based on time sequence clustering
CN120929754A
Improved DTW-KMeans clustering algorithm for wind power typical scene extraction
CN120929863A
Koji room high-quality koji block fermentation optimizing process based on time sequence clustering
CN121051492A