Electric vehicle energy consumption prediction method and device based on BKA optimization model
By constructing a CNN-LSTM-MHA model based on the BKA optimization model and combining it with the Black Kite BKA algorithm to optimize parameters, the problem of complex multivariable relationships in the energy consumption prediction of pure electric vehicles is solved, more efficient energy consumption prediction and energy management are achieved, and the accuracy and stability of the model are improved.
Patent Information
- Application Number
- CN202511068790.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-10-17
AI Technical Summary
Existing models are unable to effectively process the complex multivariable energy consumption data during the driving process of pure electric vehicles, resulting in large errors in energy consumption prediction, affecting the accuracy of vehicle range prediction and energy utilization efficiency, increasing operating and consumer costs, and reducing consumer trust.
An electric vehicle energy consumption prediction method based on the BKA optimization model is adopted. By constructing a CNN-LSTM-MHA model and using the Black Kite BKA algorithm to optimize model parameters, the global search capability and prediction accuracy of the model are enhanced by combining the local feature extraction of CNN, the long-term dependency modeling of LSTM and the global association mining of MHA.
It significantly improves the accuracy and stability of electric vehicle energy consumption prediction, solves the problems of local optimality and slow convergence in traditional neural network training, and improves the efficiency and accuracy of energy management.
Smart Images

