PSO-LSTM temperature prediction method introducing attention mechanism

By introducing attention mechanism and particle swarm algorithm in the PSO-LSTM model, screening the influencing factors of battery temperature and optimizing model parameters, the shortcomings of the existing models in temperature prediction accuracy and stability are solved, and higher battery temperature is achieved Prediction accuracy and stability.

CN119203774APending Publication Date: 2024-12-27NANJING TECH UNIV
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411430163.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

The existing PSO-LSTM temperature prediction model has shortcomings in screening factors that affect battery temperature, optimizing model parameters, and processing nonlinear time series data, which leads to the improvement of the accuracy and stability of the prediction results.

Method used

The PSO-LSTM temperature prediction method introduced an attention mechanism, screens the influencing factors of battery temperature through mutual information and Pearson correlation coefficient coupling method, and optimizes the LSTM model parameters in combination with the particle swarm algorithm to construct an input set and model for battery temperature prediction.

Benefits of technology

It significantly improves the accuracy and stability of battery temperature prediction, can better pay attention to important prediction parts, process nonlinear time series data, and improves the accuracy and stability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119203774A_ABST
    Figure CN119203774A_ABST
Patent Text Reader

Abstract

The invention provides a PSO-LSTM temperature prediction method introducing an attention mechanism, and relates to the technical field of battery temperature prediction, and the method comprises the following steps: screening battery temperature influence factors through a coupling method based on normalized battery operation data, and constructing an input set for model training according to the battery temperature influence factors; configuring a fitness function, and combining a particle swarm algorithm and an input set to optimize LSTM model parameters of a fusion attention mechanism to obtain a battery temperature prediction model; and on the basis of the battery temperature prediction model and according to the battery operation data obtained in real time, carrying out online prediction on the battery temperature to obtain a prediction result. Parameters of the prediction model are optimized by using the particle swarm optimization, unnecessary input information in the model is effectively reduced, and the battery temperature prediction model has higher accuracy and stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of battery temperature prediction, and in particular to a PSO-LSTM temperature prediction method introducing an attention mechanism. Background Art

[0002] According to incomplete statistics from the Energy Storage Industry Technology Alliance (CNESA), by the end of 2023, the global cumulative installed capacity of energy storage will reach 237.2GW, and lithium-ion batteries account for up to 90% of new energy storage, occupying a dominant position. However, when the battery is running, the temperature will fluctuate violently due to factors such as current and voltage, making temperature prediction more difficult. Effective temperature prediction will effectively solve the problem of battery thermal management safety, and improving the uniformity of battery temperature distribution in power stations will help extend the operating life.

[0003] Therefore, improving the accuracy of battery temperature prediction helps to obtain the battery's operating characteristics in advance, so as to reasonably arrange the battery's charging and discharging operation modes and countermeasures in the power grid, and improve the safety and reliability of the battery during operation. However, from a few years of research, although the temperature prediction models have improved the prediction accuracy, the PSO-LSTM combined algorithm still has room for improvement. Specifically, the existing prediction models still have deficiencies in screening battery temperature influencing factors, optimizing model parameters, and processing nonlinear time series data, resulting in the accuracy and stability of the prediction results need to be improved.

[0004] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0005] In view of this, the present invention provides a PSO-LSTM temperature prediction method that introduces an attention mechanism to solve the above-mentioned problems.

[0006] In order to solve the above problems, the specific technical solutions adopted by the present invention are as follows:

[0007] A PSO-LSTM temperature prediction method introducing an attention mechanism includes the following steps:

[0008] S 1. Based on the normalized battery operation data, the battery temperature influencing factors are screened through the coupling method, and an input set for model training is constructed according to the battery temperature influencing factors;

[0009] S2. Configure the fitness function, and combine the particle swarm algorithm and input set to optimize the LSTM model parameters of the fusion attention mechanism to obtain the battery temperature prediction model;

[0010] S3. Based on the battery temperature prediction model and according to the battery operation data obtained in real time, the battery temperature is predicted online to obtain a prediction result.

[0011] Preferably, the method of screening the battery temperature influencing factors by a coupling method based on the normalized battery operation data, and constructing an input set for model training according to the battery temperature influencing factors includes the following steps:

