With the global push towards decarbonization, the penetration rate of electric cars is increasing annually. As a potential energy storage unit for the power grid, the role of electric cars in interacting with the grid for load shifting and peak shaving is becoming increasingly prominent. However, there is a relative scarcity of in-depth research on the charging behavior characteristics of electric cars associated with different types of buildings, often lacking validation through long-term, real-world charging data. This study addresses this gap by analyzing a full year (2024) of actual charging data from typical residential and public commercial buildings. We employ both K-means and DBSCAN clustering algorithms to identify distinct charging behavior profiles. Furthermore, we conduct a detailed statistical analysis of the hourly variation in charging demand over a 24-hour cycle. The aim is to evaluate the potential of electric cars in vehicle-to-grid (V2G) interactions and virtual power plant (VPP) applications, providing a data-driven reference for optimizing grid integration strategies.

The foundational step for any data-driven analysis is rigorous data processing. The dataset for this study comprises over 26,000 charging records from public charging stations at selected sites: one residential area (featuring one fast charger and six slow chargers) and one public commercial area (equipped with five fast chargers). The time span covers the entire calendar year of 2024. To ensure the quality and reliability of our analysis, we performed comprehensive data cleaning and feature extraction. Invalid records, such as those with charging errors, negative power values, or implausibly long charging durations, were removed. The Z-score normalization method was applied, and outliers were identified and eliminated using a combination of Z-score thresholds and the interquartile range (IQR) method visualized through box plots. From each valid charging session, we extracted key features: start time, end time, charging duration (, in minutes), charged energy (, in kWh), and average charging power (, in kW).
To uncover patterns within the charging data, we utilized two complementary clustering algorithms: K-means and DBSCAN. K-means is a centroid-based, distance-sensitive algorithm. Given a dataset and a predefined number of clusters , it iteratively assigns data points to the nearest cluster center (centroid) and updates the centroids until convergence. The similarity (or distance) between a data point and a cluster centroid is typically measured using the Euclidean distance:
$$
d(x_i, c_j) = \sqrt{\sum_{n=1}^{m} (x_{i,n} – c_{j,n})^2}
$$
where is the number of dimensions (features). The optimal number of clusters for our data was determined using the silhouette coefficient, a metric that evaluates the cohesion and separation of clusters. A higher silhouette score (closer to 1) indicates better-defined clusters.
In contrast, DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a density-based algorithm. It identifies clusters as dense regions of data points separated by sparse regions, making it capable of discovering clusters of arbitrary shape and identifying noise (outliers). The algorithm requires two parameters: the neighborhood radius (, eps) and the minimum number of points () to form a dense region. A point is classified as a core point if at least points are found within its -neighborhood. Clusters are then formed by connecting density-reachable core points. Points that are not core points but lie within the -neighborhood of a core point are labeled as border points. All other points are considered noise.
Table 1 provides a comparative summary of the key characteristics of the two clustering algorithms used in our analysis of electric car charging behavior.
| Algorithm | Type | Key Principle | Strengths | Weaknesses | Primary Use in This Study |
|---|---|---|---|---|---|
| K-means | Centroid-based | Minimizes within-cluster variance (distance to centroid). | Simple, efficient for large datasets. Works well with globular, well-separated clusters. | Requires pre-specification of K. Sensitive to outliers and initial centroid selection. Struggles with non-globular clusters. | Identifying major, distinct charging profiles (e.g., fast vs. slow). |
| DBSCAN | Density-based | Groups together densely packed points; marks others as noise. | Does not require pre-specifying cluster count. Robust to outliers. Can find arbitrarily shaped clusters. | Sensitive to parameters (ε, minPts). Performance degrades with varying densities. | Detecting nuanced sub-profiles (e.g., midnight charging) and anomalous sessions. |
The analysis of electric car charging behavior at the residential site revealed distinct patterns primarily driven by dwellers’ daily routines. Applying the K-means algorithm with an optimal K=3 (silhouette score ~0.8) segmented the sessions into three clear groups, as summarized in Table 2.
| Cluster ID | Session Count | Avg. Charging Duration (min) | Avg. Charged Energy (kWh) | Interpreted Profile |
|---|---|---|---|---|
| 1 | 1,978 | 248 | 19.7 | Evening/Overnight Slow Charge |
| 2 | 1,205 | 433 | 28.2 | Extended Overnight Slow Charge |
| 3 | 2,856 | 65 | 20.9 | Fast Charge (Top-up) |
Clusters 1 and 2 represent slow charging, differentiated by duration, likely corresponding to users plugging in upon returning home in the evening. Cluster 3 represents faster, shorter-duration sessions. The DBSCAN algorithm (with ε=0.23, minPts=5) provided a more granular view, identifying 19 clusters. The most significant ones are shown in Table 3. DBSCAN effectively isolated a specific “midnight fast-charge” profile (Cluster 2) and an “extended overnight slow-charge” profile (Cluster 3), which were blended within the broader K-means clusters. This highlights DBSCAN’s utility in detecting subtle, density-based subgroups within the electric car charging data.
| Cluster ID | Session Count | Avg. Start Time | Avg. Duration (min) | Avg. Energy (kWh) | Interpreted Profile |
|---|---|---|---|---|---|
| 1 | 5,331 | 18:00 | 193 | 20.8 | Primary Evening Slow Charge |
| 2 | 110 | 01:00 | 59 | 34.2 | Late-Night Fast Charge |
| 3 | 168 | 01:00 | 308 | 33.6 | Late-Night Extended Slow Charge |
Aggregating all residential electric car sessions on an hourly basis reveals a pronounced “double-peak and single-valley” pattern, closely mirroring the daily commute rhythm. The first peak occurs around 18:00, coinciding with residents returning home from work. A second, sharper peak is observed at 23:00. The valley occurs in the early morning, around 05:00-06:00. The hourly distribution of key charging metrics is detailed in Table 4. The proportion of total daily charging demand occurring in each hourly bin for a metric (e.g., energy) is calculated as:
$$
\text{Prop}_X(h) = \frac{\sum X_h}{\sum X_{total}} \times 100\%
$$
where is the sum of metric in hour .
| Hour of Day | Charging Duration Share (%) | Charged Energy Share (%) | Avg. Power Demand Share (%) | Observation |
|---|---|---|---|---|
| 18:00 | 12.9 | 9.5 | 5.1 | Evening Peak |
| 23:00 | 12.1 | 11.7 | 7.2 | Night Peak |
| 05:00 | 0.1 | 0.3 | 0.5 | Morning Valley |
| 06:00 | 0.3 | 0.5 | 1.1 | Morning Valley |
A critical finding is that the residential electric car charging load significantly overlaps with the grid’s peak demand periods. In the studied region, grid peak periods are typically defined as 11:00-17:00 and 19:00-23:00 on normal days. As shown in Table 5, over 57% of residential charging duration occurs during these grid peak hours. This synchronization creates a “peak-on-peak” effect, increasing stress on the grid rather than alleviating it. This is largely because residential charging in this case did not operate under a time-of-use (TOU) electricity tariff, so users had no financial incentive to shift their electric car charging behavior away from their natural return-home times.
| Grid Tariff Period | Charging Duration Share (%) | Charged Energy Share (%) | Power Demand Share (%) | Impact Assessment |
|---|---|---|---|---|
| Peak (11:00-17:00, 19:00-23:00) | 57.3 | 50.5 | 41.1 | Negative (“Peak-on-Peak”) |
| Standard (07:00-11:00, 17:00-19:00) | 22.8 | 27.6 | 27.8 | Neutral |
| Off-Peak (23:00-07:00) | 19.9 | 21.9 | 31.1 | Positive (“Valley Filling”) |
The electric car charging behavior at the public commercial site presented a starkly different profile, dominated by taxis and ride-hailing vehicles. The K-means algorithm (optimal K=2, silhouette ~0.7) yielded two clusters primarily distinguished by duration and energy, as shown in Table 6. Both clusters represent fast-charging behavior, with average sessions lasting between 30 and 60 minutes. DBSCAN analysis (ε=0.23, minPts=5) confirmed this homogeneity, identifying one dominant dense cluster (Cluster 1) containing the vast majority of sessions and several small clusters representing minor behavioral variants or anomalies.
| Cluster ID | Session Count | Avg. Charging Duration (min) | Avg. Charged Energy (kWh) |
|---|---|---|---|
| 1 | 10,011 | 58 | 35.2 |
| 2 | 9,042 | 31 | 18.8 |
The hourly analysis for commercial electric car charging revealed a compelling “double-peak and double-valley” pattern that was highly synchronized with the local TOU electricity tariff structure. The peaks occurred precisely when the high “peak” tariff ended: one at 13:00 (after the morning peak) and a much larger one at 23:00 (after the evening peak). Conversely, distinct valleys emerged at the start of the peak tariff periods, around 11:00 and 17:00/21:00. This indicates that commercial electric car drivers are highly price-sensitive and actively schedule their charging to capitalize on lower electricity rates. The concentration of demand is evident in Table 7, with the 23:00 hour alone accounting for over 15% of the daily charging duration and energy.
| Hour of Day | Charging Duration Share (%) | Charged Energy Share (%) | Avg. Power Demand Share (%) | Relation to TOU Tariff |
|---|---|---|---|---|
| 11:00 | 1.1 | 1.0 | 1.2 | Valley (Start of Peak Price) |
| 13:00 | 6.1 | 6.2 | 5.9 | Peak (End of Morning Peak Price) |
| 17:00 / 21:00 | ~1.0 | ~1.0 | ~1.1 | Valley (Peak Price Period) |
| 23:00 | 15.5 | 16.1 | 12.7 | Major Peak (Start of Off-Peak Price) |
The impact of this price-driven behavior on the grid is highly positive. As quantified in Table 8, more than 55% of the commercial electric car charging load is concentrated in the grid’s off-peak period (23:00-07:00), with only about 10% occurring during grid peak hours. This demonstrates a highly effective demand-side response, where the electric car fleet actively contributes to “peak shaving and valley filling.” This behavioral pattern makes commercial electric cars an excellent candidate for aggregated grid services, such as providing capacity reserves or participating in a VPP, as their charging is already predictable and aligned with grid-supportive objectives.
| Grid Tariff Period | Charging Duration Share (%) | Charged Energy Share (%) | Power Demand Share (%) | Impact Assessment |
|---|---|---|---|---|
| Peak (11:00-17:00, 19:00-23:00) | 10.7 | 10.0 | 11.4 | Highly Positive (Minimal Peak Load) |
| Standard (07:00-11:00, 17:00-19:00) | 34.0 | 33.7 | 35.8 | Neutral |
| Off-Peak (23:00-07:00) | 55.4 | 56.3 | 52.7 | Highly Positive (Significant Valley Filling) |
This study, based on a full year of real-world data, elucidates the distinct electric car charging behavior profiles associated with residential and commercial building types and their implications for the power grid. The application of both K-means and DBSCAN clustering algorithms proved complementary: K-means effectively identified the primary, broad categories of electric car charging (e.g., fast vs. slow), while DBSCAN was superior at detecting nuanced sub-patterns and anomalous sessions within the larger electric car user groups.
The core finding is the fundamental divergence in behavior driven by user type and economic incentives. Residential electric car charging exhibits a “double-peak and single-valley” pattern aligned with domestic routines but, in the absence of TOU tariffs, creates a problematic “peak-on-peak” effect for the grid. In contrast, commercial electric car (primarily fleet) charging displays a “double-peak and double-valley” pattern that is exquisitely synchronized with TOU tariff windows, resulting in over half of its load helpfully shifting to the grid’s off-peak period.
These insights have direct practical significance. For policymakers and grid operators, implementing and promoting TOU tariffs for residential electric car charging is crucial to unlock its grid-supportive potential. The demonstrated responsiveness of commercial fleets to price signals confirms their readiness for more advanced aggregated services. The characterized load profiles provide essential inputs for modeling the capacity of electric car fleets to participate in V2G and VPP schemes. Future work should integrate spatial analysis, include more diverse building types (e.g., workplaces, transportation hubs), and model the aggregated flexibility potential of the characterized electric car groups under different control and market scenarios.