Figure CN120804667A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of new energy and energy-saving technologies, and in particular to a method and device for predicting energy consumption of an electric vehicle based on a BKA optimization model. Background Art
[0002] In the field of pure electric vehicles, existing models struggle to fully exploit the spatiotemporal characteristics of complex, time-series, multivariate energy consumption data, such as current, voltage, and temperature under different battery charging and discharging conditions, as well as vehicle speed and road conditions. Furthermore, traditional optimization algorithms, such as genetic algorithms or single machine learning models, suffer from slow convergence and struggle to quickly find optimal solutions in high-dimensional parameter spaces.
[0003] For example, predicting the energy consumption of pure electric vehicles (BEVs) during driving is influenced by the interplay of multiple variables, including driving mode (e.g., urban congestion, highway driving), ambient temperature, and remaining battery charge. However, existing models are unable to effectively address the complex relationships between these variables, resulting in significant errors in energy consumption predictions. This results in inaccurate predictions of the vehicle's remaining range, making it difficult for drivers to plan their trips ahead of time and increasing the risk of running out of battery power mid-trip. It also presents challenges for automakers in managing vehicle energy consumption and calibrating range, leading to inefficient energy utilization, increased operating costs, and increased user costs for consumers. This can lead to charging anxiety among consumers and reduce their trust in BEVs.
[0004] Currently, common time series forecasting models include simple statistical models and basic neural network models. Statistical models such as ARIMA are somewhat effective when dealing with linear relationships, but their forecasting accuracy is limited when dealing with complex, nonlinear, and multivariate time series data. Traditional neural network models, with existing methods primarily relying on traditional physical models (such as MOBILE and COPERT) or single machine learning models (such as LSTM and CNN), suffer from the following issues: 1. Single models struggle to capture long-term dependencies and complex features in the data; 2. Model limitations: Traditional models are unable to capture the nonlinear coupling relationships in multivariate time series data; 3. Optimization efficiency is low: gradient descent methods are prone to falling into local optima, and hyperparameter adjustment relies on empirical experience. Summary of the Invention
[0005] The purpose of the present invention is to provide a method and device for predicting energy consumption of electric vehicles based on a BKA optimization model, so as to overcome the deficiencies of the prior art.
[0006] In a first aspect, the present invention provides a method for predicting energy consumption of an electric vehicle based on a BKA optimization model, comprising the following steps: Collect energy consumption prediction data and preprocess them to obtain a data set for training; Divide the dataset into a training set and a validation set; Build a CNN-LSTM-MHA model; Optimize the parameters of the CNN-LSTM-MHA model using the black-winged kite BKA algorithm to obtain a BKA-CNN-LSTM-MHA model; Input the training set into the BKA-CNN-LSTM-MHA model for training; After multiple rounds of iterative training, verify the prediction accuracy of the BKA-CNN-LSTM-MHA model using the validation set; After preprocessing, import the data set to be predicted into the BKA-CNN-LSTM-MHA model for energy consumption prediction to obtain the prediction result.
[0007] Further, the process of building a CNN-LSTM-MHA model is as follows: Set the initial parameters, determine the convolution kernel size, feature dimension, and output channel number, and initialize the model weights; Build a CNN module to extract local temporal features, build an LSTM module to process time series data, and integrate an MHA module to capture global dependency relationships; Split the LSTM output sequence into multiple heads, perform attention calculation on each head independently, then concatenate and perform linear transformation; Add a global average pooling layer after the MHA layer to reduce dimensionality, then build a fully connected layer to map the pooled features to the output space; Complete the construction of the CNN-LSTM-MHA model.
[0008] Further, the process of optimizing the parameters of the CNN-LSTM-MHA model using the black-winged kite BKA algorithm to obtain a BKA-CNN-LSTM-MHA model is as follows: S1, randomly generate a hyperparameter matrix, each row of the hyperparameter matrix corresponds to a black-winged kite, and the random values uniformly distributed between the upper and lower bounds of each black-winged kite are initialized to obtain an initial population; S2, calculate the fitness of each black-winged kite, compare the fitness of all black-winged kite individuals, and select the initial leader according to the fitness; S3, enter the iterative loop, in each iteration, first perform the attack phase, select the attack strategy to update the position of each black-winged kite in the initial black-winged kite population obtained in S1 according to the preset probability; After completing the attack phase of S3, perform the migration behavior phase, compare the fitness of the current leader obtained in S2 with the fitness of all individuals in the population, if the leader's fitness lags behind, the leader returns to the population, if the leader's fitness leads, the leader continues; S5, repeat S3 and S4 until the number of iterations reaches the preset number of iterations, output the final leader position, and complete the construction of the BKA-CNN-LSTM-MHA model.
[0009] Furthermore, the hyperparameter matrix in S1 is: ; Among them, the black-winged kite population size is , the problem dimension is , It is A black kite in Dimensional location.
[0010] Furthermore, the formula for calculating the fitness of each black kite in S2 is: ; in, It is A black kite in The lower bound of dimension, It is A black kite in The upper bound of dimension, is a random value in the interval [0,1]; The formula for selecting the leader in the initial population is: ; in Usually it can be selected as the minimum value, that is .
[0011] Furthermore, in S3, the attack strategies include two types: the first attack strategy is to control the search step size by using a scaling factor that decays with iterations, and the second attack strategy is to maintain the original position; The attack strategy is expressed by the following formula: ; in, Representative A black kite in The first The position of the iteration, Representative A black kite in Weizhong The position of the iteration, is a random number in [0,1], is a constant with a value of 0.9; is a parameter that changes with the number of iterations. .
[0012] Further, in the S4, the migration behavior stage is achieved by the following formula: ; Wherein, represents the leading score of the black-winged kite in the first dimension until the first iteration; represents the current position of any black-winged kite in the first dimension in the first iteration; represents the fitness value of the random position of any black-winged kite in the first dimension in the first iteration; represents Cauchy variation; ; The Cauchy variation is shown in the following formula: ; Wherein, the parameter represents a position parameter, which determines the central peak of the distribution; the parameter is a scale parameter, which controls the dispersion degree of the distribution (0 > 0), which is fixed as 1 in the algorithm to form a standard Cauchy distribution; and the random variable represents a sampling value generated by the distribution.
[0013] In the second aspect, the application provides an electric vehicle energy consumption prediction system based on a BKA optimization model, comprising: A collection unit collects energy consumption prediction data for preprocessing to obtain a data set for training; A data set division unit divides the data set into a training set and a validation set; A first construction model constructs a CNN-LSTM-MHA model; A second construction model optimizes the CNN-LSTM-MHA model parameters by using the black-winged kite BKA algorithm to obtain a BKA-CNN-LSTM-MHA model; A training unit inputs the training set into the BKA-CNN-LSTM-MHA model for training; A verification unit verifies the prediction accuracy of the BKA-CNN-LSTM-MHA model by using the validation set after multiple rounds of iterative training; A prediction unit pre-processes the data set to be predicted and imports it into the BKA-CNN-LSTM-MHA model for energy consumption prediction to obtain a prediction result.
[0014] In a third aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0015] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0016] Compared with the prior art, the present application has the following beneficial technical effects: The present application provides an electric vehicle energy consumption prediction method based on a BKA optimization model, which optimizes the parameters of a CNN-LSTM-MHA model using the black kite BKA algorithm, obtains a BKA-CNN-LSTM-MHA model, and combines the local feature extraction of CNN, the long-term dependence modeling of LSTM, and the global correlation mining of MHA, so as to adapt to different types of complex energy consumption data and effectively break through the local optimum caused by the gradient disappearance of the LSTM in the energy consumption prediction model. Whether it is industrial production, building energy consumption, or energy consumption prediction in the field of transportation, it can effectively handle the multivariate and complex relationships therein and provide strong support for energy management in different industries. The present application effectively solves the problems of local optimum and slow convergence in traditional neural network training, significantly improves the accuracy and stability of model prediction.
[0017] Specifically, by simulating the migration and hunting behavior of black kites, combining the Cauchy mutation strategy and the leader strategy, the global search capability is enhanced, and the local optimal solution is avoided, CNN captures local features, LSTM remembers long-term dependencies, MHA mines variable correlations, and multiple modules work together, which can more comprehensively and accurately learn the characteristics of energy consumption data. Compared with traditional models, the prediction accuracy is greatly improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 FIG. 1 is a schematic diagram of an electric vehicle energy consumption prediction method based on a BKA optimization model in an embodiment of the present application.
[0019] Figure 2 FIG. 3 is a schematic diagram of the process of optimizing the parameters of a CNN-LSTM-MHA model in an embodiment of the present application.
[0020] Figure 3 FIG. 4 is a schematic diagram of a CNN-LSTM-MHA model in an embodiment of the present application. DETAILED DESCRIPTION
[0021] In the following certain exemplary embodiments are simply described. As will be realized by those skilled in the art, the described embodiments can be modified in various different ways without departing from the spirit or scope thereof. Accordingly, the drawings and descriptions are to be regarded as illustrative in nature rather than restrictive.
[0022] In the description of the present application, it is to be understood that the orientations or positional relationships indicated by the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", and the like are based on the orientations or positional relationships shown in the drawings, and are merely intended to facilitate the description of the present application and simplify the description, and therefore cannot be understood as indicating or implying that the devices or elements indicated must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application.
[0023] In addition, the terms "first", "second", "third", etc. are used only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features defined with "first", "second", etc. can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "a plurality of" is two or more, unless otherwise explicitly specified and limited.
[0024] In the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connecting", "fixing", and the like should be understood broadly, for example, can be fixed connection, can also be detachable connection, or integral; can be mechanical connection, can also be electrical connection, or communication; can be direct connection, or indirect connection through intermediate medium; can be the internal communication of two elements or the interaction relationship between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0025] In the present application, unless otherwise explicitly specified and limited, "on" or "under" of the first feature to the second feature can include that the first and second features are in direct contact, or that the first and second features are not in direct contact but are in contact through another feature between them. Moreover, "on", "above" and "on" of the first feature to the second feature includes that the first feature is directly above and obliquely above the second feature, or only indicates that the horizontal height of the first feature is higher than that of the second feature. "Below", "under" and "under" of the first feature to the second feature includes that the first feature is directly above and obliquely above the second feature, or only indicates that the horizontal height of the first feature is less than that of the second feature.
[0026] It should be understood that the terms "comprises" and "comprising," when used in this specification and the following claims, indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0027] It should also be understood that the terms used in the specification of the application are only for the purpose of describing particular embodiments and are not intended to limit the application. As used in the specification and the appended claims of the application, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0028] It should be further understood that the term "and / or" used in the specification of the application refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
[0029] Various structural diagrams according to the disclosed embodiments of the application are shown in the accompanying drawings. These drawings are not drawn to scale, in which certain details are exaggerated for the purpose of clarity and certain details can be omitted. The shapes of various regions, layers and their relative sizes and positional relationships shown in the drawings are only exemplary, and in actuality can deviate due to manufacturing tolerances or technical limitations, and regions / layers with different shapes, sizes and relative positions can be additionally designed by those skilled in the art according to actual needs.
[0030] As Figures 1 to 3 The application provides an electric vehicle energy consumption prediction method based on a BKA optimization model, comprising the following steps: Collecting energy consumption prediction data for preprocessing to obtain a data set for training; The preprocessing procedure includes data cleaning (removing outliers and filling missing values), normalization processing, and mapping the data to the [0, 1] interval to eliminate the influence of different variable data dimensions.
[0031] Dividing the data set into a training set and a validation set; Building a CNLSTM-MHA model; The process of building the CNLSTM-MHA model is specifically as follows: Setting initial parameters, determining the convolution kernel size, feature dimension, output channel number and initializing the model weight; the convolution kernel size determines the range of local features extracted by CNN, the feature dimension is the number of features of the input data, and the output channel number is the number of feature maps of each layer of CNN, which affects the representation ability of the model to local patterns.
[0032] The CNN module is built to extract local temporal features, the LSTM module is built to process time series data, and the MHA module is integrated to capture global dependency relationships. The LSTM output sequence is split into multiple heads, each head independently performs attention calculation, then spliced and linearly transformed. A global average pooling layer is added after the MHA layer to reduce dimensionality, and then a fully connected layer is constructed to map the pooled features to the output space. The CNN-LSTM-MHA model is completed.
[0033] The CNN module, Convolutional Neural Network (CNN), is responsible for extracting spatial features of data. It slides convolution kernels of different sizes over time series data, such as using 16x1 and 32x1 convolution kernels to perform convolution operations on data. In the pure electric vehicle energy consumption prediction scenario, this operation can capture the fluctuation characteristics of energy consumption data in a short time, such as local features such as sudden acceleration, instantaneous changes in battery voltage and current, etc. Then, the obtained feature map is processed by pooling, which reduces the dimension of data while preserving important features, reduces the computational complexity of the model while avoiding the loss of key information, so that the subsequent model can more efficiently process data.
[0034] The LSTM module, Long Short-Term Memory Network (LSTM), is used to capture long-term dependencies of data. It controls the transmission of information through a gating mechanism (input gate, forget gate, output gate). In the driving process of a pure electric vehicle, there are long-term correlations between driving behavior, battery state, and other time series features, such as the battery decay process after sudden acceleration. LSTM can remember energy consumption data features over a long period of time, solving the gradient vanishing problem of traditional recurrent neural networks, allowing the model to effectively process time series data and learn long-term dependency patterns in the data, providing long-term dimensional information support for accurate energy consumption prediction.
[0035] The MHA module, Multi-Head Attention Mechanism (MHA), further explores the correlation between different variables in the data. It maps input data to multiple low-dimensional spaces, calculates attention weights in each space, and then splices the results of multiple spaces. In energy consumption prediction, MHA focuses on analyzing the interaction between cross-dimensional parameters extracted locally by the CNN layer, such as the relationship between driving mileage and battery temperature. By focusing on data features from different angles, MHA can discover hidden complex correlations in data and improve prediction accuracy.
[0036] In the pure electric vehicle energy consumption prediction model, each module plays a role in coordination. The CNN module is responsible for extracting local features such as sudden acceleration, battery voltage, and current changes. The LSTM utilizes its gating unit to effectively process time series data, enabling it to capture long-term correlations of time series features such as driving behavior and battery state, such as the battery decay process after sudden acceleration. The multi-head attention mechanism (MHA) focuses on analyzing the cross-dimensional parameter interaction extracted by the CNN layer, such as the relationship between driving range and battery temperature.
[0037] Referring to Figure 2 , the BKA-CNN-LSTM-MHA model is obtained by optimizing the parameters of the CNN-LSTM-MHA model using the black kite BKA algorithm, and the process is specifically as follows: S1, randomly generate a hyperparameter matrix, each row of the hyperparameter matrix corresponds to a black kite, and the random values uniformly distributed between the upper and lower bounds of each black kite are initialized to obtain an initialized population; In one specific embodiment of the present application, the hyperparameter matrix in S1 is: ; Wherein, the population size of the black kite is , the problem dimension is , is the position of the th black kite in the th dimension.
[0038] S2, calculate the fitness of each black kite, apply the CNN-LSTM-MHA model to the validation set, and take the reciprocal of the prediction error of the model on the validation set as the fitness. Compare the fitness corresponding to all black kite individuals, and select the initial leader according to the fitness. In the initialization process, the BKA algorithm selects the individual with the best fitness value as the leader in the initial population, The formula for calculating the fitness of each black kite in S2 is: ; Wherein, is the lower bound of the th black kite in the th dimension, is the upper bound of the th black kite in the th dimension, is a random value in the interval [0, 1]; The formula for selecting the leader in the initial population is: ; Wherein, It can usually be selected as the minimum value, i.e.
[0039] S3, enters the iterative loop. In each iteration, the attack phase is first executed. For each black kite in the initial black kite population obtained in S1, the attack strategy is selected according to the preset probability to update the position. In some specific embodiments of the present invention, the attack strategy includes two types. The first attack strategy is to control the search step size using a scaling factor that decays with iterations, and the second attack strategy is to maintain the original position. The attack strategy is expressed by the following formula: ; in, Representative A black kite in The first The position of the iteration, Representative A black kite in Weizhong The position of the iteration, is a random number in [0,1], is a constant with a value of 0.9; is a parameter that changes with the number of iterations. ,in, is the total number of iterations, is the number of iterations completed so far.
[0040] In some more specific embodiments of the present invention, if the random number r is greater than or equal to the preset probability p, then according to the above formula Update the position of the black kite; use the parameter n that decays with the number of iterations to control the search step size to achieve large-scale exploration in the early stage of the algorithm and fine search in the later stage, enhancing the ability to escape from the local optimum.
[0041] S4, after completing the attack phase of S3, executes the migration behavior phase, comparing the fitness of the current leader obtained in S2 with that of all individuals in the population. If the leader's fitness lags behind, the leader returns to the population; if the leader's fitness leads, the leader continues to be the leader; In some more specific embodiments of the present invention, the migration behavior stage is implemented by the following formula: ; in, Indicates the Up to the iteration, the black kite Wei's leading score; Indicates in In the iteration, any black kite The current position obtained by dimension; fitness value of the random position obtained in the first iteration from the arbitrary black kite in the first dimension; fitness value of the random position obtained in the first iteration from the arbitrary black kite in the first dimension; fitness value of the random position obtained in the first iteration from the arbitrary black kite in the first dimension; representing Cauchy variation; ; The Cauchy variation is shown in the following formula: ; wherein the parameter represents a position parameter, which determines the central peak of the distribution; the parameter is a scale parameter, which controls the dispersion degree of the distribution >0), is fixed as 1 in the algorithm to form a standard Cauchy distribution; and the random variable represents a sampling value generated by the distribution.
[0042] The fitness value of the current leader is compared with the fitness value of the random black kite individual , if , the leader gives up the leadership, and the position is updated according to the formula , if , the leader continues to guide the population, and the position is updated according to the formula . Through this migration behavior model, the BKA algorithm can dynamically select excellent leaders to ensure that the population moves in a better direction in the search space.
[0043] The present application fuses the black kite algorithm (BKA), convolutional neural network (CNN), long short-term memory network (LSTM) and multi-head attention mechanism (MHA), and constructs an electric vehicle energy consumption prediction method based on a BKA optimization model. The BKA serves as an optimizer, optimizes neural network weights by virtue of the Cauchy variation strategy and leader strategy, accelerates model convergence, prevents local optimum, improves global search capability, and provides a new approach for model performance optimization. The present application effectively solves the problems of local optimum and slow convergence in traditional neural network training, and significantly improves the accuracy and stability of model prediction.
[0044] The present application provides an electric vehicle energy consumption prediction system based on a BKA optimization model, which comprises: a collection unit: collecting energy consumption prediction data for preprocessing to obtain a data set for training; a data set division unit: dividing the data set into a training set and a validation set; a first constructed model: constructing a CNN-LSTM-MHA model; a second constructed model: optimizing the CNN-LSTM-MHA model parameters by using the black kite BKA algorithm to obtain a BKA-CNN-LSTM-MHA model; Training unit: input the training set into the BKA-CNN-LSTM-MHA model for training; Verification unit: After multiple rounds of iterative training, the prediction accuracy of the BKA-CNN-LSTM-MHA model is verified using the validation set; Prediction unit: After preprocessing the data set to be predicted, it is imported into the BKA-CNN-LSTM-MHA model to perform energy consumption prediction and obtain the prediction results.
[0045] In one embodiment of the present invention, a computer device is provided, comprising a processor and a memory, wherein the memory is configured to store a computer program, the computer program including program instructions, and the processor is configured to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or may be another general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. It is the computing core and control core of the terminal and is suitable for implementing one or more instructions, specifically loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function. The processor described in this embodiment of the present invention can be used in the operation of the electric vehicle energy consumption prediction method.
[0046] The present application further provides a storage medium, specifically a computer readable storage medium (Memory), which is a memory device in a computer device, used for storing programs and data. It can be understood that the computer readable storage medium herein can include an internal storage medium in the computer device, and of course can also include an extended storage medium supported by the computer device. The computer readable storage medium provides a storage space, which stores an operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and the instructions can be one or more computer programs (including program codes). It should be noted that the computer readable storage medium herein can be a high-speed RAM memory, or a non-volatile memory such as at least one disk memory. One or more instructions stored in the computer readable storage medium can be loaded and executed by the processor to realize the corresponding steps of the electric vehicle energy consumption prediction method in the above embodiments.
[0047] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0048] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device implemented in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that carries out the function specified in the flow or flows and / or block or blocks.
[0049] These computer program instructions can also be stored in a computer readable memory that can direct the computer or other programmable data processing apparatus to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including instruction apparatus, which realizes the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1the function specified in the one or more blocks.
[0050] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of operation steps are performed on the computer or other programmable data processing devices to generate computer-implemented processes, so that the instructions executed on the computer or other programmable devices provide processes for implementing the flow Figure 1 one or more flows and / or blocks Figure 1 the function specified in the one or more blocks.
[0051] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, but not to limit it, although the above embodiments of the present application have been described in detail, those skilled in the art should understand: the specific embodiments of the present application can be modified or replaced by the same, without departing from the spirit and scope of the present application, any modification or equivalent replacement, which should be covered within the scope of protection of the claims of the present application.
Claims
1. A method for predicting energy consumption of electric vehicles based on the BKA optimization model, characterized in that: The following steps are involved: Collect energy consumption prediction data and preprocess them to obtain a data set for training; Divide the dataset into training and validation sets; Build a CNN-LSTM-MHA model; The Black Kite BKA algorithm is used to optimize the CNN-LSTM-MHA model parameters to obtain the BKA-CNN-LSTM-MHA model; Input the training set into the BKA-CNN-LSTM-MHA model for training; After multiple rounds of iterative training, the prediction accuracy of the BKA-CNN-LSTM-MHA model was verified using the validation set; After preprocessing the data set to be predicted, the BKA-CNN-LSTM-MHA model is imported to perform energy consumption prediction and obtain the prediction results.
2. The electric vehicle energy consumption prediction method based on the BKA optimization model according to claim 1 is characterized in that: The specific process of building the CNN-LSTM-MHA model is as follows: Set initial parameters, determine the convolution kernel size, feature dimension, number of output channels and initialize model weights; Build a CNN module to extract local time features, build an LSTM module to process time series data, and integrate an MHA module to capture global dependencies; The LSTM output sequence is split into multiple heads, each of which performs attention calculation independently, then concatenates and performs linear transformation; A global average pooling layer is added after the MHA layer to reduce the dimension, and then a fully connected layer is constructed to map the pooled features to the output space; Complete the construction of the CNN-LSTM-MHA model.
3. The electric vehicle energy consumption prediction method based on the BKA optimization model according to claim 2 is characterized in that: The process of optimizing the CNN-LSTM-MHA model parameters using the Black Kite BKA algorithm to obtain the BKA-CNN-LSTM-MHA model is as follows: S1, randomly generate a hyperparameter matrix, where each row of the hyperparameter matrix corresponds to a black kite, and initialize each black kite with a random value uniformly distributed between the upper and lower bounds to obtain the initialized population; S2, calculate the fitness of each black kite, compare the fitness of all black kites, and select the initial leader based on the fitness; S3, enters the iterative loop. In each iteration, the attack phase is first executed. For each black kite in the initial black kite population obtained in S1, the attack strategy is selected according to the preset probability to update the position. S4, after completing the attack phase of S3, executes the migration behavior phase, comparing the fitness of the current leader obtained in S2 with that of all individuals in the population. If the leader's fitness lags behind, the leader returns to the population; if the leader's fitness leads, the leader continues to be the leader; S5, repeat S3 and S4 until the number of iterations reaches the preset number of iterations, output the final leader position, and complete the construction of the BKA-CNN-LSTM-MHA model.
4. The electric vehicle energy consumption prediction method based on the BKA optimization model according to claim 3 is characterized in that: The hyperparameter matrix in S1 is: ; Among them, the black-winged kite population size is , the problem dimension is , It is A black kite in Dimensional location.
5. The electric vehicle energy consumption prediction method based on the BKA optimization model according to claim 4 is characterized in that: The formula for calculating the fitness of each black kite in S2 is: ; in, It is A black kite in The lower bound of dimension, It is A black kite in The upper bound of dimension, is a random value in the interval [0,1]; The formula for selecting the leader in the initial population is: ; in, .
6. The electric vehicle energy consumption prediction method based on the BKA optimization model according to claim 5 is characterized in that: In S3, the attack strategy includes two types. The first attack strategy is to control the search step size by using a scaling factor that decays with iterations, and the second attack strategy is to maintain the original position. The attack strategy is expressed by the following formula: ; in, Representative A black kite in The first The position of the iteration, Representative A black kite in Weizhong The position of the iteration, is a random number in [0,1], is a constant with a value of 0.9; is a parameter that changes with the number of iterations. ,in, is the total number of iterations, is the number of iterations completed so far.
7. The electric vehicle energy consumption prediction method based on the BKA optimization model according to claim 6 is characterized in that: In S4, the migration behavior stage is achieved by the following formula: ; in, Indicates the Up to the iteration, the black kite Wei's leading score; Indicates in In the iteration, any black kite The current position obtained by dimension; Indicates in In the iteration, from any black kite in The fitness value of the random position obtained by dimension; represents the Cauchy variation; ; The Cauchy variation is shown in the following formula: ; Among them, the parameters represents the location parameter, which determines the distribution of the central peak of the distribution; parameter is the scale parameter, which controls the degree of dispersion of the distribution ( >0), is fixed to 1 in the algorithm to form a standard Cauchy distribution; random variable Represents sample values generated from this distribution.
8. An electric vehicle energy consumption prediction system based on the BKA optimization model, characterized in that: include: Acquisition unit: collects energy consumption prediction data for preprocessing to obtain a data set for training; Dataset division unit: divide the dataset into training set and validation set; First, build the model: build the CNN-LSTM-MHA model; Second, build the model: use the Black Kite BKA algorithm to optimize the CNN-LSTM-MHA model parameters to obtain the BKA-CNN-LSTM-MHA model; Training unit: input the training set into the BKA-CNN-LSTM-MHA model for training; Verification unit: After multiple rounds of iterative training, the prediction accuracy of the BKA-CNN-LSTM-MHA model is verified using the validation set; Prediction unit: After preprocessing the data set to be predicted, it is imported into the BKA-CNN-LSTM-MHA model to perform energy consumption prediction and obtain the prediction results.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.