[0012] S 11. Obtaining battery operation data and constructing a data matrix, and performing normalization processing on the battery operation data using a normalization processing calculation formula;

[0013] S 12. For each data variable in the normalized battery operation data, a correlation coefficient between the data variables is calculated using a mutual information and Pearson correlation coefficient coupling method to obtain a correlation coefficient calculation result;

[0014] S13. Filter the battery temperature influencing factors that meet the prediction threshold according to the correlation coefficient calculation results; S14. Construct an input set for model training according to the filtered battery temperature influencing factors.

[0015] Preferably, the normalization calculation formula is:

[0016]

[0017] In the formula, Indicates the normalized battery operation data;

[0018] A i Represents the original data of the i-th column in the data matrix;

[0019] A i,min Represents the minimum value of the original data in the i-th column of the data matrix;

[0020] A i,max Represents the maximum value in the original data of the i-th column in the data matrix.

[0021] Preferably, the calculation formula for calculating the correlation coefficient between data variables using the mutual information and Pearson correlation coefficient coupling method is:

[0022]

[0023] In the formula, I(X;Y) represents the mutual information correlation coefficient between data variable X and data variable Y;

[0024] p(x, y) represents the joint probability distribution between data variables X and data variables Y;

[0025] p(x) and p(y) represent the marginal probability distributions of data variables X and Y respectively;

[0026] ρ X,YRepresents the Pearson correlation coefficient between data variable X and data variable Y;

[0027] x i represents the value of the x variable for the i-th observation in the data;

[0028] y i Represents the y variable value of the i-th observation in the data;

[0029] They represent the data variables X i and Y i The average value of

[0030] n represents the sample size;

[0031] i represents an integer from 1 to the number of samples n.

[0032] Preferably, configuring the fitness function and combining the LSTM model parameters of the particle swarm algorithm and the input set optimization fusion attention mechanism to obtain the battery temperature prediction model includes the following steps:

[0033] S21. Based on the pre-built LSTM model, by integrating the attention mechanism, an LSTM model with fused attention mechanism is obtained;

[0034] S22, initialize the particle swarm algorithm and configure the fitness function, and use the particle swarm algorithm to optimize the parameters of the LSTM model integrated with the attention mechanism to obtain the optimal parameter combination;

[0035] S23. Import the optimal parameter combination into the LSTM model integrated with the attention mechanism, and use the input set for training to obtain a battery temperature prediction model.

[0036] Preferably, the method of obtaining an LSTM model integrating an attention mechanism based on a pre-built LSTM model comprises the following steps:

[0037] S211, constructing a network structure of an LSTM model, wherein the network structure of the LSTM model includes a forget gate, an input gate, and an output gate;

[0038] S212. Construct an attention matrix according to the principle of the attention mechanism, and obtain an attention score by calculating the correlation between the query and the key;

[0039] S213, performing softmax normalization processing on the attention score to obtain the attention weight;

[0040] S214. Use the attention weight as the input of the LSTM model to form a weighted input, and use the weighted input to update the hidden state of the LSTM model to obtain an LSTM model that integrates the attention mechanism.

[0041] Preferably, the expression of the weighted input is:

[0042]

[0043] In the formula, represents the weighted input of the number of time steps Z;

[0044] Indicates the length of the input sequence;

[0045] α r represents the attention weight;

[0046] G r Represents the feature vector of the input sequence at time r.

[0047] Preferably, the initialization of the particle swarm algorithm and the configuration of the fitness function, and the use of the particle swarm algorithm to optimize the parameters of the LSTM model fused with the attention mechanism to obtain the optimal parameter combination include the following steps:

[0048] S221, initializing the model parameters of the LSTM model integrating the attention mechanism, performing preliminary training on the LSTM model integrating the attention mechanism using the input set, and calculating the loss function of the LSTM model integrating the attention mechanism through forward propagation;

[0049] S222, using the loss function of the LSTM model integrating the attention mechanism as the fitness function;

[0050] S223, randomly initialize a particle swarm, and update the speed and position of the particles based on a particle swarm algorithm;

