Charging probability prediction and load prediction method for electric vehicle users in residential area
By constructing the charging probability model of electric vehicle users and the improved WOA algorithm to optimize the CNN-GRU-Attention model, the load fluctuation caused by the randomness of electric vehicle charging behavior is solved, and the accuracy of power load prediction and grid stability are improved.
Patent Information
- Application Number
- CN202510393978.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-08
AI Technical Summary
The existing random charging behavior of electric vehicles leads to large load fluctuations. Traditional prediction methods such as ARIMA and SARIMA cannot accurately predict nonlinear and non-stationary time series data. The LSTM model parameter optimization algorithm WOA has the problem of slow convergence speed and falling into local solutions, which affects the accuracy of short-term power load prediction.
A charging probability model for electric vehicles in residential areas is constructed, and the user charging probability and historical load data are input into the CNN-GRU-Attention model as feature vectors, and parameter tuning is performed through the improved WOA algorithm, adaptive probability thresholds and weights are introduced, and the position update formula is improved in combination with the GSA algorithm to optimize the model hyperparameters.
It improves the accuracy of electric vehicle load prediction and generalization capabilities, ensures the stability of power grid load, provides a reference for orderly charging and discharge scheduling of electric vehicles, balances the grid load, and maintains grid stability.
Smart Images

