An electric vehicle remaining range prediction method and device
By cleaning and analyzing the driving data of electric vehicles, a set of factors affecting driving range was constructed. The Gray Wolf Optimization Algorithm was used to train an LSTM model, which solved the problem of accuracy in predicting the remaining driving range of electric vehicles and achieved more accurate driving range prediction and adaptive capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GAC AION NEW ENERGY AUTOMOBILE CO LTD
- Filing Date
- 2023-11-29
- Publication Date
- 2026-05-29
AI Technical Summary
Existing methods for predicting the remaining driving range of electric vehicles rely on a single parameter and cannot accurately predict changes in driving range. This leads to drivers being unable to accurately estimate when to charge or swap batteries, causing range anxiety and vehicle breakdowns.
By acquiring driving data from sample vehicles, cleaning the data, analyzing the factors affecting the actual driving range, constructing a set of factors influencing driving range, training an LSTM model using the Grey Wolf optimization algorithm, and optimizing the neural network parameters by combining attention mechanism and incremental learning, the remaining driving range is predicted.
It improves the accuracy of vehicle remaining range prediction, can more comprehensively represent vehicle status, avoids blind parameter tuning, enhances adaptive capabilities, and improves prediction accuracy.
Smart Images

Figure CN117507829B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a method and apparatus for predicting the remaining driving range of an electric vehicle. Background Technology
[0002] Currently, new energy vehicles, primarily electric vehicles, are developing rapidly and gradually becoming the preferred mode of transportation. While pure electric vehicles have distinguished themselves in the market, a significant issue remains: their driving range. Major manufacturers have launched fast charging, supercharging, and battery swapping services to address this problem. However, inaccurate display of remaining range can prevent drivers from accurately predicting when to charge or swap batteries, easily leading to range anxiety and even vehicle breakdowns. Therefore, accurately predicting remaining range based on the vehicle's real-time driving status, reminding drivers to recharge, and providing a better user experience are crucial for the development of new energy vehicles. Existing methods for predicting the remaining range of electric vehicles typically rely on energy calculations; however, these methods use relatively limited parameters and cannot accurately predict changes in remaining range. Summary of the Invention
[0003] The purpose of this application is to provide a method and apparatus for predicting the remaining driving range of an electric vehicle, which can perform analysis of the actual driving range factors of the vehicle and improve the accuracy of the remaining driving range prediction.
[0004] The first aspect of this application provides a method for predicting the remaining driving range of an electric vehicle, including:
[0005] Obtain driving process sample data and the actual driving range of the sample vehicles;
[0006] The driving process sample data is cleaned to obtain the data to be processed;
[0007] The data to be processed is analyzed to determine the actual driving range factors of the vehicle, and a set of driving range influencing factors is obtained.
[0008] Based on the set of factors affecting driving range and the actual driving range, a sample set is constructed;
[0009] The sample sets are then normalized to obtain the target sample set.
[0010] Construct the original LSTM model;
[0011] The original LSTM model is trained using the Grey Wolf optimization algorithm and the target sample set to obtain a trained remaining driving range prediction model.
[0012] Obtain the current driving process data of the target vehicle;
[0013] Based on the driving process data, the remaining driving range is predicted to obtain the prediction result;
[0014] Output the prediction results.
[0015] Furthermore, the original LSTM model includes an input layer, an LSTM layer, an attention mechanism layer, a dropout layer, a combination layer of LSTM and dropout layers, a dense layer, and an output layer; wherein, the input data dimension of the input layer is a preset data dimension, the number of layers in the combination layer is the first layer number obtained through optimization, and the number of layers in the dense layer is the second layer number obtained through optimization.
[0016] The optimization algorithm for the original LSTM model is the Adam algorithm, and the loss function for the original LSTM model is the MSE function.
[0017] Furthermore, the step of constructing a sample set based on the set of factors affecting driving range and the actual driving range includes:
[0018] Based on the set of factors affecting driving range and the actual driving range, a sample set and a test set are constructed.
[0019] Predicted data is obtained by using a pre-constructed GWO-LSTM network and the sample set for data prediction.
[0020] A sample set is constructed based on the predicted data, the sample set, and the test set.
[0021] Furthermore, the set of factors affecting range includes energy consumption per kilometer, battery state of charge (SOC) value, average speed per kilometer, number of times the absolute value of acceleration per kilometer exceeds 0.1g, and battery health status.
[0022] Furthermore, the original LSTM model is trained using the Grey Wolf optimization algorithm and the target sample set to obtain a trained remaining driving range prediction model, including:
[0023] The original LSTM model is trained based on the target sample set to obtain the prediction results;
[0024] Evaluation indicators are calculated based on the prediction results; wherein, the evaluation indicators include MAE, RMSE and R2.
[0025] Based on the gray wolf optimization algorithm and the R2 metric, the number of the first layer, the number of the second layer, and the number of neurons in each layer are determined;
[0026] The original LSTM model is optimized based on the number of the first layer, the number of the second layer, and the number of neurons in each layer to obtain an optimized LSTM model.
[0027] Determine whether the preset number of iterations has been reached;
[0028] If so, the final optimized LSTM model will be determined as the trained remaining driving range prediction model.
[0029] A second aspect of this application provides an electric vehicle remaining driving range prediction device, the electric vehicle remaining driving range prediction device comprising:
[0030] The electric vehicle remaining driving range prediction device includes:
[0031] The first acquisition unit is used to acquire driving process sample data of the sample vehicle and the actual driving range of the sample vehicle.
[0032] The first processing unit is used to clean the driving process sample data to obtain data to be processed.
[0033] The analysis unit is used to analyze the actual range factors of the vehicle on the data to be processed, and obtain a set of range influencing factors.
[0034] A sample construction unit is used to construct a sample set based on the set of range influencing factors and the actual range.
[0035] The second processing unit is used to perform normalization processing on the sample set respectively to obtain the target sample set;
[0036] Model building unit, used to build the original LSTM model;
[0037] The training unit is used to train the original LSTM model using the Grey Wolf Optimization Algorithm and the target sample set to obtain a trained remaining driving range prediction model.
[0038] The second acquisition unit is used to acquire the current driving process data of the target vehicle;
[0039] The prediction unit is used to predict the remaining driving range based on the driving process data and obtain the prediction result;
[0040] The output unit is used to output the prediction result.
[0041] Furthermore, the original LSTM model includes an input layer, an LSTM layer, an attention mechanism layer, a dropout layer, a combination layer of LSTM and dropout layers, a dense layer, and an output layer; wherein, the input data dimension of the input layer is a preset data dimension, the number of layers in the combination layer is the first layer number obtained through optimization, and the number of layers in the dense layer is the second layer number obtained through optimization.
[0042] The optimization algorithm for the original LSTM model is the Adam algorithm, and the loss function for the original LSTM model is the MSE function.
[0043] Furthermore, the sample construction unit includes:
[0044] Construct sub-units to build sample sets and test sets based on the set of range influencing factors and the actual range;
[0045] The data prediction subunit is used to perform data prediction using a pre-built GWO-LSTM network and the sample set to obtain predicted data.
[0046] The construction subunit is also used to construct a sample set based on the prediction data, the sample set, and the test set.
[0047] Furthermore, the set of factors affecting range includes energy consumption per kilometer, battery state of charge (SOC) value, average speed per kilometer, number of times the absolute value of acceleration per kilometer exceeds 0.1g, and battery health status.
[0048] Furthermore, the training unit includes:
[0049] The training subunit is used to train the original LSTM model based on the target sample set to obtain the prediction result;
[0050] The calculation subunit is used to calculate evaluation indicators based on the prediction results; wherein the evaluation indicators include the MAE indicator, the RMSE indicator, and the R2 indicator.
[0051] The optimization subunit is used to perform optimization based on the gray wolf optimization algorithm and the R2 index to determine the number of the first layer, the number of the second layer, and the number of neurons in each layer.
[0052] An optimization subunit is used to optimize the original LSTM model based on the number of the first layer, the number of the second layer, and the number of neurons in each layer, to obtain an optimized LSTM model.
[0053] The judgment sub-unit is used to determine whether the preset number of iterations has been reached.
[0054] The sub-unit is determined to identify the final optimized LSTM model as the trained remaining driving range prediction model when the preset number of iterations is reached.
[0055] A third aspect of this application provides an electronic device including a memory and a processor, the memory storing a computer program, and the processor running the computer program to cause the electronic device to perform the electric vehicle remaining range prediction method as described in any of the first aspects of this application.
[0056] The fourth aspect of this application provides a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform the electric vehicle remaining range prediction method described in any one of the first aspects of this application.
[0057] The beneficial effects of this application are: the method and device can perform analysis of the actual range factors of a vehicle, thereby improving the accuracy of predicting the remaining range of a vehicle. Attached Figure Description
[0058] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 A flowchart illustrating a method for predicting the remaining driving range of an electric vehicle, provided in an embodiment of this application;
[0060] Figure 2 A flowchart illustrating another method for predicting the remaining driving range of an electric vehicle provided in this application embodiment;
[0061] Figure 3 A schematic diagram of the structure of an electric vehicle remaining driving range prediction device provided in an embodiment of this application;
[0062] Figure 4 A schematic diagram of another electric vehicle remaining driving range prediction device provided in an embodiment of this application;
[0063] Figure 5 The schematic diagram of the LSTM provided for the embodiments of this application;
[0064] Figure 6 A schematic diagram of wolf pack size provided for an embodiment of this application;
[0065] Figure 7 This is a diagram illustrating the overall structure of the model provided in the embodiments of this application.
[0066] Figure 8 A schematic diagram of the attention mechanism provided in the embodiments of this application;
[0067] Figure 9 This is a schematic diagram of the operation process of an LSTM network based on the gray wolf algorithm provided in an embodiment of this application. Detailed Implementation
[0068] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0069] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0070] Example 1
[0071] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for predicting the remaining driving range of an electric vehicle provided in this embodiment. The method includes:
[0072] S101. Obtain sample data of the driving process of the sample vehicles and the actual driving range of the sample vehicles.
[0073] S102. Clean the sample data of the driving process to obtain the data to be processed.
[0074] In this embodiment, the method acquires various data collected by sensors or obtained through the CAN bus, and performs deduplication and interpolation on outliers such as duplicates, missing values, and outliers. Then, the cleaned data is analyzed from different perspectives to determine the factors affecting the vehicle's actual range. Correlation analysis is performed on data collected during driving, including energy consumption, speed, acceleration, temperature, SOC, and SOH, to verify the effectiveness of extracting factors influencing range.
[0075] S103. Perform an analysis of the actual driving range factors of the vehicle on the data to be processed to obtain a set of driving range influencing factors.
[0076] In this embodiment, the set of factors affecting range includes energy consumption per kilometer, battery state of charge (SOC) value, average speed per kilometer, number of times the absolute value of acceleration per kilometer exceeds 0.1g, and battery health status.
[0077] S104. Construct a sample set based on the set of factors affecting driving range and the actual driving range.
[0078] S105. Normalize the sample sets respectively to obtain the target sample set.
[0079] S106. Construct the original LSTM model.
[0080] In this embodiment, the original LSTM model includes an input layer, an LSTM layer, an attention mechanism layer, a dropout layer, a combination layer of LSTM and dropout layers, a dense layer, and an output layer; wherein, the input data dimension of the input layer is a preset data dimension, the number of layers of the combination layer is the first layer number obtained by optimization, and the number of layers of the dense layer is the second layer number obtained by optimization.
[0081] The optimization algorithm for the original LSTM model is the Adam algorithm, and the loss function for the original LSTM model is the MSE function.
[0082] S107. The original LSTM model is trained using the Grey Wolf optimization algorithm and the target sample set to obtain a trained remaining driving range prediction model.
[0083] S108. Obtain the current driving process data of the target vehicle.
[0084] S109. Based on driving process data, predict the remaining driving range and obtain the prediction result.
[0085] S110, Output the prediction results.
[0086] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0087] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0088] As can be seen, the electric vehicle remaining range prediction method described in this embodiment can more comprehensively represent the overall state of the vehicle during driving by combining characteristics such as driver driving style, road conditions, ambient temperature, and component energy consumption status, thereby enabling more accurate prediction of the vehicle's remaining range. Simultaneously, the LSTM neural network parameters can be optimized using the Grey Wolf algorithm, avoiding blind parameter tuning and improving the adaptive capability of the remaining range prediction. Finally, the use of attention mechanisms and incremental learning methods further enhances the accuracy of the vehicle's remaining range prediction.
[0089] Example 2
[0090] Please refer to Figure 2 , Figure 2This is a flowchart illustrating a method for predicting the remaining driving range of an electric vehicle provided in this embodiment. The method includes:
[0091] S201. Obtain sample data of the driving process of the sample vehicles and the actual driving range of the sample vehicles.
[0092] S202. Clean the sample data of the driving process to obtain the data to be processed.
[0093] S203. Perform an analysis of the actual driving range factors of the vehicle on the data to be processed to obtain a set of driving range influencing factors.
[0094] In this embodiment, the set of factors affecting range includes energy consumption per kilometer, battery state of charge (SOC) value, average speed per kilometer, number of times the absolute value of acceleration per kilometer exceeds 0.1g, and battery health status.
[0095] In this embodiment, the first remaining range influence factor F1 is the energy consumption per kilometer. This energy consumption per kilometer refers to the total power consumption of all electrical devices on the vehicle when it travels 1 kilometer. The amount of energy consumption directly affects the range. In order to avoid frequent changes in the remaining range and to reflect the vehicle's energy consumption in real time, the energy consumption per kilometer is taken as the first influence factor.
[0096]
[0097] Among them, P i Let P be the energy consumption at kilometer i. t Let be the instantaneous energy consumption at time t within the i-th kilometer. That is, the first influence factor F1 sequence is:
[0098] F1 = {P0, P1, P2, ..., P} n-1}
[0099] Where P0 represents the energy consumption for the 1st kilometer, P1 represents the energy consumption for the 2nd kilometer, P2 represents the energy consumption for the 3rd kilometer, and P... n-1 This represents the energy consumption at kilometer n.
[0100] In this embodiment, the second range-affecting factor F2 is the battery state of charge (SOC) value. The SOC value represents the amount of remaining battery power and can be divided by the power consumption to roughly estimate how many miles the battery can still travel at the current power consumption level. Therefore, the sequence of the second influencing factor F2 is as follows:
[0101] F2={SOC0, SOC1, SOC2,…,SOC n-1}
[0102] Where SOC0 represents the SOC value at kilometer 1, SOC1 represents the SOC value at kilometer 2, and SOC2 represents the SOC value at kilometer 3.n-1 This represents the SOC value at kilometer n.
[0103] In this embodiment, the third range impact factor F3 is the average speed per kilometer. The vehicle speed represents the efficiency range in which the electric drive operates; higher vehicle speeds result in lower energy utilization and shorter driving range. The calculation formula is as follows:
[0104]
[0105] Among them, t i The time taken for the (i+1)th kilometer, in hours; Let be the average vehicle speed at kilometer i+1, in km / h. The third influence factor F3 sequence is:
[0106]
[0107] in: This represents the average speed over the first kilometer. This indicates the average speed over the 2nd kilometer. This indicates the average speed over the 3rd kilometer. This represents the average speed over the nth kilometer.
[0108] In this embodiment, the fourth range-affecting factor F4 is the number of times the absolute value of acceleration per kilometer exceeds 0.1g. Frequent changes in acceleration cause battery voltage fluctuations, affecting the working efficiency of the battery and motor. Furthermore, changes in acceleration and speed reflect driving style and road conditions (urban or highway), resulting in different driving ranges for the same battery capacity under different driving scenarios. Therefore, the number of times the absolute value of acceleration per kilometer exceeds 0.1g (where g is gravitational acceleration) is taken as the fourth range-affecting factor F4. That is, the sequence of the fourth range-affecting factor F4 is:
[0109] F4 = {M0, M1, M2, ..., M} n-1}
[0110] Where M0 represents the number of times the absolute value of acceleration exceeds 0.1g in the first kilometer, M1 represents the number of times the absolute value of acceleration exceeds 0.1g in the second kilometer, M2 represents the number of times the absolute value of acceleration exceeds 0.1g in the third kilometer, and M... n-1 This indicates the number of times the absolute value of the acceleration at kilometer n exceeds 0.1g.
[0111] In this embodiment, the fifth factor affecting range, F5, is the average temperature per kilometer. Battery capacity is affected by temperature; excessively high or low temperatures will affect the battery's discharge capacity. Furthermore, temperature directly impacts the power consumption of the vehicle's thermal management system, which is closely related to range. Therefore, temperature is considered the fifth factor affecting range.
[0112]
[0113] Among them, T k-1 The k-th temperature within 1 kilometer; Let be the average temperature at kilometer i+1. That is, the fifth influence factor F5 sequence is:
[0114]
[0115] in, This indicates the average temperature over the first kilometer. This indicates the average temperature over the 2nd kilometer. This indicates the average temperature at the 3rd kilometer mark. This represents the average temperature over the nth kilometer.
[0116] In this embodiment, the sixth factor affecting battery life, F6, is the battery's state of health (SOH). As the battery is used, its internal resistance increases, leading to power degradation and affecting its charging and discharging capacity. Therefore, the battery's state of health (SOH) is used as the sixth influencing factor. That is, the sequence of the first influencing factor F6 is:
[0117] F6={SOH0, SOH1, SOH2,…, SOH n-1}
[0118] Where SOH0 represents the SOH value at kilometer 1, SOH1 represents the SOH value at kilometer 2, and SOH2 represents the SOH value at kilometer 3. n-1 This represents the SOH value at kilometer n.
[0119] S204. Based on the set of factors affecting driving range and the actual driving range, construct a sample set and a test set.
[0120] S205. Predictive data is obtained by using a pre-built GWO-LSTM network and a sample set for data prediction.
[0121] In this embodiment, the method expands the sample set through incremental learning.
[0122] In this embodiment, the method can address situations where there may be a lack of vehicle samples by using an incremental learning approach. First, a basic GWO-LSTM network is trained using historical data. Then, the data collected online in real time and the corresponding new predicted values are added to the training set to continuously update the model and improve its predictive performance.
[0123] S206. Construct a sample set based on the prediction data, sample set, and test set.
[0124] S207. Normalize the sample sets respectively to obtain the target sample set.
[0125] S208. Construct the original LSTM model.
[0126] In this embodiment, the original LSTM model includes an input layer, an LSTM layer, an attention mechanism layer, a dropout layer, a combination layer of LSTM and dropout layers, a dense layer, and an output layer; wherein, the input data dimension of the input layer is a preset data dimension, the number of layers of the combination layer is the first layer number obtained by optimization, and the number of layers of the dense layer is the second layer number obtained by optimization.
[0127] The optimization algorithm for the original LSTM model is the Adam algorithm, and the loss function for the original LSTM model is the MSE function.
[0128] In this embodiment, the principle of LSTM network ( Figure 5 The schematic diagram of LSTM is shown below:
[0129]
[0130] Where h <t-1>< / t-1> The hidden information output at the previous time step, x <t>< / t> Input information for the current time step. σ and f are the sigmoid and tanh activation functions, respectively. t i t o t These are the forget gate, input gate, output gate, and W at the current time step. f W t W o b f b i b o Each has its own weight and bias. These are candidate values to replace memory cells. The operation process of an LSTM cell is as follows:
[0131] First, the forget gate decides which information to discard from the cell state. The Sigmoid function processes the hidden information output from the previous time step and the input information from the current time step to obtain a state between 0 and 1, which is given to the memory unit of the previous time step, where: 1 means to keep everything and 0 means to discard everything.
[0132] Then, the input gate determines how much new information is added to the current LSTM unit. Similarly, the sigmoid function obtains a state between 0 and 1, and the tanh function generates an alternative state for updating.
[0133] From state Ct-1 Updated to C t The old state C t-1 with f t Multiply the results to "forget" the information you previously decided to discard. Then multiply the resulting values. with i t Multiply the two parts, and then add the products of the last two parts to get the updated state value.
[0134] Finally, the output gate determines what to output. A sigmoid activation function is run, which determines which parts of the current LSTM cell to output. Then, the memory cell state is set using tanh (changing the value to between -1 and 1), and multiplied by the output of the sigmoid layer, thus determining the final output.
[0135] In this embodiment, the method can divide the extracted range-affecting factors and the actual range into training and testing sets, then perform Min-Max normalization, import the data into the LSTM model, set the training data's timestep=10, batchsize=20, epochs=180, select the Adam algorithm for optimization, and use the following internal parameters: learning_rate=0.0015, beta_1=0.89, beta_2=0.98, epsilon=1e-07, and select the MSE function for loss.
[0136] In this embodiment, the method uses the gray wolf algorithm to optimize the number of hidden layers and the number of neurons in each layer of the LSTM network. The number of wolves in the gray wolf algorithm is initialized to 20, the number of iterations is 100, the lower limit of the number of layers of the LSTM and Dense networks is 1, and the upper limit is 3. The lower limit of the number of neurons in each layer is set to 32, and the upper limit is 256.
[0137] S209. Train the original LSTM model based on the target sample set to obtain the prediction results.
[0138] S210. Calculate evaluation indicators based on the prediction results; among which, the evaluation indicators include MAE, RMSE and R2.
[0139] S211. Based on the gray wolf optimization algorithm and the R2 index, the number of the first layer and the second layer, and the number of neurons in each layer are determined.
[0140] In this embodiment, the GWO algorithm (Grey Wolf Optimization Algorithm) simulates the hunting behavior of a grey wolf pack, achieving optimization based on the cooperative mechanism of the wolf pack. The GWO algorithm is characterized by its simple structure, few adjustable parameters, and ease of implementation. It incorporates an adaptively adjustable convergence factor and an information feedback mechanism, achieving a balance between local optimization and global search, thus exhibiting good performance in terms of both solution accuracy and convergence speed.
[0141] Gray wolf packs are generally divided into four ranks: the first rank consists of the alpha wolves, denoted by α, who are primarily responsible for decision-making and then relaying those decisions to the entire pack; the second rank consists of wolves denoted by β, known as subordinate wolves, who assist the alpha wolves in decision-making and other pack activities; the third rank consists of wolves denoted by δ, including scout wolves, guard wolves, older wolves, and predators; and the fourth rank consists of wolves denoted by ω. Based on this gray wolf hierarchy, a mathematical model of the social hierarchy of gray wolves can be constructed. If the most suitable solution is α, then the second and third optimal solutions are represented by β and δ, respectively, while all other solutions are assumed to be ω.
[0142] (1) Encircle the prey
[0143] Gray wolves use the following position update formula to surround their prey during the hunt:
[0144] Formula for the distance between a gray wolf and its prey:
[0145] Grey Wolf's position update formula:
[0146] in, and These are the position vectors of the prey and the gray wolf, respectively, and t is the current iteration number. and The coefficient vector of is calculated using the following formula:
[0147]
[0148]
[0149] in, and It is a vector of two one-dimensional components with values in the range [0, 1]. Used to simulate the attack behavior of gray wolves on their prey, its value is affected by The influence of convergence factor. It is a key parameter for balancing the exploration and hunting capabilities of GWO. The value of decreases linearly from 2 to 0 as the number of iterations increases.
[0150] (2) Hunting prey:
[0151] In evolutionary computation, the prey (optimal solution) position The location of the prey is unknown. In the Grey Wolf Algorithm, the optimal Grey Wolf is considered α, the second-best is β, the third-best is δ, and the remaining Grey wolves are ω. A model is built based on the property that α (potential optimal solution), β, and δ have more information about the prey's position. During the iteration process, α, β, and δ are used to guide the movement of ω, thereby achieving global optimization. The positions of α, β, and δ are utilized. , , Update the positions of all gray wolves using the following equation:
[0152] ;
[0153] ;
[0154] ;
[0155] , , These represent the distances of individual gray wolves (ω) from wolf packs at layers α, β, and δ, respectively.
[0156] ;
[0157] ;
[0158] ;
[0159] , , These represent the positions that an individual gray wolf (ω) needs to adjust to due to the influence of wolf packs at layers α, β, and δ, respectively. Here, we take the average value.
[0160]
[0161] (3) Attacking prey
[0162] To simulate approaching the prey, a decrease in the value of 'a' will cause the value of 'A' to fluctuate accordingly. In other words, as 'a' converges from 2 to 0, 'A' changes within the interval [-a, a].
[0163] a = 2 - 2 * t / T
[0164] Where t represents the current iteration number, and T is the set maximum iteration number. When the value of A is within the interval, the gray wolf's next position can be anywhere between its current position and the prey's position. When |A| < 1, the wolf pack attacks the prey (getting stuck in a local optimum); when |A| > 1, the gray wolf separates from the prey, hoping to find a more suitable prey (global optimum).
[0165] For each prediction result, R² is used as the fitness value of the Grey Wolf algorithm. When the fitness value is less than 0, the fitness value is set to 0. During the selection phase, a roulette wheel selection method is chosen. To increase diversity, a small value of 1*10 is added to all fitness values. -3 This ensures that, theoretically, every sample has the potential to be selected, that is:
[0166] fitness=0+0.001, fitness<0;
[0167] fitness=fitness+0.001, fitness>0;
[0168] The first layer of the model receives the incoming data and sets the dimension of the incoming data to (timestep, number of influence factors). Then, it enters the LSTM layer. After the first LSTM layer, an attention mechanism layer is added, followed by a dropout layer. Then, based on the optimized LSTM layer count, the LSTM and dropout layers are added in combination (i.e., assuming the optimized LSTM layer count is n, first create one LSTM layer, one attention mechanism layer, and one dropout layer, then repeatedly add LSTM and dropout layers in a loop (n-1) times). All dropout values are set to 0.28. The number of neurons in each LSTM layer is determined by the number of wolves in the wolf pack. Next, based on the optimized DENSE layer count, a corresponding number of dense layers are added. No activation function is used, and the kernel_regularizer is set to L2 regularization with a parameter of 0.001. Similarly, the number of neurons in each dense layer is determined by the number of wolves in the wolf pack (the wolf pack count is explained as follows). Figure 6 (As shown). Finally, add a dense layer with 1 neuron, also without an activation function, to output the model's prediction results (the overall model structure diagram is shown). Figure 7 (As shown).
[0169] S212. The original LSTM model is optimized based on the number of the first layer, the number of the second layer, and the number of neurons in each layer to obtain an optimized LSTM model.
[0170] In this embodiment, when training the GWO-LSTM model, considering that different influencing factors have different effects on the final prediction results, in order to better identify the differences between different influencing factors, this method also introduces an attention mechanism to improve the local learning ability of the model.
[0171] like Figure 8 The diagram illustrates the attention mechanism, which inputs the training set into an LSTM and then obtains the corresponding hidden states H=[h1, h2, ..., h...]. t Then, an activation function is applied to obtain the score for each impact factor; here, we choose... The activation function is used to calculate the proportion of each influence factor in the overall score. The final output of the attention mechanism layer is the weighted sum of the product of each influence factor and its weight.
[0172] e tj =activation(h j );
[0173] ;
[0174] .
[0175] S213. Determine whether the preset number of iterations has been reached. If yes, proceed to step S214; otherwise, proceed to step S209.
[0176] S214. The final optimized LSTM model is determined as the trained remaining driving range prediction model.
[0177] S215. Obtain the current driving process data of the target vehicle.
[0178] S216. Based on driving process data, predict the remaining driving range and obtain the prediction result.
[0179] S217. Output the prediction results.
[0180] In this embodiment, the operation flow of the LSTM network based on the Grey Wolf algorithm is as follows (e.g.) Figure 9 (as shown)
[0181] Step 1: Set upper and lower limits for the number of hidden layers and the number of neurons per layer. Within the specified range, randomly initialize the gray wolf population.
[0182] Step 2: Calculate the fitness of individual gray wolves and save the top 3 wolves with the best fitness (α, β, and δ);
[0183] Step 3: Update the current position of the gray wolf;
[0184] Step 4: Update a, A, and C;
[0185] Step 5: Calculate the fitness of all gray wolves, and update the fitness and position of α, β, and δ.
[0186] Step 6: Determine if the maximum number of iterations has been reached. If so, the algorithm stops and returns. The value of is taken as the final optimal solution; otherwise, proceed to step 3 until the optimization process ends.
[0187] For each prediction result, three evaluation metrics were selected: MAE, RMSE, and R2.
[0188] MAE (MeanAbsoluteError): ;
[0189] RMSE(RootMeanSquareError): ;
[0190] R2: ;
[0191] in, y represents the predicted driving range. i This indicates the actual driving range. This represents the average actual battery life, and n represents the number of samples.
[0192] In this embodiment, the subject executing the method can be a computing device such as a computer or server, and no limitation is made in this embodiment.
[0193] In this embodiment, the subject executing the method can also be a smart device such as a smartphone or tablet, and no limitation is made in this embodiment.
[0194] As can be seen, the electric vehicle remaining range prediction method described in this embodiment can more comprehensively represent the overall state of the vehicle during driving by combining characteristics such as driver driving style, road conditions, ambient temperature, and component energy consumption status, thereby enabling more accurate prediction of the vehicle's remaining range. Simultaneously, the LSTM neural network parameters can be optimized using the Grey Wolf algorithm, avoiding blind parameter tuning and improving the adaptive capability of the remaining range prediction. Finally, the use of attention mechanisms and incremental learning methods further enhances the accuracy of the vehicle's remaining range prediction.
[0195] Example 3
[0196] Please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of an electric vehicle remaining driving range prediction device provided in this embodiment. Figure 3 As shown, the electric vehicle remaining driving range prediction device includes:
[0197] The first acquisition unit 310 is used to acquire driving process sample data of the sample vehicle and the actual driving range of the sample vehicle.
[0198] The first processing unit 320 is used to clean the driving process sample data to obtain the data to be processed.
[0199] Analysis unit 330 is used to analyze the actual range factors of the vehicle in the data to be processed, and obtain a set of range influencing factors;
[0200] Sample construction unit 340 is used to construct a sample set based on the set of range influencing factors and the actual range.
[0201] The second processing unit 350 is used to perform normalization processing on the sample set to obtain the target sample set;
[0202] Model building unit 360 is used to build the original LSTM model;
[0203] Training unit 370 is used to train the original LSTM model using the Grey Wolf optimization algorithm and the target sample set to obtain a trained remaining driving range prediction model.
[0204] The second acquisition unit 380 is used to acquire the current driving process data of the target vehicle;
[0205] Prediction unit 390 is used to predict the remaining driving range based on driving process data and obtain the prediction result;
[0206] Output unit 400 is used to output the prediction results.
[0207] In this embodiment, the explanation of the electric vehicle remaining range prediction device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated in this embodiment.
[0208] As can be seen, the electric vehicle remaining range prediction device described in this embodiment can more comprehensively characterize the overall vehicle state during driving by combining data representing driver style, road conditions, ambient temperature, and component energy consumption status, thereby enabling more accurate prediction of the vehicle's remaining range. Simultaneously, it can optimize the LSTM neural network parameters using the Grey Wolf algorithm, thus avoiding blind parameter tuning and improving the adaptive capability of the remaining range prediction. Finally, employing attention mechanisms and incremental learning methods further enhances the accuracy of the vehicle's remaining range prediction.
[0209] Example 4
[0210] Please refer to Figure 4 , Figure 4This is a schematic diagram of the structure of an electric vehicle remaining driving range prediction device provided in this embodiment. Figure 4 As shown, the electric vehicle remaining driving range prediction device includes:
[0211] The first acquisition unit 310 is used to acquire driving process sample data of the sample vehicle and the actual driving range of the sample vehicle.
[0212] The first processing unit 320 is used to clean the driving process sample data to obtain the data to be processed.
[0213] Analysis unit 330 is used to analyze the actual range factors of the vehicle in the data to be processed, and obtain a set of range influencing factors;
[0214] Sample construction unit 340 is used to construct a sample set based on the set of range influencing factors and the actual range.
[0215] The second processing unit 350 is used to perform normalization processing on the sample set to obtain the target sample set;
[0216] Model building unit 360 is used to build the original LSTM model;
[0217] Training unit 370 is used to train the original LSTM model using the Grey Wolf optimization algorithm and the target sample set to obtain a trained remaining driving range prediction model.
[0218] The second acquisition unit 380 is used to acquire the current driving process data of the target vehicle;
[0219] Prediction unit 390 is used to predict the remaining driving range based on driving process data and obtain the prediction result;
[0220] Output unit 400 is used to output the prediction results.
[0221] In this embodiment, the original LSTM model includes an input layer, an LSTM layer, an attention mechanism layer, a dropout layer, a combination layer of LSTM and dropout layers, a dense layer, and an output layer; wherein, the input data dimension of the input layer is a preset data dimension, the number of layers of the combination layer is the first layer number obtained by optimization, and the number of layers of the dense layer is the second layer number obtained by optimization.
[0222] The optimization algorithm for the original LSTM model is the Adam algorithm, and the loss function for the original LSTM model is the MSE function.
[0223] As an optional implementation, the sample construction unit 340 includes:
[0224] Subunit 341 is constructed to build a sample set and a test set based on the set of factors affecting driving range and the actual driving range;
[0225] The data prediction subunit 342 is used to perform data prediction using a pre-built GWO-LSTM network and a sample set to obtain predicted data;
[0226] Subunit 341 is also used to construct a sample set based on prediction data, sample set, and test set.
[0227] In this embodiment, the set of factors affecting range includes energy consumption per kilometer, battery state of charge (SOC) value, average speed per kilometer, number of times the absolute value of acceleration per kilometer exceeds 0.1g, and battery health status.
[0228] As an optional implementation, the training unit 370 includes:
[0229] Training subunit 371 is used to train the original LSTM model based on the target sample set to obtain prediction results;
[0230] The calculation subunit 372 is used to calculate evaluation indicators based on the prediction results; among which, the evaluation indicators include the MAE indicator, the RMSE indicator, and the R2 indicator.
[0231] The optimization subunit 373 is used to perform optimization based on the gray wolf optimization algorithm and the R2 index to determine the number of the first layer, the number of the second layer, and the number of neurons in each layer.
[0232] Optimization subunit 374 is used to optimize the original LSTM model based on the number of the first layer, the number of the second layer, and the number of neurons in each layer, to obtain an optimized LSTM model;
[0233] Judgment subunit 375 is used to determine whether the preset number of iterations has been reached;
[0234] Subunit 376 is defined to determine the final optimized LSTM model as the trained remaining driving range prediction model when the preset number of iterations is reached.
[0235] In this embodiment, the explanation of the electric vehicle remaining range prediction device can be referred to the description in Embodiment 1 or Embodiment 2, and will not be repeated in this embodiment.
[0236] As can be seen, the electric vehicle remaining range prediction device described in this embodiment can more comprehensively characterize the overall vehicle state during driving by combining data representing driver style, road conditions, ambient temperature, and component energy consumption status, thereby enabling more accurate prediction of the vehicle's remaining range. Simultaneously, it can optimize the LSTM neural network parameters using the Grey Wolf algorithm, thus avoiding blind parameter tuning and improving the adaptive capability of the remaining range prediction. Finally, employing attention mechanisms and incremental learning methods further enhances the accuracy of the vehicle's remaining range prediction.
[0237] This application provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor runs the computer program to enable the electronic device to perform the electric vehicle remaining driving range prediction method in embodiment 1 or embodiment 2 of this application.
[0238] This application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the remaining driving range prediction method for electric vehicles in embodiment 1 or embodiment 2 of this application is performed.
[0239] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0240] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0241] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0242] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0243] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0244] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for predicting the remaining driving range of an electric vehicle, characterized in that, include: Obtain driving process sample data and the actual driving range of the sample vehicles; The driving process sample data is cleaned to obtain the data to be processed; The data to be processed is analyzed to determine the actual driving range factors of the vehicle, and a set of driving range influencing factors is obtained. Based on the set of factors affecting driving range and the actual driving range, a sample set is constructed; The sample sets are then normalized to obtain the target sample set. Construct the original LSTM model; The original LSTM model is trained using the Grey Wolf optimization algorithm and the target sample set to obtain a trained remaining driving range prediction model. Obtain the current driving process data of the target vehicle; The remaining driving range is predicted based on the driving process data, and the prediction result is obtained. Output the prediction result; The step of constructing a sample set based on the set of factors affecting driving range and the actual driving range includes: Based on the set of factors affecting driving range and the actual driving range, a sample set and a test set are constructed. Predicted data is obtained by using a pre-constructed GWO-LSTM network and the sample set for data prediction. Based on the predicted data, the sample set, and the test set, a sample set is constructed; The set of factors affecting range includes energy consumption per kilometer, battery state of charge (SOC) value, average speed per kilometer, number of times the absolute value of acceleration per kilometer exceeds 0.1g, and battery health status.
2. The method for predicting the remaining driving range of an electric vehicle according to claim 1, characterized in that, The original LSTM model includes an input layer, an LSTM layer, an attention mechanism layer, a dropout layer, a combination layer of LSTM and dropout layers, a dense layer, and an output layer; wherein, the input data dimension of the input layer is a preset data dimension, the number of layers of the combination layer is the first layer number obtained by optimization, and the number of layers of the dense layer is the second layer number obtained by optimization; The optimization algorithm for the original LSTM model is the Adam algorithm, and the loss function for the original LSTM model is the MSE function.
3. The method for predicting the remaining driving range of an electric vehicle according to claim 2, characterized in that, The original LSTM model is trained using the Grey Wolf optimization algorithm and the target sample set to obtain a trained remaining driving range prediction model, including: The original LSTM model is trained based on the target sample set to obtain the prediction results; Evaluation indicators are calculated based on the prediction results; wherein, the evaluation indicators include MAE, RMSE and R2. Based on the gray wolf optimization algorithm and the R2 metric, the number of the first layer, the number of the second layer, and the number of neurons in each layer are determined; The original LSTM model is optimized based on the number of the first layer, the number of the second layer, and the number of neurons in each layer to obtain an optimized LSTM model. Determine whether the preset number of iterations has been reached; If so, the final optimized LSTM model will be determined as the trained remaining driving range prediction model.
4. A device for predicting the remaining driving range of an electric vehicle, characterized in that, The electric vehicle remaining driving range prediction device includes: The first acquisition unit is used to acquire driving process sample data of the sample vehicle and the actual driving range of the sample vehicle. The first processing unit is used to clean the driving process sample data to obtain data to be processed. The analysis unit is used to analyze the actual range factors of the vehicle on the data to be processed, and obtain a set of range influencing factors. A sample construction unit is used to construct a sample set based on the set of range influencing factors and the actual range. The second processing unit is used to perform normalization processing on the sample set respectively to obtain the target sample set; Model building unit, used to build the original LSTM model; The training unit is used to train the original LSTM model using the Grey Wolf Optimization Algorithm and the target sample set to obtain a trained remaining driving range prediction model. The second acquisition unit is used to acquire the current driving process data of the target vehicle; The prediction unit is used to predict the remaining driving range based on the driving process data and obtain the prediction result; An output unit is used to output the prediction result; The sample construction unit includes: Construct sub-units to build sample sets and test sets based on the set of range influencing factors and the actual range; The data prediction subunit is used to perform data prediction using a pre-built GWO-LSTM network and the sample set to obtain predicted data. The construction subunit is further configured to construct a sample set based on the prediction data, the sample set, and the test set; The set of factors affecting range includes energy consumption per kilometer, battery state of charge (SOC) value, average speed per kilometer, number of times the absolute value of acceleration per kilometer exceeds 0.1g, and battery health status.
5. The electric vehicle remaining driving range prediction device according to claim 4, characterized in that, The original LSTM model includes an input layer, an LSTM layer, an attention mechanism layer, a dropout layer, a combination layer of LSTM and dropout layers, a dense layer, and an output layer; wherein, the input data dimension of the input layer is a preset data dimension, the number of layers of the combination layer is the first layer number obtained by optimization, and the number of layers of the dense layer is the second layer number obtained by optimization; The optimization algorithm for the original LSTM model is the Adam algorithm, and the loss function for the original LSTM model is the MSE function.
6. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the electric vehicle remaining driving range prediction method according to any one of claims 1 to 3.
7. A readable storage medium, characterized in that, The readable storage medium stores computer program instructions, which, when read and executed by a processor, perform the electric vehicle remaining range prediction method according to any one of claims 1 to 3.