Safety early warning method for parallel battery packs based on neural network
By using the encoder and decoder of the sparse probabilistic multi-head self-attention layer in the parallel battery pack safety warning, the problems of low training efficiency and poor accuracy of the prediction model in the existing technology are solved, and more efficient current prediction and safety risk are achieved. judge.
Patent Information
- Application Number
- CN202210556458.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-05-20
AI Technical Summary
When training neural network models with existing technologies, the training efficiency of the prediction model is low and the prediction accuracy is difficult to guarantee when faced with a large amount of data. Especially in the safety warning of parallel battery packs, it is difficult to effectively improve the training efficiency and accuracy of the prediction model. .
A parallel battery pack safety warning method based on neural networks is adopted, using the encoder and decoder of the sparse probabilistic multi-head self-attention layer, and through the self-attention distillation mechanism of the sparse probabilistic multi-head self-attention layer to reduce the length of the feature sequence and combine the encoding input sequence and decode the structure of the input sequence to improve the training efficiency and accuracy of the prediction model.
When faced with a large amount of training data, the training efficiency and prediction accuracy of the prediction model are improved, memory space and calculation time are saved, and the effect of safety warning for parallel battery packs is significantly improved.
Smart Images

Figure CN114924192B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power battery safety of new energy vehicles, and specifically to a safety early warning method for parallel battery packs based on a neural network. Background Art
[0002] In electric vehicles, power batteries are the main energy storage and power supply equipment. For automotive power batteries with high energy and power requirements, they are generally made up of multiple batteries connected in a mixed manner. Previous studies have shown that the connection method of first connecting in parallel and then in series is more advantageous than the connection method of first connecting in series and then in parallel in terms of reliability, balanced efficiency, economy, group capacity, etc. In actual electric vehicles, two or more batteries are often connected in parallel to form a battery pack, and then connected in series with other battery packs.
[0003] Due to the different manufacturing processes and environments of batteries, their characteristic parameters such as impedance, capacity, and state of charge (SOC) are inconsistent in dynamic working environments, resulting in uneven current distribution in each branch of the parallel battery pack, which will affect the life and safety of the battery pack in the long run. Considering that the current sensor will not be installed on each battery in actual situations, and the battery management system (BMS) needs to monitor the safety status of the battery in real time. Therefore, accurately estimating the current distribution in the parallel configuration is of great significance for the economy of electric vehicles, diagnosis of inconsistent faults, and thermal runaway warning. In addition, after the determined branch current is obtained, it is helpful to study the influence of various characteristic parameters on battery inconsistency such as current distribution.
[0004] Among them, the Chinese patent with publication number CN112083346B discloses the "LSTM-based method and system for estimating the internal current distribution of parallel battery packs", which includes obtaining the terminal voltage, terminal current, SOC and DC internal resistance parameters of the parallel battery pack during the charging and discharging process and using them as training input data groups for normalized packaging and slicing processing; the processed data group is passed through an LSTM network running at fixed time intervals to estimate the internal current distribution of the battery pack. This existing solution uses parallel battery pack information such as terminal voltage, total current, battery capacity (SOC), battery internal resistance, etc. to estimate its internal current distribution to obtain the current of each battery, and then effectively manage each single battery and timely predict various faults in the group.
[0005] The applicant discovered that when training a neural network model, the training data needs to be converted into a training sequence and input into the model, and the corresponding prediction sequence is output through the model. However, the neural network model needs to be trained with a large amount of training data to ensure the prediction accuracy, that is, the prediction sequence during the prediction model training will be very long, which results in a long training time and low training efficiency for the prediction model. At the same time, the LSTM (Long Short Term Memory) and other related prediction models in the above-mentioned existing solutions show weaker performance effects when faced with longer prediction sequences, that is, the prediction accuracy of the prediction model is difficult to guarantee. Therefore, how to design a method that can improve the training efficiency and prediction accuracy of the prediction model when faced with a large amount of training data is a technical problem that needs to be solved urgently. Summary of the invention
[0006] In view of the above-mentioned deficiencies in the prior art, the technical problem to be solved by the present invention is: how to provide a parallel battery pack safety warning method based on a neural network, so as to improve the training efficiency and prediction accuracy of the prediction model when faced with a large amount of training data, thereby improving the effect of the parallel battery pack safety warning.
[0007] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0008] A safety early warning method for parallel battery packs based on a neural network comprises the following steps:
[0009] S1: Construct the corresponding branch current prediction model based on neural network;
[0010] The branch current prediction model includes an encoder and a decoder with a sparse probabilistic multi-head self-attention layer; the sparse probabilistic multi-head self-attention layer has a self-attention distillation mechanism; the inputs of the encoder and the decoder are independent of each other, and the output of the encoder is connected to the decoder;
[0011] S2: Collect measured data of parallel battery packs and construct a training data set for the branch current prediction model;
[0012] The training data set includes several groups of training data using battery pack characteristic data of parallel battery packs as training input data and currents of two branches as real comparison data;
[0013] S3: training the branch current prediction model using the training data set;
[0014] S4: Inputting the battery pack characteristic data of the parallel battery pack to be tested into the trained branch current prediction model, outputting the predicted currents of the two branches, and then judging whether there is a safety risk in the parallel battery pack based on the predicted currents of the two branches.
[0015] Preferably, in step S1, the encoder has two layers of sparse probabilistic multi-head self-attention layers connected in series; the decoder has a sparse probabilistic multi-head self-attention layer and a multi-head attention layer connected in series, and the output of the encoder is connected to the multi-head attention layer; the output of the decoder is connected to a set fully connected layer, and the current prediction sequence, i.e., the predicted current of the two branches, is output through the fully connected layer.
[0016] Preferably, the calculation formula of the attention mechanism in the sparse probabilistic multi-head self-attention layer is as follows:
[0017]
[0018] Where: Q is the word vector Query; K is the key vector Key; V is the value vector Value; K T represents the transpose of the key vector K, d k is the number of columns of the Q and K matrices, that is, the vector dimension; Softmax represents the normalization function.
[0019] Preferably, the sparsity of the word vector Query is measured by the sparsity evaluation value:
[0020]
[0021] Where: M(q i ,k j ) represents the sparsity evaluation value; L represents the number of rows of the key vector matrix; q i , k j They represent the i-th and j-th rows of the word vector and key vector matrices respectively; d represents the dimension of the word vector and key vector matrices, that is, the number of columns; the superscript T represents transposition.
[0022] Preferably, in step S2, firstly, the main circuit current I of the parallel battery group at time n is collected. n , the voltage of the two branches and And the currents of the two branches Then based on the main circuit current I n Calculate the corresponding accumulated power ACC n ;Finally, construct the corresponding training input data Compared with the real data as a set of training data.
[0023] Preferably, in step S2, before training the branch current prediction model, the training input data is first normalized and the timestamp position is embedded to obtain a corresponding training input vector; then the training input vector is split into an encoding input sequence and a decoding input sequence; finally, the prediction sequence is concatenated on the decoding input sequence;
[0024] Among them, the encoding input sequence, the decoding input sequence and the sequence to be predicted constitute a set of training input sequences.
[0025] Preferably, the encoding input sequence
[0026] Decoding the input sequence
[0027] Where: represents the coded input sequence at time t; L sequence The length of the training input vector; d model is the dimension of the model; Represents the concatenated sequence of the decoded input sequence and the sequence to be predicted at time t, i.e., the input of the decoder; is the decoding input sequence at time t; Represents the sequence to be predicted at time t; Concat represents and Sequence splicing; L token The length of the training input vector; L y represents the length of the current prediction sequence; d model is the dimension of the model.
[0028] Preferably, the training input data is normalized by Z-score standard normalization;
[0029] The calculation formula for Z-score standard normalization is as follows:
[0030]
[0031] Where: X mean represents the mean of each feature of the total input length; σ represents the variance of the feature;
[0032] The formula for timestamp position embedding is as follows:
[0033] PE (pos,2i) =sin(pos / 10000 2i / d );
[0034] PE (pos,2i+1) =cos(pos / 10000 2i / d );
[0035] Where: PE is Position Embedding; pos represents the position of a state in all inputs; 2i represents the even position in the dimension; 2i+1 represents the odd position in the dimension; d represents the dimension of the feature matrix.
[0036] Preferably, in step S3, the branch current prediction model is trained by the following steps:
[0037] S301: inputting the training input sequence corresponding to each group of training data into the branch current prediction model;
[0038] S302: Input the encoded input sequence into the encoder, and after passing through its two layers of sparse probabilistic multi-head self-attention layers in sequence, use the output tensor as the output of the encoder;
[0039] S303: Input the decoded input sequence into the decoder, and after passing through its sparse probabilistic multi-head self-attention layer, input the output tensor into the multi-head attention layer, and input the output of the encoder into the multi-head attention layer at the same time, and use the output of the multi-head attention layer as the output of the decoder;
[0040] S304: Input the output of the decoder into the fully connected layer, and output the corresponding current prediction sequence;
[0041] S305: Execute steps S301 to S304 for each set of training input sequences until a complete current prediction sequence is output; then calculate the mean square error function error through the complete current prediction sequence combined with the corresponding real comparison data; finally, backpropagate the mean square error function error to the entire branch current prediction model to complete the training.
[0042] Preferably, in step S4, whether the parallel battery pack has a safety risk is determined by the following method:
[0043] 1) In the non-polarization stage, the absolute value of the current difference between the two branches is compared. If the absolute value of the current difference is greater than the set safety threshold, it is determined that there is a safety risk in the parallel battery pack to be tested;
[0044] 2) Based on the predicted current of the two branches, the charge states of the two branches are calculated respectively, and by comparing the consistency of the charge states of the two branches, it is determined whether there is a safety risk in the parallel battery pack to be tested.
[0045] The parallel battery pack safety early warning method based on neural network in the present invention has the following beneficial effects:
[0046] The present invention uses a sparse probabilistic multi-head self-attention layer in the encoder and decoder of the branch current prediction model, and can assign higher weights to advantageous features with main features through the self-attention distillation mechanism of the sparse probabilistic multi-head self-attention layer, so that the length of the feature sequence can be reduced while retaining the advantageous features, thereby saving memory space and computing time during the training process and ensuring the training effect of the prediction model, that is, it can improve the training efficiency and prediction accuracy of the prediction model when faced with a large amount of training data, thereby improving the effect of the safety warning of the parallel battery pack.
[0047] The present invention splits the training input vector into an encoding input sequence and a decoding input sequence, and splices the prediction sequence onto the decoding input sequence to form a training input sequence. The structure of the training input sequence enables the decoder of the branch current prediction model to obtain a complete current prediction sequence at one time, that is, it can realize one-time decoding of the branch current prediction model. Compared with the step-by-step prediction method of the existing timing prediction, the time efficiency of the prediction model prediction decoding can be greatly improved, thereby further improving the training efficiency and prediction efficiency of the prediction model. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:
[0049] Figure 1 The logical block diagram of the safety early warning method of parallel battery pack based on neural network;
[0050] Figure 2 This is a diagram showing the operation principle of the sparse probabilistic multi-head self-attention layer;
[0051] Figure 3 The model architecture and operation principle diagram of the branch current prediction model;
[0052] Figure 4 The estimated result of battery G13 and its partial enlarged picture;
[0053] Figure 5 The estimated result of battery G32 and its partial enlarged picture;
[0054] Figure 6 Parallel calculation results for the complete current prediction sequence. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.
[0056] It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. In the description of the present invention, it should be noted that the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, or the orientation or position relationship in which the invention product is usually placed when used, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance. In addition, the terms "horizontal", "vertical", etc. do not mean that the components are absolutely horizontal or suspended, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted. In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0057] The following is a further detailed description through specific implementation methods:
[0058] Example:
[0059] This embodiment discloses a safety early warning method for parallel battery packs based on a neural network.
[0060] like Figure 1 As shown, the safety early warning method of parallel battery pack based on neural network includes the following steps:
[0061] S1: Construct the corresponding branch current prediction model (i.e., Informer model) based on the Informer neural network;
[0062] The branch current prediction model includes an encoder and a decoder with a sparse probabilistic multi-head self-attention layer; the sparse probabilistic multi-head self-attention layer has a self-attention distillation mechanism; the inputs of the encoder and the decoder are independent of each other, and the output of the encoder is connected to the decoder;
[0063] S2: Collect measured data of parallel battery packs and construct a training data set for the branch current prediction model;
[0064] The training data set includes several groups of training data using battery pack characteristic data of parallel battery packs as training input data and currents of two branches as real comparison data;
[0065] S3: training the branch current prediction model using the training data set;
[0066] S4: Inputting the battery pack characteristic data of the parallel battery pack to be tested into the trained branch current prediction model, outputting the predicted currents of the two branches, and then judging whether there is a safety risk in the parallel battery pack based on the predicted currents of the two branches.
[0067] In this embodiment, the structure of the sparse probabilistic multi-head self-attention layer is as follows: Figure 2 As shown, it includes an attention layer part (Attention Block) and a convolution layer part (ConvLayer).
[0068] The attention layer calculates the attention value of the input feature tensor (encoded input sequence) in sequence (extracts the key feature information of the input feature tensor), extracts high-dimensional features through (one-dimensional) convolution, performs nonlinear processing (two-layer neuron) on the high-dimensional features through activation functions, extracts high-dimensional features through convolution, and performs batch normalization on the high-dimensional features; finally, the output feature sequence is input to the convolution layer; the convolution layer extracts features from the input feature sequence in sequence through the convolution layer, linearizes the features through activation functions (ELU, exponential linear function), and pools the features through the pooling layer, and finally outputs the corresponding tensor.
[0069] The sparse probabilistic multi-head self-attention layer has a self-attention distillation mechanism. The self-attention distillation mechanism refers to giving higher weights to the dominant features with main features to achieve the extraction of key features, thereby reducing the number of features.
[0070] In other preferred embodiments, other existing self-attention layers with self-attention distillation mechanisms can also be selected as sparse probabilistic multi-head self-attention layers.
[0071] The present invention uses a sparse probabilistic multi-head self-attention layer in the encoder and decoder of the branch current prediction model, and can assign higher weights to advantageous features with main features through the self-attention distillation mechanism of the sparse probabilistic multi-head self-attention layer, so that the length of the feature sequence can be reduced while retaining the advantageous features, thereby saving memory space and computing time during the training process and ensuring the training effect of the prediction model, that is, it can improve the training efficiency and prediction accuracy of the prediction model when faced with a large amount of training data, thereby improving the effect of the safety warning of the parallel battery pack.
[0072] like Figure 3 As shown, the encoder has two layers of sparse probabilistic multi-head self-attention layers connected in series; the decoder has a sparse probabilistic multi-head self-attention layer and a multi-head attention layer connected in series, and the output of the encoder is connected to the multi-head attention layer; the output of the decoder is connected to the set fully connected layer, and the current prediction sequence, i.e., the predicted current of the two branches, is output through the fully connected layer.
[0073] The calculation formula of the attention mechanism in the sparse probabilistic multi-head self-attention layer is as follows:
[0074]
[0075] Where: Q is the word vector Query; K is the key vector Key; V is the value vector Value; K T represents the transpose of the key vector K, d k is the number of columns of the Q and K matrices, that is, the vector dimension; Softmax represents the normalization function.
[0076] To prevent Q and K T The inner product is too large, so divide by d k The square root of .
[0077]
[0078] The sparsity of the word vector query is measured by the sparsity evaluation value:
[0079]
[0080] Where: M(q i ,k j ) represents the sparsity evaluation value; L represents the number of rows of the key vector matrix; q i , k j They represent the i-th and j-th rows of the word vector and key vector matrices respectively; d represents the dimension of the word vector and key vector matrices, that is, the number of columns; the superscript T represents transposition.
[0081] The present invention can reduce the output sequence length of the encoder to one quarter of the original sequence through the sparse probabilistic multi-head self-attention layer connected in series in the encoder, and can also fuse the retained important features to ensure the training effect of the prediction model through the sparse probabilistic multi-head self-attention layer and the multi-head attention layer connected in series in the decoder, thereby further improving the training efficiency and prediction accuracy of the prediction model when faced with a large amount of training data.
[0082] In the specific implementation process, first collect the main circuit current I of the parallel battery group at time n n , the voltage of the two branches and And the currents of the two branches Then based on the main circuit current I n Calculate the corresponding accumulated power ACC n ;Finally, construct the corresponding training input data Compared with the real data as a set of training data.
[0083] In this embodiment, two battery cells, G13 and G32, are connected in parallel to form a parallel battery pack.
[0084] Based on the laboratory simulation of the actual vehicle test, the capacity experiment was first carried out to measure the capacity of G13 to be 31.7269Ah, and the capacity of G32 battery to be 29.2616Ah. Four operating condition tests were carried out, including DST (Dynamic Stress Test), UDDS (Urban Dynamometer Driving Schedule), HPPC (The Hybrid Pulse Power Characterization), and FUDS (The Federal Urban Driving Schedule), and historical offline data (i.e., measured data) were collected with a sampling frequency of 20HZ.
[0085] The data of FUDS, HPPC and UDDS working conditions are used as training data sets, which are spliced according to the time series and have a length of 65000. The data of DST working condition are used as test data sets, which have a length of 16000. The data used in the four dynamic working conditions are all the discharge process.
[0086] The collected data include main circuit current I n , the voltage of the two branches and And the currents of the two branches The collected data is preprocessed, including outlier removal and missing value filling. The collected mat file data is checked. After outliers are removed and missing values are filled, in order to reduce the amount of calculation and training time, the sampling data is taken every 20 frames, that is, the sampling frequency is 1HZ. The real vehicle data collected on the actual big data platform is mostly 0.1HZ, so the accuracy of 1HZ meets the requirements.
[0087] In the specific implementation process, before training the branch current prediction model, the training input data is first normalized and the timestamp position is embedded to obtain the corresponding training input vector; then the training input vector is split into an encoding input sequence and a decoding input sequence; finally, the prediction sequence is concatenated on the decoding input sequence;
[0088] Among them, the encoding input sequence, the decoding input sequence and the sequence to be predicted constitute a set of training input sequences.
[0089] Encode the input sequence
[0090] Decoding the input sequence
[0091] Where: represents the coded input sequence at time t; L sequence The length of the training input vector; d model is the dimension of the model; Represents the concatenated sequence of the decoded input sequence and the sequence to be predicted at time t, i.e., the input of the decoder; is the decoding input sequence at time t; Represents the sequence to be predicted at time t; Concat represents and Sequence splicing; L token The length of the training input vector; L y represents the length of the current prediction sequence; d model is the dimension of the model.
[0092] Normalize the training input data using Z-score standard normalization;
[0093] The calculation formula for Z-score standard normalization is as follows:
[0094]
[0095] Where: X mean represents the mean of each feature of the total input length; σ represents the variance of the feature;
[0096] The formula for timestamp position embedding is as follows:
[0097] PE (pos,2i) =sin(pos / 10000 2i / d );
[0098] PE (pos,2i+1) =cos(pos / 10000 2i / d );
[0099] Where: PE is Position Embedding; pos represents the position of a state in all inputs; 2i represents the even position in the dimension; 2i+1 represents the odd position in the dimension; d represents the dimension of the feature matrix.
[0100] In the specific implementation process, the branch current prediction model is trained through the following steps:
[0101] S301: inputting the training input sequence corresponding to each group of training data into the branch current prediction model;
[0102] S302: Input the encoded input sequence into the encoder, and after passing through its two layers of sparse probabilistic multi-head self-attention layers in sequence, use the output tensor as the output of the encoder;
[0103] S303: Input the decoded input sequence into the decoder, and after passing through its sparse probabilistic multi-head self-attention layer, input the output tensor into the multi-head attention layer, and input the output of the encoder into the multi-head attention layer at the same time, and use the output of the multi-head attention layer as the output of the decoder;
[0104] S304: Input the output of the decoder into the fully connected layer, and output the corresponding current prediction sequence;
[0105] S305: Execute steps S301 to S304 for each set of training input sequences until a complete current prediction sequence is output; then calculate the mean square error function error through the complete current prediction sequence combined with the corresponding real comparison data; finally, backpropagate the mean square error function error to the entire branch current prediction model to complete the training.
[0106] In this embodiment, the length of the encoding input sequence is set to 96, the length of the decoding input sequence is set to 48, the length of the sequence to be predicted is set to 24, the number of attentions of the multi-head self-attention layer is set to 8, and the time consumed by the branch current prediction model training and prediction is recorded as 768.9s, while the time consumed by the existing LSTM training is 1038.4s. The predicted currents of the two branches are respectively as follows Figure 4 and Figure 5 shown.
[0107] The present invention splits the training input vector into an encoding input sequence and a decoding input sequence, and splices the prediction sequence on the decoding input sequence to form a training input sequence. The structure of the training input sequence enables the decoder of the branch current prediction model to obtain a complete current prediction sequence (such as Figure 6 As shown, each row represents a dimension of the output, that is, a set of training input sequences. The total output dimension is the total length of the current prediction sequence minus the length of a single current prediction sequence. In this way, the prediction value of the first dimension and the last prediction value of each subsequent dimension are concatenated to represent the total length of the prediction), that is, the one-time decoding of the branch current prediction model can be achieved. Compared with the step-by-step prediction method of the existing timing prediction, the time efficiency of the prediction model prediction decoding can be greatly improved, thereby further improving the training efficiency and prediction efficiency of the prediction model.
[0108] During the specific implementation process, the following methods are used to determine whether there is a safety risk in the parallel battery pack:
[0109] 1) In the non-polarization stage, the absolute value of the current difference between the two branches is compared. If the absolute value of the current difference is greater than the set safety threshold, it is determined that there is a safety risk in the parallel battery pack to be tested;
[0110] 2) Based on the predicted current of the two branches, the charge states of the two branches are calculated respectively, and by comparing the consistency of the charge states of the two branches, it is determined whether there is a safety risk in the parallel battery pack to be tested.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.
Claims
1. A safety early warning method for parallel battery packs based on neural networks, characterized in that: The following steps are involved: S1: Construct the corresponding branch current prediction model based on neural network; The branch current prediction model includes an encoder and a decoder with a sparse probabilistic multi-head self-attention layer; The sparse probabilistic multi-head self-attention layer has a self-attention distillation mechanism; the inputs of the encoder and decoder are independent of each other, and the output of the encoder is connected to the decoder; The encoder has two layers of sparse probabilistic multi-head self-attention layers connected in series; the decoder has a sparse probabilistic multi-head self-attention layer and a multi-head attention layer connected in series, and the output of the encoder is connected to the multi-head attention layer; the output of the decoder is connected to a set fully connected layer, and the current prediction sequence, i.e., the predicted current of the two branches, is output through the fully connected layer; The calculation formula of the attention mechanism in the sparse probabilistic multi-head self-attention layer is as follows: Where: Q is the word vector Query; K is the key vector Key; V is the value vector Value; K T represents the transpose of the key vector K, d k is the number of columns of the Q and K matrices, i.e., the vector dimension; Softmax represents the normalization function; The sparsity of the word vector query is measured by the sparsity evaluation value: Where: M(q i ,k j ) represents the sparsity evaluation value; L represents the number of rows of the key vector matrix; q i , k j denotes the i-th and j-th rows of the word vector and key vector matrices, respectively; d denotes the dimension of the word vector and key vector matrices, i.e., the number of columns; the superscript T denotes transposition; S2: Collect measured data of parallel battery packs and construct a training data set for the branch current prediction model; The training data set includes several groups of training data using battery pack characteristic data of parallel battery packs as training input data and currents of two branches as real comparison data; First, collect the main circuit current I of the parallel battery group at time n n , the voltage of the two branches and And the currents of the two branches Then based on the main circuit current I n Calculate the corresponding accumulated power ACC n ;Finally, construct the corresponding training input data Compared with the real data As a set of training data; Before training the branch current prediction model, the training input data is normalized and the timestamp position is embedded to obtain the corresponding training input vector; then the training input vector is split into an encoding input sequence and a decoding input sequence; finally, the prediction sequence is concatenated on the decoding input sequence; Among them, the encoding input sequence, the decoding input sequence and the sequence to be predicted constitute a set of training input sequences; S3: training the branch current prediction model using the training data set; S4: Inputting the battery pack characteristic data of the parallel battery pack to be tested into the trained branch current prediction model, outputting the predicted currents of the two branches, and then judging whether there is a safety risk in the parallel battery pack based on the predicted currents of the two branches.
2. The neural network-based parallel battery pack safety early warning method according to claim 1, characterized in that: Encode the input sequence Decoding the input sequence Where: represents the coded input sequence at time t; L sequence The length of the training input vector; d model is the dimension of the model; Represents the concatenated sequence of the decoded input sequence and the sequence to be predicted at time t, i.e., the input of the decoder; is the decoding input sequence at time t; Represents the sequence to be predicted at time t; Concat represents and Sequence splicing; L token The length of the training input vector; L y represents the length of the current prediction sequence; d model is the dimension of the model.
3. The neural network-based parallel battery pack safety early warning method according to claim 1, characterized in that: Normalize the training input data using Z-score standard normalization; The calculation formula for Z-score standard normalization is as follows: Where: X mean represents the mean of each feature of the total input length; σ represents the variance of the feature; The formula for timestamp position embedding is as follows: ON (pos,2i) =sin(pos / 10000 2i / d ); ON (pos,2i+1) =cos(pos / 10000 2i / d ); Where: PE is Position Embedding; pos represents the position of a state in all inputs; 2i represents the even position in the dimension; 2i+1 represents the odd position in the dimension; d represents the dimension of the feature matrix.
4. The neural network-based parallel battery pack safety early warning method according to claim 1, characterized in that: In step S3, the branch current prediction model is trained through the following steps: S301: inputting the training input sequence corresponding to each group of training data into the branch current prediction model; S302: Input the encoded input sequence into the encoder, and after passing through its two layers of sparse probabilistic multi-head self-attention layers in sequence, use the output tensor as the output of the encoder; S303: Input the decoded input sequence into the decoder, and after passing through its sparse probabilistic multi-head self-attention layer, input the output tensor into the multi-head attention layer, and input the output of the encoder into the multi-head attention layer at the same time, and use the output of the multi-head attention layer as the output of the decoder; S304: Input the output of the decoder into the fully connected layer, and output the corresponding current prediction sequence; S305: Execute steps S301 to S304 for each set of training input sequences until a complete current prediction sequence is output; then calculate the mean square error function error through the complete current prediction sequence combined with the corresponding real comparison data; finally, backpropagate the mean square error function error to the entire branch current prediction model to complete the training.
5. The neural network-based parallel battery pack safety early warning method according to claim 3, characterized in that: In step S4, whether there is a safety risk in the parallel battery pack is determined by the following method: 1) In the non-polarization stage, the absolute value of the current difference between the two branches is compared. If the absolute value of the current difference is greater than the set safety threshold, it is determined that there is a safety risk in the parallel battery pack to be tested; 2) Based on the predicted current of the two branches, the charge states of the two branches are calculated respectively, and by comparing the consistency of the charge states of the two branches, it is determined whether there is a safety risk in the parallel battery pack to be tested.
