Method for predicting remaining mileage of pure electric vehicle based on real vehicle data
Through the improved Bi-LSTM model and whale optimization algorithm based on real vehicle data, the problem of low prediction accuracy of remaining mileage in low temperature environments of pure electric vehicles is solved, and high-precision, rapid training and good generalization prediction effects are achieved.
Patent Information
- Application Number
- CN202510283895.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-27
AI Technical Summary
The existing pure electric vehicle residual mileage prediction method has low accuracy in low temperature environments, and the traditional LSTM model has a long training time and is difficult to deal with long-term dependence, which is prone to gradient explosion or gradient disappearance.
Using a method based on real-vehicle data, the improved Bi-LSTM model combined with whale optimization algorithm is used to achieve high-precision prediction of the remaining mileage in the low-temperature environment of electric vehicles. The method includes data preprocessing, feature selection, Bi-LSTM model construction and hyperparameter optimization.
It improves the accuracy of the remaining mileage prediction of pure electric vehicles in low-temperature environments, shortens the model training time, and enhances the generalization ability and explanatory nature of the model.
Smart Images

Figure CN120207123A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the fields of power battery technology and new energy vehicles, and particularly relates to a method for predicting the remaining driving range of a pure electric vehicle based on real vehicle data. Background Art
[0002] Lithium-ion batteries have the advantages of long life, fast charging speed, no memory effect, etc., and have now become the first choice for energy storage in pure electric vehicles and hybrid electric vehicles, and have been popularized in electric vehicles. However, due to its chemical properties, the available capacity of lithium batteries decreases and the internal resistance increases in a low-temperature environment. Therefore, electric vehicles are prone to problems such as actual driving range shrinkage and slow charging speed in a low-temperature environment. Although the low-temperature attenuation characteristics of the battery cannot be avoided, in recent years, vehicle manufacturers have achieved certain results in technological breakthroughs, and the recognition of new energy vehicles by consumers in low-temperature regions has gradually increased, and the annual access volume of new energy vehicles in low-temperature regions has maintained a rapid growth trend. Accurately predicting the driving range of electric vehicles in a low-temperature environment can enhance the driver's confidence in the vehicle's remaining driving range, improve energy utilization efficiency, and is of great significance for the popularization and use of new energy vehicles in low-temperature regions.
[0003] The existing methods for predicting the remaining driving range mainly include methods based on battery SOC, historical energy consumption, model prediction, and data-driven methods. The prediction methods based on battery SOC and historical energy consumption do not consider factors such as driving behavior and environmental temperature, so the estimation accuracy is low. The model-based prediction method establishes a mathematical model of the battery and the vehicle, and the computational complexity during model construction is high. The data-driven method only needs to obtain data according to the charge and discharge segments of the electric vehicle to capture complex non-linear relationships and achieve accurate prediction of the remaining driving range. At present, there is less research on the prediction of the remaining driving range of real vehicles based on data-driven methods. Some existing integrated learning methods such as random forest regression algorithm and gradient boosting regression algorithm are used for mileage prediction, but their models have poor interpretability, long training time, are sensitive to hyperparameter adjustment, and are prone to overfitting and other problems. The traditional LSTM has a long training time, is difficult to handle long-term dependencies, has many parameters, and may still encounter gradient explosion or gradient disappearance in long time series data. Summary of the Invention
[0004] To solve the above problems, the present invention provides a method for predicting the remaining driving range of a pure electric vehicle based on real vehicle data, which realizes the prediction of the remaining driving range of an electric vehicle in a low-temperature environment through an improved Bi-LSTM combined with a whale optimization algorithm, and has a high prediction accuracy.
[0005] To solve the above technical problems, the method specifically includes the following steps:
[0006] S1. Collect real vehicle operation data of a pure electric vehicle in a low-temperature environment through an open-source data set;
[0007] The actual vehicle operation data includes: vehicle status, charging status, vehicle speed, driving mileage, total current, total voltage, maximum battery voltage, minimum battery voltage, maximum battery temperature, and minimum battery temperature;
[0008] S2. Complete the collected actual vehicle operation data, preprocess the completed data to obtain the actual state of charge; classify the vehicle's endurance level through cluster analysis, and obtain the highly correlated features with the remaining driving mileage through Spearman correlation analysis; normalize the highly correlated features to obtain the actual vehicle operation data set, and divide the actual vehicle operation data set into a training set and a test set;
[0009] The steps are as follows:
[0010] S2.1. Complete according to the obtained actual vehicle data set;
[0011] The method of completion is: detect missing values and outliers in the actual vehicle data set. If there are missing values or outliers, delete the outliers and complete them by the horizontal mean interpolation method. The interpolation calculation formula is as follows:
[0012]
[0013] In the formula, K t is the actual vehicle operation data at the current t moment; K t-1 is the actual vehicle operation data at the current t - 1 moment; K t+1 is the actual vehicle operation data at the current t + 1 moment;
[0014] S2.2. Extract the current from the completed data, calculate the actual state of charge (SOC) of the battery. The calculation formula is as follows:
[0015]
[0016] In the formula, Ca represents the battery capacity; SOC t and SOC t-1 respectively represent the actual state of charge at the t moment and the t - 1 moment; η represents the Coulomb efficiency; i t represents the current at the t moment; Δt represents the sampling time interval;
[0017] S2.3. Perform K - means cluster analysis on the vehicle according to the endurance mileage. Divide the vehicles whose driving distance under full charge and standard conditions is less than the first threshold into low - endurance vehicles, divide the vehicles whose driving distance is greater than the first threshold and less than the second threshold into medium - endurance vehicles, and divide the vehicles whose driving distance is greater than the second threshold into high - endurance vehicles. The first threshold is less than the second threshold;
[0018] S2.4. Perform Spearman correlation coefficient analysis on the segmented vehicles to obtain features with high correlation with the remaining driving range;
[0019] The expression of Spearman correlation coefficient analysis is as follows:
[0020]
[0021] In the formula, ρ is the Spearman correlation coefficient; d i is the rank difference of the corresponding values of the two variables; n is the sample size;
[0022] Use the Spearman correlation coefficient analysis method to analyze the correlation between variables and the remaining driving range in the actual vehicle operation data. Select the correlation features with a Spearman correlation coefficient higher than the correlation threshold. Among the correlation features, select the data related to the low-temperature environment as the high-correlation features and input them as feature variables;
[0023] The high-correlation features include: the lowest voltage, discharge SOC, and the lowest temperature;
[0024] S2.5. Use the Min-Max method to normalize the high-correlation features to obtain the actual vehicle operation data set;
[0025] The value range of the normalized data is [0, 1], and the expression is as follows:
[0026]
[0027] In the formula, x n represents the high-correlation feature to be normalized; x min and x max represent the minimum data value and the maximum data value in the normalized data respectively; x represents the normalized result;
[0028] S2.6. Divide the actual vehicle operation data set into a training set and a test set according to a certain proportion.
[0029] S3. Construct a bidirectional long short-term neural network model (Bi-LSTM);
[0030] S3.1. The bidirectional long short-term neural network model (Bi-LSTM) includes two independent LSTM layers. The first LSTM layer is used for forward transmission, and the second LSTM layer is used for backward transmission;
[0031] The core of the LSTM layer includes an input gate, a forget gate, an output gate, and a cell state; among them, the expression of the input gate at a single time step t is as follows:
[0032] i t =σ(W i . [h t-1 , xt +b i );
[0033] C t ′=tanh(W C .[h t-1 ,x t +b C );
[0034] In the formula, i t is the output of the input gate; σ is the Sigmoid activation function; W i and W C are the weight matrices of the input gate and the candidate state; h t-1 is the hidden state at time t-1; x t is the input at the current time; b i and b C are the biases of the input gate and the candidate state;
[0035] The expression of the forget gate is as follows:
[0036] f t =σ(W f .[h t-1 ,x t +b f );
[0037] In the formula, f t is the output of the forget gate; W f is the weight matrix of the forget gate; b f is the bias of the forget gate;
[0038] The expression of the output gate is as follows:
[0039] o t =σ(W o .[h t-1 ,x t +b o );
[0040] h t =o t .tanh(C t );
[0041] In the formula, o t is the output of the output gate, which determines the hidden state at the current time; W o is the weight matrix of the output gate; b o is the bias of the output gate; C t is the cell state at the current time;
[0042] The expression of the cell state is as follows:
[0043] Ct = f t .C t-1 + i t .C t ';
[0044] Where C t-1 is the cell state at time t-1;
[0045] S3.2. After the data is input into the Bi-LSTM, it is respectively input into the first LSTM layer and the second LSTM layer and concatenated at each time step t;
[0046] The first LSTM layer is used for forward transmission, and the expression is as follows:
[0047]
[0048] Where is the hidden state of the forward transmission LSTM at time t; The hidden state of the forward transmission LSTM at time t-1;
[0049] The second LSTM layer is used for backward transmission, and the expression is as follows:
[0050]
[0051] Where is the hidden state of the backward transmission LSTM at time t; The hidden state of the backward transmission LSTM at time t-1;
[0052] The expression for concatenating the hidden states is as follows:
[0053]
[0054] Where [,] is the vector concatenation operation, which is used to capture the forward and backward dependencies of the sequence data at the same time;
[0055] S4. Introduce a gate control mechanism in the bidirectional long short-term neural network model to construct a bidirectional long short-term neural network model with a residual adaptive gating mechanism;
[0056] The construction steps are as follows:
[0057] S4.1. Add a gating variable to each Bi-LSTM layer to control whether to perform a residual connection;
[0058] The expression of the gating variable is as follows:
[0059] r t = σ(W r .[O t-1 , x t + br );
[0060] Wherein, r t is the gating variable, which determines whether to perform residual connection; W r and b r are the weights and biases of the gating variable, used to train the gating variable;
[0061] S4.2. Set a residual connection after each Bi-LSTM layer, and the expression is as follows:
[0062] O' t = Bi-LSTM(h t-1 , x t ) + r t .x t ;
[0063] Wherein, O' t is the final output of each layer of Bi-LSTM; r t is the gating variable, which obtains a value between 0 and 1 through the gating mechanism and controls the strength of the residual connection; x t is the input at the current moment;
[0064] S4.3. The gating variable controls whether to perform residual connection through forward propagation, and updates the weights W r and biases b r through backpropagation. The steps are as follows:
[0065] S4.3.1. Initialize the weights W r and biases b r ;
[0066] S4.3.2. After each layer of Bi-LSTM, judge whether to use residual connection by calculating the weights W r and biases b r ;
[0067] The judgment method is:
[0068] When r t = 1, the residual connection is fully adopted;
[0069] When r t = 0, the residual connection is ignored;
[0070] When r t is between 0 and 1, the residual connection is partially adopted, and the expression is as follows:
[0071] Residual connection output = r t × Input of Bi-LSTM + Calculation result of the current layer;
[0072] S4.3.3. Update the weights W of the gating mechanism through backpropagation r and the bias b r ;
[0073] Backpropagation of the gating variable: During training, the loss function is calculated based on the model's output and the true labels, and the weights W of the gating mechanism are updated through backpropagation r and the bias b r ;
[0074] During backpropagation, the gradient of the gating variable r t is calculated and used to update its weights; these gradients come from the output of the Bi-LSTM and the final loss of the network, gradually adjusting the gating weights W r to better determine the role of the residual connection;
[0075] Calculation of the loss function: The mean squared error (MSE) is used as the loss function L, and its calculation formula is as follows;
[0076]
[0077] where y t is the final output of the model after passing through the fully connected layer; represents the true label value; N represents the total number of batches; i represents the batch number;
[0078] During backpropagation, the gradient of the loss function is passed to the parameter weights W of the gating variable r and the bias b r for updating;
[0079] The gradient calculation expression of the loss function with respect to the output y t is as follows:
[0080]
[0081] The gradient calculation expression of the loss function with respect to the gating variable r t is as follows:
[0082]
[0083] The gradient calculation expression of the loss function with respect to W r and b r is as follows:
[0084]
[0085] where z = W r . [h t-1 , x t + b r ;
[0086] Update W using the gradient descent method r and b r , and the expression is as follows:
[0087]
[0088] where w represents the learning rate; W' r represents the updated weight; b' r represents the updated bias;
[0089] S4.4. Perform a residual connection between the input data and the data output by the Bi-LSTM through the updated gating variable;
[0090] S4.5. Map the output obtained in S4.4 through a fully connected layer and then output it;
[0091] The fully connected layer (FC Layer) maps the output of the last time step to obtain the final output, and the expression is as follows:
[0092] y t = W FC .O tt + b FC ;
[0093] where y t is the final output of the model after passing through the fully connected layer; O tt represents the output after concatenating the output vectors of each layer; W FC is the weight of the fully connected layer; b FC is the bias of the fully connected layer.
[0094] S5. Optimize the hyperparameters of the bidirectional long short-term neural network model with a residual adaptive gating mechanism through the whale algorithm, and the steps are as follows:
[0095] S5.1. Set the hyperparameters to be optimized, including: the number of hidden layers, the number of hidden layer nodes, the number of time steps, the number of batch processes, the number of training epochs;
[0096] S5.2. Set the search space of the whale algorithm;
[0097] The whale optimization algorithm needs to define the search space of the hyperparameters and determine the minimum and maximum values of the hyperparameters;
[0098] S5.3. Use the root mean square error RMSE to evaluate the quality of each set of hyperparameters in the search space;
[0099] The evaluation method is: use the root mean square error RMSE as the fitness function to evaluate the quality of each candidate solution, and the smaller the RMSE, the better the solution;
[0100] The goal of the Whale Optimization Algorithm is to find a set of hyperparameters from the hyperparameters after evaluating the quality, so as to minimize the RMSE of the improved Bi-LSTM model;
[0101] S5.4. Conduct a global search in the hyperparameter space through the Whale Optimization Algorithm to obtain the optimal hyperparameter combination, and input the hyperparameter combination into the improved Bi-LSTM model;
[0102] The global search is: search by simulating the foraging behavior of whales (surrounding prey, spiral bubble net attack, random search);
[0103] Repeat step S5.4 until the maximum number of iterations is reached, and finally output the optimal hyperparameter combination;
[0104] S6. Use the training set to train the optimized model to obtain a trained model;
[0105] S7. Use the test set to predict the remaining driving mileage of the model in S6 to obtain the prediction result, and evaluate the prediction result to obtain the evaluation index;
[0106] The evaluation index includes: coefficient of determination R-squared (R 2 ), maximum absolute error (MAE), and root mean square error (RMSE). The expressions are as follows:
[0107] R-squared:
[0108] Maximum absolute error:
[0109] Root mean square error:
[0110] In the formula, n' is the length of the test data; ii is the serial number of the test data; y ii is the actual value of the remaining driving mileage of the test data; is the average value of the remaining driving mileage of all test data; y iihat is the predicted value of the remaining driving mileage of the test data.
[0111] The beneficial effects of the present invention:
[0112] Based on the actual vehicle operation data of pure electric vehicles in low-temperature environments, the present invention uses the Spearman correlation analysis method to select features related to the driving range of the vehicle, and applies the whale optimization algorithm to the bidirectional long short-term neural network model to construct an estimation model for the remaining driving range of pure electric vehicles. The present invention can directly extract highly correlated feature factors from the charging and discharging process, greatly reducing the number of features, and can effectively improve the training speed and accuracy of the model; the established model can accurately predict the remaining driving range for different vehicle models and has good generalization performance. Description of the Drawings
[0113] Figure 1 It is a flowchart of the steps of the present invention;
[0114] Figure 2 It is a schematic diagram of the implementation process of the present invention;
[0115] Figure 3 It is a schematic diagram of the network of the bidirectional long short-term neural network model with a residual adaptive gating mechanism of the present invention;
[0116] Figure 4 It is a schematic diagram of the hyperparameters of the network of the bidirectional long short-term neural network model with a residual adaptive gating mechanism optimized by the whale optimization algorithm of the present invention;
[0117] Figure 5 It represents a prediction result diagram of the remaining driving range of the vehicle; among them, part (a) is the prediction result diagram of the remaining driving range of low-endurance vehicles; part (b) is the prediction result diagram of the remaining driving range of medium-endurance vehicles; part (c) is the prediction result diagram of the remaining driving range of high-endurance vehicles. Detailed Implementation Modes
[0118] The present invention will be further described in detail below in conjunction with specific embodiments.
[0119] As Figure 1 and Figure 2 shown, a method for predicting the remaining driving range of a pure electric vehicle based on actual vehicle data includes the following steps:
[0120] S1. Collect actual vehicle operation data of pure electric vehicles in low-temperature environments through an open-source dataset;
[0121] The actual vehicle operation data includes: vehicle status, charging status, vehicle speed, driving range, total current, total voltage, maximum battery voltage, minimum battery voltage, maximum battery temperature, minimum battery temperature;
[0122] In this embodiment, the open-source dataset is the actual vehicle operation data of 30 pure electric vehicles with different driving ranges provided by the 2024 National College New Energy Vehicle Big Data Innovation and Entrepreneurship Competition, which records the charging and discharging data from January to March in real time.
[0123] S2. Complete the collected real - vehicle operation data, pre - process the completed data to obtain the actual state of charge; classify the vehicle's endurance level through cluster analysis, and obtain the highly correlated features with the remaining driving range through Spearman correlation analysis; normalize the highly correlated features to obtain the real - vehicle operation data set, and divide the real - vehicle operation data set into a training set and a test set;
[0124] The steps are as follows:
[0125] S2.1. Complete according to the obtained real - vehicle data set;
[0126] The method of completion is: detect the missing values and outliers in the real - vehicle data set. If there are missing values or outliers, delete the outliers and complete them by the horizontal mean interpolation method. The interpolation calculation formula is as follows:
[0127]
[0128] In the formula, K t is the real - vehicle operation data at the current t - moment; K t-1 is the real - vehicle operation data at the current t - 1 moment; K t+1 is the real - vehicle operation data at the current t + 1 moment;
[0129] S2.2. Extract the current from the completed data, calculate the actual state of charge (SOC) of the battery. The calculation formula is as follows:
[0130]
[0131] In the formula, Ca represents the battery capacity; SOC t and SOC t-1 represent the actual state of charge at the t - moment and the t - 1 moment respectively; η represents the Coulomb efficiency; i t represents the current at the t - moment, and the value is 1; Δt represents the sampling time interval;
[0132] S2.3. Conduct K - means cluster analysis on the vehicle according to the endurance mileage. Divide the vehicles whose driving distance under full - charge standard conditions is less than the first threshold into low - endurance vehicles, those whose driving distance is greater than the first threshold and less than the second threshold into medium - endurance vehicles, and those whose driving distance is greater than the second threshold into high - endurance vehicles. The first threshold is less than the second threshold;
[0133] The first threshold is set to 200 KM; the second threshold is set to 500 KM;
[0134] That is, vehicles with S ≤ 200 KM are classified as low-endurance vehicles, vehicles with a distance of 200 ≤ S ≤ 500 KM are classified as medium-endurance vehicles, and vehicles with a distance of S ≥ 500 KM are classified as high-endurance vehicles;
[0135] S2.4. Perform a Spearman correlation coefficient analysis on the divided vehicles to obtain high-correlation features with the remaining driving mileage;
[0136] The expression of the Spearman correlation coefficient analysis is as follows:
[0137]
[0138] In the formula, ρ is the Spearman correlation coefficient, ranging from -1 to 1; d i is the rank difference of the corresponding values of the two variables; n is the sample size;
[0139] Use the Spearman correlation coefficient analysis method to analyze the correlation between variables and the remaining driving mileage in the actual vehicle operation data. Select the correlation features with a Spearman correlation coefficient higher than the correlation threshold. Select the data related to the low-temperature environment as the high-correlation features from the correlation features and input them as feature variables;
[0140] The correlation threshold is set to 0.6;
[0141] The high-correlation features include: the lowest voltage, discharge SOC, and the lowest temperature;
[0142] In this embodiment, taking vehicle No. 6 as an example, the correlation between speed and the remaining driving mileage is only 0.04, and the correlation between the total current and the remaining driving mileage is only 0.25. Therefore, they are removed, as shown in Table 1:
[0143] Table 1: Spearman correlation coefficient of vehicle No. 6
[0144]
[0145] It can be seen from Table 1 that the data related to the low-temperature environment selected from the correlation features are: the lowest voltage, discharge SOC, and the lowest temperature, which meet the selection conditions of high-correlation features;
[0146] S2.5. Use the Min-Max method to normalize the high-correlation features to obtain the actual vehicle operation data set;
[0147] The value range of the normalized data is [0, 1], and the expression is as follows:
[0148]
[0149] In the formula, x n represents the high-correlation feature to be normalized; x min and x maxrespectively represent the minimum data value and the maximum data value in the normalized data; x represents the result after normalization;
[0150] S2.6. Divide the real vehicle operation dataset into a training set and a test set according to a ratio;
[0151] The ratio is set to 7:3;
[0152] S3. Construct a bidirectional long short-term neural network model (Bi-LSTM);
[0153] S3.1. The bidirectional long short-term neural network model (Bi-LSTM) includes two independent LSTM layers. The first LSTM layer is used for forward transmission, and the second LSTM layer is used for backward transmission;
[0154] The core of the LSTM layer includes an input gate, a forget gate, an output gate, and a cell state; among them, the expression of the input gate at a single time step t is as follows:
[0155] i t = σ(W i . [h t-1 , x t + b i );
[0156] C t ′ = tanh(W c . [h t-1 , x t + b C );
[0157] In the formula, i t is the output of the input gate; σ is the Sigmoid activation function; W i and W C are the weight matrices of the input gate and the candidate state; h t-1 is the hidden state at time t-1; x t is the input at the current time; b i and b C are the biases of the input gate and the candidate state;
[0158] The expression of the forget gate is as follows:
[0159] f t = σ(W f . [h t-1 , x t + b f );
[0160] In the formula, f t is the output of the forget gate; W f is the weight matrix of the forget gate; b f is the bias of the forget gate;
[0161] The expression of the output gate is as follows:
[0162] o t = σ(W o .h t-1 , x t + b o );
[0163] h t = o t . tanh(C t );
[0164] In the formula, o t is the output of the output gate, which determines the hidden state at the current moment; W o is the weight matrix of the output gate; b o is the bias of the output gate; C t is the cell state at the current moment;
[0165] The expression of the cell state is as follows:
[0166] C t = f t . C t-1 + i t . C t ';
[0167] In the formula, C t-1 is the cell state at time t - 1;
[0168] S3.2. After the data is input into the Bi - LSTM, it is respectively input into the first - layer LSTM layer and the second - layer LSTM layer and concatenated at each time step t;
[0169] The first - layer LSTM layer is used for forward transmission, and the expression is as follows:
[0170]
[0171] In the formula, is the hidden state of the forward - transmission LSTM at time t; The hidden state of the forward - transmission LSTM at time t - 1;
[0172] The second - layer LSTM layer is used for backward transmission, and the expression is as follows:
[0173]
[0174] In the formula, is the hidden state of the backward - transmission LSTM at time t; The hidden state of the backward - transmission LSTM at time t - 1;
[0175] The expression for the hidden state concatenation is as follows:
[0176]
[0177] In the formula, [,] is the vector concatenation operation, which is used to capture the forward and backward dependencies of the sequence data simultaneously;
[0178] Such as Figure 2 shown, it is a schematic diagram of the state of charge prediction model based on the bidirectional long short-term memory neural network. In this embodiment, the input head of the state of charge prediction model of the bidirectional long short-term memory neural network is 3.
[0179] S4. As Figure 3 shown, a gate control mechanism is introduced into the bidirectional long short-term neural network model to construct a bidirectional long short-term neural network model with a residual adaptive gating mechanism;
[0180] The residual connection is to add the input to the output of the Bi-LSTM layer after each Bi-LSTM layer. In the present invention, a learnable gating unit is introduced into each Bi-LSTM layer to determine whether to add the input of the previous layer to the output of the current layer, dynamically controlling the residual connection of each layer, so as to realize automatically adjusting the use of the residual according to the training process and data characteristics;
[0181] The construction steps are as follows:
[0182] S4.1. Add a gating variable to each Bi-LSTM layer to control whether to perform a residual connection;
[0183] The expression of the gating variable is as follows:
[0184] r t = σ(W r . [O t-1 , x t + b r );
[0185] In the formula, r t is the gating variable, which determines whether to perform a residual connection; W r and b r are the weights and biases of the gating variable, which are used to train the gating variable;
[0186] S4.2. Set a residual connection after each Bi-LSTM layer, and the expression is as follows:
[0187] O' t = Bi-LSTM(h t-1 , x t ) + r t . x t ;
[0188] Wherein, O' t is the final output of each layer of Bi-LSTM; r t is the gating variable, which obtains a value between 0 and 1 through the gating mechanism and controls the strength of the residual connection; x t is the input at the current moment;
[0189] S4.3. The gating variable controls whether to perform a residual connection through forward transmission and updates the weights W r and the bias b r of the gating variable through backpropagation, and the steps are as follows:
[0190] S4.3.1. Initialize the weights W r and the bias b r of the gating variable;
[0191] S4.3.2. After each layer of Bi-LSTM, judge whether to use a residual connection by calculating the weights W r and the bias b r of the gating variable;
[0192] The judgment method is:
[0193] When r t = 1, the residual connection is fully adopted;
[0194] When r t = 0, the residual connection is ignored;
[0195] When r t is between 0 and 1, the residual connection is partially adopted, and the expression is as follows:
[0196] Residual connection output = r t × Input of Bi-LSTM + Calculation result of the current layer;
[0197] S4.3.3. Update the weights W r and the bias b r of the gating mechanism through backpropagation;
[0198] Backpropagation of the gating variable: During the training process, the loss function is calculated based on the output of the model and the true labels, and the weights W r and the bias b r of the gating mechanism are updated through backpropagation;
[0199] During the backpropagation process, the gradient of the gating variable r t is calculated and used to update its weights; these gradients come from the output of Bi-LSTM and the final loss of the network, and gradually adjust the gating weights W r to enable it to better determine the role of the residual connection;
[0200] Calculation of the loss function: The mean squared error (MSE) is used as the loss function L, and its calculation formula is as follows;
[0201]
[0202] where y t is the final output of the model after passing through the fully connected layer; represents the true label value; N represents the total number of batches; i represents the batch number;
[0203] During the backpropagation process, the gradient of the loss function is passed to the parameter weights W r and the bias b r for update;
[0204] The gradient calculation expression of the loss function with respect to the output y t is as follows:
[0205]
[0206] The gradient calculation expression of the loss function with respect to the gated variable r t is as follows:
[0207]
[0208] The gradient calculation expression of the loss function with respect to W r and b r is as follows:
[0209]
[0210] where z = W r . [h t-1 , x t + b r ;
[0211] Update W r and b r using the gradient descent method, and the expression is as follows:
[0212]
[0213] where e represents the learning rate; W' r represents the updated weight; b' r represents the updated bias;
[0214] S4.4. Perform residual connection on the input data and the data output by the Bi-LSTM through the updated gated variable;
[0215] S4.5. Map the output obtained in S4.4 through a fully connected layer and then output it;
[0216] The fully connected layer (FC Layer) maps the output of the last time step to obtain the final output. The expression is as follows:
[0217] y t = W FC .O tt + b FC ;
[0218] In the formula, y t is the final output of the model after passing through the fully connected layer; O tt represents the output after concatenating the output vectors of each layer; W FC is the weight of the fully connected layer; b FC is the bias of the fully connected layer.
[0219] S5. Optimize the hyperparameters of the bidirectional long short-term neural network model with a residual adaptive gating mechanism through the whale algorithm. The steps are as follows:
[0220] S5.1. As Figure 4 shown, set the hyperparameters to be optimized, including: the number of hidden layers, the number of hidden layer nodes, the number of time steps, the number of batch processes, and the number of training epochs;
[0221] S5.2. Set the search space of the whale algorithm;
[0222] The whale optimization algorithm needs to define the search space of the hyperparameters, determine the minimum and maximum values of the hyperparameters, and define the number of layers of the Bi-LSTM network as [1, 5], the number of neurons in each LSTM unit, that is, the number of units in the LSTM hidden layer, as [32, 512], and the number of batch processes as [32, 128];
[0223] S5.3. Use the root mean square error RMSE to evaluate the quality of each set of hyperparameters in the search space;
[0224] The evaluation method is: use the root mean square error RMSE as the fitness function to evaluate the quality of each candidate solution. The smaller the RMSE, the better the solution;
[0225] The goal of the whale optimization algorithm is to find a set of hyperparameters from the hyperparameters after evaluating the quality, so as to minimize the RMSE of the improved Bi-LSTM model;
[0226] S5.4. Conduct a global search in the hyperparameter space through the whale optimization algorithm to obtain the optimal hyperparameter combination, and input the hyperparameter combination into the improved Bi-LSTM model;
[0227] The global search is as follows: Search by simulating the foraging behavior of whales (surrounding prey, spiral bubble net attack, random search), specifically as follows:
[0228] S5.4.1. Search for the hyperparameters after evaluating the quality using the method of surrounding prey;
[0229] Since the optimal position in the data sample is uncertain, the "whale" will set a locally optimal foraging direction. Therefore, assume that the position of the sample with the highest current fitness is the target position and use it as a reference for other samples to update their own positions. The formula is as follows:
[0230]
[0231] In the formula, The vector representing the position of the "prey"; The vector representing the position of the "whale"; tt is the number of iteration rounds; and are coefficient vectors. When calculating, will debug the and vectors to find the position around the optimal solution of , and The calculation formulas of are as follows:
[0232]
[0233] Among them, The value of linearly decreases from 2 to 0 gradually; and are random vectors taken from [0, 1];
[0234] S5.4.2. Search for the hyperparameters after evaluating the quality using the method of spiral bubble net attack;
[0235] The spiral bubble net attack is to simulate and implement the distance for other sample positions to update to the optimal sample position through spiral position update and contraction surrounding mechanism;
[0236] First, calculate the distance between the "whale" position and the "prey" position, and establish a spiral equation between the two positions to simulate the spiral movement of the humpback whale during hunting:
[0237]
[0238] In the formula, b represents the spiral constant; l is a random number in the interval [-1, 1]; Use a spiral constant b to define the shape of the spiral; is the distance between the "whale" and the "prey"; The whale swims towards the prey in a spiral shape while contracting the surrounding circle;
[0239] S5.4.3. Search for the hyperparameters after evaluating the quality using random search;
[0240] Random search is as follows: To enhance its global search ability, when it randomly updates the positions of sample individuals according to the characteristics of the data samples;
[0241]
[0242] In the formula, is an individual randomly selected from the current population;
[0243] Repeat step S5.4 until the maximum number of iterations is reached, and finally output the optimal hyperparameter combination;
[0244] The maximum number of iterations can be set to: 50 times, 100 times, 150 times, and 200 times;
[0245] Combined with the whale optimization algorithm, the hyperparameters of the improved Bi-LSTM model are determined to be: the number of hidden layers is 3, the number of hidden layer nodes is 36, the time step is 50, the number of batch processes is 128, and the number of training epochs is 50;
[0246] S6. Use the training set to train the optimized model to obtain a trained model;
[0247] S7. Use the test set to predict the remaining driving mileage of the model in S6, obtain the prediction results, and evaluate the prediction results to obtain evaluation indicators;
[0248] The evaluation indicators include: coefficient of determination R-squared (R 2 ), maximum absolute error (MAE), and root mean square error (RMSE). The expressions are as follows:
[0249] R-squared:
[0250] Maximum absolute error:
[0251] Root mean square error:
[0252] In the formula, n' is the length of the test data; ii is the serial number of the test data; y ii is the actual value of the remaining driving mileage of the test data; is the average value of the remaining driving mileage of all test data; y iihat is the predicted value of the remaining driving mileage of the test data;
[0253] The present invention comparatively analyzes the prediction results of different data-driven methods for the remaining driving range. The comparison results are shown in Table 1. The algorithm R of the present invention 2 is 0.997, the MAE is 0.633, and the RMSE is 1.157. The results show that the prediction effect of the present invention is better than that of other machine learning algorithms;
[0254] Table 1: Prediction Results and Errors of Different Methods
[0255]
[0256] S8. Generalize the model of S7 using different vehicle models;
[0257] As Figure 5 shown in parts a, b, and c, it can be seen from the figure that the present invention can accurately predict the remaining driving range of pure electric vehicles. The predicted values can be well distributed near the true values. The model can better predict the remaining driving range. Further comparative analysis of the prediction results of the remaining driving range of high-endurance vehicles, mid-endurance vehicles, and low-endurance vehicles verifies the model. As shown in Table 2, it shows that the proposed method has both good prediction accuracy and generalization, indicating the prediction ability of the method and showing its broad application prospects in the field of pure electric vehicle mileage prediction.
[0258] Table 2: Prediction Results and Errors of Different Vehicle Models
[0259]
[0260] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for predicting the remaining driving range of a pure electric vehicle based on real vehicle data, characterized in that: The following steps are involved: S1. Collect real vehicle operation data of pure electric vehicles in low temperature environment through open source data sets; The actual vehicle operation data includes: vehicle status, charging status, vehicle speed, mileage, total current, total voltage, battery maximum voltage, battery minimum voltage, battery maximum temperature, battery minimum temperature; S2. Complete the collected real vehicle operation data, pre-process the completed data to obtain the actual charge state; classify the vehicle endurance level through cluster analysis, and obtain the features with high correlation with the remaining mileage through Spearman correlation analysis; obtain the real vehicle operation data set after normalizing the highly correlated features, and divide the real vehicle operation data set into a training set and a test set; S3, construct a bidirectional long-term and short-term neural network model; S4. Introducing the gate control mechanism into the bidirectional long-short term neural network model to construct a bidirectional long-short term neural network model with a residual adaptive gate control mechanism; S5. Hyperparameter optimization of the bidirectional long-short term neural network model with residual adaptive gating mechanism is performed through the whale algorithm; S6. Use the training set to train the optimized model to obtain a trained model; S7, using the test set to predict the remaining mileage of the model in S6, obtaining the prediction results, and evaluating the prediction results to obtain evaluation indicators, including: determination coefficient R-squared, maximum absolute error and root mean square error; S8. Use different car models to verify the generalization of the S7 model.
2. The method for predicting the remaining driving range of a pure electric vehicle based on real vehicle data according to claim 1, characterized in that: The collected real vehicle operation data is supplemented, and the supplemented data is preprocessed to obtain the actual charge state; the vehicle endurance level is divided by cluster analysis, and the high correlation characteristics with the remaining mileage are obtained by Spearman correlation analysis; After normalizing the high-correlation features, the real vehicle operation data set is obtained. The steps for dividing the real vehicle operation data set into a training set and a test set are as follows: S2.
1. Complete the data according to the obtained real vehicle data set; The completion method is as follows: missing values and outliers are detected in the real vehicle data set. If there are missing values or outliers, the outliers are deleted and completed by the level mean interpolation method; S2.2, extracting the current from the completed data and calculating the actual state of charge of the battery; S2.
3. Perform K-means cluster analysis on the vehicles according to the cruising range, and classify the vehicles whose driving distance under full-power standard condition is less than a first threshold as low-range vehicles, the vehicles whose driving distance is greater than the first threshold but less than a second threshold as medium-range vehicles, and the vehicles whose driving distance is greater than the second threshold as long-range vehicles, where the first threshold is less than the second threshold; S2.4, perform Spearman correlation coefficient analysis on the divided vehicles to obtain features with high correlation to the remaining mileage; The Spearman correlation coefficient analysis method is used to analyze the correlation between the variables and the remaining mileage in the actual vehicle operation data. The correlation features with the Spearman correlation coefficient higher than the correlation threshold are selected. Among the correlation features, the data related to the low temperature environment are selected as high correlation features and input as feature variables. Highly relevant features include: minimum voltage, discharge SOC, and minimum temperature; S2.5, using the Min-Max method to normalize the high correlation features to obtain the actual vehicle operation data set; S2.
6. Divide the actual vehicle operation data set into a training set and a test set according to the proportion.
3. The method for predicting the remaining driving range of a pure electric vehicle based on real vehicle data according to claim 1, characterized in that: The steps of constructing a bidirectional long-term and short-term neural network model are as follows: S3.1, the bidirectional long short-term neural network model includes two independent LSTM layers, the first LSTM layer is used for forward transmission, and the second LSTM layer is used for reverse transmission; S3.
2. After the data is input into Bi-LSTM, it is input into the first LSTM layer and the second LSTM layer respectively and concatenated at each time step t.
4. The method for predicting the remaining driving range of a pure electric vehicle based on real vehicle data according to claim 1, characterized in that: The steps of constructing a bidirectional long-short-term neural network model network by introducing a gate control mechanism into the bidirectional long-short-term neural network model to construct a residual adaptive gate control mechanism are as follows: S4.
1. Add a gating variable to each Bi-LSTM layer. S4.2, set residual connection after each Bi-LSTM layer; S4.3, the gated variable controls whether to perform residual connection through forward transmission, and updates the weight W of the gated variable through back propagation r and bias b r , the steps are as follows: S4.3.
1. Initialize the weight W of the gated variable r and bias b r ; S4.3.
2. After each layer of Bi-LSTM, the weight W of the gated variable is calculated r and bias b r To determine whether to use residual connection; The judgment method is: When t =1, the residual connection is fully adopted; When t = 0, the residual connection is ignored; When t When between 0 and 1, the residual connection is partially adopted, and the expression is as follows: Residual connection output = r t ×Bi-LSTM input + current layer calculation result; S4.3.
3. Update the weight W of the gating mechanism by back-propagation r and bias b r ; S4.4, residual connection is performed between the input data and the output data of Bi-LSTM through the updated gating variables; S4.
5. Map the output obtained in S4.4 through a fully connected layer and output it.
5. The method for predicting the remaining driving range of a pure electric vehicle based on real vehicle data according to claim 1, characterized in that: The steps of performing hyperparameter optimization on the bidirectional long-short term neural network model network of the residual adaptive gating mechanism by the whale algorithm are as follows: S5.
1. Set the hyperparameters that need to be optimized, including: number of hidden layers, number of hidden layer nodes, time step, number of batches, and number of training generations; S5.
2. Set the search space of the whale algorithm; S5.
3. Use the root mean square error (RMSE) to evaluate the quality of each set of hyperparameters in the search space. S5.
4. Perform a global search in the hyperparameter space through the whale optimization algorithm to find the optimal hyperparameter combination, and input the hyperparameter combination into the improved Bi-LSTM model; Repeat step S5.4 until the maximum number of iterations is reached, and finally output the optimal hyperparameter combination.
Citation Information
Cited By
Lithium ion battery capacity prediction method based on random charging fragments and indirect characteristics
CN119881657A
A lithium-ion battery capacity prediction method based on random charging segments and indirect features
CN119881657B