Figure CN120280900A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric load forecasting, and particularly to a method for predicting the charging probability and load of electric vehicle users in residential areas. Background Art
[0002] With the increasingly serious energy crisis and environmental problems, electric vehicles have become an important way and development trend for future energy security, energy conservation and environmental protection. However, the widespread use of electric vehicles will have an impact on power grid dispatching. It is difficult for a single electric vehicle to directly participate in power grid dispatching. Therefore, it is necessary to conduct a centralized time-period analysis of the typical electricity consumption patterns of large electric vehicle users and the complete charging events of each electric vehicle user in order to participate in power grid dispatching.
[0003] At present, due to the randomness of the charging behavior of electric vehicle users, there are large fluctuations in the charging load, especially during peak hours, which brings certain difficulties to the prediction work; secondly, the charging behavior of electric vehicles is affected by various factors. Due to the small scale of electric vehicles at the present stage, most of the methods for evaluating their demand response potential are based on mathematical modeling, scenario simulation and simulation, and rarely involve artificial intelligence technology analysis methods such as machine learning and deep learning; data simulation cannot restore the reliability of real charging station or regional load data; in addition, with the strong promotion and construction of the regional integrated energy system, and the large-scale growth of new energy vehicles in the future, it is more necessary to consider the aggregated participation of electric vehicle groups in demand response.
[0004] Traditional prediction methods such as ARIMA, SARIMA, etc. cannot accurately predict time series data with non-linearity and non-stationarity when dealing with time series data. Therefore, most of the existing prediction methods for short-term electric load use multi-step prediction methods based on artificial intelligence to improve the stability and accuracy of prediction. The long short-term memory network (LSTM) is improved from the deep learning model recurrent neural network (RNN), and can solve the problems of gradient disappearance and gradient explosion in traditional RNN, and has a strong ability to model long-term dependence relationships, and is one of the most widely used prediction models in short-term electric load forecasting. The parameter combination of the LSTM model has a great influence on its prediction performance. In order to optimize the prediction performance of the LSTM model, a method is proposed to quickly find the optimal parameter combination of the LSTM through the whale optimization algorithm (WOA). However, when the WOA algorithm is applied to optimize the parameters of the LSTM model, there are problems such as slow convergence speed and falling into local solutions, which will also affect the accuracy of subsequent short-term electric load forecasting. Summary of the Invention
[0005] To solve the above technical problems, the present technical solution provides a method for predicting the charging probability and load of electric vehicle users in residential areas. By using the user charging probability as one of the input feature vectors into the CNN-GRU-Attention model and optimizing the model parameters through an improved WOA algorithm, not only the efficiency of selecting key parameters is improved, but also the output result has higher prediction accuracy, effectively solving the above problems.
[0006] The present invention is realized through the following technical solutions:
[0007] A method for predicting the charging probability and load of electric vehicle users in residential areas, comprising the steps of:
[0008] Step 1: Collect data to obtain a corresponding characteristic data set of charging load;
[0009] Step 2: Construct an electric vehicle user charging probability model to obtain the user charging probability;
[0010] Step 3: Construct a CNN-GRU-Attention model, and input the user charging probability and historical load data as feature vectors into the CNN-GRU-Attention model;
[0011] Step 4: Improve the WOA algorithm by replacing the original fixed probability threshold with an adaptive probability threshold, introducing the improved adaptive weight into the position update formula and combining with the GSA algorithm to improve the algorithm;
[0012] Step 5: Optimize the hyperparameters of the CNN-GRU-Attention model through the improved WOA algorithm;
[0013] Step 6: Construct a residential area electric vehicle charging load prediction model, determine the model structure according to the parameters optimized by the WOA algorithm, use the test set as the input variable of the optimized model, and further predict the residential area electric vehicle charging load to obtain the output of the electric vehicle charging load prediction result.
[0014] Further, the specific operation method of collecting data in Step 1 is: collect user charging data and historical electricity price data in the residential area, including charging time, charging amount, time-of-use electricity price, etc., preprocess the data, and divide the training set and the test set. Further, the electric vehicle user charging probability model in Step 2 is:
[0015]
[0016]
[0017] In the formula, P t(t1, t2) is the probability of user charging within the time period from t1 to t2, f(t) is the probability density function of the user starting to charge, dt is the derivative of t, t is the starting charging time of the electric vehicle, μ, σ, σ 2 are the mean, standard deviation and variance of the normal distribution respectively; e is the natural constant, approximately equal to 2.71828.
[0018] Furthermore, for the construction of the CNN-GRU-Attention model described in step three, the specific operation steps include:
[0019] Step 3.1: Create an input layer and input the user charging probability and historical load data as feature vectors;
[0020] Step 3.2: Create a two-layer convolutional layer to extract local features of the data;
[0021] Step 3.3: Create an attention layer, complete feature learning by multiplying the weight coefficients to the original feature map, and at the same time introduce a regulation factor in the Attention layer to improve the weight calculation formula;
[0022] Step 3.4: Create a GRU layer to capture long-term dependence relationships;
[0023] Step 3.5: Create a fully connected layer and an output layer to output the load prediction value for the next 24 hours.
[0024] Furthermore, for the introduction of a regulation factor in the Attention layer described in step 3.3 to improve the weight calculation formula, the specific operation method is: adjust the weight calculation formula in the Attention layer according to the real-time change characteristics of the input data;
[0025] Introduce a regulation factor α based on the real-time change rate, calculate the charging load change rate, and when the absolute value of the change rate is greater than 0.2, the weight formula of Attention becomes:
[0026]
[0027] α = e -λ·Δt (4)
[0028] In the formula, Q, K, V are the query, key and value vectors generated based on the input data, K T is the transpose of the key vector matrix, dim keyis the dimension of the key vector, α is the adjustment factor for dynamically adjusting the attention weight, and λ is the coefficient for controlling the attenuation rate of the adjustment factor; Δt is the charging load stabilization time, that is, the time difference from the last change rate exceeding the threshold of 0.2 to the current moment, which gradually approaches 1 as the charging load stabilization time increases, avoiding the model from over-focusing on abnormal data at a certain moment, and at the same time being able to capture important information in time when the data fluctuates; e is the natural constant, approximately equal to 2.71828.
[0029] Further, replacing the original fixed probability threshold with the adaptive probability threshold in step four is specifically as follows: The adaptive probability threshold is used to replace the 50% fixed probability threshold set in the original algorithm. The specific calculation formula for the improved probability threshold is:
[0030]
[0031] In the formula, n is the current iteration number, N max is the maximum iteration number, and P2 is the improved probability threshold.
[0032] Further, the improved adaptive weight in step four has the following expression formula:
[0033]
[0034] In the formula, ω new is the improved adaptive weight, ω min and ω max are respectively the minimum and maximum values of the adaptive weight; here, the weight minimum value is set to 0.1 and the maximum value is set to 0.9; the added weight formula has a large weight in the initial stage, enhancing the global search ability of the algorithm. As the number of iterations increases, the algorithm focuses more on local search in the later stage.
[0035] Further, the position update formula in step four adopts the whale position update formula. The whale position update formula for each stage is:
[0036] When P < P2 and |A| < 1, the whale group enters the shrinking and surrounding stage; when P ≥ P2, the whale group enters the spiral rising stage; in the two predation stages, the improved adaptive probability threshold and the improved adaptive weight are introduced. The whale position update formula is:
[0037]
[0038] In the formula, k is the whale individual, X(k + 1) is the updated position of the whale, X * (k) is the optimal position of the whale, X(k) is the current position of the whale, G ∈ [0, 2] is the random perturbation factor, P is a random number in [0, 1], ω newTo improve the adaptive weight, A is a vector coefficient, b is a spiral shape constant, and l is a random number between [-1, 1];
[0039] When P < P2 and |A| ≥ 1, the whale group enters the random search stage. Combining the golden sine algorithm GSA to improve the original formula for searching prey, introducing the golden section coefficient, the whale position update formula is:
[0040] X rand (k + 1) = ω new ·X * (k) - A·|S1·X(k) - S2·X rand (k)| (8)
[0041] In the formula, X rand (k + 1) is the position of the whale after update in the random search stage, X rand (k) is the randomly generated position of the whale, S1 and S2 are the golden section coefficients. Combining the golden section coefficients with the random search stage of the whale guides the search direction and speeds up the convergence rate.
[0042] Furthermore, the specific operation method of step five is as follows:
[0043] Step 5.1: Encode the learning rate and the number of hidden layer units of the CNN - GRU - Attention model and convert them into the individual position vectors in the whale algorithm;
[0044] Step 5.2: Use the Sobol sequence to initialize the population and generate the initial combination of whale positions representing the model parameters;
[0045] Step 5.3: For each set of model parameters, decode and apply them to the model for training. Use the mean absolute error as the evaluation index, and the parameters corresponding to the whale position with the smallest mean absolute error are the optimal parameters;
[0046] Step 5.4: Update the probability threshold that determines the whale to enter different stages. Improve the adaptive probability threshold formula as:
[0047]
[0048] In the formula, n is the current iteration number, N max is the maximum iteration number, and P2 is the improved probability threshold;
[0049] Step 5.5: Update the adaptive weight. Improve the adaptive weight formula as:
[0050]
[0051] In the formula, ω min and ω maxare the minimum and maximum values of the adaptive weight respectively. The minimum value of the weight is set to 0.1 and the maximum value is set to 0.9;
[0052] Step 5.6: In each iteration, update the individual position according to the rules of the whale algorithm; update the whale position. The position update formulas for each stage are as follows:
[0053]
[0054] In the formula, X(k + 1) is the position of the whale after update, X * (k) is the optimal position of the whale, X rand (k + 1) is the position of the whale after update in the random search stage, X rand (k) is the position of the randomly generated whale, X(k) is the position of the current whale, G ∈ [0, 2] is a random perturbation factor, P is a random number in [0, 1], ω new is the improved adaptive weight, A is the vector coefficient, b is the spiral shape constant, l is a random number between [-1, 1], and S1, S2 are the golden section coefficients.
[0055] Step 5.7: Determine whether the maximum number of iterations has been reached. If not, return to Step 3. If the maximum number of iterations has been reached, output the learning rate and the number of hidden layer units that can obtain the optimal prediction performance.
[0056] Furthermore, determining the model structure according to the parameters optimized by the WOA algorithm described in Step Six is to determine the final model structure according to the learning rate and the number of hidden layer unit parameters obtained in Step Five; the final model structure is:
[0057]
[0058] In the formula, c i is the output after convolution, D is the feature dimension, W c 、W z 、W r 、W h 、W y are the weight matrices of the convolution kernel, GRU update gate, reset gate, candidate hidden state, and output layer respectively. B c 、B z 、B r 、B h 、B y are the bias terms of the convolution operation, update gate, reset gate, candidate hidden state, and output layer respectively. Attention(Q, K, V) is the attention score, C att,i is the weighted convolution output, i ∈ {1, 2..., I} is the time step, z i is the output of the GRU update gate, r iis the output of the GRU reset gate, is the candidate hidden state, h i is the final hidden state, and y is the 24-hour electric vehicle charging load in the residential area of the final output.
[0059] Beneficial effects
[0060] A method for predicting the charging probability and load of electric vehicle users in a residential area proposed by the present invention has the following beneficial effects compared with the prior art:
[0061] (1) By constructing an electric vehicle user charging probability model, the present invention obtains the user charging probability, and inputs the user charging probability and historical load data as feature vectors into the CNN-GRU-Attention model, which reflects the dynamic behavior of users. At the same time, as supplementary information, it fills the gaps in the data sparse area, improving the generalization ability of the model. At the same time, a regulation factor is introduced in the weight calculation of the Attention layer, and a change rate threshold is set according to the change of historical load data, avoiding the model from over-focusing on abnormal data at a certain moment, and being able to capture important information when the data fluctuates, improving the model's processing ability and prediction performance for complex time series data. And the parameters of the model are optimized by the improved WOA algorithm, which not only improves the efficiency of selecting key parameters, but also makes the output result have higher prediction accuracy, playing an important role in constructing a new power system. The improved prediction model can improve the accuracy of electric vehicle load prediction in the residential area, provide a reference for the orderly charging and discharging scheduling of electric vehicles, effectively balance the grid load, and maintain the stability of the grid.
[0062] (2) In the improved WOA algorithm of the present invention, the improved adaptive probability threshold replaces the fixed probability threshold, allowing the whale to select a more appropriate predation strategy during iteration, balancing the global search and local development capabilities of the algorithm; an improved adaptive weight is introduced, enhancing the global search ability of the algorithm in the initial stage of iteration and focusing on local search in the later stage of the algorithm; combined with the GSA algorithm, guiding the search direction of the whale and accelerating the convergence speed. The improved CNN-GRU-Attention prediction model improves the efficiency of selecting key parameters and has higher prediction accuracy, playing an important role in ensuring the reliable operation of the power system in the residential area. Description of the drawings
[0063] Figure 1 is the overall process schematic diagram of the present invention.
[0064] Figure 2 is the flow chart of the improved whale algorithm in the present invention.
[0065] Figure 3 is the model architecture diagram of CNN-GRU-Attention in the present invention.
[0066] Figure 4 This is a comparison chart of the test effects of the improved whale algorithm and other algorithms in the present invention.
[0067] Figure 5 This is a comparison chart of the load prediction value and the actual value of the IWOA-CNN-GRU-Attention model. Specific implementation manners
[0068] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Without departing from the design concept of the present invention, various variations and improvements made by those of ordinary skill in the art to the technical solutions of the present invention shall fall within the protection scope of the present invention.
[0069] Embodiment 1:
[0070] As Figure 1 shown, a method for predicting the charging probability and load of electric vehicle users in a residential area includes the steps:
[0071] Step 1: Collect data to obtain a corresponding characteristic data set of charging load; the specific operation method is: collect user charging data and historical electricity price data in the residential area, including charging time, charging amount, time-of-use electricity price, etc., preprocess the data, and divide it into a training set and a test set.
[0072] Step 2: Construct an electric vehicle user charging probability model to obtain the user charging probability; the electric vehicle user charging probability model is:
[0073]
[0074] In the formula, P t (t1,t2) is the probability that the user charges within the time period from t1 to t2, f(t) is the probability density function of the user starting to charge, dt is the derivative of t, t is the starting charging time of the electric vehicle, μ, σ, σ 2 are respectively the mean, standard deviation and variance of the normal distribution; e is the natural constant, approximately equal to 2.71828.
[0075] Step 3: Construct a CNN-GRU-Attention model, and input the user charging probability and historical load data as feature vectors into the CNN-GRU-Attention model. The specific operation steps for constructing the CNN-GRU-Attention model include:
[0076] Step 3.1: Create an input layer and input the user charging probability and historical load data as feature vectors.
[0077] Step 3.2: Create a double-layer convolutional layer to extract local features of the data.
[0078] Step 3.3: Create an attention layer. Complete feature learning by multiplying the weight coefficients to the original feature map; meanwhile, introduce a regulation factor in the Attention layer to improve the weight calculation formula. The specific operation method is as follows: Adjust the weight calculation formula in the Attention layer according to the real-time change characteristics of the input data.
[0079] Introduce a regulation factor α based on the real-time change rate, calculate the charging load change rate. When the absolute value of the change rate is greater than 0.2, the weight formula of Attention becomes:
[0080]
[0081] α = e -λ·Δt (4)
[0082] In the formula, Q, K, and V are query, key, and value vectors generated based on the input data, K T is the transpose of the key vector matrix, dim key is the dimension of the key vector, α is the regulation factor for dynamically adjusting the attention weight, λ is the coefficient for controlling the attenuation speed of the regulation factor; Δt is the charging load steady time, that is, the time difference from the last time the change rate exceeded the threshold of 0.2 to the current moment, and it gradually approaches 1 as the charging load steady time increases, avoiding the model from overly focusing on abnormal data at a certain moment, and at the same time being able to capture important information in time when the data fluctuates; e is the natural constant, approximately equal to 2.71828.
[0083] Step 3.4: Create a GRU layer to capture long-term dependence relationships.
[0084] Step 3.5: Create a fully connected layer and an output layer to output the load prediction value for the next 24 hours.
[0085] Step Four: Improve the WOA algorithm. Replace the original fixed probability threshold with an adaptive probability threshold, introduce the improved adaptive weight into the position update formula and combine with the GSA algorithm to improve the algorithm.
[0086] The replacement of the original fixed probability threshold with an adaptive probability threshold is specifically as follows: Use an adaptive probability threshold to replace the 50% fixed probability threshold set in the original algorithm. The specific calculation formula for the improved probability threshold is:
[0087]
[0088] In the formula, n is the current iteration number, N max is the maximum iteration number, and P2 is the improved probability threshold.
[0089] The improved adaptive weight has the following expression formula:
[0090]
[0091] In the formula, ω new is the improved adaptive weight, ω min and ω max are respectively the minimum and maximum values of the adaptive weight; here, the minimum weight value is set to 0.1 and the maximum value is set to 0.9; the added weight formula has a large weight in the initial stage, enhancing the global search ability of the algorithm. As the number of iterations increases, the algorithm focuses more on local search in the later stage.
[0092] The position update formula used is the whale position update formula, as Figure 2 shown, the whale position update formula for each stage is:
[0093] When P < P2 and |A| < 1, the whale group enters the shrinking and surrounding stage; when P ≥ P2, the whale group enters the spiral ascending stage; in the two predation stages, an improved adaptive probability threshold and an improved adaptive weight are introduced, and the whale position update formula is:
[0094]
[0095] In the formula, k is the whale individual, X(k + 1) is the updated position of the whale, X * (k) is the optimal position of the whale, X(k) is the current position of the whale, G ∈ [0, 2] is a random perturbation factor, P is a random number in [0, 1], ω new is the improved adaptive weight, A is the vector coefficient, b is the spiral shape constant, and l is a random number between [-1, 1];
[0096] When P < P2 and |A| ≥ 1, the whale group enters the random search stage. Combining the golden sine algorithm GSA to improve the original formula for searching for prey and introducing the golden section coefficient, the whale position update formula is:
[0097] X rand (k + 1) = ω new ·X * (k) - A·|S1·X(k) - S2·X rand (k)| (8)
[0098] In the formula, X rand (k + 1) is the updated position of the whale in the random search stage, X rand (k) is the randomly generated position of the whale, S1 and S2 are the golden section coefficients. Combining the golden section coefficients with the random search stage of the whale guides the search direction and speeds up the convergence rate.
[0099] Step 5: Hyperparameter tuning of the CNN-GRU-Attention model is performed using the improved WOA algorithm; the specific operation method is as follows:
[0100] Step 5.1: Encode the learning rate and the number of hidden layer units of the CNN-GRU-Attention model and convert them into the individual position vectors in the whale algorithm;
[0101] Step 5.2: Use the Sobol sequence to initialize the population and generate the initial combination of whale positions representing the model parameters;
[0102] Step 5.3: For each set of model parameters, decode and apply them to the model for training, and use the mean absolute error as the evaluation index. The parameters corresponding to the whale position with the smallest mean absolute error are the optimal parameters;
[0103] Step 5.4: Update the probability threshold that determines the whale to enter different stages, and improve the adaptive probability threshold formula as:
[0104]
[0105] In the formula, n is the current iteration number, N max is the maximum iteration number, and P2 is the improved probability threshold;
[0106] Step 5.5: Update the adaptive weight, and improve the adaptive weight formula as:
[0107]
[0108] In the formula, ω min and ω max are the minimum and maximum values of the adaptive weight respectively. Set the minimum weight value to 0.1 and the maximum value to 0.9;
[0109] Step 5.6: In each iteration, update the individual position according to the rules of the whale algorithm; update the whale position, and the position update formula for each stage is:
[0110]
[0112] In the formula, X(k + 1) is the updated position of the whale, X * (k) is the optimal position of the whale, X rand (k + 1) is the updated position of the whale in the random search stage, X rand (k) is the position of the randomly generated whale, X(k) is the current position of the whale, G ∈ [0, 2] is a random perturbation factor, P is a random number in [0, 1], ω newTo improve the adaptive weight, A is the vector coefficient, b is the spiral shape constant, l is a random number between [-1, 1], and S1, S2 are the golden ratio coefficients.
[0113] Step 5.7: Determine whether the maximum number of iterations is reached. If not, return to Step 3. If the maximum number of iterations is reached, output the learning rate and the number of hidden layer units that can obtain the optimal prediction performance.
[0114] Step Six: Construct a residential area electric vehicle charging load prediction model. Determine the model structure according to the parameters optimized by the WOA algorithm. Use the test set as the input variable of the optimized model to further predict the residential area electric vehicle charging load and obtain the output of the electric vehicle charging load prediction result. The determination of the model structure according to the parameters optimized by the WOA algorithm is to determine the final model structure according to the learning rate and the number of hidden layer unit parameters obtained in Step Five; the final model structure is:
[0115]
[0116] In the formula, c i is the output after convolution, D is the feature dimension, W c , W z , W r , W h , W y are the weight matrices of the convolution kernel, GRU update gate, reset gate, candidate hidden state, and output layer respectively. B c , B z , B r , B h , B y are the bias terms of the convolution operation, update gate, reset gate, candidate hidden state, and output layer respectively. Attention(Q, K, V) is the attention score, C att,i is the weighted convolution output, i ∈ {1, 2..., I} is the time step, z i is the output of the GRU update gate, r i is the output of the GRU reset gate, is the candidate hidden state, h i is the final hidden state, and y is the 24-hour electric vehicle charging load in the residential area of the final output.
[0117] Use the test function set to perform performance tests on the improved whale algorithm, the original whale algorithm WOA, the grey wolf algorithm GWO, and the sparrow algorithm SSA. Select the average value Ave and the standard deviation Std of the performance parameters as the algorithm performance evaluation indicators. The test results are as Figure 4 shown. The following results are obtained:
[0118] 1) Evaluation of the convergence speed: FromFigure 4 It can be seen that as the number of iterations increases, the improved whale optimization algorithm (IWOA) has a faster convergence speed compared to the whale optimization algorithm (WOA), grey wolf optimization algorithm (GWO), and sparrow search algorithm (SSA), and can effectively save the optimization time.
[0119] 2) Precision evaluation: The standard deviation reflects the degree of dispersion of a set of data relative to the mean. The smaller the standard deviation, the higher the algorithm precision. The standard deviation of the improved whale optimization algorithm is smaller than that of other algorithms, indicating that the results obtained by the improved whale optimization algorithm are more accurate, and the optimization results of the whale optimization algorithm, grey wolf optimization algorithm, and sparrow search algorithm are more dispersed.
[0120] 3) Stability judgment. The average value obtained by a stable optimization algorithm fluctuates less. In the same number of iterations and test functions, the average value of the improved whale optimization algorithm fluctuates within a smaller range, and its results are relatively more stable compared to other algorithms, without large deviations.
[0121] It can be concluded that the IWOA algorithm has a better overall effect, with better convergence speed, precision, and stability, which is helpful for finding the parameters in the prediction model.
[0122] In this embodiment, a residential area in a certain place is taken as the research object, and the charging load data of electric vehicles in the residential area is taken as an example for simulation to verify the performance of the IWOA algorithm and the improved attention mechanism in the electric vehicle charging load prediction model. The sample data obtained from the charging load includes data such as the historical charging load of vehicles, user charging probability, electricity price, temperature, etc., and is normalized and mapped to the range of [0, 1]. The dataset is divided into a training set and a test set in a ratio of 3:1.
[0123] The IWOA algorithm is used to optimize the model to solve the optimal combination parameter values of the learning rate and the number of hidden layer units. The initial population size is set to 10. In order to reduce the search range and improve the optimization efficiency, the search range of the parameters is set to [3, 7] and [0.001, 0.01] after estimating the approximate interval.
[0124] The learning rate and the number of hidden layer units are encoded and transformed into the position vector of the whale individual; the population is initialized to generate the initial combination of model parameters; for each set of model parameters, they are decoded and applied to the prediction model, and the mean absolute error is used as the evaluation index. The parameters corresponding to the whale position with the smallest mean absolute error are the optimal parameters; the optimal parameter combination is output, and the learning rate and the number of hidden layer units that can obtain the optimal prediction performance are 0.0029 and 4 respectively. The settings and values of the hyperparameters of the model are shown in the following table.
[0125] Table 3 Settings and values of model hyperparameters
[0126] Hyperparameter Value Learning rate 0.0029 Number of GRU hidden layer units 4 Number of CNN layers 2 Number of CNN convolutional kernels 16 and 64 Optimizer Adam
[0127] The architecture diagram of the improved CNN-GRU-Attention model based on the whale optimization algorithm is as follows Figure 3 shown. After the optimization algorithm ends, the hyperparameters of the neural network are determined according to the optimal solution, and a neural network with a specific structure is constructed to predict the charging probability of users in the residential area and the electric vehicle load. The prediction results are as follows Figure 5 shown.
[0128] From Figure 5 it can be seen that as the test data increases, compared with the CNN-GRU model, the overall data deviation rate (compared with the actual value) of the IWOA-CNN-GRU-Attention load prediction in the present invention is more obvious, the single-day load prediction result is closer to the actual load, and the accuracy is higher.
[0129] From the above result analysis, it can be known that IWOA has the advantages of fast convergence speed and high optimization accuracy compared with WOA, and CNN-GRU-Attention has the ability of feature extraction, processing long sequences and paying attention to important information. Combining IWOA with CNN-GRU-Attention improves the efficiency of selecting key parameters and has better prediction performance in load prediction. According to these prediction results, data support can be provided for the dynamic charging and discharging scheduling of electric vehicles, so as to optimize the charging and discharging time sequence, reduce the peak-valley difference of the power grid, and improve the new energy consumption capacity.
[0130] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes, substitutions and improvements within the technical scope disclosed by the present invention are within the protection scope of the present invention.
Claims
1. A method for predicting the charging probability and load of electric vehicle users in residential areas, including the steps: Step 1: Collect data to obtain a characteristic data set of the corresponding charging load; Step 2: Build an electric vehicle user charging probability model to obtain the user charging probability; Step 3: Build a CNN-GRU-Attention model, and input the user charging probability and historical load data as feature vectors into the CNN-GRU-Attention model; Step 4: Improve the WOA algorithm. Replace the original fixed probability threshold with an adaptive probability threshold, introduce an improved adaptive weight into the position update formula and combine it with the GSA algorithm to improve the algorithm; Step 5: Optimize the hyperparameters of the CNN-GRU-Attention model through the improved WOA algorithm; Step 6: Build a residential area electric vehicle charging load prediction model, determine the model structure according to the parameters optimized by the WOA algorithm, use the test set as the input variable of the optimized model, and further predict the residential area electric vehicle charging load to obtain the output of the electric vehicle charging load prediction result.
2. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 1, characterized in that: The specific operation method of collecting data in Step 1 is: Collect user charging data and historical electricity price data in the residential area, including charging time, charging volume, time-of-use electricity price, etc., preprocess the data, and divide it into a training set and a test set.
3. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 1, characterized in that: The electric vehicle user charging probability model described in Step 2 is: Where P t (t1, t2) is the probability that the user charges within the time period from t1 to t2, f(t) is the probability density function of the user starting to charge, dt is the derivative with respect to t, t is the starting charging time of the electric vehicle, μ, σ, σ 2 are the mean, standard deviation, and variance of the normal distribution respectively; e is the natural constant, approximately equal to 2.71828.
4. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 1, characterized in that: The specific operation steps of building the CNN-GRU-Attention model described in Step 3 include: Step 3.1: Create an input layer and input the user charging probability and historical load data as feature vectors; Step 3.2: Create a two-layer convolutional layer to extract local features of the data; Step 3.3: Create an attention layer, complete feature learning by multiplying the weight coefficient to the original feature map, and at the same time introduce a regulation factor in the Attention layer to improve the weight calculation formula; Step 3.4: Create a GRU layer to capture long-term dependence relationships; Step 3.5: Create a fully connected layer and an output layer to output the load prediction value for the next 24 hours.
5. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 4, characterized in that: The specific operation method of introducing a regulation factor in the Attention layer in Step 3.3 to improve the weight calculation formula is: Adjust the weight calculation formula in the Attention layer according to the real-time change characteristics of the input data; Introduce a regulation factor α based on the real-time change rate, calculate the charging load change rate, and when the absolute value of the change rate is greater than 0.2, the weight formula of Attention becomes: α=e -λ·Δt (4) where Q, K, and V are query, key, and value vectors generated based on the input data, and K T is the transpose of the key vector matrix, and dim key is the dimension of the key vector, α is a regulation factor for dynamically adjusting the attention weights, and λ is a coefficient for controlling the decay rate of the regulation factor; Δt is the charging load steady time, that is, the time difference from the last change rate exceeding the threshold of 0.2 to the current moment, and gradually approaches 1 as the charging load steady time increases, avoiding the model from over-focusing on abnormal data at a certain moment while being able to capture important information in a timely manner when the data fluctuates; e is the natural constant, approximately equal to 2.71828.
6. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 1, characterized in that: The specific method of replacing the original fixed probability threshold with an adaptive probability threshold in Step 4 is: Use an adaptive probability threshold to replace the 50% fixed probability threshold set in the original algorithm. The specific calculation formula of the improved probability threshold is: where n is the current iteration number, N max is the maximum iteration number, and P2 is the improvement probability threshold.
7. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 6, characterized in that: The expression formula of the improved adaptive weight described in Step 4 is: where ω new is the improved adaptive weight, ω min and ω max are the minimum and maximum values of the adaptive weight respectively; here, the minimum weight is set to 0.1 and the maximum weight is set to 0.9; the added weight formula has a large weight in the initial stage, enhancing the global search ability of the algorithm. As the number of iterations increases, the algorithm focuses more on local search in the later stage.
8. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 7, characterized in that: The position update formula used in Step 4 is the whale position update formula, and the whale position update formula for each stage is: When P < P2 and |A| < 1, the whale group enters the contraction and encirclement stage; when P ≥ P2, the whale group enters the spiral ascent stage; in the two predation stages, an improved adaptive probability threshold and an improved adaptive weight are introduced, and the whale position update formula is as follows: where k is the whale individual, X(k + 1) is the updated position of the whale, X * (k) is the optimal position of the whale, X(k) is the current position of the whale, G ∈ [0, 2] is a random perturbation factor, P is a random number in [0, 1], ω new is the improved adaptive weight, A is the vector coefficient, b is the spiral shape constant, l is a random number between [-1, 1]; When P < P2 and |A| ≥ 1, the whale group enters the random search stage. Combining the golden sine algorithm GSA to improve the original formula for searching for prey, introducing the golden section coefficient, the whale position update formula is as follows: X rand (k + 1) = ω new ·X * (k) - A·|S1·X(k) - S2·X rand (k)| (8) Where X rand (k + 1) is the position of the whale after updating in the random search stage, and X rand (k) is the randomly generated position of the whale. S1 and S2 are the golden section coefficients. Combining the golden section coefficients with the random search stage of the whale guides the search direction and speeds up the convergence rate.
9. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 8, characterized in that: The specific operation method of step five is as follows: Step 5.1: Encode the learning rate and the number of hidden layer units of the CNN-GRU-Attention model and convert them into the individual position vectors in the whale algorithm; Step 5.2: Use the Sobol sequence to initialize the population and generate the initial combination of model parameters represented by the whale positions; Step 5.3: For each group of model parameters, decode and apply them to the model for training, and use the mean absolute error as the evaluation index. The parameters corresponding to the whale position with the smallest mean absolute error are the optimal parameters; Step 5.4: Update the probability threshold that determines the whale to enter different stages. The improved adaptive probability threshold formula is as follows: where n is the current iteration number, N max is the maximum number of iterations, and P2 is the improvement probability threshold; Step 5.5: Update the adaptive weight. The improved adaptive weight formula is as follows: where ω min and ω max are the minimum and maximum values of the adaptive weight respectively. The minimum value of the weight is set to 0.1 and the maximum value is set to 0.9; Step 5.6: In each iteration, update the individual position according to the rules of the whale algorithm; Update the whale position. The position update formula for each stage is as follows: Where, X(k + 1) is the position of the whale after update, X * (k) is the optimal position of the whale, X rand (k + 1) is the position of the whale after update in the random search stage, X rand (k) is the position of the randomly generated whale, X(k) is the position of the current whale, G ∈ [0, 2] is a random perturbation factor, P is a random number in [0, 1], ω new is the improved adaptive weight, A is the vector coefficient, b is the spiral shape constant, l is a random number between [-1, 1], and S1, S2 are the golden section coefficients. Step 5.7: Determine whether the maximum number of iterations is reached. If not, return to step 3. If the maximum number of iterations is reached, output the learning rate and the number of hidden layer units that can obtain the optimal prediction performance.
10. A method for predicting the charging probability and load of electric vehicle users in a residential area according to claim 9, characterized in that: Determining the model structure according to the parameters optimized by the WOA algorithm described in step six means determining the final model structure according to the learning rate and the number of hidden layer units obtained in step five; the final model structure is: where c i is the output after convolution, D is the feature dimension, and W c , W z , W r , W h , W y are the weight matrices of the convolutional kernel, GRU update gate, reset gate, candidate hidden state, and output layer respectively. B c , B z , B r , B h , B y are the bias terms of the convolutional operation, update gate, reset gate, candidate hidden state, and output layer respectively. Attention(Q, K, V) is the attention score, C att,i is the weighted convolutional output, i ∈ {1, 2..., I} is the time step, z i is the output of the GRU update gate, r i is the output of the GRU reset gate, is the candidate hidden state, h i is the final hidden state, and y is the 24-hour electric vehicle charging load in the residential area of the final output.
Citation Information
Cited By
Resident charging load prediction method and electronic equipment
CN121813300A