[0051] S224, for each particle's updated position, use it as a new parameter combination of the LSTM model fused with the attention mechanism, and recalculate the fitness function;

[0052] S225. Repeat steps S223-S224 until the preset number of iterations is reached, and select the global optimal position as the optimal parameter combination of the LSTM model with integrated attention mechanism according to the calculation result of the fitness function.

[0053] Preferably, the randomly initializing particle swarm and updating the speed and position of particles based on the particle swarm algorithm comprises the following steps:

[0054] S2231, randomly generate particle positions and velocities, each particle represents the parameters of the LSTM model integrated with the attention mechanism, including weights and biases;

[0055] S2232, according to the strategy of linearly decreasing inertia weight, setting the maximum value and minimum value of inertia weight;

[0056] S2233, bring the parameter group represented by each particle into the LSTM model integrated with the attention mechanism, calculate the output of the model through forward propagation, and compare it with the true value to obtain the loss function value as the fitness value of the particle;

[0057] S2234. According to the current number of iterations, the inertia weight is calculated using the linearly decreasing inertia weight calculation formula, and the speed and position of each particle are calculated and updated according to the inertia weight and the particle group speed update formula.

[0058] Preferably, the linear decreasing inertia weight calculation formula is:

[0059] ω=ω max -(ω max -ω min )*b / B;

[0060] Where ω represents the inertia weight;

[0061] ω max and ω min Respectively represent the maximum and minimum values ​​of the inertia weight;

[0062] b represents the current iteration number;

[0063] B represents the total number of iterations.

[0064] The beneficial effects of the present invention are:

[0065] 1. The present invention adopts the mutual information and Pearson correlation coefficient coupling method to screen the factors affecting the battery temperature, so as to establish the input feature vector of the prediction model; the accuracy of battery temperature prediction is greatly improved, and then an LSTM model optimized by introducing an attention mechanism algorithm particle swarm algorithm is proposed. The particle swarm algorithm is used to optimize the parameters of the prediction model, which effectively reduces unnecessary input information in the model and improves the accuracy of the LSTM model prediction results. At the same time, the attention mechanism is introduced so that the model can focus more on important parts, so that the battery temperature prediction model has higher accuracy and stability.

[0066] 2. The present invention can effectively perform global search using the particle swarm algorithm, which helps to find the optimal parameter configuration in LSTM and can process nonlinear time series data. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0068] Figure 1 is a flow chart of a PSO-LSTM temperature prediction method that introduces an attention mechanism according to an embodiment of the present invention;

[0069] Figure 2 This is a flowchart of an Attention model combining self and cross in a PSO-LSTM temperature prediction method that introduces an attention mechanism according to an embodiment of the present invention;

[0070] Figure 3 This is a flow chart of a PSO-LSTM-Attention model of a PSO-LSTM temperature prediction method that introduces an attention mechanism according to an embodiment of the present invention;

[0071] Figure 4 This is a LSTM structure diagram in a PSO-LSTM temperature prediction method that introduces an attention mechanism according to an embodiment of the present invention;

[0072] Figure 5 This is a comparison diagram of prediction results under different prediction models in a PSO-LSTM temperature prediction method that introduces an attention mechanism according to an embodiment of the present invention;

[0073] Figure 6 This is a comparison chart of prediction results under different prediction models in a PSO-LSTM temperature prediction method that introduces an attention mechanism according to an embodiment of the present invention. DETAILED DESCRIPTION

[0074] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0075] According to an embodiment of the present invention, a PSO-LSTM temperature prediction method introducing an attention mechanism is provided.

[0076] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1-4 As shown, the PSO-LSTM temperature prediction method introducing the attention mechanism according to an embodiment of the present invention includes the following steps:

[0077] S 1. Based on the normalized battery operation data, the battery temperature influencing factors are screened through the coupling method, and an input set for model training is constructed according to the battery temperature influencing factors;

[0078] As a preferred embodiment, the method of screening the battery temperature influencing factors by a coupling method based on the normalized battery operation data and constructing an input set for model training according to the battery temperature influencing factors includes the following steps:

[0079] S 11. Obtaining battery operation data and constructing a data matrix, and performing normalization processing on the battery operation data using a normalization processing calculation formula;

