Electric vehicle charging load prediction method based on PatchTST
Through the PatchTST model combined with Transformer architecture and time series blocking technology, the limitations of large-scale timing data processing in electric vehicle charging load prediction are solved, and accurate capture of long-term trends and periodic changes are achieved, which improves prediction accuracy and stability , solves the problems of prediction inaccuracy and stability in the prior art.
Patent Information
- Application Number
- CN202411139799.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-12-13
AI Technical Summary
The existing electric vehicle charging load prediction methods have limitations when processing large-scale and complex timing data, making it difficult to accurately predict long-term trends and stability, and fail to effectively deal with random interference factors such as weather and date types, affecting the accuracy of the prediction and stability.
Using the PatchTST model combined with Transformer architecture and time series blocking technology, through data preprocessing, feature extraction, normalization, time series blocking, projection and position embedding, Transformer encoder processing, flattening plus linear attention and reversal normalization To accurately predict electric vehicle charging demand and capture long-term trends and cyclical changes.
Improve the accuracy and stability of charging load prediction of electric vehicles, has higher prediction accuracy and generalization capabilities, can automatically identify important time points, ignore unimportant information, and significantly improve the degree of conformity and prediction with the actual load curve. accuracy.
Smart Images

Figure CN119134285A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for predicting a vehicle charging load, and in particular to a method for predicting a vehicle charging load based on PatchTST. Background Art
[0002] The large-scale use of electric vehicles has brought new challenges to the stability and operational efficiency of the power grid. Especially during the peak charging period, the centralized charging behavior of electric vehicles may lead to a sharp increase in the load on the power grid, which requires the grid operator to make accurate load forecasts and reasonable power dispatch. At present, a variety of electric vehicle (EV) load forecasting schemes have been proposed in academia. These schemes are mainly divided into two categories. The first category is mathematical statistical methods, such as Monte Carlo simulation and Markov chain. This type of method estimates the charging demand by simulating the driving path, number and battery status of electric vehicles. The second category focuses on machine learning techniques, including ensemble learning, neural networks and deep learning, to predict charging demand. These methods usually have limitations in processing large-scale and complex time series data. Especially in identifying long-term trends, existing methods often find it difficult to achieve ideal accuracy and stability. Therefore, developing a method that can improve the accuracy and stability of electric vehicle charging load forecasting has become a research and application need.
[0003] The Chinese patent application "A method and system for optimizing orderly charging of electric vehicles" with application number 202010013800.2 inputs the basic load forecast data of power residents in the substation area, the upper-level power grid regulation requirement data, the user charging demand data and the electric vehicle charging data of the orderly charging master station into the pre-built orderly charging dual-objective optimization model, determines the charging time and charging power of each electric vehicle participating in the orderly charging scheduling, forms a charging plan and sends it to the energy controller to complete the orderly control of electric vehicle charging. Disadvantages: It requires a lot of computing power support and cannot predict long-term charging trends. It does not take into account the characteristic factors affecting the load, which is inaccurate and will affect the stability of the power system operation.
[0004] The Chinese patent application numbered 202310099216.7, "A method, system and medium for modeling the timing of electric vehicle charging load based on a width learning system", uses data normalization processing to avoid the influence of different dimensions between the original data that affect the charging load of electric vehicles; according to the performance analysis of the charging load of electric vehicles, the factors affecting the charging load of electric vehicles are determined, and a width learning system is used to establish a timing prediction model for the charging load of electric vehicles to achieve the timing prediction of the charging load of electric vehicles. Disadvantages: A large amount of data is required for training, and the accuracy of untrained data is poor. Random interference can easily affect the charging load.
[0005] The Chinese patent application numbered 202311615543.X, "Method, system and storage medium for predicting charging load of electric vehicles based on neural networks", classifies historical load data by applying fuzzy evaluation methods; further processes and mines the similarity of load data based on grey system theory, takes the first n items of historical load data sorted by relevance, and establishes a new historical load data sequence according to the time sequence; uses the new historical load data sequence established according to the time sequence as a training set to train the BP neural network, establish a BP neural network model, and realize the prediction of charging load of electric vehicles based on the BP neural network model. Disadvantages: A lot of computing power is required, and a lot of weather factors and date types are added to improve accuracy, making the model complicated.
[0006] The Chinese patent application "Electric Vehicle Charging Load Timing Modeling System" with application number 202320094194.0 relates to an electric vehicle charging load timing modeling system, including a charging pile, to which the electric vehicle is connected when charging, and a charging load data acquisition device connected to the charging pile and the electric vehicle, which transmits the collected data to a computer device, and a width learning system is fixedly installed in the computer device to perform electric vehicle charging load timing modeling and realize the timing prediction of electric vehicle charging load. Disadvantages: Random interference will affect the load, such as weather and date factors, which cause the dates of historical data arrangement to be polluted by noise, destroy the internal laws of the data, and make the prediction inaccurate.
[0007] The Chinese patent application numbered 202310960127.7, "Data-driven Electric Vehicle Charging Load Forecasting", involves the fields of electric vehicle batteries and neural networks, and specifically discloses a data-driven electric vehicle charging load forecasting model establishment method; by combining the electric vehicle battery charging and discharging design standards with massive historical data, a data-driven electric vehicle charging load forecasting model system is established, which can effectively forecast the battery charging load. Disadvantages: There are limitations in processing large-scale and complex time series data, and it is difficult to achieve stability in long-term forecasts.
[0008] The Chinese patent application with application number 202310896642.3, "A method, system and prediction terminal for predicting charging load of electric vehicles", adopts the configuration of prediction time periods, splits the prediction time periods, obtains the travel start time, travel period and travel end time of electric vehicles and classifies them, draws a frequency distribution histogram based on the classified electric vehicle data; establishes the correlation between the remaining power SOC of electric vehicles and the driving mileage; calculates the probability that the electric vehicle starts charging in the i-th period, the probability that charging is not stopped in the i-th period, and the probability that the electric vehicle is not fully charged in the i-th period; calculates the probability P that the electric vehicle is charging in the i-th period; based on the probability P, calculates the load generated by the charging of the electric vehicle in the i-th period. Disadvantages: There are limitations in processing large-scale and complex time series data. It is impossible to accurately predict long-term trends.
[0009] The Chinese patent application numbered 202211427381.2, "A Beidou Positioning-Assisted Electric Vehicle Charging Demand Forecasting Method and Device", first obtains the real-time location data of the electric vehicle, calculates the predicted trajectory of the electric vehicle through a time series prediction method (DA-RNN); obtains the starting power of each sampling of the electric vehicle, establishes a state transfer equation and an observation equation based on the starting power, and calculates the estimated value of the remaining capacity; calculates the charging demand in the area based on the vehicle information of each electric vehicle in the area, the predicted trajectory and the estimated value of the remaining capacity. Disadvantages: Beidou positioning assistance is required, the calculation is large, interference factors are not eliminated, and errors are easily caused.
[0010] At present, some technologies do not consider the impact of random interference on charging load, including weather factors and date types, etc. These factors make the dates of historical data arrangement polluted by noise, destroy the internal laws of the data, and affect the stability of prediction.
[0011] Existing algorithms have limitations when processing large-scale, complex time series data. In particular, existing methods often find it difficult to achieve ideal accuracy and stability when identifying long-term trends. Summary of the invention
[0012] Purpose of the invention: The centralized charging of electric vehicles may lead to a sharp increase in the load on the power grid. The purpose of the invention is to enable power grid operators to make accurate load forecasts and reasonable power dispatch, and to improve the accuracy and stability of electric vehicle charging load forecasts. The invention provides an electric vehicle charging load forecasting method based on PatchTST.
[0013] The present invention designs the PatchTST model in combination with the Transformer architecture and time series blocking technology. Based on the existing time series data, it can accurately predict the charging demand of electric vehicles. At the same time, it can effectively process large-scale time series data, accurately capture long-term trends and cyclical changes, and improve the model's ability to understand the time series data of electric vehicle charging load, especially the accuracy in predicting long-term trends and cyclical fluctuations.
[0014] Technical solution: The electric vehicle charging load prediction method based on PatchTST provided by the present invention comprises the following steps:
[0015] Step 1: Input electric vehicle charging load data and perform data preprocessing. The process includes:
[0016] 1.1 First, data cleaning is performed to remove outliers and missing values to ensure data quality.
[0017] 1.2 Perform feature engineering to extract features with predictive value for charging load from multiple dimensions.
[0018] Step 2: Data normalization: Standardize the data to reduce the impact of different dimensions and numerical ranges and ensure the effectiveness of model training.
[0019] Step 3: Divide the time series and process them in blocks. In the PatchTST model, the standardized data is divided into blocks, and the time series data is converted into a series of time blocks (patches) to adapt to the Transformer model processing. These patches are encoded by position to maintain the time order information.
[0020] Step 4: Projection and position embedding.
[0021] Step 5: Transformer encoder processing. The above patch time blocks are fed into the Transformer encoder. This part of the model is responsible for capturing the temporal dynamic characteristics of load changes and the changing patterns of electric vehicle charging demand in different time periods.
[0022] Step 6: Flatten and add linear attention. The calculated attention score will be used to weight the value vector, that is, all value vectors are weighted and summed by the attention score to obtain the output representation of each element.
[0023] Step 7: Denormalization: The normalized value output by the model prediction needs to be denormalized to restore the dimension of the original load value.
[0024] Step 8: Output the prediction result. Denormalize the output data of the Transformer encoder through step 7, and integrate these output representations to form the final sequence output.
[0025] Compared with the prior art, the present invention has the following beneficial effects:
[0026] 1. When the PatchTST model is compared with other traditional or new time series forecasting models (such as Seasonal Naive, DeepAR, Prophet, ARIMA and DLinear), the PatchTST model divides the time series data into several small blocks (Patch), each of which contains part of the time series information, which helps the model capture more fine-grained time characteristics, and has more accurate prediction ability in capturing the dynamic changes of load peaks and valleys, which is conducive to predicting dynamic changes.
[0027] 2. The PatchTST model of the present invention is able to maintain high prediction accuracy when facing longer time series data. Through the self-attention mechanism of Transformer, the model can automatically identify and strengthen the features at important time points and ignore unimportant information. Compared with other models, it has higher prediction accuracy and better generalization ability, which is conducive to application scenarios that require accurate prediction of future trends and patterns.
[0028] 3. The PatchTST model of the present invention has a high degree of agreement with the actual load curve, showing good prediction accuracy. At the same time, the PatchTST model has a lower RMSE value than other models, and has higher accuracy and reliability in capturing the dynamic changes of electric vehicle charging load. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a flow chart of the method of the present invention;
[0030] Figure 2 This is a schematic diagram of the PatchTST model. There is a set of multivariate time series data. Now based on the review window L: (x1,...,x L )Predict the time series of future T values (x L+1 , ..., x L+T ), where each time step x1 is a vector of dimension M. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be further described below.
[0032] Step 1: Input electric vehicle charging load data and perform data preprocessing. The process includes:
[0033] 1.1 First, perform data cleaning to remove outliers and missing values to ensure data quality. The details are as follows: For the i-th univariate time series with a length of L i=1,...,M, independent input (x1,...,x L ) is split into M univariate sequences x (i) ∈R 1×L .
[0034] 1.2 Perform feature engineering to extract features with predictive value for charging load from multiple dimensions, such as historical load data, time characteristics, and related external factors. The details are as follows: Pearson correlation coefficient is used
[0035]
[0036] Among them, X i and Y i is the ith observation of the two variables, and is the average of the two variables, and n is the total number of variable observations. The closer its value is to 1 or -1, the stronger the correlation between the two variables is. The indicator with stronger correlation is selected as the main weather feature in the model.
[0037] Step 2: Data normalization
[0038] Normalize the data to reduce the impact of different dimensions and value ranges and ensure the effectiveness of model training. Specifically: Use the min-max normalization method to scale each feature to the range of [0, 1] to eliminate the impact of dimensions and unify the data scale. The formula for normalization is expressed as
[0039]
[0040] Where: Ci is the normalized data point, C is the original data point, C max and C min are the maximum and minimum values of the feature in the dataset, respectively.
[0041] Step 3: Divide the time series and process it in blocks
[0042] In the time series division stage of the PatchTST model, the standardized data is divided into blocks, and the time series data is converted into a series of time blocks (patches) to adapt to the Transformer model processing. These patches are encoded by position to maintain the time order information.
[0043] The details are as follows: Input time series x ( i ), is first divided into patches, and then a series of patches are generated: The number of patches N obtained through the patching process can be expressed as:
[0044]
[0045] Where: P and S represent the length of the patch and the step size respectively - the non-overlapping area between two consecutive patches. PatchTST adds S repeated last patches to the end of the original sequence before segmentation. Through the patch operation, the number of input tokens will be reduced from L to approximately L / S.
[0046] Step 4: Projection and Position Embedding
[0047] Through a trainable linear projection W p ∈R D×P Map the above patch to the D-dimensional Transformer latent space and apply a positional additional encoding W pos ∈R D×N , the time series order of the patch is as follows: in is the input to the Transformer encoder.
[0048] Step 5: Transformer encoder processing
[0049] The above patch time blocks are fed into the Transformer encoder, which uses its core self-attention mechanism: by calculating the query, key, and value at each position in the input sequence, it captures the dependencies between time steps in the sequence. The encoder learns the dependencies between patches through a multi-head attention mechanism, in which each head h=1,...,H is converted into a query matrix The deep features of time series are extracted as follows:
[0050] Where: are the matrix representations of query, key, and value, respectively, d k is the dimension of the key vector and is used to scale the dot product in order to have a more stable gradient when computing the softmax. This part of the model is responsible for capturing the temporal dynamics of load changes and the changing patterns of EV charging demand over different time periods.
[0051] Step 6: Flatten and add linear attention
[0052] The calculated attention score will be used to weight the value vector, that is, all value vectors are weighted and summed by the attention score to obtain the output representation of each element.
[0053] Step 7: Denormalization
[0054] The normalized value of the model prediction output needs to be denormalized to restore the dimension of the original load value, as follows:
[0055]
[0056] Step 8: Output prediction results
[0057] Through step 7, the output data of the Transformer encoder is denormalized, and these output representations are integrated to form the final sequence output to obtain the final result
[0058] The above is only a preferred embodiment of the present invention and does not limit the present invention in any way. Any technician in the relevant technical field, without departing from the scope of the technical solution of the present invention, makes any form of equivalent replacement or modification to the technical solution and technical content disclosed in the present invention, which does not depart from the content of the technical solution of the present invention and still falls within the protection scope of the present invention.
Claims
1. A method for predicting electric vehicle charging load based on PatchTST, characterized in that: The steps include: Step 1: Input electric vehicle charging load data and perform data preprocessing; Step 2: Data normalization; Step 3: Divide the time series and process them in blocks; Step 4: Projection and position embedding; Step 5: Transformer encoder processing; Step 6: Flatten and add linear attention; Step 7: Denormalization; Step 8: Output the prediction results.
2. The electric vehicle charging load prediction method based on PatchTST according to claim 1 is characterized in that: The step 1 method: 1.1 First, perform data cleaning. For the i-th univariate time series with a length of L Independent input (x1, ..., x L ) is split into M univariate sequences x (i) ∈R 1×L , 1.2 Perform feature engineering and use Pearson correlation coefficient Among them, X i and Y i is the ith observation of the two variables, and is the average of the two variables, n is the total number of variable observations, and the closer its value is to 1 or -1, the stronger the correlation between the two variables is. The indicator with stronger correlation is selected as the main weather feature in the model.
3. The electric vehicle charging load prediction method based on PatchTST according to claim 2 is characterized in that: The method of step 2: Use the min-max normalization method to scale each feature to the range of [0, 1] to eliminate the influence of dimension and unify the data scale. The formula of normalization processing is expressed as: Where: Ci is the normalized data point, C is the original data point, C max and C min are the maximum and minimum values of the feature in the dataset, respectively.
4. The electric vehicle charging load prediction method based on PatchTST according to claim 3 is characterized in that: Step 3 of the method: Input time series x (i) , is first divided into patches, and then a series of patches are generated: The number of patches N obtained through the patching process can be expressed as: Where: P and S represent the length and step size of the patch respectively - the non-overlapping area between two consecutive patches. PatchTST will add S repeated last patches to the end of the original sequence before segmentation. Through the patch operation, the number of input tokens will be reduced from L to approximately L / S.
5. The electric vehicle charging load prediction method based on PatchTST according to claim 4 is characterized in that: The step 4 method: through a trainable linear projection W p ∈R D×P Map the above patch to the D-dimensional Transformer latent space and apply a positional additional encoding W pos ∈R D×N , the time series order of the patch is as follows: in is the input sent to the Transformer encoder.
6. The electric vehicle charging load prediction method based on PatchTST according to claim 5 is characterized in that: The method of step 5: The patch time block is fed into the Transformer encoder, and its core self-attention mechanism is used: by calculating the query (Query), key (Key) and value (Value) at each position in the input sequence, the dependencies between each time step in the sequence are captured. The encoder learns the dependencies between patches through a multi-head attention mechanism, in which each head h = 1, ..., H is converted into a query matrix The deep features of time series are extracted as follows: Where: are the matrix representations of query, key, and value, respectively, d k is the dimension of the key vector and is used to scale the dot product in order to have a more stable gradient when computing SofiMax. This part of the model is responsible for capturing the temporal dynamic characteristics of load changes and the changing pattern of EV charging demand in different time periods.
7. The electric vehicle charging load prediction method based on PatchTST according to claim 6 is characterized in that: The method of step 6: The calculated attention score will be used to weight the value vector, that is, all value vectors are weighted and summed by the attention score to obtain the output representation of each element.
8. The electric vehicle charging load prediction method based on PatchTST according to claim 7 is characterized in that: The method of step 7: the normalized value output by the model prediction needs to be denormalized to restore the dimension of the original load value, as follows:
9. The electric vehicle charging load prediction method based on PatchTST according to claim 8 is characterized in that: The method of step 8 is to denormalize the output data of the Transformer encoder through step 7, integrate these output representations to form the final sequence output, and obtain the final result
Citation Information
Cited By
Prediction method and device of time series data and electronic equipment
CN119692561A
Processing method for predicting node load based on electric vehicle data
CN119721383A
Power load long time sequence prediction method and related device
CN120016482A
Industrial environmental control system-oriented time sequence energy-saving control large model construction method
CN121995892A
