Detailed Description
Referring to fig. 1, an embodiment of a power consumer clustering method is provided, which includes the following steps:
s110: and acquiring the peak time period of the power load of each power consumer.
Wherein the peak time period includes a start time point and an end time point. The power system supplies power to the power consumers, each power consumer corresponds to a respective power load, and the power consumers have peak time periods of the respective power loads, namely time periods corresponding to power peak hours. In this embodiment, specifically, the peak time period of the electrical load of each electrical consumer within the preset time period is obtained, for example, within one day of the preset time period, in the time period in which the electrical load of the electrical consumer is higher than 70% of the maximum value of the electrical load, if the data interval is 1 hour, the time at which the first electrical load exceeds 70% of the maximum value of the electrical load is pushed forward by 30 minutes to be the peak start time, that is, the start time point, and if the time is 0 point, the peak start time is 0 point. And the time point of the end of the peak, namely the end time point, is deduced backwards by 30 minutes when the last continuous electric load value is higher than 70% of the maximum electric load value. If the data interval is 15 minutes, the time when the first electrical load exceeds 70% of the maximum value of the electrical load is advanced by 15 minutes to be the peak start time, and if the time is 0 point, the peak start time is 0 point. And if the time is 23 points and 45 points, the peak ending time is 23 points and 45 points.
S120: and sequencing the starting time points in the peak time periods of the power consumers according to a preset sequencing rule to obtain a starting time point set, and sequencing the ending time points in the peak time periods of the power consumers to obtain an ending time point set.
Due to the fact that the electricity utilization conditions of the power consumers are different, the corresponding electricity loads are different, namely the peak time periods of the corresponding electricity loads may be different, and therefore the starting time point and the ending time period in the peak time periods of the power consumers may be different. In this embodiment, according to a preset sorting rule, the start time points in the peak time period of each power consumer are sorted to obtain a start time point set, and the end time points in the peak time period of each power consumer are sorted to obtain an end time point set. The preset ordering rule may be an ordering rule with time from small to large, or an ordering rule with time from large to small.
S130: obtaining the ranking numbers of the preset clustering numbers according to a preset selection rule, selecting the starting time point corresponding to each ranking number from the starting time point set, and selecting the ending time point corresponding to each ranking number from the ending time point set.
When power consumers are clustered, a preset clustering number is preset, after a start time point and an end time point in a peak time period of each power consumer are respectively sequenced to obtain a start time point set and an end time point set, the start time point of the preset clustering number needs to be selected from the start time point set, the end time point of the preset clustering number needs to be selected from the end time set, in this embodiment, ranking numbers of the preset clustering number are obtained through a preset selection rule, the start time point corresponding to each ranking number is selected from the start time point set, and the end time point corresponding to each ranking number is selected from the end time point set.
S140: and constructing a new time period of the preset clustering number according to the starting time point corresponding to each row position and the ending time point corresponding to each row position.
S150: and respectively initializing the new time periods with the preset clustering number into clustering centers with the preset clustering number, and clustering the power consumers according to the peak time period of the power load of each power consumer, the clustering centers and a K-means clustering algorithm to obtain the clustering results of each power consumer.
And obtaining the ranking of the preset clustering number, thereby obtaining the starting time point and the ending time point corresponding to the ranking, and constructing a new time period of the preset clustering number according to the starting time point corresponding to each ranking and the ending time point corresponding to each ranking. When clustering is performed by using the K-means clustering algorithm, firstly, the clustering centers of the preset clustering numbers need to be initialized, in this embodiment, new time periods of the preset clustering numbers are respectively initialized to the clustering centers of the preset clustering numbers, and then, clustering is performed on the power consumers by using the K-means clustering algorithm to obtain clustering results, wherein the clustering characteristics adopted during clustering are peak time periods of the power consumers.
The power consumer clustering method includes the steps that starting time points of peak time periods of power consumers are arranged according to a time sequence, starting time points of preset clustering numbers are selected from a starting time point set obtained after sequencing according to a preset selection rule to initialize starting time points of the preset clustering centers, similarly, starting time points of the preset clustering numbers are selected from an ending time point set obtained after sequencing according to the preset selection rule to initialize ending time points of the preset clustering centers, namely, the clustering centers of the preset clustering numbers are initialized, then the power consumers are clustered according to the peak time periods of power loads of the power consumers, the clustering centers and a K-means clustering algorithm, and clustering results of the power consumers are obtained. When the clustering centers with the preset clustering numbers are initialized by the power consumer clustering method, the time period with the preset clustering numbers is not selected from the peak time period of the power load of the power consumers randomly as the initialized clustering centers, but the new time period formed by the starting time point corresponding to each ranking number and the ending time point corresponding to each ranking number is initialized to the clustering centers with the preset clustering numbers, so that the clustering centers with the preset clustering numbers can be initialized reasonably, and the power consumers are clustered according to a K-means clustering algorithm after the clustering centers are initialized, so that more accurate clustering results can be obtained, and the clustering accuracy is improved.
In the process that the power system provides electric energy for users, the electricity utilization conditions of different power users may be different, and the clustering result of the power users has an important influence on economic analysis, operation and planning of the power system, so that after the power users are clustered to obtain the clustering result, the power system can be planned according to the clustering result of the power users, for example, electric energy with higher power can be provided for the power users with larger electricity loads. By improving the accuracy of the clustering result of the power consumer, the power system can be effectively and accurately planned, so that the power system can stably operate.
In one embodiment, the step of initializing the new time periods of the preset clustering number to the clustering centers of the preset clustering number respectively, and clustering the power consumers according to the peak time period of the power loads of the power consumers, the clustering centers and the K-means clustering algorithm to obtain the clustering results of the power consumers comprises:
s251: and respectively initializing the new time periods with the preset clustering number into the clustering centers with the preset clustering number.
And respectively initializing the new time periods with the preset clustering number into the clustering centers with the preset clustering number, so as to obtain the clustering centers with the preset clustering number.
S252: and respectively calculating the coincidence rate of the peak time period of the power load of each power consumer and each clustering center.
S253: and respectively dividing the power consumers to the clustering centers corresponding to the peak time periods of the power consumers and the maximum coincidence rate of each clustering center to obtain the clustering categories of the preset clustering numbers.
S254: and calculating the mean value of the starting time point and the mean value of the ending time point of the peak time period corresponding to the power consumer in each cluster category.
S255: and updating the clustering center of the clustering category where the power consumer is located into a time period from the mean value of the starting time point to the mean value of the ending time point corresponding to the clustering category.
S256: and judging whether the updated clustering centers have clustering centers different from the corresponding clustering centers before updating.
When the updated cluster center is the same as the corresponding cluster center before updating, S257 is executed: and determining the clustering result of each power user as the clustering category of the preset clustering number.
And when the updated clustering centers have clustering centers different from the corresponding clustering centers before updating, returning to the step of respectively calculating the coincidence rate of the peak time period of the power load of each power consumer and each clustering center.
After the clustering centers are initialized, the coincidence rate of the peak time periods of the power loads of the power consumers and the clustering centers is calculated, then the power consumers are classified into the clustering centers corresponding to the peak time periods of the power consumers and the maximum coincidence rate of the clustering centers, the clustering categories with preset clustering numbers are obtained, and the initial clustering of the power consumers is realized. After the cluster types with the preset cluster number are obtained, calculating the starting time point mean value and the ending time point mean value of the peak time period corresponding to the power users in each cluster type, updating the cluster centers of the cluster types where the power users are located into the time periods from the starting time point mean value to the ending time point mean value corresponding to the cluster types, and repeating the steps until the cluster centers with the preset cluster number do not change any more.
In one embodiment, the coincidence rate is the coincidence period between the peak time period of the electric load of the electric power consumer and the clustering center divided by the longer time period between the peak time period of the electric load of the electric power consumer and the clustering center.
The larger the coincidence rate is, the larger the time period in which the peak time period of the power load of the power consumer and the peak time period of the power load of the power consumer are summed with the longer time period in the clustering center is, the closer the peak time period of the power load of the power consumer and the clustering center is, and the higher the probability that the power consumer corresponding to the peak time period of the power load is classified into the clustering center is.
In one embodiment, obtaining the ranking number of the preset cluster number according to the preset selection rule includes:
obtaining the ranking number of the preset cluster number according to the following formula:
Ph=round(m/(k+1))*h-1。
wherein, PhH is more than or equal to 1 and less than or equal to k, k is the preset clustering number, m is the number of power users, and the round function is a rounded function.
The above-mentioned power consumer clustering method is specifically described in an embodiment.
When the power consumers need to be clustered, the peak time periods in the power loads can be analyzed, and the clustering of the power consumers can be realized by performing clustering analysis on the peak time periods. The invention relates to a power consumer clustering method based on a K-means clustering algorithm (a time-period K-means algorithm), wherein the preset clustering number K is 10, and the power consumers are assumed to be 100, namely the peak time periods needing clustering are 100 in total and need to be clustered into 10 classes. The specific clustering steps are as follows:
(1) initializing 10 cluster centers
The start times (start time points) of all peak periods to be clustered are ranked in time order, and a set of start time points (set as set 1) is obtained as follows:
set 1 ═ start time point 1, start time point 2, start time point 3, …, start time point 100.
Where start time point 1 is earlier than start time point 2, start time point 2 is earlier than start time point 3, and so on, start time point 100 is the largest. Similarly, the end times (end time points) of all peak periods that need to be clustered are chronologically ranked, and an end time set (set 2) is obtained as follows:
set 2 ═ end time point 1, end time point 2, end time point 3, …, end time point 100}
Where end time point 1 is earlier than end time point 2, end time point 2 is earlier than end time point 3, and so on, end time point 100 is the largest.
According to the formula: round (m/(k + 1)). h-1 (note: round is a rounded function, h is 1, 2, 3,. k, k is a preset number of clusters, and m is the number of the clustered samples, namely the number of power consumers) selects the ranking numbers which are respectively 8, 17, 26, 35, 44, 53, 62, 71, 80 and 89.
Selecting a starting time point corresponding to each row position number in the set 1, selecting an ending time point corresponding to each row position number in the set 2, and constructing a new time period with preset clustering numbers according to the starting time point corresponding to each row position number and the ending time point corresponding to each row position number, namely selecting the 8 th elements of the set 1 and the set 2 to form a new time period, such as: { starting time point 8, ending time point 8}, similarly selecting 17 th, 26 th, 35 th, 44 th, 53 th, 62 th, 71 th, 80 th, 89 th elements in the set 1 and the set 2 respectively, thereby forming 10 new time periods respectively, and taking the 10 new time periods as initial center points of the clusters, namely initializing 10 cluster centers.
(2) Performing first clustering
When clustering is carried out, the coincidence rate from the peak time period of the electric load of each power consumer to the time period of the 10 initialized clustering centers is calculated (the coincidence rate is the maximum of the coincidence time period/the peak time period of the electric load of the power consumer and the time period of the clustering centers), the clustering center with the maximum coincidence rate is selected as the clustering center, and thus the corresponding clustering center is found by the peak time periods of the electric loads of all the power consumers.
(3) Updating cluster centers
And respectively averaging the initial time and the end time of all time periods of the same class, taking the time point average value and the end time point average value as the initial time point and the end time point of the new clustering center of the class, namely updating the clustering centers, and performing the same operation on all other clustering classes to obtain 10 updated clustering centers.
(4) Clustering continues until convergence
And recalculating the coincidence rate of the peak time periods of the power loads of all the power consumers and the updated clustering centers by using the generated 10 updated clustering centers, selecting the clustering center with the highest coincidence rate, and continuously repeating the steps until the 10 clustering centers are not changed any more.
Referring to fig. 3, a power consumer clustering device according to an embodiment includes:
the load peak time period obtaining module 310 is configured to obtain a peak time period of the electrical load of each power consumer, where the peak time period includes a start time point and an end time point.
The sorting module 320 is configured to sort the start time points in the peak time period of each power consumer according to a preset sorting rule to obtain a start time point set, and sort the end time points in the peak time period of each power consumer to obtain an end time point set.
The selecting module 330 is configured to obtain the ranking numbers of the preset cluster numbers according to a preset selection rule, select a starting time point corresponding to each ranking number from the starting time point set, and select an ending time point corresponding to each ranking number from the ending time point set.
The constructing module 340 is configured to construct a new time period with a preset number of clusters according to the starting time point corresponding to each row number and the ending time point corresponding to each row number.
And the clustering module 350 is configured to initialize the new time periods with the preset clustering numbers to the clustering centers with the preset clustering numbers, and cluster the power consumers according to the peak time period of the power load of each power consumer, the clustering centers, and the K-means clustering algorithm to obtain the clustering results of each power consumer.
The electric power user clustering device arranges the starting time points of the peak time periods of all the electric power users according to the time sequence, initializes the starting time points of the clustering centers of the preset number according to the starting time points of the preset clustering number selected from the starting time point set obtained after sequencing according to the preset selection rule, also initializes the ending time points of the clustering centers of the preset number according to the starting time points of the preset clustering number selected from the ending time point set obtained after sequencing according to the preset selection rule, namely initializes the clustering centers of the preset clustering number, and then clusters all the electric power users according to the peak time periods of the electric loads of all the electric power users, the clustering centers and the K-means clustering algorithm to obtain the clustering results of all the electric power users. When the clustering centers with the preset clustering numbers are initialized by the power consumer clustering device, the time period with the preset clustering numbers is not selected from the peak time period of the power consumer's power load at random to serve as the initialized clustering centers, but the new time period formed by the starting time point corresponding to each ranking number and the ending time point corresponding to each ranking number is initialized to be the clustering centers with the preset clustering numbers, so that the clustering centers with the preset clustering numbers can be initialized reasonably, and the power consumers are clustered according to a K-means clustering algorithm after the clustering centers are initialized, so that more accurate clustering results can be obtained, and the clustering accuracy is improved.
Referring to fig. 4, in one embodiment, the clustering module includes:
the initializing module 451 is configured to initialize the new time periods with the preset number of clusters to the cluster centers with the preset number of clusters.
And the coincidence rate calculating module 452 is configured to calculate the coincidence rate between the peak time period of the power load of each power consumer and each cluster center.
The cluster category obtaining module 453 is configured to divide the power consumers into cluster centers corresponding to peak time periods of the power consumers and the maximum coincidence rates of the cluster centers, and obtain cluster categories of a preset number of clusters.
The mean value calculating module 454 is configured to calculate a starting time point mean value and an ending time point mean value of the peak time period corresponding to the power consumer in each cluster category.
The updating module 455 is configured to update the cluster center of the cluster category where the power consumer is located into a time period from the starting time point mean value to the ending time point mean value corresponding to the cluster category.
The determining module 456 is configured to determine whether there is a cluster center in the updated cluster centers that is different from the corresponding cluster center before updating.
The determining module 457 is configured to determine that the clustering result of each power user is a clustering category of a preset clustering number when the updated clustering center is the same as the corresponding pre-updated clustering center.
In one embodiment, the power consumer clustering device further includes:
and a returning module 458, configured to, when there is a cluster center in the updated cluster centers that is different from the corresponding cluster center before updating, calculate, by the returning coincidence rate calculation module, a coincidence rate between the peak time period of the power load of each power consumer and each cluster center, respectively.
In one embodiment, the coincidence rate is the coincidence period between the peak time period of the electric load of the electric power consumer and the clustering center divided by the longer time period between the peak time period of the electric load of the electric power consumer and the clustering center.
In one embodiment, the selection module is further specifically configured to obtain the ranking number of the preset cluster number according to the following formula:
Ph=round(m/(k+1))*h-1。
wherein, PhH is more than or equal to 1 and less than or equal to k, k is the preset clustering number, m is the number of power users, and the round function is a rounded function.
The above power consumer clustering device is a device for implementing the above power consumer clustering method, and the technical features are in one-to-one correspondence, which is not described herein again.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.