[0080] As a preferred implementation, the normalization calculation formula is:

[0081]

[0082] In the formula, Indicates the normalized battery operation data;

[0083] A i Represents the original data of the i-th column in the data matrix;

[0084] A i,min Represents the minimum value of the original data in the i-th column of the data matrix;

[0085] A i,max Represents the maximum value in the original data of the i-th column in the data matrix.

[0086] S 12. For each data variable in the normalized battery operation data, a correlation coefficient between the data variables is calculated using a mutual information and Pearson correlation coefficient coupling method to obtain a correlation coefficient calculation result;

[0087] As a preferred implementation, the calculation formula for calculating the correlation coefficient between data variables using the mutual information and Pearson correlation coefficient coupling method is:

[0088]

[0089] In the formula, I(X;Y) represents the mutual information correlation coefficient between data variable X and data variable Y;

[0090] p(x, y) represents the joint probability distribution between data variables X and data variables Y;

[0091] p(x) and p(y) represent the marginal probability distributions of data variables X and data variables Y respectively; if X and Y are independent, p(x, y) = p(x)p(y), and the mutual information correlation coefficient I(X; Y) = 0. If X and Y are completely correlated, the mutual information correlation coefficient reaches its maximum value.

[0092] ρ X,Y Represents the Pearson correlation coefficient between data variable X and data variable Y;

[0093] x i represents the value of the x variable of the i-th observation in the data;

[0094] yi represents the value of the y variable of the i-th observation in the data;

[0095] They represent the data variables X i and Y i The average value of

[0096] n represents the sample size;

[0097] i represents an integer from 1 to the number of samples n.

[0098] Among them, the larger the absolute value of the correlation coefficient, the stronger the correlation. The data variable X includes time, current, voltage, capacity, etc., and the data variable Y is temperature. As shown in Table 1, it can be seen that time and voltage are the two factors with large absolute values ​​of correlation coefficients, which are the main factors of temperature;

[0099] Table 1 Analysis of main influencing factors

[0100]

[0101] S13, selecting battery temperature influencing factors that meet the prediction threshold according to the correlation coefficient calculation result;

[0102] S14. Construct an input set for model training based on the screened battery temperature influencing factors.

[0103] S2. Configure the fitness function, and combine the particle swarm algorithm and the input set to optimize the parameters of the LSTM model (long short-term memory network model) fused with the attention mechanism to obtain the battery temperature prediction model;

[0104] As a preferred implementation, the configuration of the fitness function and the LSTM model parameters combining the particle swarm algorithm and the input set optimization fusion attention mechanism to obtain the battery temperature prediction model include the following steps:

[0105] S21. Based on the pre-built LSTM model, by integrating the attention mechanism, an LSTM model with fused attention mechanism is obtained;

[0106] It should be noted that by constructing the attention matrix, the input features are linearly transformed to generate three sets of vectors: Query, Key, and Value, and the attention score is calculated. In the feedforward process of the model, the Attention layer is first introduced to process the input features and generate weighted features. Prepare the training data, transform the input data through the Attention mechanism, and generate weighted features for subsequent model training.

[0107] The Attention mechanism is composed of self and cross attention. Self attention can better understand the information within a single feature factor, and cross attention can fully understand the information between feature factors. By combining these two attention mechanisms, the model can better understand the dependencies between sequences. The model that introduces the Attention mechanism can make predictions more accurately. The Attention mechanism simulates the way the human brain allocates resources. It converges the attention of Query and Key, calculates the correlation between them, and finds the most appropriate Value to achieve the allocation of attention to the target information, reduce the impact of irrelevant information, and highlight important information. The mathematical expression of the attention score is;

[0108]

[0109] In the formula, Q represents Query, K represents Key, and V represents Value. Indicates the key vector dimension, used for scaling.

[0110] Specifically, these scores are normalized by taking as input a vector and converting it into attention weights by performing a softmax operation on it.

[0111] It should be noted that the mathematical expression of softmax is:

[0112]

[0113] In the formula, z i Represents the i-th element of the input vector, u represents the dimension of the vector, and j represents the index variable of the sum operation, which is used to traverse all elements of the input vector z.

