Background
As an important rechargeable battery, a lithium ion battery has been widely used in the fields of electric automobiles, mobile devices, energy storage and the like, and the performance of the lithium ion battery is often related to factors such as the number of charge and discharge cycles, the charge and discharge multiplying power and the like. Therefore, the method accurately predicts the capacity curve of the battery and has important significance for performance evaluation, equipment design and control of the battery.
In recent years, a data-driven method has achieved great achievement in battery capacity degradation track prediction, and deep learning technology stands out by virtue of accurate, stable and efficient prediction analysis and other characteristics. However, deep learning correlation algorithms typically require a large number of data sets for model training, and the data sets involved in the network model training need to have a certain diversity, thereby improving the accuracy and generalization of model predictive analysis. However, in practical application, the conventional data acquisition method needs to consume a lot of time and cost, and the acquisition of the battery degradation data is affected by various factors such as the battery working environment, load, acquisition method and the like, and the battery degradation data is not as many as thousands as financial and image data sets, so that the available data sets in the research are extremely precious. In order to acquire more and richer battery degradation data sets, research results and application scenes are further expanded, and the existing battery degradation data sets are expanded through a data generation technology, so that the number of samples and diversity of the data sets are improved, the accuracy and robustness of prediction analysis of a deep learning network model are improved, and research and development of battery capacity degradation track prediction are promoted.
At present, in the generation of battery capacity data, a mainstream method is a data generation method based on a traditional model, wherein the method is generally used for exploring the rule of battery capacity degradation through the establishment of a mathematical or physical model so as to simulate the generation of data, the method is higher in the quantity and quality of the generated data, but the generated data is single and poor in generalization capability, and based on a statistical method, the method is mainly used for analyzing and extracting the rule of battery capacity change along with time by adopting the statistical method and generating the data according to the extracted rule, and the method can accurately simulate the change of the battery capacity, but needs a large amount of experimental data to support and has the same disadvantages as the generation of the traditional model data. Therefore, it is urgent to find a data enhancement method that can generate a large number of data, has a high diversity, and generates data with high fidelity. Deep learning has emerged from birth to date as a vast array of superior models for generating countermeasure networks (GAN), recurrent Neural Networks (RNN), variational self-encoders (VAE), and the like. These models have also achieved very good results in the field of data enhancement.
The present study uses a condition generation countermeasure network (CGAN) in the GAN family to enhance the battery capacity degradation dataset. CGAN is a more suitable option in the present invention than RNN, VAE or other models. Firstly, the RNN can only generate a sequence similar to the historical data, but when generating a battery capacity fading curve, the condition information must be considered, and the RNN cannot effectively use the condition information to generate a capacity fading curve which meets the condition, and secondly, the VAE can generate data similar to the training data, but cannot control the characteristics of the generated data, and in the task of generating the battery capacity fading curve, we need to generate a capacity fading curve with specific requirements according to different condition information, and the VAE cannot effectively realize the problem. In contrast CGAN is a model dedicated to generating conditional constraints, so it is suitable for generating battery capacity decay curves. In addition, CGAN has the greatest advantage over the standard GAN in that the battery capacity fading curve can be generated in a multi-dimensional space by inputting noise and condition information due to the introduction of the condition vector, so that the generated curve has more diversity.
Disclosure of Invention
In view of the above, in order to solve the above problems of the prior art, an object of the present invention is to provide a battery capacity fading curve generation method based on a condition generation countermeasure network to solve the cost and time limitation faced by the conventional data acquisition method for lithium battery capacity data, so that a large amount of data can be effectively generated for later study in battery capacity curve prediction, battery performance evaluation, and the like.
The invention adopts the technical scheme that the battery capacity attenuation curve generating method based on the condition generating countermeasure network comprises the following steps:
s1, acquiring a real capacity attenuation curve of a lithium battery;
S2, carrying out normalization processing on a real capacity attenuation curve of the lithium battery, and dividing a processed data set into a training data set and a test data set;
s3, constructing CGAN a network model, wherein the CGAN network model comprises a generator and a discriminator;
s4, inputting the training data set into a CGAN network model for training to obtain an optimal generator;
s5, generating predicted capacity attenuation curves of the lithium batteries in batches through an optimal generator, and selecting the most representative predicted capacity attenuation curves by using a maximum diversity generation curve selection method;
And S6, calculating a similarity score between the test data set and the most representative predicted capacity fading curve so as to evaluate the performance of the generator, obtaining a group of good CGAN network models if the performance of the generator is good, and returning to S4 to continue training if the performance of the generator is not good.
Further, in S1, the method for obtaining the real capacity fading curve data of the lithium battery is as follows:
s101, dividing a lithium battery into three types according to the service life, namely short service life, medium service life and long service life, wherein the short service life is less than 700 cycles, the medium service life is 700-1500 cycles, and the long service life is more than 1500 cycles;
And S102, clustering by adopting a k-means clustering algorithm to obtain a clustering center curve corresponding to the real capacity attenuation curve of each type of lithium battery.
Further, in the S2, it includes:
S201, defining one-hot codes of various real capacity attenuation curves as 000,010,100 respectively;
S202, reading clustering center curve data of various real capacity attenuation curves, adding artificial control noise n1 to the x axis and adding artificial control noise n2 to the y axis;
s203, storing each cluster center curve and each corresponding one-hot code expansion m times into a set object;
s204, carrying out normalization processing on the acquired collection objects;
s205, packaging the normalized aggregate object into a data loader serving as a training data set.
Further, after removing the cluster center curve from each type of real capacity fade curve, the bar data is randomly chosen as the test dataset.
Further, in S3, the built CGAN network model includes a generator and a arbiter;
the generator comprises BatchNorm linear layers and comprises a BatchNorm d function layer, wherein the input of the generator is random noise and one-hot coding of each type of real capacity attenuation curve, and the output is a predicted capacity attenuation curve generated after five-layer linear layer processing;
The input of the discriminator comprises 4 linear layers, the input of the discriminator is a real capacity fading curve, one-hot codes of each type of real capacity fading curve and the output of the generator, and the output is a predicted capacity fading curve with higher reality and the probability of judging the type of the current predicted capacity fading curve to be true.
Further, in S4, the optimal generator is obtained by the following method:
S401, after a training data set is obtained, randomly generating a batch of random noise which accords with 0-1 positive-fit distribution and has the same size, and inputting the random noise and one-hot codes of various real capacity attenuation curves in the current training data set into a generator together for forward propagation;
S402, inputting the output of the generator, the category to which the current real capacity attenuation curve belongs and the real capacity attenuation curve into a discriminator;
S403, calculating a loss value through the output of the discriminator and the real capacity attenuation curve, carrying out back propagation and feeding back to the generator, and obtaining the optimal generator by the mutual countermeasure between the generator and the discriminator.
Further, in S5, the method of choosing the most representative predicted capacity fade curve is as follows:
s501, generating predicted capacity fading curves in batches by using the trained optimal generator and defining the curves as a set C;
S502, defining an empty set C *, and randomly selecting a curve C r in the generated set C;
S503, finding a curve C with the largest distance curve C r from the set C, then putting the curve C into the set C *, and removing the curve C from the set C;
And repeating S501-S503 until the number of curves in the set C * is equal to the input selection number n, and terminating the cycle to obtain the most representative n curves in the set C.
Further, in S6, the performance of the evaluation generator adopts the following method:
S601, calculating the DTW distance from a curve in the test data set to each predicted capacity attenuation curve in the set C in sequence;
S602, acquiring a predicted capacity fading curve C1 with the smallest distance in a set C, wherein the predicted capacity fading curve has data with the largest similarity;
s603, outputting the smallest predicted capacity fading curve c1 and the corresponding distance index value.
The beneficial effects of the invention are as follows:
1. The battery capacity attenuation curve generation method based on the condition generation countermeasure network solves the problems that the battery capacity attenuation curve data set in the existing battery capacity attenuation curve prediction field is less, the existing data enhancement method in the field is high in difficulty, poor in generalization performance and the like.
2. According to the battery capacity degradation curve generation method based on the condition generation countermeasure network, the existing battery degradation data set is expanded through the CGAN network model, so that the number of samples and the diversity of the data set can be increased, the accuracy and the robustness of prediction analysis of the deep learning network model are improved, and the research and the development of lithium battery capacity degradation track prediction are promoted to a certain extent.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar modules or modules having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application. On the contrary, the embodiments of the application include all alternatives, modifications and equivalents as may be included within the spirit and scope of the appended claims.
Example 1
In an embodiment, a method for generating a battery capacity attenuation curve of an countermeasure network based on a condition is specifically provided, as shown in fig. 1, the method includes the following steps:
s1, acquiring a real capacity attenuation curve of a lithium battery, wherein in S1, the method for acquiring the real capacity attenuation curve data of the lithium battery comprises the following steps:
S101, dividing a lithium battery data set into three categories according to the service life length, namely short service life, medium service life and long service life, wherein the short service life is less than 700 cycles, the medium service life is 700-1500 cycles, and the long service life is more than 1500 cycles;
And S102, clustering by adopting a k-means clustering algorithm to obtain a clustering center curve corresponding to the real capacity attenuation curve of each type of lithium battery. The K-means clustering algorithm (K-means clustering algorithm) is an iterative solution clustering analysis algorithm, and the method comprises the steps of pre-dividing data into K groups, randomly selecting K objects as initial clustering centers, calculating the distance between each object and each seed clustering center, and distributing each object to the closest clustering center.
S2, carrying out normalization processing on a real capacity attenuation curve of the lithium battery, and dividing the processed data set into a training data set and a test data set, wherein in the S2, the method for acquiring the training data set comprises the following steps:
S201, defining one-hot codes of various real capacity attenuation curves as 000,010,100 respectively;
S202, reading clustering center curve data of various real capacity attenuation curves, adding artificial control noise n1 to the x axis and adding artificial control noise n2 to the y axis;
s203, storing each cluster center curve and each corresponding one-hot code expansion m times into a set object;
s204, carrying out normalization processing on the acquired collection objects;
S205, packaging the normalized aggregate object into a data loader as a training data set, wherein the training data set is used for model training of a subsequent CGAN network model.
In this S2, after removing the cluster center curves from each type of real capacity fading curves, randomly selecting n pieces of data as a test dataset by a random function, the test dataset being used for model evaluation by a subsequent CGAN network model.
S3, determining CGAN super parameters required by the network model, wherein the super parameters comprise the size B of batch processing, the learning rate LR, the momentum parameter B1 and the momentum parameter B2.
A CGAN network model is constructed, as shown in FIG. 2, the CGAN network model comprises a generator and a discriminator, optimizers of the generator and the discriminator adopt Adam optimizers, and loss functions adopt MSE losses.
The generator comprises BatchNorm layers of functions of BatchNorm d and 5 layers of linear functions, the activation function is LeakyReLU, and finally a layer of Tanh activation function is added to convert the linear output into a value between-1 and 1. The input of the generator is random noise and one-hot coding of each type of real capacity attenuation curve, and the output is a predicted capacity attenuation curve generated after five-layer linear layer processing;
The arbiter comprises 4 linear layers, the activation function is LeakyReLU, meanwhile, in order to prevent the arbiter from generating the over-fitting phenomenon, the middle linear layer is followed by a Dropout layer, and data are discarded according to a fixed proportion, so that data regularization is realized. The input of the discriminator is a real capacity fading curve, one-hot codes of each type of real capacity fading curve and the output of the generator, and the output is a predicted capacity fading curve with higher reality and the probability of judging the category to which the current predicted capacity fading curve belongs as true.
The specific structure of each layer in CGAN network model can be further described by the following table.
Table 1CGAN model each layer concrete structure
Note that point_num represents the number of sampling points of the input battery capacity curve, and n_ classes represents the number of categories of the battery capacity curve.
S4, inputting the training data set into a CGAN network model for training to obtain an optimal generator, and in S4, obtaining the optimal generator by the following method:
S401, after a training data set is obtained, randomly generating a batch of random noise which accords with 0-1 positive-fit distribution and has the same size, and inputting the random noise and one-hot codes of various real capacity attenuation curves in the current training data set into a generator together for forward propagation;
S402, inputting the output of the generator, the category to which the current real capacity attenuation curve belongs and the real capacity attenuation curve into a discriminator;
S403, calculating a loss value loss through the output of the discriminator and the real capacity attenuation curve, feeding back the loss value loss to the generator, continuously adjusting own model parameters, namely parameter weights of each item in a generator network model and the like by the generator according to feedback, and continuously opposing the generator and the discriminator to generate an optimal generator so as to finally acquire the optimal generator.
S5, generating predicted capacity fading curves of lithium batteries in batches through an optimal generator, and selecting the most representative predicted capacity fading curve by using a maximum diversity generation curve selection method, wherein in S5, as shown in FIG. 4, the method for selecting the most representative predicted capacity fading curve is as follows:
s501, generating predicted capacity attenuation curves in batches by using the trained optimal generator and defining the predicted capacity attenuation curves as a set C, wherein the generated curve set is shown in FIG. 3;
S502, defining an empty set C *, and randomly selecting a curve C r in the generated set C;
S503, finding a curve C with the largest distance curve C r from the set C, then putting the curve C into the set C *, and removing the curve C from the set C;
s504, judging whether k is equal to n;
S505, if the two curves are equal, acquiring a selected set C * and ending, if the two curves are not equal, finding a curve C ' with the largest distance curve C r in the set C, then putting the curve C ' into the set C *, removing the curve C ' from the set C, and returning to S504 after k+1;
And repeating the steps until the number of curves in the set C * is equal to the input selection number n, and terminating the cycle to obtain the n curves in the set C, which are the most representative, as shown in FIG. 5.
And S6, calculating a similarity score between the test data set and the most representative predicted capacity fading curve so as to evaluate the performance of the generator, obtaining a group of good CGAN network models if the performance of the generator is good, and returning to S4 to continue training and adjusting model parameters if the performance of the generator is bad. In S6, as shown in fig. 6, the performance of the evaluation generator adopts the following method:
S601, calculating the DTW distance from a curve in the test data set to each predicted capacity attenuation curve in the set C in sequence;
S602, acquiring a predicted capacity fading curve C1 with the smallest distance in the set C, wherein the predicted capacity fading curve has data with the largest similarity, as shown in FIG. 7;
S603, outputting the smallest predicted capacity fading curve c1 and the corresponding distance index value. To measure the magnitude of the difference between the generated predicted capacity fading curve and the true capacity fading curve, the present embodiment uses the Mean Square Error (MSE) as the evaluation index.
Where k is the total number of test sets, y k andA curve capacity value and a true curve capacity value are generated, respectively.
The generator performance trained by this embodiment can be further illustrated using the following table.
TABLE 2 error results of real voltage sequences and generated Curve voltage sequences
As can be seen from the data in Table 2, the real capacity fade curve approximates the predicted capacity fade curve generated by the CGAN network model with less loss, so the generator performs better.
The battery capacity attenuation curve generation method based on the condition generation countermeasure network solves the problems that the battery capacity attenuation curve data set in the existing battery capacity attenuation curve prediction field is small, the existing data enhancement method in the field is large in difficulty, poor in generalization performance and the like. The research expands the existing battery degradation data set through CGAN network model, can improve the sample number and diversity of the data set, improves the accuracy and robustness of the deep learning network model prediction analysis, and promotes the research and development of lithium battery capacity degradation track prediction to a certain extent.
It should be noted that any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and that preferred embodiments of the present application include additional implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present application.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of techniques known in the art, discrete logic circuits with logic gates for implementing logic functions on data signals, application specific integrated circuits with appropriate combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like.
While embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.