A charging feature extraction method and system based on self-supervised learning
Patent Information
- Application Number
- CN202211639352.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-20
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-12-20
AI Technical Summary
[0005]然而,上述传统的方法都需要通过人工进行充电特征的提取,需要大量的专业知识,不仅效率低下,且使用不同来源电池数据提取的充电特征训练的模型的估计(预测)效果参差不齐,泛化能力差,在实际应用过程中容易受到环境影响
[0037]通过对包括充电电流、充电电压以及充电SOC的电池充电数据进行分组、截取、随机MASK操作以得到充电数据集,利用充电数据集对基于transformer构建的特征提取模型进行训练,再利用训练后的特征提取模型进行充电特征的自动提取,即使用深度学习算法对充电特征进行自动提取以代替传统的人工提取,缩短充电特征提取时间,且深度学习算法基于大量的电池充电数据进行算法拟合,具有很好的泛化能力,而利用transformer能很好的捕捉长时间序列的特征表示,通过transformer的无监督学习能缓和不同数据分布之间带来的预测误差,通过随机MASK操作让每一充电子数据的充电曲线都能学习到大数据样本下的表征体系,最终极大的提升了充电特征提取的效率以及质量。
Smart Images

Figure CN116070100B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of lithium battery detection, and particularly discloses a charging feature extraction method and system based on self-supervised learning. BACKGROUND
[0002] With the development and progress of science and technology, more and more electronic devices are widely used, and electric vehicles and electric bicycles driven by lithium batteries have become an indispensable part of our travel.
[0003] However, the quality of lithium batteries produced by different manufacturers is uneven, and the chemical formula and manufacturing process of lithium batteries also differ, the most direct manifestation being that the capacity decay rate (aging degree) of lithium batteries is different under the same use time. During the charging and discharging cycle of the lithium battery, some irreversible chemical reactions occur inside, causing the loss of Li+“embedded / extracted”on the electrode of the lithium battery, so the voltage and current curves formed during charging of lithium batteries with different aging degrees are different.
[0004] Since the accuracy of battery capacity estimation is directly related to the safety and user experience of the vehicle, the voltage and current curves (battery data) are used to estimate the battery capacity. For battery capacity estimation, there are the following methods: 1. Establishing an electrochemical mechanism model and an equivalent circuit model to describe the aging behavior of lithium batteries, i.e., battery capacity estimation; 2. Using a deep learning model of CNN and RNN to estimate the battery capacity; 3. Using a machine learning algorithm to estimate the battery capacity.
[0005] However, the above traditional methods need to extract charging features manually, which requires a lot of professional knowledge, is not only inefficient, and the estimation (prediction) effect of the model trained by extracting charging features from battery data of different sources is uneven, and the generalization ability is poor, which is easily affected by the environment in the actual application process.
[0006] Therefore, how to provide a charging feature extraction method and system based on self-supervised learning to improve the efficiency and quality of charging feature extraction has become a technical problem to be solved. SUMMARY
[0007] The technical problem to be solved by the present application is to provide a charging feature extraction method and system based on self-supervised learning to improve the efficiency and quality of charging feature extraction.
[0008] In a first aspect, the present application provides a charging feature extraction method based on self-supervised learning, comprising the following steps:
[0009] Step S10, obtaining a large amount of battery charging data including charging current, charging voltage and charging SOC;
[0010] Step S20, grouping and intercepting each battery charging data to obtain charging sub-data;
[0011] Step S30, performing random MASK operation on each charging sub-data to obtain charging data set;
[0012] Step S40, constructing a feature extraction model based on transformer, and training the feature extraction model using the charging data set;
[0013] Step S50, automatically extracting charging features using the trained feature extraction model.
[0014] Further, the step S20 is specifically:
[0015] An SOC gradient and a time threshold are set, each battery charging data is grouped based on the SOC gradient, and each battery charging data after grouping is sequentially intercepted based on the time threshold to obtain charging sub-data, and the charging sub-data whose time length does not satisfy the time threshold is filled with 0.
[0016] Further, the step S30 is specifically:
[0017] A MASK ratio, a MASK length interval and a MASK interval interval are set, and the charging current, the charging voltage and the charging SOC in the charging sub-data are respectively subjected to random MASK operation based on the MASK ratio, the MASK length interval and the MASK interval interval to obtain the charging data set.
[0018] Further, in the step S40, the feature extraction model is used to convert the input charging data set into a feature vector, and after unsupervised learning of each feature vector by transformer, the data masked in the charging data set is linearly projected.
[0019] Further, in the step S40, the loss function of the feature extraction model is:
[0020] L = l(x, y) = {l1,...,l n ,...,l N} T ,l n =(x n -y n ) 2 ;
[0021] Wherein, L represents the loss function; x represents the predicted value; y represents the true value; n represents the number of data in the charging data set; N represents the total number of data in the charging data set; xn represents the nth prediction value; y n represents the nth true value; T represents transposition; l() represents the RMSE function.
[0022] In a second aspect, the present application provides a charging feature extraction system based on self-supervised learning, comprising the following modules:
[0023] A battery charging data acquisition module is configured to acquire a large amount of battery charging data including charging current, charging voltage and charging SOC.
[0024] A charging sub-data generation module is configured to group and intercept each of the battery charging data to obtain charging sub-data.
[0025] A charging data set generation module is configured to perform random MASK operation on each of the charging sub-data to obtain a charging data set.
[0026] A feature extraction model training module is configured to construct a feature extraction model based on transformer, and train the feature extraction model using the charging data set.
[0027] A charging feature automatic extraction module is configured to use the trained feature extraction model to automatically extract charging features.
[0028] Further, the charging sub-data generation module is specifically configured to:
[0029] An SOC gradient and a time threshold are set, each of the battery charging data is grouped based on the SOC gradient, and each of the grouped battery charging data is sequentially intercepted based on the time threshold to obtain charging sub-data, and the charging sub-data whose time length does not satisfy the time threshold is filled with 0.
[0030] Further, the charging data set generation module is specifically configured to:
[0031] A MASK ratio, a MASK length interval and a MASK interval are set, and the charging current, the charging voltage and the charging SOC in the charging sub-data are respectively subjected to random MASK operation based on the MASK ratio, the MASK length interval and the MASK interval to obtain a charging data set.
[0032] Further, in the feature extraction model training module, the feature extraction model is configured to convert the input charging data set into a feature vector, and then linearly project the data in the charging data set that is subjected to MASK after unsupervised learning of each of the feature vectors by transformer.
[0033] Further, in the feature extraction model training module, the loss function of the feature extraction model is:
[0034] L = l(x, y) = {l1,..., ln,..., lN} n ,...,l N} T ,l n =(x n -y n ) 2 ;
[0035] Wherein, L represents the loss function; x represents the predicted value; y represents the true value; n represents the number of data in the charging data set; N represents the total number of data in the charging data set; x n represents the nth predicted value; y n represents the nth true value; T represents transposition; l() represents the RMSE function.
[0036] The present application has the advantages of:
[0037] By grouping, intercepting and random MASK operation on the battery charging data including charging current, charging voltage and charging SOC to obtain a charging data set, the feature extraction model based on transformer is trained using the charging data set, and the trained feature extraction model is used for automatic extraction of charging features, that is, the deep learning algorithm is used to automatically extract the charging features instead of traditional manual extraction, the charging feature extraction time is shortened, and the deep learning algorithm is based on a large amount of battery charging data for algorithm fitting, has good generalization ability, and the transformer can well capture the feature representation of long time sequence, the prediction error caused by different data distribution can be alleviated through unsupervised learning of transformer, through random MASK operation, each charging data can learn the representation system under large data samples, and finally the efficiency and quality of charging feature extraction are greatly improved. BRIEF DESCRIPTION OF DRAWINGS
[0038] The present application will be further described below with reference to the accompanying drawings and embodiments.
[0039] Figure 1 is a flowchart of a charging feature extraction method based on self-supervised learning according to the present application.
[0040] Figure 2 is a structural schematic diagram of a charging feature extraction system based on self-supervised learning according to the present application.
[0041] Figure 3 is a schematic diagram of random MASK operation according to the present application.
[0042] Figure 4 is a schematic diagram of the feature extraction model of the present application.
[0043] Figure 5 is a schematic diagram of random masking of input data of the feature extraction model of the present application. DETAILED DESCRIPTION
[0044] The technical solution in the embodiments of the present application has the following general idea: using a deep learning algorithm to automatically extract charging features to shorten the charging feature extraction time, and based on a large amount of battery charging data to fit the algorithm to improve the generalization ability, and using transformer to well capture the feature representation of long time series, using unsupervised learning of transformer to alleviate the prediction error between different data distributions, and using random MASK operation to enable each charging sub-data to learn the representation system under large data samples to improve the efficiency and quality of charging feature extraction.
[0045] Referring to Figures 1 to 5 , a preferred embodiment of a charging feature extraction method based on self-supervised learning of the present application includes the following steps:
[0046] Step S10, a large amount of battery charging data including charging current, charging voltage and charging SOC is obtained; that is, the battery charging data contains three groups of data;
[0047] Step S20, grouping and intercepting each battery charging data to obtain charging sub-data;
[0048] Step S30, random MASK operation (random masking operation) is performed on each charging sub-data to obtain a charging data set;
[0049] Step S40, a feature extraction model is constructed based on transformer, and the feature extraction model is trained using the charging data set;
[0050] Step S50, using the trained feature extraction model to automatically extract charging features.
[0051] The step S20 is specifically:
[0052] An SOC gradient and a time threshold are set, each battery charging data is grouped based on the SOC gradient, and each battery charging data after grouping is sequentially intercepted based on the time threshold to obtain charging sub-data, and the charging sub-data whose time length does not meet the time threshold is filled with 0.
[0053] Generally, at least 4000 pieces of battery charging data are generated by sampling once per second in a complete charging process, so the SOC gradient is set to group each piece of battery charging data, and the SOC gradient is preferably 5SOC. Since the input of the feature extraction model needs to be a fixed length vector, the battery charging data is truncated based on the time length threshold, and the time length threshold is preferably 500S.
[0054] The step S30 is specifically:
[0055] A MASK ratio, a MASK length interval, and a MASK interval are set, and the charging current, the charging voltage, and the charging SOC in the charging data are randomly subjected to the MASK operation based on the MASK ratio, the MASK length interval, and the MASK interval, to obtain a charging data set; the random MASK operation of the charging current, the charging voltage, and the charging SOC is performed asynchronously.
[0056] As shown in Figure 3 , for example, the MASK ratio is set to 15%, the MASK length interval is 5-8S, and the MASK interval is 6-50S, when the length of the charging data is 500S, then 500S*15% of the region is randomly selected for random MASK operation, and the MASK length is randomly generated between 5-8S, and the MASK interval between the MASKs is randomly generated between 6-50S.
[0057] In the step S40, the feature extraction model is used to convert the input charging data set into a feature vector, and then the transformer is used for unsupervised learning of each feature vector, and the data masked in the charging data set is linearly projected.
[0058] The feature extraction model is as shown in Figure 4 , Embedding represents a feature vector composed of charging current, charging voltage, and charging SOC; each piece of training data in the charging data set represents 3 feature values at 500 time points, i.e. [500, 3]; 3 layers of the same transformer are used to improve the expression ability of the feature extraction model, Figure 4 The right side of the figure shows the internal structure of the transformer, which is mathematically represented as:
[0059]
[0060] Z2=FFN(Z)=max(0,ZW1+b1)W2+b2;
[0061] wherein Q, K, and V all represent matrices with a size of [3, 128], dk FFN() represents a linear projection function for converting a matrix of [500, 128] into a matrix Z2 of [500, 256]; W1, W2, b1, b2 represent linear projection coefficients;
[0062] The Regression Head is used for linear projection on the output of the transformer hidden layer, and finally output to the output layer of the feature extraction model, which is mathematically expressed as:
[0063] Z3 = FFN(Z2) = Z2W3 + b3;
[0064] Wherein, the input is a matrix Z2 with a size of [500, 256], and since the final output is a scalar, the output dimension is 1, and finally the matrix Z3 with a size of [500, 1] will be changed.
[0065] In the step S40, the loss function of the feature extraction model is:
[0066] L = l(x, y) = {l1,...,l n ,...,l N} T ,l n =(x n -y n ) 2 ;
[0067] Wherein, L represents the loss function; x represents the predicted value; y represents the true value; n represents the number of data in the charging data set; N represents the total number of data in the charging data set; x n represents the nth predicted value; y n represents the nth true value; T represents transposition; l() represents the RMSE function.
[0068] Through the loss function, any scalar value can be compressed to low <= target value <= high.
[0069] The preferred embodiment of the battery charging feature extraction system based on self-supervised learning provided by the application comprises the following modules:
[0070] A battery charging data acquisition module is used to acquire a large amount of battery charging data including charging current, charging voltage and charging SOC; that is, the battery charging data contains three groups of data.
[0071] A charging sub-data generation module is used to group and intercept each of the battery charging data to obtain charging sub-data.
[0072] The charging dataset generation module is used to perform a random masking operation on each of the charging sub-data to obtain the charging dataset;
[0073] The feature extraction model training module is used to build a feature extraction model based on transformer and train the feature extraction model using the charging dataset.
[0074] The automatic charging feature extraction module is used to automatically extract charging features using the trained feature extraction model.
[0075] The charging electronic data generation module is specifically used for:
[0076] Set a SOC gradient and a duration threshold. Group the charging data of each battery based on the SOC gradient. Then, extract the charging data of each grouped battery sequentially based on the duration threshold. Fill the charging data of charging sub-data with 0 for the duration that does not meet the duration threshold.
[0077] In a typical complete charging process, sampling at 1 second generates at least 4000 battery charging data points. Therefore, it is necessary to set the SOC gradient to group the battery charging data points, and the SOC gradient is preferably 5SOC. Since the input of the feature extraction model needs to be a fixed-length vector, the battery charging data is truncated based on the duration threshold, which is preferably 500 seconds.
[0078] The charging dataset generation module is specifically used for:
[0079] A mask ratio, a mask length range, and a mask interval range are defined. Based on the mask ratio, mask length range, and mask interval range, random mask operations are performed on the charging current, charging voltage, and charging SOC in the charging sub-data to obtain the charging dataset. The random mask operations on the charging current, charging voltage, and charging SOC are performed asynchronously.
[0080] like Figure 3 As shown, for example, the MASK ratio is set to 15%, the MASK length range is 5-8 seconds, and the MASK interval range is 6-50 seconds. When the length of the charging electronic data is 500 seconds, a 500-second * 15% region is randomly selected for random MASK operation, and the MASK length is randomly generated between 5 and 8 seconds, and the MASK interval between MASKs is randomly generated between 6 and 50 seconds.
[0081] The feature extraction model is used to convert the input charging data set into a feature vector, and then the transformer is used for unsupervised learning of each feature vector, and the data masked in the charging data set is linearly projected.
[0082] The feature extraction model is as shown in the figure Figure 4 The Embedding is a feature vector composed of charging current, charging voltage and charging SOC. Each training data in the charging data set is represented by 3 feature values at 500 time points, i.e. [500, 3]. A 3-layer transformer is used to improve the expression ability of the feature extraction model. Figure 4 The right side of the figure shows the internal structure of the transformer, which is mathematically represented as:
[0083]
[0084] Z2 = FFN(Z) = max(0, ZW1 + b1)W2 + b2;
[0085] Where Q, K, and V are matrices with a size of [3, 128], d k is the square root of 128; FFN() represents a linear projection function used to convert a matrix of [500, 128] to a matrix of [500, 256]; W1, W2, b1, and b2 represent linear projection coefficients.
[0086] The Regression Head is used to linearly project the output of the transformer hidden layer, and finally output to the output layer of the feature extraction model, which is mathematically represented as:
[0087] Z3 = FFN(Z2) = Z2W3 + b3;
[0088] Where the input is a matrix Z2 with a size of [500, 256]. Since the final output is a scalar, the output dimension is 1, and finally the matrix Z3 with a size of [500, 1] is obtained.
[0089] The loss function of the feature extraction model in the feature extraction model training module is:
[0090] L = l(x, y) = {l1,...,l n ,...,l N} T ,l n = (x n -y n ) 2 ;
[0091] wherein, L represents a loss function; x represents a predicted value; y represents a true value; n represents the number of data in the charging data set; N represents the total number of data in the charging data set; x n represents the nth predicted value; y n represents the nth true value; T represents a transpose; l() represents an RMSE function.
[0092] By means of the loss function, any scalar value can be compressed to low <= target value <= high.
[0093] In summary, the advantages of the present application are:
[0094] By grouping, intercepting and random MASK operation on the battery charging data including charging current, charging voltage and charging SOC to obtain a charging data set, a feature extraction model based on transformer is trained using the charging data set, and the trained feature extraction model is used for automatic extraction of charging features, that is, a deep learning algorithm is used to automatically extract charging features instead of traditional manual extraction, which shortens the charging feature extraction time, and the deep learning algorithm is based on a large amount of battery charging data for algorithm fitting, which has good generalization ability, and the transformer can well capture the feature representation of long time series, and the unsupervised learning of the transformer can alleviate the prediction error between different data distributions, and the random MASK operation enables each charging data to learn the representation system under the large data sample, which greatly improves the efficiency and quality of charging feature extraction.
[0095] Although the specific embodiments of the present application are described above, those skilled in the art should understand that the specific examples described are only illustrative, and are not intended to limit the scope of the present application, and equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present application should be covered within the scope of the claims of the present application.
Claims
1. A charging feature extraction method based on self-supervised learning, characterized in that: The method comprises the following steps: Step S10, obtaining a large amount of battery charging data including charging current, charging voltage and charging SOC; Step S20, grouping and intercepting each of the battery charging data to obtain charging sub-data; Step S30, performing random MASK operation on each of the charging sub-data to obtain a charging data set; Step S40, constructing a feature extraction model based on a transformer, and training the feature extraction model using the charging data set; Step S50, automatically extracting charging features using the trained feature extraction model; The step S20 specifically comprises: An SOC gradient and a time threshold are set, each battery charging data is grouped based on the SOC gradient, and each battery charging data after grouping is sequentially intercepted based on the time threshold to obtain charging sub-data, and the charging sub-data whose time length does not satisfy the time threshold is filled with 0; The step S30 specifically comprises: A MASK ratio, a MASK length interval and a MASK interval are set, and the charging current, the charging voltage and the charging SOC in the charging sub-data are respectively subjected to random MASK operation based on the MASK ratio, the MASK length interval and the MASK interval to obtain the charging data set.
2. The charging feature extraction method based on self-supervised learning of claim 1, wherein: In the step S40, the feature extraction model is used to convert the input charging data set into a feature vector, and after unsupervised learning of each feature vector by the transformer, the data masked in the charging data set is linearly projected.
3. The charging feature extraction method based on self-supervised learning of claim 1, wherein: In the step S40, the loss function of the feature extraction model is: ; wherein, represents a loss function; represents a predicted value; represents a true value; represents a number of data in the charging data set; represents a total number of data in the charging data set; represents a th predicted value; represents a th true value; represents a transpose; represents an RMSE function.
4. A charging feature extraction system based on self-supervised learning, characterized in that: The method comprises the following modules: A battery charging data acquisition module is configured to acquire a large amount of battery charging data including charging current, charging voltage and charging SOC; A charging sub-data generation module is configured to group and intercept each of the battery charging data to obtain charging sub-data; A charging data set generation module is configured to perform random MASK operation on each of the charging sub-data to obtain a charging data set; A feature extraction model training module is configured to construct a feature extraction model based on a transformer, and train the feature extraction model using the charging data set; A charging feature automatic extraction module is configured to automatically extract charging features using the trained feature extraction model; The charging sub-data generation module is specifically configured to: An SOC gradient and a time threshold are set, each battery charging data is grouped based on the SOC gradient, and each battery charging data after grouping is sequentially intercepted based on the time threshold to obtain charging sub-data, and the charging sub-data whose time length does not satisfy the time threshold is filled with 0; The charging data set generation module is specifically configured to: A MASK ratio, a MASK length interval and a MASK interval are set, and the charging current, the charging voltage and the charging SOC in the charging sub-data are respectively subjected to random MASK operation based on the MASK ratio, the MASK length interval and the MASK interval to obtain the charging data set.
5. The self-supervised learning based charging feature extraction system of claim 4, wherein: In the feature extraction model training module, the feature extraction model is used to convert the input charging data set into a feature vector, and then the transformer performs unsupervised learning on each feature vector, and linearly projects the data masked in the charging data set.
6. The self-supervised learning based charging feature extraction system of claim 4, wherein: In the feature extraction model training module, a loss function of the feature extraction model is: ; wherein, represents a loss function; represents a predicted value; represents a true value; represents a number of data in the charging data set; represents a total number of data in the charging data set; represents the th predicted value; represents the th true value; represents a transpose; represents an RMSE function.
Citation Information
Patent Citations
Lithium battery life prediction method based on feature screening
CN111832221A
Model training method and device, computer equipment and storage medium
CN113807515A