Battery state of charge estimation method, model training method and device
By constructing a loss function through an improved consistency-constrained self-attention graph pooling mechanism and self-attention score, the problem of low prediction accuracy of the battery state-of-charge estimation model is solved, and the stability and accuracy of feature extraction are improved.
Patent Information
- Application Number
- CN202410892481.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-04
AI Technical Summary
The battery state-of-charge estimation model in the existing technology has low prediction accuracy, and the shallow learning architecture lacks comprehensiveness when considering the redundancy of feature information.
The improved consistency-constrained self-attention graph pooling mechanism is used to perform self-attention graph pooling on the sample feature maps, and the machine learning model parameters are adjusted by constructing a self-attention score loss function to enhance the global representation and consistency of the features.
The accuracy and feature extraction stability of the battery state-of-charge estimation model are improved, and the global feature representation of the battery operating parameter sequence is enhanced.
Smart Images

Figure CN118425790B
Abstract
Description
Technical Field
[0001] The present application relates to the field of batteries, and in particular to a battery state of charge estimation method, a model training method and a device. Background Art
[0002] The state of charge is one of the most important state quantities of lithium batteries. It is an important parameter to measure the remaining power of the battery and an important indicator to ensure the safety and service life of the battery. Therefore, accurately estimating the state of charge of lithium batteries is a key issue that needs to be solved.
[0003] At present, model-based battery state of charge estimation is one of the more common battery state of charge estimation methods. In the prior art, model-based battery state of charge estimation methods use many traditional machine learning algorithms, such as support vector machines, semi-supervised learning, artificial neural networks, etc. to simulate the nonlinear characteristics of batteries, have appropriate data integrity, and can autonomously learn the relationship between battery state of charge and observable variables (voltage, current, temperature, etc.) from data.
[0004] However, these shallow learning architectures lack comprehensiveness in considering the redundancy of feature information, which ultimately leads to low accuracy of the battery state of charge predicted by the model. Summary of the invention
[0005] The present application provides a battery state of charge estimation method, a model training method and a device to solve the technical problem of low accuracy of the battery state of charge predicted by the battery state of charge estimation model in the prior art.
[0006] In a first aspect, the present application provides a method for training a battery state of charge estimation model, the method comprising:
[0007] Acquire sample data, the sample data including a battery operating parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at a cutoff time of the historical time interval;
[0008] The sample data is input into a machine learning model to be trained, a sample feature map is extracted from the sample data through the machine learning model, and a self-attention map pooling process is performed on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and a predicted state of charge of the sample battery at the cutoff time is obtained based on the self-attention pooling feature map corresponding to the sample feature map;
[0009] A loss function is constructed according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score, and the model parameters of the machine learning model are adjusted using the loss function to obtain a battery state of charge estimation model.
[0010] In a possible implementation manner, the battery operation parameter sequence includes a battery operation parameter sequence of at least two parameter dimensions, and extracting a sample feature graph from the sample data includes:
[0011] Constructing a graph of the battery operation parameter sequence under each parameter dimension to obtain a sub-feature graph of the sample battery corresponding to each parameter dimension;
[0012] For each of the parameter dimensions, a graph convolution operation is performed on the sub-feature graph of the sample battery corresponding to the parameter dimension and the battery operation parameter sequence under the parameter dimension to obtain an aggregated feature graph of the sample battery corresponding to the parameter dimension;
[0013] The aggregated feature graphs of the sample battery corresponding to each parameter dimension are fused to obtain the sample feature graph.
[0014] In a possible implementation manner, the graph construction of the battery operation parameter sequence under each parameter dimension to obtain the sub-feature graph of the sample battery corresponding to each parameter dimension includes:
[0015] Performing a convolution operation on the battery operation parameter sequence of the at least two parameter dimensions to obtain a feature matrix of the sample battery in the historical time interval;
[0016] Multiplying the feature matrix and its transposed matrix to obtain an adjacency matrix of the sample battery in the historical time interval;
[0017] For each of the parameter dimensions, a graph is constructed according to the adjacency matrix and the battery operation parameter sequence under the parameter dimension to obtain a sub-feature graph of the sample battery corresponding to the parameter dimension.
[0018] In a possible implementation, fusing the aggregated feature graphs of the sample battery corresponding to each parameter dimension to obtain the sample feature graph includes:
[0019] Performing a set feature interaction operation on the aggregate feature graphs of the sample battery corresponding to each two parameter dimensions, respectively, to obtain an interactive aggregate feature graph of the sample battery corresponding to each two parameter dimensions;
[0020] The sample battery is subjected to a set feature fusion operation corresponding to the interactive aggregation feature graph of each two parameter dimensions to obtain the sample feature graph.
[0021] In a possible implementation, the self-attention map pooling mechanism based on the improved consistency constraint performs self-attention map pooling processing on the sample feature map to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, including:
[0022] Performing a graph convolution operation on the sample feature map to obtain a first self-attention score corresponding to the sample feature map;
[0023] Performing self-attention masking processing on the sample feature map based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map;
[0024] The sample feature map is regularized by a self-attention mechanism to obtain a second self-attention score corresponding to the sample feature map.
[0025] In a possible implementation, constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score includes:
[0026] constructing a first loss sub-function according to the predicted state of charge and the actual state of charge;
[0027] Constructing a second loss sub-function according to the first self-attention score and the second self-attention score;
[0028] A final loss function is constructed according to the first loss sub-function and the second loss sub-function.
[0029] In a possible implementation, constructing a second loss sub-function according to the first self-attention score and the second self-attention score includes:
[0030] Substituting the first sub-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function.
[0031] In a second aspect, the present application provides a battery state of charge estimation method based on the battery state of charge estimation model described in any one of the first aspects, the method comprising:
[0032] Acquire a target battery operating parameter sequence to be estimated, wherein the target battery operating parameter sequence includes battery operating parameters of the target battery collected within a set time interval;
[0033] The target battery operating parameter sequence is input into the battery state of charge estimation model, a feature map is extracted from the target battery operating parameter sequence through the battery state of charge estimation model, and the feature map is subjected to self-attention map pooling processing to obtain a self-attention pooling feature map corresponding to the feature map, and the state of charge of the target battery at the cutoff time of the set time interval is obtained based on the self-attention pooling feature map.
[0034] In a possible implementation, obtaining the state of charge of the target battery at the end time of the set time interval based on the self-attention pooling feature map corresponding to the feature map includes:
[0035] Determine the attention coefficient of the self-attention pooling feature map corresponding to the feature map based on the attention mechanism;
[0036] Obtaining an initial predicted state of charge according to the self-attention pooling feature map corresponding to the feature map;
[0037] The initial predicted state of charge and the attention coefficient are weighted to obtain the predicted state of charge of the target battery at the end time of the set time interval.
[0038] In a third aspect, the present application provides a training device for a battery state of charge estimation model, the device comprising:
[0039] A sample acquisition module, used to acquire sample data, wherein the sample data includes a battery operation parameter sequence of a sample battery within a set historical time interval and an actual charge state of the sample battery at the end of the historical time interval;
[0040] A model input module, used to input the sample data into a machine learning model to be trained, extract a sample feature map from the sample data through the machine learning model, and perform self-attention map pooling processing on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and obtain a predicted state of charge of the sample battery at the cutoff time based on the self-attention pooling feature map corresponding to the sample feature map;
[0041] a loss function construction module, configured to construct a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score;
[0042] The model parameter adjustment module is used to adjust the model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model.
[0043] In a possible implementation manner, the battery operation parameter sequence includes a battery operation parameter sequence of at least two parameter dimensions, and the model input module includes:
[0044] A graph construction unit, used to construct a graph of the battery operation parameter sequence under each parameter dimension, to obtain a sub-feature graph of the sample battery corresponding to each parameter dimension;
[0045] A graph aggregation unit, configured to perform a graph convolution operation on the sub-feature graph of the sample labeled battery corresponding to the parameter dimension and the battery operation parameter sequence under the parameter dimension for each parameter dimension, so as to obtain an aggregated feature graph of the sample battery corresponding to the parameter dimension;
[0046] The graph fusion unit is used to fuse the aggregated feature graphs of the sample battery corresponding to each parameter dimension to obtain the sample feature graph.
[0047] In a possible implementation, the graph construction unit includes:
[0048] A convolution subunit, configured to perform a convolution operation on the battery operation parameter sequence of the at least two parameter dimensions to obtain a feature matrix of the sample battery in the historical time interval;
[0049] A first operator unit, configured to multiply the feature matrix by its transposed matrix to obtain an adjacency matrix of the sample battery in the historical time interval;
[0050] A construction subunit is used to construct a graph for each parameter dimension according to the adjacency matrix and the battery operation parameter sequence under the parameter dimension to obtain a sub-feature graph of the sample battery corresponding to the parameter dimension.
[0051] In a possible implementation, the graph fusion unit includes:
[0052] A second operation subunit is used to perform a set feature interaction operation on the aggregate feature graphs of the sample battery corresponding to each two parameter dimensions, to obtain an interactive aggregate feature graph of the sample battery corresponding to each two parameter dimensions;
[0053] The third operation subunit is used to perform a set feature fusion operation on the interactive aggregation feature graphs of each two parameter dimensions of the sample battery to obtain the sample feature graph.
[0054] In a possible implementation, the model input module includes:
[0055] A first score determination module, configured to perform a graph convolution operation on the sample feature map to obtain a first self-attention score corresponding to the sample feature map;
[0056] A mask module, configured to perform self-attention masking on the sample feature map based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map;
[0057] The second score determination module is used to regularize the sample feature map through a self-attention mechanism to obtain a second self-attention score corresponding to the sample feature map.
[0058] In a possible implementation, the loss function construction module includes:
[0059] A first construction submodule, configured to construct a first loss subfunction according to the predicted state of charge and the actual state of charge;
[0060] A second construction submodule, configured to construct a second loss subfunction according to the first self-attention score and the second self-attention score;
[0061] A synthesis module is used to construct a final loss function according to the first loss sub-function and the second loss sub-function.
[0062] In a possible implementation manner, the second construction submodule is specifically used to:
[0063] Substituting the first sub-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function.
[0064] In a fourth aspect, the present application provides a battery state of charge estimation device based on the battery state of charge estimation model described in any one of the first aspects, the device comprising:
[0065] A target data acquisition module, used to acquire a target battery operating parameter sequence to be estimated, wherein the target battery operating parameter sequence includes battery operating parameters of the target battery collected within a set time interval;
[0066] The state of charge estimation module is used to input the target battery operating parameter sequence into the battery state of charge estimation model, extract a feature map from the target battery operating parameter sequence through the battery state of charge estimation model, and perform self-attention map pooling processing on the feature map to obtain a self-attention pooling feature map corresponding to the feature map, and obtain the state of charge of the target battery at the cutoff time of the set time interval based on the self-attention pooling feature map.
[0067] In a possible implementation, the state of charge estimation module obtains the state of charge of the target battery at the end time of the set time interval based on the self-attention pooling feature map corresponding to the feature map, including:
[0068] Determine the attention coefficient of the self-attention pooling feature map corresponding to the feature map based on the attention mechanism;
[0069] Obtaining an initial predicted state of charge according to the self-attention pooling feature map corresponding to the feature map;
[0070] The initial predicted state of charge and the attention coefficient are weighted to obtain the predicted state of charge of the target battery at the end time of the set time interval.
[0071] In a fifth aspect, the present application provides a device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to:
[0072] Acquire sample data, the sample data including a battery operating parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at a cutoff time of the historical time interval;
[0073] The sample data is input into a machine learning model to be trained, a sample feature map is extracted from the sample data through the machine learning model, and a self-attention map pooling process is performed on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and a predicted state of charge of the sample battery at the cutoff time is obtained based on the self-attention pooling feature map corresponding to the sample feature map;
[0074] constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score, and adjusting model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model;
[0075] or,
[0076] Acquire a target battery operating parameter sequence to be estimated, wherein the target battery operating parameter sequence includes battery operating parameters of the target battery collected within a set time interval;
[0077] The target battery operating parameter sequence is input into the battery state of charge estimation model, a feature map is extracted from the target battery operating parameter sequence through the battery state of charge estimation model, and the feature map is subjected to self-attention map pooling processing to obtain a self-attention pooling feature map corresponding to the feature map, and the state of charge of the target battery at the cutoff moment of the set time interval is obtained based on the self-attention pooling feature map corresponding to the feature map.
[0078] In a sixth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the battery state of charge estimation model training method or battery state of charge estimation method described in any one of the above items of the present application.
[0079] The above-mentioned technical scheme provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application, by using an improved consistency-constrained self-attention map pooling mechanism to perform self-attention map pooling processing on the sample feature map of the sample data when training the battery state of charge estimation model, to obtain the self-attention pooling feature map, the first self-attention score and the second self-attention score corresponding to the sample feature map, and the predicted state of charge of the sample battery at the said cut-off time is obtained based on the self-attention pooling feature map corresponding to the sample feature map, a loss function is constructed according to the said predicted state of charge, the actual state of charge, the first self-attention score and the second self-attention score, and the model parameters of the machine learning model are adjusted by using the loss function to obtain the battery state of charge estimation model, so that in the process of model training, the consistency constraint error between the two self-attention scores is introduced into the loss function of the model, and the model is adjusted by the loss function, so that the battery state of charge estimation model trained in this way can not only better capture the global feature representation of the battery operating parameter sequence when extracting features from the battery operating parameter sequence to be estimated, but also enhance the consistency and stability of the extracted features, thereby improving the accuracy of the final estimated battery state of charge. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0081] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0082] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0083] Figure 1 A flow chart of an embodiment of a method for training a battery state of charge estimation model provided in an embodiment of the present application;
[0084] Figure 2 A flow chart of an embodiment of extracting a sample feature map from sample data provided in an embodiment of the present application;
[0085] Figure 3 A flowchart of an embodiment for constructing a graph of a battery operating parameter sequence under each parameter dimension to obtain a sub-feature graph of a sample battery corresponding to each parameter dimension;
[0086] Figure 4 A schematic diagram of the overall process of extracting a sample feature map from sample data provided in an embodiment of the present application;
[0087] Figure 5 A flow chart of an embodiment of a battery state of charge estimation method provided in an embodiment of the present application;
[0088] Figure 6 A schematic diagram of the overall process of the battery state of charge estimation model provided in an embodiment of the present application when estimating the state of charge of a target battery;
[0089] Figure 7 Schematic diagram of the LSTM structure integrating the attention mechanism;
[0090] Figure 8 A schematic diagram of introducing a Bayesian optimization algorithm in the process of training a battery state of charge estimation model in the technical solution of an embodiment of the present application;
[0091] Fig. 9 A block diagram of an embodiment of a training device for a battery state of charge estimation model provided in an embodiment of the present application;
[0092] Fig.10 A block diagram of an embodiment of a battery state of charge estimation device provided in an embodiment of the present application;
[0093] Fig.11 A schematic diagram of the structure of a device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0094] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0095] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0096] In order to solve the technical problem in the prior art that the battery state of charge estimation model predicts the battery state of charge with low accuracy, the present application provides a battery state of charge estimation method, a model training method and a device, which can train an estimation model that can accurately predict the battery state of charge.
[0097] Figure 1 The flowchart of an embodiment of a method for training a battery state of charge estimation model provided in an embodiment of the present application is as follows. Figure 1 As shown, the method comprises the following steps:
[0098] Step 101 : Acquire sample data, where the sample data includes a battery operation parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at the end of the historical time interval.
[0099] First of all, it should be noted that the number of the above sample data is usually multiple. In the technical solution of the embodiment of the present application, each sample data includes a battery operating parameter sequence of the sample battery within a set historical time interval and the actual state of charge of the sample battery at the end of the historical time interval. Here, the set historical time interval refers to a period of time during the charging (or discharging) process of the sample battery. For example, the set historical time interval refers to a period of time of 30s during the charging (or discharging) process of the sample battery. The actual state of charge of the sample battery at the end of the historical time interval refers to the state of charge estimated by other battery state of charge estimation methods, such as the ampere-time integration method, the open circuit voltage method, etc., and approved by the user. Here, the actual state of charge is equivalent to the label value of the sample data.
[0100] In addition, for different sample data, the corresponding sample batteries may be the same or different, and the embodiments of the present application do not limit this. In the case where the sample batteries corresponding to different sample data are the same, the historical time intervals corresponding to different sample data may be different. Here, different historical time intervals refer to different starting times (or end times), but the duration is the same. For example, the battery operating parameter sequence of sample battery A in the historical time interval of 0-30s during the charging process is obtained as sample data 1, and the battery operating parameter sequence of sample battery A in the historical time interval of 20s-50s during the charging process is obtained as sample data 2. It can be seen that different historical time intervals may have overlapping parts, and the embodiments of the present application do not limit this.
[0101] In one embodiment, the battery operation parameter sequence includes a battery operation parameter sequence of at least two parameter dimensions. The parameter dimension refers to the type of battery operation parameter. For example, the at least two parameter dimensions include voltage, current and temperature, then the sample data may include a battery operation parameter sequence of voltage, a battery operation parameter sequence of current and a battery operation parameter sequence of temperature of the sample battery within a set historical time interval.
[0102] Step 102: input the sample data into the machine learning model to be trained, extract a sample feature map from the sample data through the machine learning model, and perform self-attention map pooling processing on the sample feature map based on the improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and obtain the predicted state of charge of the sample battery at the cutoff time based on the self-attention pooling feature map.
[0103] Step 103: construct a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score, and use the loss function to adjust the model parameters of the machine learning model to obtain a battery state of charge estimation model.
[0104] For ease of understanding, step 102 and step 103 are described in a unified manner as follows:
[0105] The machine learning model to be trained is implemented using the Graph Convolutional Network (GCN) architecture. Graph Convolutional Neural Network is a promising method for time series prediction with spatiotemporal feature data. By deeply mining the interdependencies between feature nodes to reflect spatial features, it is possible to mine hidden information between multi-source signals.
[0106] The Self-Attention Graph Pooling mechanism refers to the use of the self-attention mechanism to perform pooling operations on graph data. The goal of this pooling operation is to aggregate the node information in the graph into an overall graph representation for subsequent task processing or downstream learning tasks. In the self-attention graph pooling mechanism, the attention weights between each node and its neighboring nodes are learned, thereby achieving attention to important nodes and their features in the graph data. This mechanism can help the model better capture the global feature representation of graph data and improve the representation learning effect of graph data.
[0107] Based on this, in the technical solution of the embodiment of the present application, a self-attention graph pooling mechanism is introduced into the battery state of charge estimation model, in the expectation that the battery state of charge estimation model can focus on important battery operating parameters and their characteristics in the battery operating parameter sequence, so as to better capture the global feature representation of the battery operating parameter sequence.
[0108] However, as the complexity of graph data increases, it is difficult for the self-attention graph pooling mechanism in the prior art to learn the appropriate attention score for each node, resulting in a decrease in model performance and model stability. In order to overcome these problems, the embodiment of the present application proposes a consistency-constrained self-attention graph pooling mechanism based on the improved self-attention graph pooling mechanism, under which two self-attention scores are obtained, and then the consistency constraint error is calculated by comparing the difference between the two self-attention scores, and the consistency constraint error is added as a rule term to the loss function of the model to encourage the model to pay more attention to nodes with larger initial attention scores.
[0109] Specifically, it can be seen from the description of step 102 that based on the improved consistency-constrained self-attention graph pooling mechanism, two self-attention scores can be obtained: a first self-attention score and a second self-attention score. The first self-attention score is obtained based on the self-attention graph pooling mechanism in the prior art, and the second self-attention score can be regarded as a pre-estimation of the importance of the node, indicating the relative importance of the node in the graph, which is obtained by other means.
[0110] In one embodiment, the sample feature map is subjected to self-attention map pooling processing based on the improved consistency constraint self-attention map pooling mechanism to obtain the self-attention pooling feature map corresponding to the sample feature map, the first self-attention score, and the second self-attention score. The specific implementation includes: performing a graph convolution operation on the sample feature map to obtain the first self-attention score corresponding to the sample feature map, and then performing self-attention mask processing on the sample feature map based on the first self-attention score to obtain the self-attention pooling feature map corresponding to the sample feature map. And the sample feature map is subjected to regularization processing through the self-attention mechanism to obtain the second self-attention score corresponding to the sample feature map.
[0111] Here, a graph convolution operation is performed on the sample feature map to obtain a first self-attention score corresponding to the sample feature map, and then the sample feature map is self-attention masked based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map. For the specific implementation, reference can be made to the processing process of the self-attention graph pooling mechanism in the prior art, which will not be repeated here.
[0112] It should be noted that the specific implementation of the above-mentioned regularization processing of the sample feature map through the self-attention mechanism to obtain the second self-attention score corresponding to the sample feature map can be seen in the following formula (1):
[0113] Formula (1)
[0114] In the above formula (1), R j is the feature vector of the node in the sample feature graph, P j is the preset distribution of the self-attention scores of the nodes in the sample feature graph, H all,j is the feature matrix of the nodes in the sample feature graph, j=1,2,3...
[0115] Furthermore, in one embodiment, the specific implementation of constructing the loss function according to the predicted state of charge, the actual state of charge, the first self-attention score and the second self-attention score in the above step 103 includes: constructing a first loss sub-function according to the predicted state of charge and the actual state of charge, constructing a second loss sub-function according to the first self-attention score and the second self-attention score, and constructing a final loss function according to the first loss sub-function and the second loss sub-function.
[0116] Optionally, a mean square error loss is used to estimate the error between the predicted state of charge and the actual state of charge. That is, the predicted state of charge and the actual state of charge are substituted as parameters into the mean square error loss function to obtain the first loss sub-function.
[0117] In one embodiment, the specific implementation of constructing the second loss sub-function according to the first self-attention score and the second self-attention score includes: substituting the first sub-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function. Optionally, the consistency error constraint function is an F-norm function. For example, the second loss sub-function is shown in the following formula (2):
[0118] Formula (2)
[0119] In the above formula (2), represents the consistency constrained error between the first self-attention score and the second self-attention score; P represents the second self-attention score, and Q represents the first self-attention score.
[0120] In one embodiment, the specific implementation of constructing the final loss function according to the first loss sub-function and the second loss sub-function includes: performing a weighted operation on the first loss sub-function and the second loss sub-function to obtain the final loss function. For example, performing a weighted operation on the first loss sub-function and the second loss sub-function according to the following formula (3) to obtain the final loss function:
[0121] Formula (3)
[0122] In the above formula (3), represents the final loss function, represents the first loss sub-function, is a parameter used to balance the mean square loss and the consistency constraint error, for example, 0.2.
[0123] The technical solution provided by the embodiment of the present application uses an improved consistency-constrained self-attention map pooling mechanism to perform self-attention map pooling processing on the sample feature map of the sample data when training the battery state of charge estimation model, so as to obtain the self-attention pooling feature map, the first self-attention score and the second self-attention score corresponding to the sample feature map, and obtain the predicted state of charge of the sample battery at the said cut-off time based on the self-attention pooling feature map corresponding to the sample feature map, construct a loss function according to the said predicted state of charge, the actual state of charge, the first self-attention score and the second self-attention score, and use the loss function to adjust the model parameters of the machine learning model to obtain the battery state of charge estimation model, so as to achieve the introduction of the consistency constraint error between the two self-attention scores into the loss function of the model during the model training process, and adjust the model parameters through the loss function, so that the battery state of charge estimation model trained in this way can not only better capture the global feature representation of the battery operating parameter sequence when extracting features from the battery operating parameter sequence to be estimated, but also enhance the consistency and stability of the extracted features, thereby improving the accuracy of the final estimated battery state of charge.
[0124] Figure 2 The present invention provides a flowchart of an embodiment of extracting a sample feature map from sample data. In this embodiment, the sample data includes a battery operating parameter sequence of a sample battery in at least two parameter dimensions. Figure 2 As shown, the process includes the following steps:
[0125] Step 201: construct a graph of the battery operation parameter sequence under each parameter dimension to obtain a sub-feature graph of the sample battery corresponding to each parameter dimension.
[0126] When the sample data includes a battery operating parameter sequence of a sample battery in at least two parameter dimensions, a graph is constructed for the battery operating parameter sequence in each parameter dimension to obtain a sub-feature graph of the sample battery in each parameter dimension.
[0127] For example, assuming that the parameter dimensions include current, voltage and temperature, then here we can obtain the sub-characteristic graph G1 of the sample battery under the parameter dimension of current, the sub-characteristic graph G2 of the sample battery under the parameter dimension of voltage, and the sub-characteristic graph G3 of the sample battery under the parameter dimension of temperature.
[0128] In one embodiment, if Figure 3 As shown, the specific implementation of step 201 includes:
[0129] Step 301: Perform a convolution operation on a battery operating parameter sequence of at least two parameter dimensions to obtain a feature matrix of a sample battery in a historical time interval.
[0130] Here, the battery operating parameters of at least two parameter dimensions collected at the same time are regarded as a set of eigenvalue groups, and then a one-dimensional convolutional neural network is used to perform convolution operations on multiple sets of eigenvalues to obtain the feature matrix of the sample battery in the historical time interval. The feature matrix is a 1*n matrix, where n is the number of the above eigenvalue groups.
[0131] Step 302: multiply the feature matrix by its transposed matrix to obtain the adjacency matrix of the sample battery in the historical time interval.
[0132] Assume that the above feature matrix is H, then the adjacency matrix A obtained in step 302 is: A=HH T .
[0133] Step 303: For each parameter dimension, a graph is constructed according to the adjacency matrix and the battery operation parameter sequence under the parameter dimension to obtain a sub-feature graph of the sample battery corresponding to the parameter dimension.
[0134] Continuing with the above example, the sub-characteristic graph G1 of the sample battery in the parameter dimension of current is represented by G1=(V1,E,A), the sub-characteristic graph G2 of the sample battery in the parameter dimension of voltage is represented by G2=(V2,E,A), and the sub-characteristic graph G3 of the sample battery in the parameter dimension of voltage is represented by G3=(V3,E,A).
[0135] It can be seen that the sub-feature maps of the sample battery under different parameter dimensions share the same adjacency matrix, so the information of other sub-feature maps can be integrated in each sub-feature map.
[0136] The above V1 represents the battery operation parameter sequence of the sample battery under the parameter dimension of current, V2 represents the battery operation parameter sequence of the sample battery under the parameter dimension of voltage, and V3 represents the battery operation parameter sequence of the sample battery under the parameter dimension of temperature. E represents the set of edges.
[0137] Step 202: For each parameter dimension, a graph convolution operation is performed on the sub-feature graph of the sample battery corresponding to the parameter dimension and the battery operation parameter sequence under the parameter dimension to obtain an aggregated feature graph of the sample battery corresponding to the parameter dimension.
[0138] In one embodiment, for each parameter dimension, a graph convolution operation is performed on the sub-feature graph of the sample battery corresponding to the parameter dimension and the battery operation parameter sequence under the parameter dimension to obtain the calculation process of the aggregated feature graph of the sample battery corresponding to the parameter dimension as shown in the following formula (4):
[0139] Formula (4)
[0140] In the above formula (4), H i Represents the aggregated feature map corresponding to the sub-feature map Gi, is the symmetric normalized adjacency matrix, X i Represents the battery operating parameter sequence, W i represents the weight matrix, is the activation function.
[0141] Step 203: fuse the aggregated feature graphs of the sample battery corresponding to each parameter dimension to obtain a sample feature graph.
[0142] In one embodiment, the specific implementation of step 203 includes: performing set feature interaction operations on the aggregated feature graphs corresponding to each two parameter dimensions of the sample battery to obtain interactive aggregated feature graphs corresponding to each two parameter dimensions of the sample battery; performing set feature fusion operations on the interactive aggregated feature graphs corresponding to each two parameter dimensions of the sample battery to obtain sample feature graphs.
[0143] Optionally, the feature interaction operation set above is a product interaction operation. Product interaction allows complex interactions and combinations between features. By calculating the product between features, higher-order feature relationships can be captured, thereby better expressing nonlinear relationships in the input data.
[0144] The feature fusion operation set above is an addition operation.
[0145] See also Figure 4 , which is a schematic diagram of the overall process of the above steps 201 to 203. Figure 4 Middle, H all Represents the final fused sample feature map.
[0146] Figure 2 The process shown in the figure constructs a graph of the battery operating parameter sequence under each parameter dimension to obtain the sub-feature graph of the sample battery corresponding to each parameter dimension, and then for each parameter dimension, performs a graph convolution operation on the sub-feature graph of the sample battery corresponding to the parameter dimension and the battery operating parameter sequence under the parameter dimension to obtain the aggregated feature graph of the sample battery corresponding to the parameter dimension, and finally fuses the aggregated feature graph of the sample battery corresponding to each parameter dimension to obtain the sample feature graph, thereby realizing the fusion of information from multiple parameter dimensions. In this way, on the one hand, it can well mine the hidden information of battery operating parameters of different parameter dimensions, and on the other hand, it can deeply mine the potential interdependence between battery operating parameters of different parameter dimensions, which is helpful to realize the accurate prediction and estimation of battery state of charge.
[0147] Figure 5 This is a flow chart of an embodiment of a battery state of charge estimation method provided in an embodiment of the present application. The process is implemented based on the battery state of charge estimation model trained in the above embodiment, and includes the following steps:
[0148] Step 501: Acquire a target battery operating parameter sequence to be estimated, where the target battery operating parameter sequence includes battery operating parameters of a target battery collected within a set time interval.
[0149] The target battery operating parameter sequence to be estimated is a battery operating parameter sequence of a target battery whose state of charge is to be estimated. Further, the target battery operating parameter sequence includes battery operating parameters of the target battery collected within a set time interval.
[0150] In one embodiment, the target battery operation parameter sequence includes a battery operation parameter sequence under at least two parameter dimensions. Figure 1 The relevant description in the illustrated embodiment will not be repeated here.
[0151] Step 502: input the target battery operating parameter sequence into the battery state of charge estimation model, extract a feature map from the target battery operating parameter sequence through the battery state of charge estimation model, and perform self-attention map pooling on the feature map to obtain a self-attention pooling feature map corresponding to the feature map, and obtain the state of charge of the target battery at the cutoff time of the set time interval based on the self-attention pooling feature map.
[0152] See also Figure 6 , is a schematic diagram of the overall process of the battery state of charge estimation model provided in an embodiment of the present application when estimating the state of charge of a target battery.
[0153] like Figure 6As shown in the figure, the battery state of charge estimation model can be roughly divided into three modules, namely, the multi-source information fusion module, the self-attention graph pooling module and the time series prediction module. Among them, the time series prediction module is optionally implemented using the LSTM (Long Short-Term Memory) structure. The LSTM structure can effectively process time series data and capture its long-term dependencies, and learn the patterns and trends of time series data. Based on this, the LSTM structure can effectively and accurately estimate the state of charge of the target battery.
[0154] The multi-source information fusion module can utilize the above Figure 2 and Figure 3 The technical solution provided by the illustrated embodiment performs fusion processing on the battery operation parameter sequences of the target battery in at least two parameter dimensions to obtain a fused feature map. The specific implementation process will not be described in detail here.
[0155] The self-attention map pooling module can perform self-attention map pooling on the feature map based on the self-attention map pooling mechanism to obtain a self-attention pooling feature map corresponding to the feature map. The self-attention pooling feature map will then be used to predict the state of charge of the target battery. Here, by performing self-attention map pooling on the feature map, the effect of multi-source information fusion can be further improved, and the consistency and stability of information fusion can be enhanced, thereby helping to effectively and accurately estimate the state of charge of the target battery.
[0156] Further, such as Figure 6 As shown in Figure 2, the attention mechanism is introduced into the time series prediction module. By giving different weights to the input features, the attention mechanism makes it easier for the model to capture the long-distance interdependent features in the sequence, further improving the comprehensiveness of data feature extraction. Figure 7 , which is a schematic diagram of the LSTM structure integrating the attention mechanism. Figure 7 In it, y1, y2, y3, y4 are the predicted state of charge output by the time series prediction module, and a1, a2, a3, a4 are the attention coefficients.
[0157] Based on this, the specific implementation of the state of charge estimation module obtaining the state of charge of the target battery at the cutoff moment of the set time interval based on the self-attention pooling feature map corresponding to the feature map includes: determining the attention coefficient of the self-attention pooling feature map corresponding to the feature map based on the attention mechanism, processing the self-attention pooling feature map corresponding to the feature map through the time series prediction module in the battery state of charge estimation model, obtaining the initial predicted state of charge output by the time series prediction module, and performing a weighted operation on the initial predicted state of charge output by the time series prediction module and the attention coefficient to obtain the predicted state of charge of the target battery at the cutoff moment of the set time interval.
[0158] Among them, the specific implementation of determining the attention coefficient of the self-attention pooling feature map corresponding to the feature map based on the attention mechanism includes: firstly performing a nonlinear transformation on the above self-attention pooling feature map, and then using a preset shared attention vector q to obtain the attention value w i , as shown in the following formula (5):
[0159] Formula (5)
[0160] In the above formula (5), q is the preset shared attention vector, a and b are the self-attention pooling feature map H out And the predicted state of charge Y output by the time series prediction module out The weight matrix of , c is the preset bias vector. i represents the node i in the self-attention pooling feature map.
[0161] Then, use the softmax function to focus on the value w i Normalize and get the attention coefficient.
[0162] The above-mentioned calculation process of weighted operation of the predicted state of charge output by the time series prediction module and the attention coefficient to obtain the predicted state of charge of the target battery at the end time of the set time interval is shown in the following formula (6):
[0163] Formula (6)
[0164] In the above formula (6), is the predicted state of charge of the target battery at the end of the set time interval, is the above attention coefficient.
[0165] In addition, the hyperparameters of machine learning models are one of the main factors affecting their performance, and the process of selecting hyperparameters for machine learning models based on experience or multiple attempts is very time-consuming and not always effective in improving model performance. Figure 8 In the technical solution of the embodiment of the present application, in the process of training the battery state of charge estimation model, the Bayesian optimization algorithm is introduced to optimize the hyperparameters of the LSTM module, which helps to improve the prediction accuracy of the battery state of charge by the finally trained LSTM module. Among them, the model hyperparameters are parameters that need to be set before model training, such as learning rate, batch size, number of iterations, regularization parameters and other hyperparameters. The selection of model hyperparameters has a crucial impact on the performance of the model. The Bayesian algorithm optimizes the model hyperparameters using a continuously updated probability model, updates the posterior probability of the optimization function through a smaller number of objective function evaluations, and finds better hyperparameters in a shorter time.
[0166] Figure 5The process shown in the figure obtains the target battery operating parameter sequence to be estimated, inputs the target battery operating parameter sequence into the battery state of charge estimation model, extracts a feature map from the target battery operating parameter sequence through the battery state of charge estimation model, and performs self-attention map pooling processing on the feature map to obtain a self-attention pooling feature map corresponding to the feature map, and obtains the state of charge of the target battery at the cutoff time of the set time interval based on the self-attention pooling feature map, thereby realizing the use of the trained battery state of charge estimation model to quickly predict the state of charge of the target battery, and because the battery state of charge estimation model adopts the above Figure 1 The model trained by the model training method in the illustrated embodiment has good stability and prediction accuracy, so the state of charge of the target battery can be accurately predicted here.
[0167] Fig. 9 This is a block diagram of an embodiment of a training device for a battery state of charge estimation model provided in an embodiment of the present application. Fig. 9 As shown, the device comprises:
[0168] A sample acquisition module 91 is used to acquire sample data, wherein the sample data includes a battery operation parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at the end of the historical time interval;
[0169] A model input module 92, used to input the sample data into a machine learning model to be trained, extract a sample feature map from the sample data through the machine learning model, and perform self-attention map pooling processing on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and obtain a predicted state of charge of the sample battery at the cutoff time based on the self-attention pooling feature map corresponding to the sample feature map;
[0170] A loss function construction module 93, configured to construct a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score;
[0171] The model parameter adjustment module 94 is used to adjust the model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model.
[0172] In a possible implementation manner, the battery operation parameter sequence includes a battery operation parameter sequence of at least two parameter dimensions, and the model input module 92 includes:
[0173] A graph construction unit, used to construct a graph of the battery operation parameter sequence under each parameter dimension, to obtain a sub-feature graph of the sample battery corresponding to each parameter dimension;
[0174] A graph aggregation unit, configured to perform a graph convolution operation on the sub-feature graph of the sample battery corresponding to the parameter dimension and the battery operation parameter sequence under the parameter dimension for each parameter dimension, so as to obtain an aggregated feature graph of the sample battery corresponding to the parameter dimension;
[0175] The graph fusion unit is used to fuse the aggregated feature graphs of the sample battery corresponding to each parameter dimension to obtain the sample feature graph.
[0176] In a possible implementation, the graph construction unit includes:
[0177] A convolution subunit, configured to perform a convolution operation on the battery operation parameter sequence of the at least two parameter dimensions to obtain a feature matrix of the sample battery in the historical time interval;
[0178] A first operator unit, configured to multiply the feature matrix by its transposed matrix to obtain an adjacency matrix of the sample battery in the historical time interval;
[0179] A construction subunit is used to construct a graph for each parameter dimension according to the adjacency matrix and the battery operation parameter sequence under the parameter dimension to obtain a sub-feature graph of the sample battery corresponding to the parameter dimension.
[0180] In a possible implementation, the graph fusion unit includes:
[0181] A second operation subunit is used to perform a set feature interaction operation on the aggregate feature graphs of the sample battery corresponding to each two parameter dimensions, to obtain an interactive aggregate feature graph of the sample battery corresponding to each two parameter dimensions;
[0182] The third operation subunit is used to perform a set feature fusion operation on the interactive aggregation feature graphs of each two parameter dimensions of the sample battery to obtain the sample feature graph.
[0183] In a possible implementation, the model input module 92 includes:
[0184] A first score determination module, configured to perform a graph convolution operation on the sample feature map to obtain a first self-attention score corresponding to the sample feature map;
[0185] A mask module, configured to perform self-attention masking on the sample feature map based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map;
[0186] The second score determination module is used to regularize the sample feature map through a self-attention mechanism to obtain a second self-attention score corresponding to the sample feature map.
[0187] In a possible implementation, the loss function construction module 93 includes:
[0188] A first construction submodule, configured to construct a first loss subfunction according to the predicted state of charge and the actual state of charge;
[0189] A second construction submodule, configured to construct a second loss subfunction according to the first self-attention score and the second self-attention score;
[0190] A synthesis module is used to construct a final loss function according to the first loss sub-function and the second loss sub-function.
[0191] In a possible implementation manner, the second construction submodule is specifically used to:
[0192] Substituting the first sub-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function.
[0193] Fig.10 This is a block diagram of an embodiment of a battery state of charge estimation device provided in an embodiment of the present application. Fig.10 As shown, the device comprises:
[0194] A target data acquisition module 1001 is used to acquire a target battery operating parameter sequence to be estimated, wherein the target battery operating parameter sequence includes battery operating parameters of a target battery collected within a set time interval;
[0195] The state of charge estimation module 1002 is used to input the target battery operating parameter sequence into the battery state of charge estimation model, extract a feature map from the target battery operating parameter sequence through the battery state of charge estimation model, and perform self-attention map pooling processing on the feature map to obtain a self-attention pooling feature map corresponding to the feature map, and obtain the state of charge of the target battery at the cutoff time of the set time interval based on the self-attention pooling feature map.
[0196] In a possible implementation, the state of charge estimation module 1002 obtains the state of charge of the target battery at the end time of the set time interval based on the self-attention pooling feature map corresponding to the feature map, including:
[0197] Determine the attention coefficient of the self-attention pooling feature map corresponding to the feature map based on the attention mechanism;
[0198] Obtaining an initial predicted state of charge according to the self-attention pooling feature map corresponding to the feature map;
[0199] The initial predicted state of charge and the attention coefficient are weighted to obtain the predicted state of charge of the target battery at the end time of the set time interval.
[0200] like Fig.11 As shown, an embodiment of the present application provides a device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0201] Memory 113, used for storing computer programs;
[0202] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the training method of the battery state of charge estimation model provided by any of the above method embodiments, including:
[0203] Acquire sample data, the sample data including a battery operating parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at a cutoff time of the historical time interval;
[0204] The sample data is input into a machine learning model to be trained, a sample feature map is extracted from the sample data through the machine learning model, and a self-attention map pooling process is performed on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and a predicted state of charge of the sample battery at the cutoff time is obtained based on the self-attention pooling feature map corresponding to the sample feature map;
[0205] constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score, and adjusting model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model;
[0206] Alternatively, the method for estimating the battery state of charge provided by any of the foregoing method embodiments may include:
[0207] Acquire a target battery operating parameter sequence to be estimated, wherein the target battery operating parameter sequence includes battery operating parameters of the target battery collected within a set time interval;
[0208] The target battery operating parameter sequence is input into the battery state of charge estimation model, a feature map is extracted from the target battery operating parameter sequence through the battery state of charge estimation model, and the feature map is subjected to self-attention map pooling processing to obtain a self-attention pooling feature map corresponding to the feature map, and the state of charge of the target battery at the cutoff moment of the set time interval is obtained based on the self-attention pooling feature map corresponding to the feature map.
[0209] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the training method of a battery state of charge estimation model or the steps of a battery state of charge estimation method as provided in any of the aforementioned method embodiments is implemented.
[0210] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0211] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.
[0212] It should be understood that the terms used in the text are only for the purpose of describing specific example embodiments, and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used in the text may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0213] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.
Claims
1. A method for training a battery state of charge estimation model, characterized in that: The method comprises: Acquire sample data, the sample data including a battery operating parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at a cutoff time of the historical time interval; The sample data is input into a machine learning model to be trained, a sample feature map is extracted from the sample data through the machine learning model, and a self-attention map pooling process is performed on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and a predicted state of charge of the sample battery at the cutoff time is obtained based on the self-attention pooling feature map corresponding to the sample feature map; constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score, and adjusting model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model; The improved consistency-constrained self-attention map pooling mechanism performs self-attention map pooling processing on the sample feature map to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, including: Performing a graph convolution operation on the sample feature map to obtain a first self-attention score corresponding to the sample feature map; Performing self-attention masking processing on the sample feature map based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map; Regularizing the sample feature map through a self-attention mechanism to obtain a second self-attention score corresponding to the sample feature map; The constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score includes: Constructing a first loss sub-function according to the predicted state of charge and the actual state of charge; constructing a second loss sub-function according to the first self-attention score and the second self-attention score; constructing a final loss function according to the first loss sub-function and the second loss sub-function; The constructing a second loss sub-function according to the first self-attention score and the second self-attention score comprises: Substituting the first self-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function.
2. The method according to claim 1, characterized in that The battery operation parameter sequence includes a battery operation parameter sequence of at least two parameter dimensions, and the extracting a sample feature graph from the sample data includes: Constructing a graph of the battery operation parameter sequence under each parameter dimension to obtain a sub-feature graph of the sample battery corresponding to each parameter dimension; For each of the parameter dimensions, a graph convolution operation is performed on the sub-feature graph of the sample battery corresponding to the parameter dimension and the battery operation parameter sequence under the parameter dimension to obtain an aggregated feature graph of the sample battery corresponding to the parameter dimension; The aggregated feature graphs of the sample battery corresponding to each parameter dimension are fused to obtain the sample feature graph.
3. The method according to claim 2, characterized in that The graph construction of the battery operation parameter sequence under each parameter dimension to obtain the sub-feature graph of the sample battery corresponding to each parameter dimension includes: Performing a convolution operation on the battery operation parameter sequence of the at least two parameter dimensions to obtain a feature matrix of the sample battery in the historical time interval; Multiplying the feature matrix and its transposed matrix to obtain an adjacency matrix of the sample battery in the historical time interval; For each of the parameter dimensions, a graph is constructed according to the adjacency matrix and the battery operation parameter sequence under the parameter dimension to obtain a sub-feature graph of the sample battery corresponding to the parameter dimension.
4. The method according to claim 2, characterized in that: The step of fusing the aggregated feature graphs of the sample battery corresponding to each parameter dimension to obtain the sample feature graph comprises: Performing a set feature interaction operation on the aggregate feature graphs of the sample battery corresponding to each two parameter dimensions, respectively, to obtain an interactive aggregate feature graph of the sample battery corresponding to each two parameter dimensions; The sample battery is subjected to a set feature fusion operation corresponding to the interactive aggregation feature graph of each two parameter dimensions to obtain the sample feature graph.
5. A method for estimating a battery state of charge, characterized in that: The method comprises: Acquire a target battery operating parameter sequence to be estimated, wherein the target battery operating parameter sequence includes battery operating parameters of the target battery collected within a set time interval; Inputting the target battery operating parameter sequence into a battery state of charge estimation model, extracting a feature map from the target battery operating parameter sequence through the battery state of charge estimation model, and performing self-attention map pooling processing on the feature map to obtain a self-attention pooling feature map corresponding to the feature map, and obtaining the state of charge of the target battery at the cutoff time of the set time interval based on the self-attention pooling feature map corresponding to the feature map; The battery state of charge estimation model is trained in the following way: Acquire sample data, the sample data including a battery operating parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at a cutoff time of the historical time interval; The sample data is input into a machine learning model to be trained, a sample feature map is extracted from the sample data through the machine learning model, and a self-attention map pooling process is performed on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and a predicted state of charge of the sample battery at the cutoff time is obtained based on the self-attention pooling feature map corresponding to the sample feature map; constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score, and adjusting model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model; The improved consistency-constrained self-attention map pooling mechanism performs self-attention map pooling processing on the sample feature map to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, including: Performing a graph convolution operation on the sample feature map to obtain a first self-attention score corresponding to the sample feature map; Performing self-attention masking processing on the sample feature map based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map; Regularizing the sample feature map through a self-attention mechanism to obtain a second self-attention score corresponding to the sample feature map; The constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score includes: Constructing a first loss sub-function according to the predicted state of charge and the actual state of charge; constructing a second loss sub-function according to the first self-attention score and the second self-attention score; constructing a final loss function according to the first loss sub-function and the second loss sub-function; The constructing a second loss sub-function according to the first self-attention score and the second self-attention score comprises: Substituting the first self-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function.
6. The method according to claim 5, characterized in that The obtaining the state of charge of the target battery at the end time of the set time interval based on the self-attention pooling feature map corresponding to the feature map includes: Determine the attention coefficient of the self-attention pooling feature map corresponding to the feature map based on the attention mechanism; Obtaining an initial predicted state of charge according to the self-attention pooling feature map corresponding to the feature map; The initial predicted state of charge and the attention coefficient are weighted to obtain the predicted state of charge of the target battery at the end time of the set time interval.
7. A training device for a battery state of charge estimation model, characterized in that: The device comprises: A sample acquisition module, used to acquire sample data, wherein the sample data includes a battery operation parameter sequence of a sample battery within a set historical time interval and an actual charge state of the sample battery at the end of the historical time interval; A model input module, used to input the sample data into a machine learning model to be trained, extract a sample feature map from the sample data through the machine learning model, and perform self-attention map pooling processing on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and obtain a predicted state of charge of the sample battery at the cutoff time based on the self-attention pooling feature map corresponding to the sample feature map; a loss function construction module, configured to construct a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score; A model parameter adjustment module, used to adjust the model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model; The improved consistency-constrained self-attention map pooling mechanism performs self-attention map pooling processing on the sample feature map to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, including: Performing a graph convolution operation on the sample feature map to obtain a first self-attention score corresponding to the sample feature map; Performing self-attention masking processing on the sample feature map based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map; Regularizing the sample feature map through a self-attention mechanism to obtain a second self-attention score corresponding to the sample feature map; The constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score includes: Constructing a first loss sub-function according to the predicted state of charge and the actual state of charge; constructing a second loss sub-function according to the first self-attention score and the second self-attention score; constructing a final loss function according to the first loss sub-function and the second loss sub-function; The constructing a second loss sub-function according to the first self-attention score and the second self-attention score comprises: Substituting the first self-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function.
8. A battery state of charge estimation device, characterized in that: The device comprises: A target data acquisition module, used to acquire a target battery operating parameter sequence to be estimated, wherein the target battery operating parameter sequence includes battery operating parameters of the target battery collected within a set time interval; A state of charge estimation module, used to input the target battery operating parameter sequence into a battery state of charge estimation model, extract a feature map from the target battery operating parameter sequence through the battery state of charge estimation model, and perform self-attention map pooling processing on the feature map to obtain a self-attention pooling feature map corresponding to the feature map, and obtain the state of charge of the target battery at the cutoff time of the set time interval based on the self-attention pooling feature map corresponding to the feature map; The battery state of charge estimation model is trained in the following way: Acquire sample data, the sample data including a battery operating parameter sequence of a sample battery within a set historical time interval and an actual state of charge of the sample battery at a cutoff time of the historical time interval; The sample data is input into a machine learning model to be trained, a sample feature map is extracted from the sample data through the machine learning model, and a self-attention map pooling process is performed on the sample feature map based on an improved consistency constraint self-attention map pooling mechanism to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, and a predicted state of charge of the sample battery at the cutoff time is obtained based on the self-attention pooling feature map corresponding to the sample feature map; constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score, and adjusting model parameters of the machine learning model using the loss function to obtain a battery state of charge estimation model; The improved consistency-constrained self-attention map pooling mechanism performs self-attention map pooling processing on the sample feature map to obtain a self-attention pooling feature map, a first self-attention score, and a second self-attention score corresponding to the sample feature map, including: Performing a graph convolution operation on the sample feature map to obtain a first self-attention score corresponding to the sample feature map; Performing self-attention masking processing on the sample feature map based on the first self-attention score to obtain a self-attention pooling feature map corresponding to the sample feature map; Regularizing the sample feature map through a self-attention mechanism to obtain a second self-attention score corresponding to the sample feature map; The constructing a loss function according to the predicted state of charge, the actual state of charge, the first self-attention score, and the second self-attention score includes: Constructing a first loss sub-function according to the predicted state of charge and the actual state of charge; constructing a second loss sub-function according to the first self-attention score and the second self-attention score; constructing a final loss function according to the first loss sub-function and the second loss sub-function; The constructing a second loss sub-function according to the first self-attention score and the second self-attention score comprises: Substituting the first self-attention score and the second self-attention score as parameters into a preset consistency error constraint function to obtain a second loss sub-function.
Citation Information
Patent Citations
Self-attention video abstraction method based on distribution consistency
CN110287374A
Solar cell panel defect generation method based on generative adversarial network
CN113935977A
Estimation method and system of state of charge of battery cluster, electronic equipment and storage medium
CN114705990A
Voice extraction method and device, neural network model training method and device and storage medium
CN115116448A
Cross-patient unsupervised SEEG epilepsy early warning method based on knowledge distillation
CN116269436A
