Electric vehicle user charging behavior classification method based on K-means + + and Euclidean distance
By using the K-means++ clustering algorithm and Euclidean distance comparison method in the charging behavior classification of electric vehicle users, combined with multi-stage clustering and data matrix processing, the problem of low adaptability of charging behavior classification in the existing technology is solved, and a more accurate and stable user behavior analysis is achieved.
Patent Information
- Application Number
- CN202510239761.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, when categorizing charging behaviors of electric vehicle users, it is difficult to effectively capture the complexity and diversity of charging behaviors within 24 hours, resulting in low adaptability of clustering results.
The charging behavior classification method of electric vehicle users based on K-means++ and Euclidean distance is adopted. Through multi-stage clustering and Euclidean distance comparison method, the initial clustering center selection is optimized, clustering accuracy and stability are improved, and the data dimension is reduced through 15-minute particle size and 86400 matrix processing.
It significantly improves the purity of charging data and the stability of clustering results, can more accurately reflect the behavior characteristics of electric vehicle users, and provides scientific basis for grid scheduling optimization and charging facility planning.
Smart Images

Figure CN120145175A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data mining and user behavior analysis, and specifically relates to a method for classifying electric vehicle user charging behaviors based on K-means++ and Euclidean distance. Background Art
[0002] As a means of urban low-carbon transportation, new energy vehicles have received great attention from various countries in recent years. As a representative of future green transportation, electric vehicles not only reduce carbon emissions but also promote the application of renewable energy in the transportation field. However, the large-scale popularization of electric vehicles has brought new challenges and opportunities to the power system, especially the distribution network.
[0003] The charging behavior of electric vehicles directly affects the operational stability and economy of the power grid. On the one hand, the charging time of electric vehicle users is highly random, and the difference in electricity demand during peak and valley periods is significant, which may lead to increased fluctuations in the power grid load and even cause local grid overload or power quality degradation. On the other hand, the charging preferences of different users (such as fast charging or slow charging) and the charging power distribution have an important impact on power grid dispatching and charging infrastructure planning. For example, high-power fast-charging users may form a peak load on the power grid in a short period of time, while low-power slow-charging users may consume electricity smoothly over a longer period.
[0004] In addition, with the gradual grid connection of renewable energy sources (such as photovoltaic and wind energy), the uncertainty of power supply has increased, further exacerbating the contradiction between electric vehicle charging demand and power grid dispatching. In this complex background, scientific clustering analysis of electric vehicle user charging behaviors helps to understand the behavior patterns of different user groups and provides support for power grid load forecasting and optimizing the layout of charging stations.
[0005] For the clustering analysis of the k-means algorithm, the literature "Short-term Charging Load Prediction of Electric Vehicles Based on BP-DTR with K-means Clustering" proves that compared with the direct clustering analysis of the k-means algorithm, combining multi-stage data processing steps can effectively improve the accuracy of the results and reduce errors. The literature "Analysis of Electric Vehicle Charging Load Characteristics Based on Improved K-Means Algorithm" takes the charging pile load data of a certain city in Yunnan as an example for analysis. Aiming at the randomness and instability in the selection of the initial clustering center of the K-Means algorithm, it is then iteratively optimized in combination with the K-Means algorithm, effectively solving the problem of unstable clustering results of the K-Means algorithm. The literature "Analysis of Steam Usage Behavior of Thermal Users Based on K-Means Clustering" elaborates in detail on the disadvantage of the need to manually select the optimal number of clusters in the K-Means clustering algorithm. The article makes improvements by analyzing two clustering validity indicators to automatically determine the optimal number of clusters, proving that the instability disadvantage of the k-means algorithm can be compensated by reasonable data processing steps and improving the correlation indicators of the clustering algorithm.
[0006] Based on the above-mentioned literature, it is theoretically feasible to use the k-means algorithm for clustering analysis of electric vehicle charging users. However, when applied to a large amount of data, the existing data processing methods do not meet the characteristic requirements of the k-means. When clustering the charging user order data, the existing methods generally consider the time factor and classify them using the peak-valley period method in three periods of a day. These classification methods have three disadvantages: (1) The number of classifications is determined in advance, and it is easy to fall into the local optimal situation; (2) The classification principle is difficult to clearly distinguish various types of power curve situations in different periods. For example, if the charging time is in the early morning and is too long to cross the zero point, it is easy to divide the periods before and after the zero point into two categories; (3) The number of classifications is too small, which does not match the time scale of 24 hours a day, and the distribution of the clustering centers may not be able to capture different behavioral characteristics such as peak, valley, and random charging. In addition, under the above classification principle, most are based on data in fixed time periods, which will lead to the inability to fully reflect the complexity and diversity of users' charging behaviors within 24 hours a day, resulting in a low adaptability of the clustering results. Therefore, it is necessary to propose a k-means clustering method to solve the high dimensionality problem under a large amount of data and make a reasonable classification of user behaviors. Summary of the Invention
[0007] The present invention is to solve the above-mentioned deficiencies of the existing technologies, and proposes a classification method for electric vehicle user charging behaviors based on K-means++ and Euclidean distance, in order to more accurately reflect the differences between the behavioral characteristics of electric vehicle users, so as to provide a scientific basis for power supply companies to optimize grid dispatching strategies, improve load prediction accuracy, and rationally allocate charging infrastructure.
[0008] To achieve the above object, the present invention adopts the following technical solutions:
[0009] A method for classifying electric vehicle user charging behaviors based on K-means++ and Euclidean distance according to the present invention is characterized by including the following steps:
[0010] Step 1: Set the charging orders of electric vehicles in a charging station during a certain time period and perform preprocessing to obtain a preprocessed electric vehicle charging data set , where represents the th charging order, and , represents the th charging order at the nth moment of the charging power, E is the total number of charging orders; T represents transpose;
[0011] Step 2: Use the k-means++ clustering algorithm to perform clustering to obtain order clusters and the clustering center of each order cluster , where represents the th order cluster, and , is the th charging order in the th order cluster , and , represents at the nth moment of the charging power, I k represents the total number of charging orders in ; is the clustering center of the th order cluster, and , represents the th clustering center at the nth moment ;
[0012] Step 3: Use Equation (1) to calculate the average value , and then use Equation (2) to obtain the weight , and obtain the weights of all clustering centers:
[0013] (1)
[0014] (2)
[0015] Step 4: Set the minimum value in as the weight of the j-th cluster center , then let the j-th order cluster be the messy cluster, and , be the i-th charging order in the j-th order cluster , I represents j the total number of charging orders in ;
[0016] Step 5: Calculate the Euclidean distances between each of the other order clusters except and their respective cluster centers, obtaining Euclidean distance matrices , where represents the Euclidean distance matrix between the -th order cluster and the -th cluster center ; and , represents the Euclidean distance between the -th charging order in the -th order cluster and the -th cluster center ;
[0017] Take the maximum value in to obtain the maximum value matrix ;
[0018] Step 6: Calculate the Euclidean distance matrix between the messy cluster and the -th cluster center , thereby obtaining Euclidean distance matrices , where represents the Euclidean distance between the -th charging order in the messy cluster and the -th cluster center ;
[0019] Step 7: Divide each charging order in the messy cluster into the remaining order clusters, thereby obtaining updated order clusters , as the clustering result of the charging behavior of electric vehicle users, where is the th updated order cluster.
[0020] The feature of the method for classifying the charging behavior of electric vehicle users according to the present invention also lies in that the step 7 includes:
[0021] Step 7.1: Initialize ;
[0022] Step 7.2: Initialize ;
[0023] Step 7.3: Judge whether is less than . If so, put into the th matrix ; otherwise, directly execute step 7.4;
[0024] Step 7.4: After assigning to , return to step 7.3 until ends, so as to obtain the final th matrix ;
[0025] Step 7.5; Put the th charging order in the messy cluster into the order cluster corresponding to the minimum value in ;
[0026] Step 7.6; After assigning to , return to step 7.2 until ends, so as to obtain updated order clusters .
[0027] The feature of an electronic device according to the present invention, which includes a memory and a processor, is that the memory is used to store a program for supporting the processor to execute the method for classifying the charging behavior of electric vehicle users, and the processor is configured to execute the program stored in the memory.
[0028] The feature of a computer-readable storage medium according to the present invention, on which a computer program is stored, is that the computer program executes the steps of the method for classifying the charging behavior of electric vehicle users when run by a processor.
[0029] Compared with the prior art, the beneficial effect of the present invention lies in:
[0030] 1. The present invention provides a precise means for analyzing user behavior for new energy electric vehicles to access the power grid. Through a multi-stage clustering method, it can deeply explore the charging mode characteristics of different users, thereby providing a scientific basis for the demand response of the power grid, the optimization of load dispatching, and the siting and planning of charging facilities. With high efficiency, precision, and intelligence as the core, the present invention provides important technical support for the efficient coordination and sustainable development of new energy electric vehicles and modern power grids;
[0031] 2. The present invention first comprehensively observes the curve graphs of all electric vehicle charging behavior data to fully understand the overall data distribution and patterns in each time period during the charging process, and thus proposes a set of deletion strategies for noise data. This method can effectively avoid the negative impact of individual abnormal points (such as abnormal fluctuations in charging power or data that does not conform to the normal charging behavior pattern when a user charges an electric vehicle) on the clustering results. Through this deletion process, not only the core characteristics of the charging behavior data are retained, but also the abnormal data that may interfere with the clustering effect is filtered out, thereby significantly improving the purity of the charging data and the stability of the charging behavior clustering results;
[0032] 3. In the analysis of electric vehicle charging behavior, the present invention uses the K-means++ algorithm to cluster the charging data and further improves the accuracy and stability of clustering by increasing the number of iterations. In view of the diversity of charging behavior in different time periods, power fluctuations, and user charging preferences, the K-means++ algorithm effectively captures the characteristics of each sub-time period during the charging process by intelligently selecting the initial clustering centers, reducing the influence of initial randomness on the recognition of charging behavior patterns. At the same time, increasing the number of iterations ensures the stable convergence of the charging data during the clustering process, avoiding the trap of local optimal solutions, and thus providing a more accurate basis for behavior classification for power grid dispatching optimization and charging facility planning;
[0033] 4. The present invention divides the electric vehicle charging data by granularity of fifteen minutes and processes the data by constructing an 86400 matrix (i.e., the total number of seconds in a day). First, the power value every 300 seconds is calculated as an average value to generate a matrix that conforms to the fifteen-minute granularity. This method reduces the data dimension while effectively avoiding the problems of excessive number of columns and too large matrix dimension caused by one-second-level data, thereby ensuring the accuracy of the charging behavior clustering results and the controllability of the computational complexity. At the same time, this method can also more accurately capture the dynamic changes of charging behavior in each time period of a day, providing solid data support for in-depth analysis of charging behavior;
[0034] 5. The present invention fully combines the actual power change characteristics during the charging of electric vehicles and uses the Euclidean distance comparison method to achieve fine data classification. Specifically, during the normal charging process, such as low-power charging at night or fast charging during peak hours, the power curve usually rises and falls smoothly and slowly. However, equipment failures, poor interface contacts, or other abnormal factors may cause sudden changes or violent fluctuations in the power curve. Therefore, the present invention not only calculates the Euclidean distance between each data point in each charging behavior cluster and its clustering center, but also compares these distances with the Euclidean distances of the data initially classified as miscellaneous. By comparing the maximum and minimum values of the data in each charging behavior cluster, the present invention can objectively identify the charging data that highly conforms to the typical charging mode and select it from the miscellaneous category, avoiding the error classification caused by artificially setting thresholds or subjective judgments. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a flowchart of the method of the present invention;
[0036] Figure 2 is a curve graph of the clustering center of each cluster in this embodiment;
[0037] Figure 3 is a distribution graph of the order curves of the miscellaneous clusters in this embodiment;
[0038] Figure 4 is a distribution graph of the order curves of each cluster after reclassification in this embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0039] In this embodiment, a classification method for the charging behavior of electric vehicle users based on K-means++ and Euclidean distance is as Figure 1 shown. In this example, the charging user order data of a charging station in a certain area is used as a sample to achieve the clustering analysis of charging users. The specific process is as Figure 1 shown, including the following steps:
[0040] Step 1: Set the time period , that is , , the time interval is 15 minutes, and there are moments. Download the charging orders of electric vehicles in the charging station and perform preprocessing to obtain the preprocessed electric vehicle charging data set . In this example, the obtained matrix part is , where represents the th charging order, and , represents the th charging order at the nth moment The charging power, E is the total number of charging orders; T represents the transpose.
[0041] Step 2: Use the k-means++ clustering algorithm to perform clustering. In this example, set to obtain order clusters and the clustering center of each order cluster , where represents the th order cluster, and , is the th order cluster in the th charging order, and , represents at the th moment k represents the total number of charging orders in is the th order cluster clustering center, and , represents the th clustering center at the th moment. In this example, the clustering centers are shown as Figure 2 , and cluster1-cluster7 correspond to the clustering center curves of clusters 1-7.
[0042] Step 3: Use Equation (1) to calculate average value , and then use Equation (2) to obtain weight , and obtain the weights of all clustering centers:
[0043] (1)
[0044] (2)
[0045] Step 4: Let the minimum value in be the weight of the th clustering center, then let the th order cluster be the messy cluster, and is the th charging order in the j th order cluster The total number of charging orders in this instance, is of the messy type, that is , Figure 3 Show the power curve of the messy type, where the blue curve is the corresponding cluster center.
[0046] Step 5: Calculate the Euclidean distances between each of the other order clusters except and their respective cluster centers, obtaining Euclidean distance matrices , where represents the th order cluster and the th cluster center Euclidean distance matrix; and , represents the th order cluster and the th charging order in it and the th cluster center
[0047] Take the maximum value in , thus obtaining the maximum value matrix . In this instance, the Euclidean distance maximum value matrix is .
[0048] Step 5: Calculate the Euclidean distance matrix between the messy cluster and the th cluster center , thereby obtaining Euclidean distance matrices , where represents the Euclidean distance between the th charging order in the messy cluster and the th cluster center .
[0049] In this instance, as represents the Euclidean distance matrix between the messy type and the 1st cluster center;
[0050]
[0051] Step 6: Divide each charging order in the messy cluster into the remaining order clusters, thereby obtaining updated order clusters , as the clustering result of electric vehicle users' charging behavior, where is the th updated order cluster, and the order curve graphs of the updated cluster2 - cluster7 are as Figure 4 shown. It can be seen that the order curves are basically classified according to time characteristics.
[0052] Step 6.1: Initialize ;
[0053] Step 6.2: Initialize ;
[0054] Step 6.3: Judge whether is less than . If so, put into the th matrix ; otherwise, directly execute Step 6.4;
[0055] Step 6.4: After assigning to , return to Step 8 until ends, so as to obtain the final th matrix ;
[0056] Step 6.5; Put the th charging order in the messy cluster into the order cluster corresponding to the minimum value in ;
[0057] Step 6.6; After assigning to , return to Step 7 until ends, so as to obtain updated order clusters .
[0058] In summary, based on K-means++, the present invention effectively captures the behavioral characteristics of electric vehicles in different charging scenarios by optimizing the selection of the initial clustering centers, thereby enhancing the stability and accuracy of the clustering algorithm in charging data processing. Using the Euclidean distance as the similarity metric standard, it can finely distinguish the differences in power curves, charging durations, and behavioral characteristics such as fast charging and slow charging during the charging process. To adapt to the diversity of charging behaviors at different time periods within 24 hours a day, the present invention designs a multi-stage clustering strategy to gradually refine and analyze the charging behavior patterns within each time period, ensuring that the clustering results can comprehensively reflect various electricity consumption characteristics from low-power slow charging at night to fast charging during peak hours. This multi-stage method not only significantly improves the accuracy of charging data clustering but also effectively overcomes the deficiencies of traditional methods in depicting complex charging behavior patterns, providing scientific and accurate data support for power grid dispatching optimization, load forecasting, and charging facility planning. Ultimately, through the method of the present invention, the potential laws of electric vehicle user behaviors can be mined, providing a scientific basis for power supply companies to optimize power grid dispatching strategies, improve load forecasting accuracy, and rationally allocate charging infrastructure, while supporting the intelligent development of new energy systems.
Claims
1. A method for classifying electric vehicle user charging behavior based on K-means++ and Euclidean distance, characterized in that: The steps include: Step 1: Set a time period Place a charging order for electric vehicles in the charging station and preprocess it to obtain the preprocessed electric vehicle charging dataset ,in, Indicates Charging orders, and , Indicates Charging orders At the nth moment The charging power, E is the total number of charging orders; T represents transposition; Step 2: Use k-means++ clustering algorithm to Perform clustering and obtain Order Cluster And the cluster center of each order cluster ,in, Indicates order clusters, and , For the Order Cluster The Charging orders, and , express At the nth moment The charging power, I k express Total number of charging orders in; For the Order Cluster The cluster center of , Representative Cluster Centers At the nth moment The value of Step 3: Calculate using formula (1) The average , and then use formula (2) to get Weight , and get the weights of all cluster centers : (1) (2) Step 4: Set The minimum value among them is the weight of the jth cluster center , then let the jth order cluster is a messy cluster, and , is the jth order cluster The Charging orders, I j express Total number of charging orders in; Step 5: Calculate the The Euclidean distances between the other order clusters and their own cluster centers are obtained. Euclidean distance matrix ,in, Indicates Order Cluster With Cluster Centers The Euclidean distance matrix of ; and , Indicates Order Cluster The Charging order and Cluster Centers The Euclidean distance of Pick The maximum value in , thus obtaining the maximum value matrix ; Step 6: Calculate the clutter clusters With Cluster Centers The Euclidean distance matrix , thus obtaining Euclidean distance matrix ,in, Represents a chaotic cluster Middle Charging orders With Cluster Centers The Euclidean distance of Step 7: Cluster the clutter Each charging order is divided into the remaining order clusters, thus obtaining Updated order clusters , as the clustering result of electric vehicle users’ charging behavior, where For the An updated order cluster.
2. The method for classifying charging behavior of electric vehicle users according to claim 1 is characterized in that: The step 7 comprises: Step 7.1: Initialization ; Step 7.2: Initialization ; Step 7.3: Judgement Is it less than If so, then Put in Matrix Otherwise, go directly to step 7.4; Step 7.4: Assign to Then return to step 7.3 until So far, we get the final Matrix ; Step 7.5: Cluster the clutter Middle Charging orders Put in In the order cluster corresponding to the minimum value; Step 7.6: Assign to Then return to step 7.2 until So far, we get Updated order clusters .
3. An electronic device, comprising a memory and a processor, characterized in that: The memory is used to store a program that supports the processor to execute the electric vehicle user charging behavior classification method according to claim 1 or 2, and the processor is configured to execute the program stored in the memory.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for classifying charging behavior of electric vehicle users according to claim 1 or 2 are executed.