[0114] As a preferred implementation, the LSTM model integrated with the attention mechanism based on the pre-built LSTM model includes the following steps:

[0115] S211, constructing a network structure of an LSTM model, wherein the network structure of the LSTM model includes a forget gate, an input gate, and an output gate;

[0116] Specifically, LSTM determines whether to retain or discard information through the forget gate, input gate, and output gate, and can effectively retain key information. The mathematical expression of the LSTM model is:

[0117] f t =σ(W f ·px t ,h t-1 ]+b f );

[0118] d t =σ(W d ·[x t ,h t-1 ]+b d );

[0119] C t =tanh(W c ·[x t ,h t-1 ]+b c );

[0120] C t =C t *i t +C t-1 *f t ;

[0121] o t =σ(W o ·[x t ,h t-1 ]+b o );

[0122] h t =tanh(C t )*o t ;

[0123] In the formula, C t , f t , d t , C t , o t They represent the current state, forget gate, input gate, input node and node output respectively; h t and h t-1 are the output gates at time t and t-1 respectively; W f , W d , W c , W oRespectively represent the weight parameters of the forget gate, input gate, input node and node output; b f , b d , b c , b o is the bias parameter; σ, tanh represent the Sigmoid function and tanh function respectively.

[0124] Among them, Figure 4 As shown, S t C t The state of the cell at time t.

[0125] S212. Construct an attention matrix according to the principle of the attention mechanism, and obtain an attention score by calculating the correlation between the query and the key;

[0126] S213, performing softmax normalization processing on the attention score to obtain the attention weight;

[0127] S214. Use the attention weight as the input of the LSTM model to form a weighted input, and use the weighted input to update the hidden state of the LSTM model to obtain an LSTM model that integrates the attention mechanism.

[0128] As a preferred implementation, the expression of the weighted input is:

[0129]

[0130] In the formula, represents the weighted input of the number of time steps Z;

[0131] Indicates the length of the input sequence;

[0132] α r represents the attention weight;

[0133] G r Represents the feature vector of the input sequence at time r.

[0134] It should be noted that in the feedforward process of the model, the Attention layer is first introduced to process the input features; the training data is prepared, and the input data is transformed through the Attention mechanism for feature transformation for subsequent model training. During the training, the PSO-LSTM and Attention mechanism parameters are optimized, and the weights and biases are effectively adjusted by integrating the model for back propagation, as follows:

[0135] Initialize model parameters, including initializing weights and biases in LSTM and Attention mechanisms;

[0136] The training data is input into the LSTM network, and the LSTM output is obtained through layer-by-layer calculation. The Attention mechanism is applied to the LSTM output to focus on important features and generate weighted output. The loss function is calculated based on the model output and the actual target.

[0137] Among them, the weighted input updates the hidden state of LSTM. The specific mathematical expression is as follows:

[0138]

[0139] In the formula, h t represents the hidden state of LSTM at time step t. LSTM stands for Long Short Term Memory Network. represents the weighted input at time step t, and represents the hidden state of the LSTM at time step t-1.

[0140] S22, initialize the particle swarm algorithm and configure the fitness function, and use the particle swarm algorithm to optimize the parameters of the LSTM model integrated with the attention mechanism to obtain the optimal parameter combination;

[0141] S23. Import the optimal parameter combination into the LSTM model integrated with the attention mechanism, and use the input set for training to obtain a battery temperature prediction model.

[0142] S3. Based on the battery temperature prediction model and according to the battery operation data obtained in real time, the battery temperature is predicted online to obtain a prediction result.

[0143] As a preferred implementation, the initialization of the particle swarm algorithm and the configuration of the fitness function, and the use of the particle swarm algorithm to optimize the parameters of the LSTM model fused with the attention mechanism to obtain the optimal parameter combination include the following steps:

[0144] S221, initializing the model parameters of the LSTM model integrating the attention mechanism, performing preliminary training on the LSTM model integrating the attention mechanism using the input set, and calculating the loss function of the LSTM model integrating the attention mechanism through forward propagation;

[0145] S222, using the loss function of the LSTM model integrating the attention mechanism as the fitness function;

