Electric vehicle aggregate load capacity prediction method based on LSTM model
By combining ARIMA and LSTM models to perform time series decomposition and weighted combination of electric vehicle charging load data, the problem of unstable prediction accuracy of electric vehicle aggregate load capacity in the existing technology is solved, and higher short-term prediction accuracy is achieved.
Patent Information
- Application Number
- CN202510039769.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-01-10
AI Technical Summary
The existing short-term electric vehicle aggregate load capacity forecasting technology based on intelligent algorithms and traditional forecasting methods is unstable when processing linear and nonlinear load data, which affects the accuracy of short-term load forecasting results.
The LSTM model is combined with the ARIMA model to perform time series decomposition of the charging load data, process the linear and nonlinear trend parts separately, and obtain the electric vehicle aggregate load capacity prediction results through weighted combination.
The accuracy of short-term electric vehicle aggregate load capacity forecasting is improved. The linear part is processed by the ARIMA model, the nonlinear part is centrally processed by the LSTM model, and the weighted combination forecast results are output, which improves the stability and accuracy of the forecast.
Smart Images

Figure CN119965838B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electric vehicles and power system loads, and more specifically, relates to a method for predicting the aggregated load capacity of electric vehicles based on an LSTM model. Background Art
[0002] The construction of new infrastructure is rapidly developing and becoming an increasingly important component of power system loads. In particular, electric vehicles, as intelligent transportation infrastructure addressing issues such as energy substitution and environmental pollution, have experienced rapid growth in recent years. This rapid development has had a wide-ranging impact on power system operations. EVs offer flexible charging times, enabling them to flexibly leverage the regulatory role of energy storage. Leveraging vehicle battery energy storage, improving the intelligence and coordinated control capabilities of charging infrastructure, and strengthening its integration with new energy and power grid technologies can further enhance the power system's regulatory capabilities. Consequently, electric vehicles are becoming a hot topic in power system optimization and load forecasting.
[0003] Accurate forecasting of EV aggregate load capacity can help ensure orderly charging and discharging of EVs, enabling the "peak shaving" and "valley filling" of EV loads on the power grid. Furthermore, forecasting EV aggregate load capacity can effectively optimize EV distribution network planning and charging infrastructure planning, meeting the demands for EV charging and grid planning in the context of widespread EV access.
[0004] Currently, the aggregated load capacity of electric vehicles refers to the total charging demand of all electric vehicles in a specific area (such as a city or power grid). It is affected by many factors, including the number and distribution of electric vehicles, charging time, charging power, and the availability of charging infrastructure. Electric vehicle charging typically places a certain load on the power system, especially during periods when a large number of electric vehicles are charging together. This also places demands on the flexibility of the power system. Therefore, the management of aggregated load capacity can effectively optimize grid resources, avoid overloads, and improve power utilization efficiency. Furthermore, power system load forecasting can be divided into ultra-short-term, short-term, medium-term, and long-term forecasts. Short-term forecasts are an important component of load forecasting, and their accuracy directly affects the correctness and economic efficiency of the main scheduling and decision-making of the power system.
[0005] To achieve flexible resource capacity forecasting, aggregated load capacity forecasting focuses on short-term load forecasting. Short-term load forecasting methods can be categorized into traditional and intelligent forecasting methods. Traditional methods include time series methods and regression analysis, while intelligent methods include neural networks, decision trees, wavelet analysis, random forests, support vector machines, and cloud computing. Neural networks, with their strong self-learning and nonlinear fitting capabilities, are well-suited for solving smart grid load forecasting problems. However, existing short-term load forecasting technologies based on intelligent algorithms and traditional forecasting methods are subject to the influence of linear and nonlinear load data. This leads to unstable forecasting results when processing linear and nonlinear load data, which in turn affects the accuracy of short-term load forecasting results. Summary of the Invention
[0006] In order to address the deficiencies in the prior art, the purpose of the present invention is to solve the above-mentioned defects and further propose a method for predicting the aggregated load capacity of electric vehicles based on the LSTM model.
[0007] The present invention adopts the following technical solutions.
[0008] The first aspect of the present invention discloses a method for predicting the aggregate load capacity of electric vehicles based on an LSTM model, the method comprising:
[0009] Acquiring charging load data of the charging station within a first time period, dividing the first time period into sub-time periods, and sampling the charging load data according to the divided sub-time periods to obtain periodic load data samples;
[0010] Constructing a data set based on the load data samples and preprocessing the load data samples, wherein the data set includes the load data samples and their corresponding time data, temperature data, and geographic location data of the charging station;
[0011] Dividing the load data sample into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and building an ARIMA model based on the first load data to obtain an ARIMA forecasting model;
[0012] Randomly dividing the second load data in the data set into a training set and a validation set according to a preset ratio, and training and testing the LSTM model based on the training set and the validation set to obtain an LSTM prediction model;
[0013] The output results of the ARIMA prediction model and the LSTM prediction model for the charging load data of the electric vehicle are weighted and combined to obtain the prediction result of the aggregated load capacity of the electric vehicle.
[0014] Furthermore, constructing a data set based on the load data samples and preprocessing the load data samples includes:
[0015] The load data samples and temperature data are normalized. The normalization expressions of the load data samples and temperature data are:
[0016]
[0017] Where max(x) is the maximum value of the input charging load sequence or temperature sequence, min(x) is the minimum value of the input charging load sequence or temperature sequence, x is the real-time charging load data or real-time temperature data, and x' is the result of normalization processing;
[0018] The non-numerical day types in the time data are divided into working days and weekends, and the working days and weekends are marked with different numerical values. The non-numerical charging station geographical locations in the geographical location data are divided into commercial areas, living areas and industrial areas, and the commercial areas, living areas and industrial areas are marked with different numerical values, so as to digitize the non-numerical time data and geographical location data.
[0019] Furthermore, the load data samples are divided into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and an ARIMA model is modeled based on the first load data to obtain an ARIMA forecasting model, including:
[0020] Determining the model order of the ARIMA model according to the autocorrelation function and the partial autocorrelation function graph to fit the ARIMA model;
[0021] Among them, the fitting expression of the ARIMA model is:
[0022]
[0023] Where, is the autoregressive coefficient, θ is the moving average coefficient, ε(t) is the white noise, t is the time data, and T(t) is the fitting result.
[0024] Furthermore, the method of dividing the load data sample into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and modeling an ARIMA model based on the first load data to obtain an ARIMA forecasting model, further includes:
[0025] Estimating model parameters of the ARIMA model based on the training set divided by the first load data to minimize the mean square error of the residual;
[0026] A validation set is constructed based on the first load data to check the residual sequence to verify the fitting result of the ARIMA model and obtain the ARIMA forecasting model after modeling;
[0027] The ARIMA prediction model is used to predict the charging load data of the linear trend part of the electric vehicle.
[0028] Furthermore, the second load data in the data set is randomly divided into a training set and a validation set according to a preset ratio, and the LSTM model is trained and tested based on the training set and the validation set to obtain the LSTM prediction model, including:
[0029] Decomposing the load data sample into a linear trend portion and a residual portion by STL decomposition, wherein the residual portion is the load data sample in the network input data of the LSTM model, and the network input data also includes the pre-processed day type, temperature data, and geographic location data;
[0030] The network input data at the first moment is input into the LSTM model to convert the load data sample into the predicted load data at the second moment. The expression of the conversion process is:
[0031]
[0032] Where, f θ The constructed neural network is composed of a fully connected layer and a long short-term memory recursive neural network. P is the load data sample, D is the day type, T is the temperature data, L is the geographic location data, and P is the load data sample. pre is the predicted load data at the second moment, and the second moment is any moment in the future of the first moment, and 672×4 is the independent window data dimension of the fully connected layer input.
[0033] Furthermore, the second load data in the data set is randomly divided into a training set and a validation set according to a preset ratio, and the LSTM model is trained and tested based on the training set and the validation set to obtain the LSTM prediction model, further comprising:
[0034] Inputting the last hidden feature output by the long short-term memory recurrent neural network into the fully connected layer to output the predicted load data at the second moment;
[0035] Calculating model parameters that minimize the gap between the predicted value and the true value based on the load data sample at the second moment and the predicted load data, and defining a loss function between the true value and the predicted value;
[0036] The expression of the model parameter with the smallest gap between the predicted value and the true value is:
[0037]
[0038] Where θ * is the model parameter with the smallest gap between the predicted value and the true value, f θ is the constructed neural network, X is the load data sample at the first moment, f θ (X) is the predicted value at the second moment, and Y is the true value at the second moment;
[0039] The loss function is the Euclidean distance between the true value and the predicted value, and its expression is:
[0040]
[0041] Where, P truth is the true value, P pre is the predicted value.
[0042] Furthermore, the output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of the electric vehicle are weightedly combined to obtain the electric vehicle aggregate load capacity prediction result, including:
[0043] Inputting the current charging load data of the electric vehicle into the ARIMA prediction model and the LSTM prediction model respectively to output a linear part prediction value and a nonlinear part prediction value of the current charging load data;
[0044] Calculating a weighted combination prediction result of the linear part prediction value and the nonlinear part prediction value, wherein the weighted combination prediction result is the electric vehicle aggregate load capacity prediction result;
[0045] The calculation expression of the weighted combination prediction result is:
[0046]
[0047] Where, is the weighted combination prediction result, is the predicted value of the linear part, is the predicted value of the nonlinear part, ω1 is the weight of the linear part, ω2 is the weight of the nonlinear part, and ω1+ω2=1.
[0048] The second aspect of the present invention discloses a device for predicting the aggregated load capacity of electric vehicles based on an LSTM model, the device comprising:
[0049] a data sampling module, configured to obtain charging load data of the charging station within a first time period, divide the first time period into sub-time periods, and sample the charging load data according to the divided sub-time periods to obtain periodic load data samples;
[0050] a data preprocessing module, configured to construct a data set based on the load data samples and preprocess the load data samples, wherein the data set includes the load data samples and their corresponding time data, temperature data, and geographic location data of the charging station;
[0051] A first model building module is configured to divide the load data sample into first load data with a linear trend and second load data with a nonlinear trend by using a time series decomposition method, and to build an ARIMA model based on the first load data to obtain an ARIMA forecasting model;
[0052] a second model building module, configured to randomly divide the second load data in the data set into a training set and a validation set according to a preset ratio, and train and test the LSTM model based on the training set and the validation set to obtain an LSTM prediction model;
[0053] The load capacity prediction module is used to perform a weighted combination of the output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of the electric vehicle to obtain the electric vehicle aggregate load capacity prediction result.
[0054] A third aspect of the present invention discloses a terminal, comprising a processor and a storage medium; the storage medium is used to store instructions;
[0055] The processor is configured to operate according to the instructions to execute the steps of the method of the first aspect.
[0056] A fourth aspect of the present invention discloses a computer-readable storage medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when executed by a processor.
[0057] The beneficial effects of the present invention are that, compared with the prior art, the present invention has the following advantages:
[0058] This method obtains charging load data from charging stations over a short period of time, divides this period into sub-periods, and samples the charging load data according to the sub-periods to generate periodic load data samples. A dataset is then constructed based on these load data samples and preprocessed. Time series decomposition is then used to divide the load data samples into linear and nonlinear trend load data. An ARIMA model is then constructed based on the linear portion to generate an ARIMA forecasting model. The nonlinear portion of the dataset is then randomly divided into a training set and a validation set according to a preset ratio. An LSTM model is then trained and tested based on the training and validation sets to generate an LSTM forecasting model. Finally, the outputs of the ARIMA and LSTM forecasting models for electric vehicle charging load data are weighted and combined to generate the final forecast for the aggregated load capacity of electric vehicles. This method processes the linear and nonlinear parts of the load data through the ARIMA model and the LSTM model, models the linear part with the ARIMA model, so that the LSTM model can focus more on processing the load data of the nonlinear part, and finally outputs the weighted combination prediction result of the ARIMA model and the LSTM model to improve the accuracy of the prediction results of the aggregated load capacity of electric vehicles in the short term. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a flow chart of the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention. DETAILED DESCRIPTION
[0060] The present application will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and are not intended to limit the scope of protection of the present application.
[0061] like Figure 1 As shown, in one embodiment, a method for predicting electric vehicle aggregate load capacity based on an LSTM model includes the following steps:
[0062] Step S110 , acquiring charging load data of the charging station within a first time period, dividing the first time period into sub-time periods, sampling the charging load data according to the divided sub-time periods, and obtaining periodic load data samples.
[0063] Step S120 , constructing a data set based on the load data samples and preprocessing the load data samples. The data set includes the load data samples and their corresponding time data, temperature data, and geographic location data of the charging station.
[0064] In some embodiments, the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention constructs a data set based on load data samples and preprocesses the load data samples, specifically comprising the following steps:
[0065] Step S121, normalize the load data samples and temperature data. The normalization expression of the load data samples and temperature data is:
[0066]
[0067] Where max(x) is the maximum value of the input charging load sequence or temperature sequence, min(x) is the minimum value of the input charging load sequence or temperature sequence, x is the real-time charging load data or real-time temperature data, and x' is the result of normalization processing.
[0068] Step S122: Differentiate the non-numeric day types in the time data into working days and weekends, and mark working days and weekends with different numerical values; and differentiate the non-numeric charging station geographical locations in the geographical location data into commercial areas, living areas, and industrial areas, and mark commercial areas, living areas, and industrial areas with different numerical values, so as to digitize the non-numeric time data and geographical location data.
[0069] Step S130 , dividing the load data samples into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and building an ARIMA model based on the first load data to obtain an ARIMA prediction model.
[0070] In some embodiments, the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention divides the load data sample into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and models an ARIMA model based on the first load data to obtain an ARIMA prediction model, which specifically includes the following steps:
[0071] Step S131 : determining the model order of the ARIMA model according to the autocorrelation function and the partial autocorrelation function graph, so as to fit the ARIMA model.
[0072] Among them, the fitting expression of the ARIMA model is:
[0073]
[0074] Where, is the autoregressive coefficient, θ is the moving average coefficient, ε(t) is the white noise, t is the time data, and T(t) is the fitting result.
[0075] In some embodiments, the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention divides the load data sample into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and models an ARIMA model based on the first load data to obtain an ARIMA prediction model, which specifically further includes the following steps:
[0076] Step S132 : constructing a divided training set based on the first load data to estimate the model parameters of the ARIMA model so as to minimize the mean square error of the residual.
[0077] Step S133 : constructing a validation set divided based on the first load data to check the residual sequence to verify the fitting result of the ARIMA model and obtain the ARIMA prediction model after modeling.
[0078] Among them, the modeled ARIMA forecasting model is used to predict the charging load data of the linear trend part of electric vehicles.
[0079] In step S140 , the second load data in the data set is randomly divided into a training set and a validation set according to a preset ratio, and the LSTM model is trained and tested based on the training set and the validation set to obtain an LSTM prediction model.
[0080] In some embodiments, the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention randomly divides the second load data in the data set into a training set and a validation set according to a preset ratio, and trains and tests the LSTM model based on the training set and the validation set to obtain the LSTM prediction model, which specifically includes the following steps:
[0081] Step S141, decomposing the load data sample into a linear trend part and a residual part through STL decomposition, wherein the residual part is the load data sample in the network input data of the LSTM model, and the network input data also includes pre-processed day type, temperature data and geographic location data.
[0082] In step S142, the network input data at the first moment is input into the LSTM model to convert the load data sample into the predicted load data at the second moment. The expression of the conversion process is:
[0083]
[0084] Where, f θ The constructed neural network is composed of a fully connected layer and a long short-term memory recursive neural network. P is the load data sample, D is the day type, T is the temperature data, L is the geographic location data, and P is the load data sample. preis the predicted load data at the second moment, and the second moment is any moment in the future of the first moment. 672×4 is the independent window data dimension of the fully connected layer input.
[0085] In some embodiments, the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention randomly divides the second load data in the data set into a training set and a validation set according to a preset ratio, and trains and tests the LSTM model based on the training set and the validation set to obtain the LSTM prediction model, which specifically further includes the following steps:
[0086] In step S143, the last hidden feature output by the long short-term memory recurrent neural network is input into the fully connected layer to output the predicted load data at the second moment.
[0087] Step S144, calculating the model parameters with the smallest gap between the predicted value and the true value based on the load data sample at the second moment and the predicted load data, and defining the loss function between the true value and the predicted value.
[0088] Among them, the expression of the model parameter with the smallest gap between the predicted value and the true value is:
[0089]
[0090] Where θ * is the model parameter with the smallest gap between the predicted value and the true value, f θ is the constructed neural network, X is the load data sample at the first moment, f θ (X) is the predicted value at the second moment, and Y is the true value at the second moment.
[0091] The loss function is the Euclidean distance between the true value and the predicted value, and its expression is:
[0092]
[0093] Where, P truth is the true value, P pre is the predicted value.
[0094] Step S150 , performing a weighted combination on the output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of the electric vehicle to obtain a prediction result of the aggregated load capacity of the electric vehicle.
[0095] In some embodiments, the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention performs a weighted combination of the output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of the electric vehicle to obtain the electric vehicle aggregate load capacity prediction result, which specifically includes the following steps:
[0096] In step S151 , the current charging load data of the electric vehicle is input into the ARIMA prediction model and the LSTM prediction model respectively to output the linear part prediction value and the nonlinear part prediction value of the current charging load data.
[0097] Step S152, calculating a weighted combination prediction result of the linear part prediction value and the nonlinear part prediction value, where the weighted combination prediction result is the electric vehicle aggregate load capacity prediction result.
[0098] Among them, the calculation expression of the weighted combination prediction result is:
[0099]
[0100] Where, is the weighted combination prediction result, is the predicted value of the linear part, is the predicted value of the nonlinear part, ω1 is the weight of the linear part, ω2 is the weight of the nonlinear part, and ω1+ω2=1.
[0101] The LSTM-based electric vehicle aggregate load capacity forecasting method obtains charging load data from charging stations within a short time period, divides this time period into sub-time periods, and samples the charging load data according to the sub-time periods to obtain periodic load data samples. A dataset is then constructed based on the load data samples and preprocessed. Time series decomposition is then used to divide the load data samples into linear and nonlinear load data. An ARIMA model is then constructed based on the linear portion to obtain an ARIMA forecasting model. The nonlinear portion of the dataset is then randomly divided into a training set and a validation set according to a preset ratio. The LSTM model is then trained and tested based on the training and validation sets to obtain an LSTM forecasting model. Finally, the outputs of the ARIMA and LSTM forecasting models for the electric vehicle charging load data are weighted and combined to obtain the final forecast result for the aggregate load capacity of electric vehicles. This method processes the linear and nonlinear parts of the load data through the ARIMA model and the LSTM model, models the linear part with the ARIMA model, so that the LSTM model can focus more on processing the load data of the nonlinear part, and finally outputs the weighted combination prediction result of the ARIMA model and the LSTM model to improve the accuracy of the prediction results of the aggregated load capacity of electric vehicles in the short term.
[0102] In a specific embodiment, the electric vehicle aggregate load capacity prediction method based on the LSTM model provided by the present invention is implemented based on Python and constructed using Pytorch / TensorFlow. It is recommended to use the anaconda virtual environment, and Python software packages such as Pytorch / TensorFlow, numpy, and matplotlib need to be installed in advance.
[0103] In this embodiment, the real charging load data of a centralized charging station in a residential area of a city from January 11, 2021 to February 7, 2021 was selected. The load data was divided into a cycle of 7 days from Monday to Sunday with a sampling point of 15 minutes. Each cycle has a total of 672 sampling points, which can present 4 cycles. By observing the charging load data, it was found that it has a clear periodicity, which meets the implementation requirements of the LSTM model. In addition, since the aggregated load capacity of electric vehicles depends on user demand, and user demand is closely related to factors such as day type, charging station location, time, and temperature. Therefore, the data set also includes the above-mentioned influencing factors, among which the day type includes weekdays, weekends, and holidays, and the charging station location includes commercial areas, living areas, industrial areas, etc.
[0104] In this example, the dataset primarily contains real charging load data, day type, temperature, and charging station location data. The data samples in the dataset are then preprocessed. Due to the activation function characteristics of the neural network, it is sensitive to data within the range [-1, 1]. If the input data is within the range [-1, 1], the training speed and effectiveness of the neural network will be greatly accelerated. Therefore, the following expression is used to normalize the charging load data:
[0105]
[0106] Where max(x) is the maximum value of the input charging load sequence, min(x) is the minimum value of the input charging load sequence, x is the real-time charging load data, and x' is the result of normalization processing.
[0107] The temperature data is preprocessed using the following expression:
[0108]
[0109] In the formula, max(x) is the maximum value of the input temperature sequence, min(x) is the minimum value of the input temperature sequence, x is the real-time temperature data, and x' is the result of normalization processing.
[0110] During the preprocessing of day-type data, non-numeric day types are distinguished only between weekdays and weekends, with weekdays represented by 0 and weekends by 1, and holidays are not considered. During the preprocessing of charging station location data, non-numeric charging station locations are distinguished only between commercial areas, residential areas, and industrial areas, with commercial areas represented by 0, residential areas by 1, and industrial areas by 2.
[0111] After data preprocessing is completed, by observing the charging load data, it can be found that the load data has a certain daily periodicity and weekly periodicity. Therefore, a sliding window is constructed based on the above periodicity. When a sampling point is 15 minutes, the sliding window length is set to 672, and a cycle is one week. Set the input to (P, D, T, L) 672×4 , where (P,D,T,L) 672×4 It is represented as input data with a window length of 672 frames. Each frame contains 4 dimensions, which are the normalized real charging load data P, day type D, normalized temperature T, and charging station location L. The output is set to the real charging load data P at the next moment. pre The data set is divided into 80% training set and 20% validation set in a random manner to ensure the accuracy of the algorithm and the feasibility of load data prediction.
[0112] In this embodiment, due to the large number of LSTM model parameters and high model complexity, the training time is long, especially in large-scale data sets, which may not be conducive to real-time prediction and application. Therefore, for the charging load data, it can be divided into a linear trend part and a nonlinear part based on the time series decomposition method, and the linear trend part is modeled with the ARIMA model, so that the LSTM network focuses more on the nonlinear part, thereby obtaining a more accurate prediction effect. In addition, the charging load data X(t) can be decomposed into a linear trend part T(t) and a residual part R(t) using STL decomposition, that is, X(t) =
[0113] T(t)+R(t), the residual part R(t) is the actual charging load data P.
[0114] In the ARIMA model building process, the model order must be selected first. The model order (p, d, q) is determined based on the autocorrelation function (ACF) and partial autocorrelation function (PACF) graphs. Here, p is the AR (autoregressive) order, d is the difference order used for stabilization, and q is the MA (moving average) order. Subsequently, the ARIMA model is fitted using the selected model order (p, d, q) parameters. The fitting expression for the ARIMA model is:
[0115]
[0116] Where, is the autoregressive coefficient, θ is the moving average coefficient, ε(t) is the white noise, t is the time data, and T(t) is the fitting result.
[0117] Subsequently, the training set is used to estimate the model parameters to minimize the mean square error of the residuals, check the independence and stationarity of the residual series, and verify the model fitting results. In the prediction process of the linear partial load data, the trained ARIMA model can be used to predict the future linear trend part T(t).
[0118] In this embodiment, a long-short-term memory (LSTM) recurrent neural network achieves long-term information preservation or forgetting through a cell state that flexibly controls the flow of information. The specific implementation process includes a forget gate, an input gate, and an output gate. The forget gate determines which information in the cell state will be forgotten, the input gate determines which new information will be stored in the cell state, and the output gate determines the output of the cell. Therefore, the network receives data in frames of a certain window length at a time. The information of the previous frame is filtered by the forget gate, the data of the current frame is filtered by the input gate, and the output gate determines the output content.
[0119] The network input data is the normalized real charging load data P of the previous week, the day type D, the normalized temperature T, and the charging station location data L. The input data can be transformed into the predicted charging load data P at the next moment through the long short-term memory recurrent neural network (LSTM). pre , the prediction process can be expressed as:
[0120]
[0121] Where, f θ The constructed neural network is composed of a fully connected layer and a long short-term memory recursive neural network. P is the load data sample, D is the day type, T is the temperature data, L is the geographic location data, and 672×4 is the independent window data dimension of the fully connected layer input.
[0122] In this embodiment, the fully connected layer first converts the input independent window data of 672×4 dimensions into 672×128 dimensions, and then inputs the obtained 672×128-dimensional data into the long short-term memory recurrent neural network (LSTM). The long short-term memory recurrent neural network (LSTM) involves two layers of bidirectional long short-term memory recurrent neural network (LSTM), with 128 hidden nodes in each layer. Each layer of the long short-term memory recurrent neural network (LSTM) adopts a dropout layer, randomly discarding 25% of the neuron units during training. Since the previous frame and the subsequent frame are both crucial in updating the current frame, a bidirectional architecture can be used to utilize dynamic context. The last hidden feature of the long short-term memory recurrent neural network (LSTM) is 256-dimensional, which contains compressed information of the entire sequence and can be used for real charging load data prediction.
[0123] The last hidden feature output by the LSTM recurrent neural network is then fed into the fully connected layer to obtain the final prediction result. During model training, the gradient-based first-order optimizer Adam is used, and the learning rate can be set to 0.0015.
[0124] The LSTM network construction code is as follows:
[0125] self.linear1=nn.Linear(self.input_size,self.hidden_size)
[0126] self.lstm=nn.LSTM(self.hidden_size, self.hidden_size, self.num_layers, batch_first=True, dropout=self.drop_out, bidirectional=True)
[0127] self.linear2=nn.Linear(self.num_directions*self.hidden_size,self.output_size)
[0128] #Here, self.input_size=4, self.hidden_size=128, self.num_layers=2, self.drop_out=0.25, self.num_directions=2, self.output_size=1.
[0129] In this embodiment, in order to achieve a good prediction of the actual charging load data at the next moment, the main purpose of network training is to find the parameters that minimize the difference between the predicted value and the actual value. The calculation formula is as follows:
[0130]
[0131] Where θ * is the model parameter with the smallest gap between the predicted value and the true value, f θ is the constructed neural network, X is the real load data sample to be predicted, f θ (X) is the predicted value in the future, and Y is the actual value in the future.
[0132] The loss function is defined as the Euclidean distance between the true value and the predicted value, and its expression is:
[0133]
[0134] Where, P truth is the true value, P pre is the predicted value
[0135] After that, the training and verification of the LSTM network are carried out, and the pseudo code process of the LSTM network training and verification is as follows:
[0136] Loop epoch times:
[0137] (Training process) The model is set to training mode net.train()
[0138] (Training process) Traverse each batch of data in the training set:
[0139] (Training process) Load input data and true values
[0140] (during training) clear the optimizer's gradient record optimizer.zero_grad()
[0141] (Training process) Model forward propagation, obtain the prediction result y_pred = net(inputs)
[0142] (Training process) Use loss function to calculate loss
[0143] (Training process) Model backpropagation, calculate gradient loss.backward()
[0144] (Training process) Update model parameters optimizer.step()
[0145] (Verification process) The model is set to evaluation mode net.eval()
[0146] (Verification process) Disable gradient calculation to save memory and computing resources torch.no_grad():
[0147] (Verification process) Traverse each batch of data in the verification set:
[0148] (Verification process) Load input data and true values
[0149] (Verification process) Model forward propagation, obtain the prediction result y_pred = net(inputs)
[0150] (Verification process) Use loss function to calculate loss
[0151] (Validation process) Calculate the average loss of all batches
[0152] (Validation process) Adjust the learning rate scheduler.step(val_loss) according to the validation performance.
[0153] In this embodiment, a prediction evaluation can be performed on the trained load data prediction model to improve the accuracy of the model prediction. The prediction evaluation includes offline evaluation and online testing. Among them, the offline test is to test whether the model can meet the prediction effect by using a piece of real charging load data P, day type D, normalized temperature T, and charging station geographic location data L. The data is normalized and assigned according to the data preprocessing scheme, and then cut according to the sliding window. Finally, the processed results are sequentially put into the network model for prediction to obtain the final prediction result, and the prediction result is compared with the true value. The online test is to measure the data in real time, collect data in real time, input 672 frames of data from the current moment to the previous week into the model, obtain the prediction result, and compare it with the collected real load data in real time.
[0154] The electric vehicle aggregate load capacity prediction device based on the LSTM model provided by the present invention is described below. The electric vehicle aggregate load capacity prediction device based on the LSTM model described below and the electric vehicle aggregate load capacity prediction method based on the LSTM model described above can be referenced to each other.
[0155] In one embodiment, an electric vehicle aggregate load capacity prediction device based on an LSTM model includes a data sampling module, a data preprocessing module, a first model construction module, a second model construction module, and a load capacity prediction module.
[0156] The data sampling module is used to obtain charging load data of the charging station within a first time period, divide the first time period into sub-time periods, and sample the charging load data according to the divided sub-time periods to obtain periodic load data samples.
[0157] The data preprocessing module is used to construct a data set based on the load data samples and preprocess the load data samples. The data set includes the load data samples and their corresponding time data, temperature data, and geographic location data of the charging station.
[0158] The first model building module is used to divide the load data samples into first load data with a linear trend and second load data with a nonlinear trend through a time series decomposition method, and to build an ARIMA model based on the first load data to obtain an ARIMA prediction model.
[0159] The second model building module is used to randomly divide the second load data in the data set into a training set and a validation set according to a preset ratio, and train and test the LSTM model based on the training set and the validation set to obtain an LSTM prediction model.
[0160] The load capacity prediction module is used to perform a weighted combination of the output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of electric vehicles to obtain the prediction results of the aggregated load capacity of electric vehicles.
[0161] In this embodiment, the electric vehicle aggregate load capacity prediction device based on the LSTM model provided by the present invention, the data preprocessing module is specifically used to:
[0162] The load data samples and temperature data are normalized. The normalization expressions of the load data samples and temperature data are as follows:
[0163]
[0164] Where max(x) is the maximum value of the input charging load sequence or temperature sequence, min(x) is the minimum value of the input charging load sequence or temperature sequence, x is the real-time charging load data or real-time temperature data, and x' is the result of normalization processing.
[0165] The non-numerical day types in the time data are divided into working days and weekends, and working days and weekends are marked with different numerical values. The non-numerical charging station geographical locations in the geographic location data are divided into commercial areas, living areas and industrial areas, and commercial areas, living areas and industrial areas are marked with different numerical values to digitize the non-numerical time data and geographic location data.
[0166] In this embodiment, the electric vehicle aggregate load capacity prediction device based on the LSTM model provided by the present invention, the first model building module is specifically used to:
[0167] The model order of the ARIMA model is determined based on the autocorrelation function and partial autocorrelation function graphs to fit the ARIMA model.
[0168] Among them, the fitting expression of the ARIMA model is:
[0169]
[0170] Where, is the autoregressive coefficient, θ is the moving average coefficient, ε(t) is the white noise, t is the time data, and T(t) is the fitting result.
[0171] In this embodiment, the electric vehicle aggregate load capacity prediction device based on the LSTM model provided by the present invention, the first model building module is further used to:
[0172] The model parameters of the ARIMA model are estimated based on the divided training set constructed based on the first load data, so as to minimize the mean square error of the residual.
[0173] A validation set is constructed based on the first load data to check the residual sequence to verify the fitting results of the ARIMA model and obtain the ARIMA forecasting model after modeling.
[0174] Among them, the modeled ARIMA forecasting model is used to predict the charging load data of the linear trend part of electric vehicles.
[0175] In this embodiment, the electric vehicle aggregate load capacity prediction device based on the LSTM model provided by the present invention, the second model building module is specifically used to:
[0176] The load data samples are decomposed into a linear trend part and a residual part through STL decomposition. The residual part is the load data sample in the network input data of the LSTM model. The network input data also includes preprocessed day type, temperature data and geographic location data.
[0177] The network input data at the first moment is input into the LSTM model to convert the load data sample into the predicted load data at the second moment. The expression of the conversion process is:
[0178]
[0179] Where, f θ The constructed neural network is composed of a fully connected layer and a long short-term memory recursive neural network. P is the load data sample, D is the day type, T is the temperature data, L is the geographic location data, and P is the load data sample. pre is the predicted load data at the second moment, and the second moment is any moment in the future of the first moment. 672×4 is the independent window data dimension of the fully connected layer input.
[0180] In this embodiment, the electric vehicle aggregate load capacity prediction device based on the LSTM model provided by the present invention, the second model building module is further used to:
[0181] The last hidden feature output by the long short-term memory recurrent neural network is input into the fully connected layer to output the predicted load data at the second moment.
[0182] Based on the load data sample at the second moment and the predicted load data, the model parameters with the smallest gap between the predicted value and the true value are calculated, and the loss function between the true value and the predicted value is defined.
[0183] Among them, the expression of the model parameter with the smallest gap between the predicted value and the true value is:
[0184]
[0185] Where θ * is the model parameter with the smallest gap between the predicted value and the true value, f θ is the constructed neural network, X is the load data sample at the first moment, f θ (X) is the predicted value at the second moment, and Y is the true value at the second moment.
[0186] The loss function is the Euclidean distance between the true value and the predicted value, and its expression is:
[0187]
[0188] Where, P truth is the true value, P pre is the predicted value.
[0189] In this embodiment, the present invention provides an electric vehicle aggregate load capacity prediction device based on an LSTM model, wherein the load capacity prediction module is specifically used to:
[0190] The current charging load data of the electric vehicle is input into the ARIMA prediction model and the LSTM prediction model respectively to output the linear part prediction value and the nonlinear part prediction value of the current charging load data.
[0191] The weighted combination prediction result of the linear part prediction value and the nonlinear part prediction value is calculated, and the weighted combination prediction result is the electric vehicle aggregate load capacity prediction result.
[0192] Among them, the calculation expression of the weighted combination prediction result is:
[0193]
[0194] Where, is the weighted combination prediction result, is the predicted value of the linear part, is the predicted value of the nonlinear part, ω1 is the weight of the linear part, ω2 is the weight of the nonlinear part, and ω1+ω2=1.
[0195] The present disclosure may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0196] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.
[0197] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0198] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0199] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0200] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0201] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0202] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0203] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.
Claims
1. A method for predicting electric vehicle aggregate load capacity based on LSTM model, characterized in that: The method comprises: Acquiring charging load data of the charging station within a first time period, dividing the first time period into sub-time periods, and sampling the charging load data according to the divided sub-time periods to obtain periodic load data samples; Constructing a data set based on the load data samples and preprocessing the load data samples, wherein the data set includes the load data samples and their corresponding time data, temperature data, and geographic location data of the charging station; Dividing the load data sample into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and building an ARIMA model based on the first load data to obtain an ARIMA forecasting model; Randomly dividing the second load data in the data set into a training set and a validation set according to a preset ratio, and training and testing the LSTM model based on the training set and the validation set to obtain an LSTM prediction model; Performing a weighted combination of the output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of the electric vehicle to obtain a prediction result of the aggregated load capacity of the electric vehicle; The constructing of a data set based on the load data samples and preprocessing the load data samples includes: The load data samples and temperature data are normalized. The normalization expressions of the load data samples and temperature data are: ; Where, is the maximum value of the input charging load sequence or temperature sequence, is the minimum value of the input charging load sequence or temperature sequence, For real-time charging load data or real-time temperature data, is the result of normalization; The non-numerical day types in the time data are divided into working days and weekends, and the working days and weekends are marked with different numerical values. The non-numerical charging station geographical locations in the geographical location data are divided into commercial areas, living areas and industrial areas, and the commercial areas, living areas and industrial areas are marked with different numerical values, so as to digitize the non-numerical time data and geographical location data.
2. The electric vehicle aggregate load capacity prediction method based on the LSTM model according to claim 1 is characterized in that: The method of dividing the load data sample into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and modeling an ARIMA model based on the first load data to obtain an ARIMA forecasting model includes: Determining the model order of the ARIMA model according to the autocorrelation function and the partial autocorrelation function graph to fit the ARIMA model; Among them, the fitting expression of the ARIMA model is: ; Where, is the autoregressive coefficient, is the moving average coefficient, is white noise, is the time data, is the fitting result.
3. The electric vehicle aggregate load capacity prediction method based on the LSTM model according to claim 2 is characterized in that: The method further includes dividing the load data sample into first load data with a linear trend and second load data with a nonlinear trend by a time series decomposition method, and building an ARIMA model based on the first load data to obtain an ARIMA forecasting model. Estimating model parameters of the ARIMA model based on the training set divided by the first load data to minimize the mean square error of the residual; A validation set is constructed based on the first load data to check the residual sequence to verify the fitting result of the ARIMA model and obtain the ARIMA forecasting model after modeling; The ARIMA prediction model is used to predict the charging load data of the linear trend part of the electric vehicle.
4. The electric vehicle aggregate load capacity prediction method based on the LSTM model according to claim 3 is characterized in that: The second load data in the data set is randomly divided into a training set and a validation set according to a preset ratio, and the LSTM model is trained and tested based on the training set and the validation set to obtain the LSTM prediction model, including: Decomposing the load data sample into a linear trend portion and a residual portion by STL decomposition, wherein the residual portion is the load data sample in the network input data of the LSTM model, and the network input data also includes the pre-processed day type, temperature data, and geographic location data; The network input data at the first moment is input into the LSTM model to convert the load data sample into the predicted load data at the second moment. The expression of the conversion process is: ; Where, The neural network constructed is composed of a fully connected layer and a long short-term memory recursive neural network. is the load data sample, For day type, is the temperature data, For geographic location data, is the predicted load data at the second moment, and the second moment is any moment in the future of the first moment, The dimension of the independent window data input to the fully connected layer.
5. The electric vehicle aggregate load capacity prediction method based on the LSTM model according to claim 4 is characterized in that: The method randomly divides the second load data in the data set into a training set and a validation set according to a preset ratio, and trains and tests the LSTM model based on the training set and the validation set to obtain the LSTM prediction model, further comprising: Inputting the last hidden feature output by the long short-term memory recurrent neural network into the fully connected layer to output the predicted load data at the second moment; Calculating model parameters that minimize the gap between the predicted value and the true value based on the load data sample at the second moment and the predicted load data, and defining a loss function between the true value and the predicted value; The expression of the model parameter with the smallest gap between the predicted value and the true value is: ; Where, is the model parameter that minimizes the gap between the predicted value and the true value, For the constructed neural network, is the load data sample at the first moment, is the predicted value at the second moment, is the true value at the second moment; The loss function is the Euclidean distance between the true value and the predicted value, and its expression is: ; Where, is the true value, is the predicted value.
6. The electric vehicle aggregate load capacity prediction method based on the LSTM model according to claim 5 is characterized in that: The output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of the electric vehicle are weighted and combined to obtain the electric vehicle aggregate load capacity prediction result, including: Inputting the current charging load data of the electric vehicle into the ARIMA prediction model and the LSTM prediction model respectively to output a linear part prediction value and a nonlinear part prediction value of the current charging load data; Calculating a weighted combination prediction result of the linear part prediction value and the nonlinear part prediction value, wherein the weighted combination prediction result is the electric vehicle aggregate load capacity prediction result; The calculation expression of the weighted combination prediction result is: ; Where, is the weighted combination prediction result, is the predicted value of the linear part, is the predicted value of the nonlinear part, is the weight of the linear part, is the weight of the nonlinear part, and .
7. An electric vehicle aggregate load capacity prediction device based on an LSTM model, applied to the method according to any one of claims 1 to 6, characterized in that: The device comprises: a data sampling module, configured to obtain charging load data of the charging station within a first time period, divide the first time period into sub-time periods, and sample the charging load data according to the divided sub-time periods to obtain periodic load data samples; a data preprocessing module, configured to construct a data set based on the load data samples and preprocess the load data samples, wherein the data set includes the load data samples and their corresponding time data, temperature data, and geographic location data of the charging station; The constructing of a data set based on the load data samples and preprocessing the load data samples includes: The load data samples and temperature data are normalized. The normalization expressions of the load data samples and temperature data are: ; Where, is the maximum value of the input charging load sequence or temperature sequence, is the minimum value of the input charging load sequence or temperature sequence, For real-time charging load data or real-time temperature data, is the result of normalization; Differentiating the non-numeric day types in the time data into working days and weekends, and marking the working days and weekends with different numerical values, and differentiating the non-numeric charging station geographical locations in the geographical location data into commercial areas, living areas, and industrial areas, and marking the commercial areas, living areas, and industrial areas with different numerical values, thereby digitizing the non-numeric time data and geographical location data; A first model building module is configured to divide the load data sample into first load data with a linear trend and second load data with a nonlinear trend by using a time series decomposition method, and to build an ARIMA model based on the first load data to obtain an ARIMA forecasting model; a second model building module, configured to randomly divide the second load data in the data set into a training set and a validation set according to a preset ratio, and train and test the LSTM model based on the training set and the validation set to obtain an LSTM prediction model; The load capacity prediction module is used to perform a weighted combination of the output results of the ARIMA prediction model and the LSTM prediction model on the charging load data of the electric vehicle to obtain the electric vehicle aggregate load capacity prediction result.
8. A terminal comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Peak shaving method based on aggregated load characteristics of charging piles
CN118263902A
Short-term load prediction method and system based on ARIMA and CNN-LSTM combined model
CN118644096A