[0146] S223, randomly initialize a particle swarm, and update the speed and position of the particles based on a particle swarm algorithm;

[0147] As a preferred implementation, the randomly initialized particle swarm and updating the speed and position of particles based on the particle swarm algorithm include the following steps:

[0148] S2231, randomly generate particle positions and velocities, each particle represents the parameters of the LSTM model integrated with the attention mechanism, including weights and biases;

[0149] S2232. According to the strategy of linearly decreasing inertia weight, the maximum value and the minimum value of the inertia weight are set; the maximum value and the minimum value of the inertia weight are set to 1.2 and 0.8.

[0150] S2233, bring the parameter group represented by each particle into the LSTM model integrated with the attention mechanism, calculate the output of the model through forward propagation, and compare it with the true value to obtain the loss function value as the fitness value of the particle;

[0151] S2234. According to the current number of iterations, the inertia weight is calculated using the linearly decreasing inertia weight calculation formula, and the speed and position of each particle are calculated and updated according to the inertia weight and the particle group speed update formula.

[0152] As a preferred implementation, the linear decreasing inertia weight calculation formula is:

[0153] ω=ω max -(ω max -ω min )*b / B;

[0154] In the formula, ω represents the inertia weight (the inertia weight corresponds to the inertia factor in the PSO algorithm);

[0155] ω max and ω min Respectively represent the maximum and minimum values ​​of the inertia weight;

[0156] b represents the current iteration number;

[0157] B represents the total number of iterations, which is set to 10.

[0158] It should be noted that the specific calculation process of the PSO algorithm to update the particle speed and position is as follows:

[0159] v ij (b+1)=ω·v ij (b)+c1r1[p ij (b)-m ij (b)]+c2r2[p gi (b)-m ij (b)];

[0160] m ij (b+1)=m ij (b)+v ij (b+1);

[0161] In the formula, v represents speed, m represents position, ω represents inertia factor, c1 and c2 represent individual and group learning factors respectively, and p ij and p gi They represent the optimal positions of the particle and the group respectively, i represents the i-th particle, r1 and r2 represent random numbers in the interval [0, 1], b represents the number of iterations, and j represents the index or number of the particle, which is used to distinguish different particles.

[0162] S224, for each particle's updated position, use it as a new parameter combination of the LSTM model fused with the attention mechanism, and recalculate the fitness function;

[0163] S225. Repeat steps S223-S224 until the preset number of iterations is reached, and select the global optimal position as the optimal parameter combination of the LSTM model with integrated attention mechanism according to the calculation result of the fitness function.

[0164] Specifically, the PSO algorithm optimizes parameters. It brings the parameter group represented by the current particle into the model and calculates the loss function as the fitness of the particle. According to the speed and position update equations in the PSO algorithm, the parameters are optimized; then the loss function is calculated through back propagation, and the weights and biases are updated using the optimized PSO parameters; the above steps are repeated in each iteration to continuously optimize; when the termination condition is reached, the training ends.

[0165] In addition, in order to evaluate the performance of the battery temperature prediction model proposed in the present invention, the present invention will use the common error evaluation indicators, namely the root mean square error (RMSE) and the mean absolute percentage error (MAPE), to analyze the prediction results.

[0166]

[0167] In the formula, y i represents the true value, y i Represents the predicted value, and M represents the number of samples. When the RMSE and MAPE values ​​are smaller, the prediction accuracy is high.

[0168] The present invention studies the established model through the MATLAB software simulation platform. In order to more clearly obtain the accuracy of the proposed method, another prediction model is selected for simulation analysis, namely the PSO-LSTM-Attention model and the PSO-LSTM model. By training and testing different prediction models, the battery temperature prediction results are obtained. Figure 5 This is a comparison chart of prediction results under different prediction models. It can be seen that the prediction results of the PSO-LSTM-Attention model are closer to the actual value.

[0169] In order to visualize the accuracy of the model prediction, the temperature errors predicted by the two models were compared. The results are as follows: Figure 6 As shown in the figure. Except for a few points where the temperature prediction error exceeds 3%, most points are within 2%. At a single point, the PSO-LSTM-Attention algorithm is better than the PSO-LSTM, and the points are basically within 1% of the error. The higher accuracy is due to the input screening and the good regression ability of the PSO-LSTM-Attention algorithm in lithium-ion battery temperature prediction. In addition to the single-point comparison of the prediction, RMSE and MAPE are used to evaluate the accuracy of the prediction curve. As shown in Table 2, it can be seen that the error of the PSO-LSTM-Attention algorithm is within 1%, which is about 0.4% higher than that of the PSO-LSTM algorithm.

[0170] Table 2 Model prediction error statistics

[0171] Model RMSE(%) MAPE(%) PSO-LSTM 0.4358 1.1266 PSO-LSTM-Attention 0.2974 0.7286

[0172] The present invention establishes a PSO-LSTM-Attention model and introduces the Attention mechanism to make the model focus more on important parts, effectively improving the efficiency and accuracy of prediction. Through example verification, the PSO-LSTM-Attention model proposed in the present invention can accurately predict the battery temperature and has good generalization performance, providing a better battery temperature prediction method.

[0173] In summary, with the help of the above technical solution of the present invention, the present invention uses the mutual information and Pearson correlation coefficient coupling method to screen the factors affecting the battery temperature, so as to establish the input feature vector of the prediction model; greatly improve the accuracy of battery temperature prediction, and then propose an LSTM model optimized by introducing an attention mechanism algorithm particle swarm algorithm, and use the particle swarm algorithm to optimize the parameters of the prediction model, effectively reducing unnecessary input information in the model, and improving the accuracy of the LSTM model prediction results. At the same time, the attention mechanism is introduced so that the model can focus more on the important parts, so that the battery temperature prediction model has higher accuracy and stability. The present invention can effectively perform global search using the particle swarm algorithm, which helps to find the optimal parameter configuration in LSTM and can process nonlinear time series data.

[0174] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program code.

[0175] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A PSO-LSTM temperature prediction method that introduces an attention mechanism, characterized in that: The following steps are involved: S1. Based on the normalized battery operation data, the battery temperature influencing factors are screened through the coupling method, and an input set for model training is constructed according to the battery temperature influencing factors; S2. Configure the fitness function, and combine the particle swarm algorithm and input set to optimize the LSTM model parameters of the fusion attention mechanism to obtain the battery temperature prediction model; S3. Based on the battery temperature prediction model and according to the battery operation data obtained in real time, the battery temperature is predicted online to obtain a prediction result.

2. According to claim 1, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The method of screening the battery temperature influencing factors by a coupling method based on the normalized battery operation data and constructing an input set for model training according to the battery temperature influencing factors includes the following steps: S11, obtaining battery operation data and constructing a data matrix, and performing normalization processing on the battery operation data using a normalization processing calculation formula; S12, for each data variable in the normalized battery operation data, a correlation coefficient between the data variables is calculated using a mutual information and Pearson correlation coefficient coupling method to obtain a correlation coefficient calculation result; S13, selecting battery temperature influencing factors that meet the prediction threshold according to the correlation coefficient calculation result; S14. Construct an input set for model training based on the screened battery temperature influencing factors.

3. According to claim 1, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The normalization calculation formula is: In the formula, Indicates the normalized battery operation data; A i Represents the original data of the i-th column in the data matrix; A i,min Represents the minimum value of the original data in the i-th column of the data matrix; A i,max Represents the maximum value in the original data of the i-th column in the data matrix.

4. According to claim 1, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The calculation formula for calculating the correlation coefficient between data variables using the mutual information and Pearson correlation coefficient coupling method is: In the formula, I(X;Y) represents the mutual information correlation coefficient between data variable X and data variable Y; p(x, y) represents the joint probability distribution between data variables X and data variables Y; p(x) and p(y) represent the marginal probability distributions of data variables X and Y respectively; ρ X,Y Represents the Pearson correlation coefficient between data variable X and data variable Y; x i represents the value of the x variable for the i-th observation in the data; y i Represents the y variable value of the i-th observation in the data; They represent the data variables X i and Y i The average value of n represents the sample size; i represents an integer from 1 to the number of samples n.

5. According to claim 1, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The configuration of the fitness function and the LSTM model parameters combining the particle swarm algorithm and the input set optimization fusion attention mechanism to obtain the battery temperature prediction model include the following steps: S21. Based on the pre-built LSTM model, by integrating the attention mechanism, an LSTM model with fused attention mechanism is obtained; S22, initialize the particle swarm algorithm and configure the fitness function, and use the particle swarm algorithm to optimize the parameters of the LSTM model integrated with the attention mechanism to obtain the optimal parameter combination; S23. Import the optimal parameter combination into the LSTM model integrated with the attention mechanism, and use the input set for training to obtain a battery temperature prediction model.

6. According to claim 5, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The method of obtaining an LSTM model integrating an attention mechanism based on a pre-built LSTM model includes the following steps: S211, constructing a network structure of an LSTM model, wherein the network structure of the LSTM model includes a forget gate, an input gate, and an output gate; S212. Construct an attention matrix according to the principle of the attention mechanism, and obtain an attention score by calculating the correlation between the query and the key; S213, performing softmax normalization processing on the attention score to obtain the attention weight; S214. Use the attention weight as the input of the LSTM model to form a weighted input, and use the weighted input to update the hidden state of the LSTM model to obtain an LSTM model that integrates the attention mechanism.

7. According to claim 6, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The expression of the weighted input is: In the formula, represents the weighted input of the number of time steps Z; Indicates the length of the input sequence; α r represents the attention weight; G r Represents the feature vector of the input sequence at time r.

8. According to claim 6, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The initialization of the particle swarm algorithm and the configuration of the fitness function, and the use of the particle swarm algorithm to optimize the parameters of the LSTM model fused with the attention mechanism to obtain the optimal parameter combination include the following steps: S221, initializing the model parameters of the LSTM model integrating the attention mechanism, performing preliminary training on the LSTM model integrating the attention mechanism using the input set, and calculating the loss function of the LSTM model integrating the attention mechanism through forward propagation; S222, using the loss function of the LSTM model integrating the attention mechanism as the fitness function; S223, randomly initialize a particle swarm, and update the speed and position of the particles based on a particle swarm algorithm; S224, for each particle's updated position, use it as a new parameter combination of the LSTM model fused with the attention mechanism, and recalculate the fitness function; S225. Repeat steps S223-S224 until the preset number of iterations is reached, and select the global optimal position as the optimal parameter combination of the LSTM model with integrated attention mechanism according to the calculation result of the fitness function.

9. According to claim 8, a PSO-LSTM temperature prediction method introducing an attention mechanism is characterized in that: The randomly initialized particle swarm and updating the speed and position of particles based on the particle swarm algorithm include the following steps: S2231, randomly generate particle positions and velocities, each particle represents the parameters of the LSTM model integrated with the attention mechanism, including weights and biases; S2232, according to the strategy of linearly decreasing inertia weight, setting the maximum value and the minimum value of inertia weight; S2233, bring the parameter group represented by each particle into the LSTM model integrated with the attention mechanism, calculate the output of the model through forward propagation, and compare it with the true value to obtain the loss function value as the fitness value of the particle; S2234. According to the current number of iterations, the inertia weight is calculated using the linearly decreasing inertia weight calculation formula, and the speed and position of each particle are calculated and updated according to the inertia weight and the particle group speed update formula.

10. A PSO-LSTM temperature prediction method introducing an attention mechanism according to claim 9, characterized in that: The linear decreasing inertia weight calculation formula is: oh = oh max -(oh max -oh min )*b / B; Where ω represents the inertia weight; ω max and ω min Respectively represent the maximum and minimum values ​​of the inertia weight; b represents the current iteration number; B represents the total number of iterations.

Citation Information

Patent Citations

  • Mobile cloud load prediction method and system of LSTM network combined with attention mechanism

    CN113051130A

  • Space-time combination prediction method based on CNN-LSTM and deep learning

    CN113673775A

  • LSTM energy consumption prediction method based on dual feature selection and particle swarm optimization

    CN113962454A

  • Prediction method based on periodic feature extraction and time sequence attention

    CN116341712A

  • Traffic flow prediction method based on PSO-Attention-LSTM model

    CN116756632A