Battery state estimation method and device, equipment, medium and product
By constructing a deep learning model that combines a hidden state extraction layer, a global feature extraction layer, and a state prediction layer, the problems of insufficient temporal feature capture and insufficient cross-battery generalization ability in battery state estimation are solved, and high-precision joint prediction of battery state is achieved.
Patent Information
- Application Number
- CN202511851243.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-02-06
AI Technical Summary
In existing technologies, battery state estimation models are limited by model structure and input feature selection, making it difficult to accurately capture the dynamic time-series characteristics of battery parameters, ignoring the correlation between SOC, SOE, and SOH, and lacking cross-battery generalization ability, resulting in poor estimation accuracy.
By employing deep learning methods, a combination of hidden state extraction layer, global feature extraction layer and state prediction layer is used, along with self-attention mechanism and bidirectional gated recurrent unit, to construct an estimation model. This model extracts core common features from the input parameter sequence and achieves joint prediction of multiple states.
It improves the accuracy and adaptability of battery state estimation, enabling high-precision joint prediction of SOC, SOE, and SOH even with small sample data, thus enhancing the model's generalization ability.
Smart Images

Figure CN121476957A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of batteries, and in particular, the present application relates to a battery state estimation method, device, equipment, medium and product. BACKGROUND
[0002] In a battery management system, battery states mainly include state of charge (SOC), state of energy (SOE) and state of health (SOH), etc. These states directly affect the performance, life and safety of the battery, therefore, accurately estimating the battery state is crucial in energy storage systems and electric vehicle applications. With the continuous advancement of battery technology, especially the widespread application of lithium-ion batteries, the estimation methods of SOC, SOH and SOE are also continuously evolving, and more and more research begins to use machine learning and artificial intelligence technology.
[0003] Currently, independent estimation models are usually designed and trained for each state by combining real-time data and historical data of the battery, but the estimation models obtained in this way are limited by the design of the model structure and the selection of input features, and highly dependent on domain experts to select input features in the way of data dimensionality reduction, feature extraction and feature engineering based on prior knowledge, which is prone to the problem of poor prediction accuracy of the estimation model due to the difficulty in mining key features as input features. SUMMARY
[0004] The embodiments of the present disclosure provide a battery state estimation method, device, equipment, medium and product, which can solve the above-mentioned problems of the prior art. The technical solutions are as follows: According to one aspect of the embodiments of the present disclosure, a battery state estimation method is provided, comprising: obtaining a parameter sequence of a target battery in a current period, the parameter sequence being used to indicate a plurality of battery parameters of the target battery at each time step in the corresponding period, the battery parameter being measurement data used to describe the physical characteristics of the battery; inputting the parameter sequence into a pre-trained estimation model to obtain predicted values of a plurality of battery states of the target battery at a target time, the target time being a time indicated by a next time step of the current period, the battery state including state of charge, state of energy and state of health; wherein the estimation model is trained according to a plurality of training samples with training labels, the training sample being a parameter sequence of the target battery in a sample period, and the training label being actual values of the plurality of battery states at the corresponding target time.
[0005] According to another aspect of the embodiments of the present disclosure, a battery state estimation device is provided, the device comprising: a parameter sequence obtaining module, configured to obtain a parameter sequence of the target battery in a current time period, the parameter sequence being used to indicate a plurality of battery parameters of the target battery at each time step in a corresponding time period, the battery parameter being measurement data used to describe a physical characteristic of the battery; a battery state estimation module, configured to input the parameter sequence into a pre-trained estimation model, and obtain a predicted value of a plurality of battery states of the target battery at a target time point output by the estimation model, the target time point being a time point indicated by a next time step of the current time period, the battery state including a state of charge, a state of energy and a state of health; The estimation model is trained according to a plurality of training samples with training labels, the training sample being a parameter sequence of the target battery in a sample time period, and the training label being an actual value of the plurality of battery states at the corresponding target time point.
[0006] According to another aspect of the embodiments of the present disclosure, an electronic device is provided, which includes a memory, a processor and a computer program stored in the memory, the processor executes the computer program to implement the above method.
[0007] According to another aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, which stores a computer program, the computer program is executed by a processor to implement the above method.
[0008] According to an aspect of the embodiments of the present disclosure, a computer program product is provided, which includes a computer program, the computer program is executed by a processor to implement the above method.
[0009] The technical scheme provided by the embodiments of the present disclosure has the following beneficial effects: The strong coupling relationship of the battery states SOC, SOE and SOH in physics is considered, the estimation model depends on the same set of core common features extracted from the input parameter sequence to realize the prediction of a plurality of different battery states, the selection of the features is automatically realized, the estimation model can learn the dependency relationship between different features of multiple states, the estimation model finds a set of optimal parameters meeting the joint prediction target of multiple battery states, the extracted common features can balance and meet the prediction demand of each battery state, after the parameter sequence of the target battery in the current time period is input, the common features are extracted from the parameter sequence to perform the joint prediction of the multiple battery states at the target time point, the predicted value of the multiple battery states of the target battery at the target time point is obtained, and the accuracy of the battery state estimation is effectively improved. BRIEF DESCRIPTION OF DRAWINGS
[0010] In order to more clearly illustrate the technical scheme in the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments of the present disclosure will be briefly introduced.
[0011] Figure 1A flowchart of a battery state estimation method provided by an embodiment of the present disclosure is shown in FIG. 1. Figure 2 A structural diagram of an estimation model provided by an embodiment of the present disclosure is shown in FIG. 2. Figure 3 A structural diagram of a global feature extraction layer provided by an embodiment of the present disclosure is shown in FIG. 3. Figure 4 A flowchart of a model training method provided by an embodiment of the present disclosure is shown in FIG. 4. Figure 5 A structural diagram of a battery state estimation device provided by an embodiment of the present disclosure is shown in FIG. 5. Figure 6 A structural diagram of an electronic device provided by an embodiment of the present disclosure is shown in FIG. 6. DETAILED DESCRIPTION
[0012] Embodiments of the present disclosure will be described below with reference to the accompanying drawings. It should be understood that the embodiments described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present disclosure, and do not limit the technical solutions of the embodiments of the present disclosure.
[0013] Those skilled in the art can understand that the singular forms "a", "an" and "the" used herein include plural forms unless specifically stated otherwise. It should be further understood that the terms "include" and "contain" used in the embodiments of the present disclosure mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude other features, information, data, steps, operations, elements, components and / or their combinations supported by the present technology. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or it can mean that the element and the other element are connected through an intermediate element. In addition, "connected" or "coupled" used herein can include wireless connection or wireless coupling. The term "and / or" used herein means that at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".
[0014] In order to make the purposes, technical solutions and advantages of the present disclosure clearer, the embodiments of the present disclosure will be described in further detail below with reference to the accompanying drawings.
[0015] The technical solutions of the embodiments of the present disclosure and the technical effects produced by the technical solutions of the present disclosure will be described below through the description of several exemplary embodiments. It should be pointed out that the following embodiments can be mutually referenced, borrowed or combined, and the same terms, similar features and similar implementation steps in different embodiments will not be described repeatedly.
[0016] The following describes the terms and related technologies involved in the present application: The five core states of a battery include: SOC, SOE, SOH, SOP, and SOT.
[0017] Among them, SOC (State of Charge) reflects the remaining capacity of the battery, indicating the ratio of the current remaining charge to the rated charge; SOE (State of Energy) reflects the remaining energy of the battery, indicating the ratio of the current remaining energy (releasable energy) to the rated energy; SOH (State of Health) reflects the "aging degree" of the battery, i.e., the current battery's ability to store energy relative to a new battery, indicating the ratio of the current battery's full energy to the new battery's full energy; SOP (State of Power) refers to the maximum power that the battery can provide in a short time; SOT (State of Temperature) refers to the deviation of the current battery temperature from the optimal working temperature.
[0018] With the rapid development of big data technology, deep learning methods have shown excellent ability in dealing with nonlinear complex time series prediction problems, and their success is largely due to the increase in model complexity and the ability to cross-learn massive data sets.
[0019] However, in the face of special scenarios with data scarcity, relying solely on traditional deep learning methods often makes it difficult to learn generalizable patterns from limited samples. For small sample data, complex deep neural network models may cause the model to fit the problem; while overly simple model structures are difficult to fully exploit key feature information in time series data, resulting in poor prediction results.
[0020] Therefore, the main problems of the battery state estimation method in the actual scene are as follows: 1) Insufficient time series modeling capability: traditional methods based on physical models or simple machine learning models are difficult to accurately capture the dynamic time series characteristics of battery voltage, temperature, current, etc.
[0021] 2) Insufficient global feature correlation: there is a complex nonlinear correlation between SOC, SOE, and SOH. Existing methods usually establish different prediction models for SOC estimation, SOE estimation, and SOH estimation, ignoring the correlation between these characteristics.
[0022] 3) Limited cross-battery generalization capability: The data distribution and charge-discharge characteristics of different batteries differ significantly, resulting in insufficient generalization capability of traditional models on new batteries, which requires a large amount of labeled data for retraining.
[0023] Based on this, the embodiment of the present disclosure provides a battery state estimation method combining time series modeling, global feature correlation and cross-battery generalization capability, which is used to solve the technical problems of insufficient time series modeling, insufficient global feature capture and limited generalization capability in the related art to some extent, so as to improve the accuracy and adaptability of battery state estimation and realize high-precision joint estimation of battery SOC, SOE and SOH.
[0024] The technical solutions of the embodiments of the present disclosure and the technical effects of the technical solutions of the present disclosure will be described below through the description of several exemplary embodiments. It should be pointed out that the following embodiments can be mutually referenced, borrowed or combined. For the same terms, similar features and similar implementation steps in different embodiments, they will not be described repeatedly.
[0025] It can be understood that in the battery state estimation method provided by the embodiment of the present disclosure, any method step can be executed by an electronic device and / or a server, and all steps in the method can be executed independently by the electronic device or the server, or executed jointly by the electronic device and the server.
[0026] The server can be a stand-alone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The electronic device can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart voice interaction device (such as a smart speaker), a wearable electronic device (such as a smart watch), a vehicle terminal, a smart home appliance (such as a smart TV), an AR / VR device, etc., but is not limited thereto.
[0027] In the following, the electronic device is taken as the execution subject to introduce the embodiments of the present disclosure, however, this does not constitute a limitation on the embodiments of the present disclosure. The method provided by the embodiments of the present disclosure can be adjusted for other technical solutions for index prediction based on time series data (sequence composed of parameters at each time point in a time period) in addition to battery state estimation.
[0028] Figure 1 The flowchart of the battery state estimation method provided by the embodiments of the present disclosure is shown in FIG. 1, which includes the following steps: Figure 1 In step S101, a parameter sequence of the target battery in a current period is obtained, the parameter sequence being used to indicate a plurality of battery parameters of the target battery at respective time steps in the corresponding period, the battery parameters being measurement data used to describe physical characteristics of the battery.
[0029] Specifically, taking any target battery as an example, each step of the battery state estimation method provided by the embodiments of the present disclosure is described in detail.
[0030] A period refers to a continuous time selected in the process of charging and discharging the battery, and the period includes time points divided according to fixed time intervals. In a time sequence (data arranged in the order of time according to the same index), a time step represents each discrete time point or observation point in the time sequence, and indicates the sequential position of data in time, that is, each time step represents a time point of data collection, which is the index of the corresponding time point of the element in the time sequence.
[0031] For example, a sequence X is composed of data of a plurality of time steps, each time step representing a data point in the sequence, where t represents a time step, and X t represents data of the t th time step in the sequence.
[0032] In the embodiments of the present disclosure, the parameter sequence belongs to a time sequence, and is used to indicate a plurality of battery parameters collected at corresponding real time points of respective time steps of the target battery in the corresponding period, that is, each time step corresponds to a battery parameter group containing a plurality of battery parameters, and each battery parameter can be an original value directly measured or an original value processed by preprocessing, data transformation, etc.
[0033] It can be understood that the battery parameters refer to measurement data used to describe physical characteristics in the working state of the battery, and can be directly measured by a sensor or a tester. The types of the battery parameters include, but are not limited to, voltage, current, temperature, internal resistance, etc.
[0034] In addition, in the embodiments of the present disclosure, the period corresponds to the specific length of continuous time, the time interval between the time points, and the division method, which can be determined according to the characteristics of the battery charging and discharging process and the actual needs of monitoring the battery charging and discharging process.
[0035] The current period refers to a period being performed or recently completed in the process of charging and discharging the battery, or a corresponding current period can be determined by reverse deduction based on a target time point to be predicted. In step S101, the parameter sequence of the target battery in the current period is obtained, and the types and quantities of the battery parameters corresponding to each time step in the parameter sequence and the number of time steps corresponding to the current period can be determined according to actual needs.
[0036] For example, in the charging and discharging process, one group of battery parameters is collected every 1 second, 1 minute is taken as a period, 60 time steps are included in each period, and 60 time steps corresponding to the battery parameters in the sequence are arranged in time sequence to indicate the battery parameters in the corresponding period.
[0037] The current period can refer to a period formed by the current time and the time corresponding to 1 minute before the current time. For example, when the current time is 7:11:05, the current period refers to 7:10:05 to 7:11:05.
[0038] It should be noted that the above determination method of the current period is only taken as a specific example for the purpose of understanding the embodiments of the present disclosure, and the determination method of the current period in actual application includes but is not limited to the above method.
[0039] In step S102, the parameter sequence is input into the pre-trained estimation model to obtain the predicted values of the target battery in the target time of the multiple battery states output by the estimation model, the target time is the time indicated by the next time step of the current period, and the battery state includes the state of charge, the state of energy and the state of health. The estimation model is trained according to a plurality of training samples with training labels, the training sample is a parameter sequence of the target battery in a sample period, and the training label is an actual value of the multiple battery states in the corresponding target time.
[0040] Specifically, the target time is the time indicated by the next time step of the current period, which refers to the time sequence relationship between the target time and the current period. In actual application, the time interval between the target time and the current period can be the same as or different from the time interval of the time step in the current period, which can be set according to actual needs.
[0041] For example, the time interval of the time step in each period is 1s, and the real time can be taken as a period of 1 minute. The battery state in the target time indicated by the parameter sequence of each period after 1s or 10s is predicted.
[0042] The battery state includes the state of charge SOC, the state of energy SOE and the state of health SOH. In order to estimate the battery state of the target battery at the target time, the estimation model needs to be pre-trained. The trained estimation model outputs the SOC predicted value, the SOE predicted value and the SOH predicted value of the target battery at the target time when the parameter sequence of the target battery in the current period is input.
[0043] In the embodiments of the present disclosure, the estimation model is a model applied to the target battery. The estimation model is trained according to a plurality of training samples with training labels. The training sample is a parameter sequence of the target battery in a sample period, and the training label is an actual value of the multiple battery states in the corresponding target time of the sample period.
[0044] It can be understood that when the amount of training sample data of the target battery is sufficient, the estimation model can be directly trained by using the training sample of the target battery, and when the amount of training sample data of the target battery is insufficient, the base model can be trained in advance according to the training samples of several different batteries, and the estimation model can be obtained by fine-tuning the base model by using the training sample of the target battery. The specific structure of the estimation model and the specific way of model training can be determined according to actual needs.
[0045] After obtaining the parameter sequence of the target battery in the current period, in step S102, the parameter sequence is input into the pre-trained estimation model to obtain the predicted values of the multiple battery states of the target battery at the target time output by the estimation model, and the predicted values of the multiple battery states include the SOC predicted value, the SOE predicted value and the SOH predicted value.
[0046] The five core states of the battery include SOC, SOE, SOH, SOP and SOT. The embodiments of the present disclosure consider that SOE=SOCxSOHxrated energy, SOC, SOE and SOH have strong correlation, and the estimation model is constructed to jointly predict SOC, SOE and SOH, so that when the model is trained using labeled training samples, it can learn the internal correlation between SOC, SOE and SOH according to the more deep "generalization features" of the measured battery parameters that can explain the short-term power change and long-term performance decay at the same time, and realize more accurate prediction compared with the estimation model for predicting a single battery state.
[0047] The technical solutions provided by the embodiments of the present disclosure consider the strong coupling relationship of the battery states SOC, SOE and SOH in physics. The estimation model relies on the same set of core common features extracted from the input parameter sequence to realize the prediction of multiple different battery states, automatically realizes the selection of features, so that the estimation model can learn the dependency relationship between different features of multiple states, and make the estimation model find a set of optimal parameters that meet the joint prediction goals of multiple battery states, so that the extracted common features can balance and meet the prediction needs of each battery state. After inputting the parameter sequence of the target battery in the current period, the common features are extracted from the parameter sequence to jointly predict the multiple battery states at the target time, and the predicted values of the multiple battery states of the target battery at the target time are obtained, which effectively improves the accuracy of battery state estimation.
[0048] In one possible implementation, the estimation model includes a hidden state extraction layer, a global feature extraction layer and a state prediction layer. The parameter sequence is input into the pre-trained estimation model to obtain the predicted values of the multiple battery states of the target battery at the target time output by the estimation model, including: input the parameter sequence into the hidden state extraction layer, obtain a hidden state sequence output by the hidden state extraction layer, and the hidden state sequence includes a hidden state of each time step, and the hidden state of each time step indicates a time dependence relationship between the battery parameter of the time step and the battery parameters of other time steps; input the hidden state sequence into the global feature extraction layer, perform feature extraction on the hidden state sequence by using a self-attention mechanism of the global feature extraction layer, and obtain a global feature sequence, and the global feature sequence includes a global feature of each time step, and the global feature of each time step is obtained according to an association strength between the hidden state of the time step and the hidden states of all time steps; input the global feature of the last time step in the global feature sequence as a target global feature, input the target global feature into the state prediction layer, map the target global feature to a value range corresponding to each battery state by using the state prediction layer, and obtain and output a prediction value of the multiple battery states at the target moment.
[0049] Specifically, Figure 2 A structural schematic diagram of an estimation model provided by the embodiment of the present disclosure is shown in FIG. 1. Figure 2 As shown in FIG. 1, the estimation model includes a hidden state extraction layer, a global feature extraction layer and a state prediction layer connected in sequence.
[0050] It can be understood that the parameter sequence, the hidden state sequence and the global feature sequence processed by the estimation model are all time sequences, and also represent a calculation unit for single-step state updating and information transmission of the model.
[0051] The parameter sequence input into the estimation model is determined, the parameter sequence is first input into the hidden state extraction layer, the time dependence relationship of the battery parameter in the parameter sequence is extracted by using the hidden state extraction layer, a hidden state sequence is obtained and output, and the hidden state sequence includes a hidden state of each time step, and the hidden state of each time step is a multi-dimensional array, which contains a feature representation of the battery at the time step, and indicates a time dependence relationship between the battery parameter of the time step and the battery parameters of other time steps.
[0052] It can be understood that the hidden state extraction layer can be implemented by using a Long Short-Term Memory (LSTM), a Gated Recurrent Unit (GRU) or a related variant, for capturing long-term dependence relationship in a time sequence, and the specific actual structure and function can be set according to requirements.
[0053] For example, the hidden state extraction layer is set as a gated recurrent unit (GRU), the GRU controls the flow of information through a gating mechanism, including an update gate and a reset gate, so that the hidden state can be passed between time steps and keep important information, the hidden state is updated at each time step according to the input of the current time step and the hidden state of the previous time step, therefore, there is a recursive relationship between the hidden states of each time step in the hidden state sequence, and each hidden state of each time step indicates the temporal dependency of the input of the current time step and the input of other time steps before the current time step, so as to capture the long-term dependency in the power time sequence.
[0054] The hidden state sequence output by the hidden state extraction layer is input into the global feature extraction layer, and the global feature extraction layer is used to extract features of the hidden state sequence through a self-attention mechanism, to obtain the global feature of each time step, and to obtain the global feature sequence by comprehensively considering the global features of all time steps.
[0055] The self-attention mechanism is a deep learning mechanism that captures the internal association of a sequence through dynamic weight allocation, so that the model can dynamically evaluate the association strength between each element and all other elements in the sequence when processing a time sequence, and recalculate a new representation of each element according to the association strength, the new representation being a global feature that integrates global information, in the embodiment of the present disclosure, the global feature of each time step is obtained according to the association strength between the hidden state of the time step and the hidden states of all time steps.
[0056] It can be understood that when the global feature extraction layer implements the self-attention mechanism, an independent self-attention layer, a stacked multi-layer self-attention layer or the like can be used, and the specific actual structure and function can be set according to requirements.
[0057] The global feature of the last time step in the global feature sequence is taken as a target global feature, the target global feature contains the cumulative information and context of all time steps in the hidden state sequence, and can reflect the comprehensive information of the entire hidden state sequence, that is, can reflect a high concentration and deep understanding of the parameter sequence, and is representative in capturing long-term dependencies and predicting the battery state at the target time, effectively improving the accuracy of the prediction of the battery state at the target time.
[0058] The target global feature is input into the state prediction layer, and the target global feature is mapped to the value range corresponding to each battery state through the state prediction layer, to obtain and output the predicted values of the multiple battery states at the target time.
[0059] For example, the state prediction layer includes a full connection layer, after determining the target global feature, the target global feature is linearly transformed by the full connection layer to map the target global feature to the required output dimension, i.e., to the value range corresponding to SOC, SOE and SOH respectively, to realize the prediction and output of each battery state at the target time.
[0060] The technical scheme provided in the embodiments of the present disclosure captures the local and sequential dependency relationship in the parameter sequence by the hidden state extraction layer, understands the evolution logic of the battery parameters over time, and ensures that the information is transmitted between time steps like a chain, effectively capturing the long-term time dynamics. The global feature extraction layer directly calculates the correlation strength between any two time steps in the sequence globally based on the hidden state sequence by using the self-attention mechanism, and the global feature sequence fuses all the global information of all time steps based on the hidden state sequence. Taking the global feature of the last time step as the prediction basis, both local time series dependency and global context association are considered, thereby improving the accuracy of joint prediction of multiple battery states.
[0061] In one possible implementation, the hidden state sequence output by the hidden state extraction layer includes: The hidden state sequence of the parameter sequence is extracted in the forward direction by the hidden state extraction layer in the forward direction according to the time step sequence, and the hidden state sequence of the parameter sequence is extracted in the backward direction by the hidden state extraction layer in the backward direction according to the time step reverse sequence. The hidden state of each time step in the forward hidden state sequence indicates the dependency relationship between the battery parameters of the time step and the battery parameters of other time steps before the time step, and the hidden state of each time step in the backward hidden state sequence indicates the dependency relationship between the battery parameters of the time step and the battery parameters of other time steps after the time step. The hidden state sequence is obtained by combining the forward hidden state sequence and the backward hidden state sequence.
[0062] Specifically, the hidden state extraction layer in the embodiments of the present disclosure is implemented by a variant of GRU, i.e., a bidirectional gated recurrent unit (Bi-GRU).
[0063] The Bi-GRU adopts a bidirectional structure and is composed of two GRU units in two directions, i.e., a forward gated recurrent unit (forward GRU) and a backward gated recurrent unit (backward GRU) connected in parallel. The forward GRU processes the sequence from front to back in the time step sequence, and the backward GRU processes the sequence from back to front in the time step reverse sequence. Finally, the outputs of the forward GRU and the backward GRU are combined to capture the past and future information.
[0064] In this embodiment of the disclosure, the parameter sequence is input to the hidden state extraction layer. The hidden state of the parameter sequence is extracted by the forward gated loop unit in the order of time steps. The hidden state of each time step indicates the temporal dependency between the battery parameters of the time step and the battery parameters of other time steps before the time step. The forward hidden state sequence is obtained from the hidden states of all time steps.
[0065] The backward hidden state sequence is extracted by the backward gated loop unit in reverse order of time steps through the hidden state extraction layer. The hidden state of each time step indicates the temporal dependency between the battery parameters of the time step and the battery parameters of other time steps after the time step. The backward hidden state sequence is obtained from the hidden states of all time steps.
[0066] For example, the parameter sequence X = (x1, x2, ..., x... T Taking any time step as the current time step as an example, let the current time step be denoted as t, where x t These are the battery parameters at time step t. The hidden state forward at time step t is denoted as... The backward hidden state is denoted as , Depends on (x1, ..., x) t ), Depends on (x) t , ..., x T ).
[0067] For each time step in the forward and backward hidden state sequences, the two hidden states are combined by splicing or averaging to obtain the final output hidden state at each time step. The hidden state sequence is obtained by using the final output hidden states at each time step.
[0068] Bi-GRU generates a more comprehensive and accurate hidden state representation for each time point by simultaneously fusing past and future contextual information, thereby significantly improving the model's ability to understand the overall sequence and the accuracy of the final prediction.
[0069] In one possible implementation, the global feature extraction layer comprises a first module and multiple second modules connected in sequence. A global feature extraction layer employs a self-attention mechanism to extract features from the hidden state sequence, resulting in a global feature sequence, including: The first module performs position encoding on the hidden state sequence, adding the position information of each hidden state in the hidden state sequence to the hidden state to obtain the encoded sequence; determining a target sequence for each second module input, the target sequence for the first second module being the encoding sequence, and the target sequence for the non-first second module being the output of the previous second module; for each second module, inputting the corresponding target sequence into the second module, dynamically calculating a weight for the target sequence by the second module using a multi-head self-attention mechanism, and updating the target sequence according to the weight to obtain a first feature sequence, the weight being used to represent the correlation strength between any two elements in the target sequence; performing first residual connection and layer normalization, feed-forward neural network processing and second residual connection and layer normalization on the first feature sequence in sequence to obtain a second feature sequence; taking the second feature sequence output by the last second module as the global feature sequence.
[0070] Specifically, the global feature extraction layer in the embodiments of the present disclosure is implemented using a Transformer encoder, the Transformer encoder is stacked by a plurality of identical modules, each module includes a multi-head self-attention mechanism (Multi-Head Self-Attention) submodule and a feed-forward neural network (Feed-Forward Neural Network) submodule, and each submodule is connected with a residual connection (Residual Connection) and a layer normalization (Layer Normalization).
[0071] Correspondingly, Figure 3 A structural diagram of a global feature extraction layer provided by the embodiments of the present disclosure is shown in FIG. 1. Figure 3 As shown in FIG. 1, the global feature extraction layer in the embodiments of the present disclosure includes a first module and a plurality of second modules connected in sequence, wherein the first module is used to add position information to each element in the input hidden state sequence, and each second module includes a multi-head attention mechanism submodule and a feature encoding submodule connected in sequence.
[0072] In all second modules, the input of the first second module is the output of the first module (i.e., the encoding sequence), and the input of the non-first second module is the output of the previous second module (i.e., the first feature sequence).
[0073] The hidden state sequence is input into the first module of the global feature extraction layer, and the hidden state sequence is position encoded by the first module to add position information indicating the position of each hidden state in the time sequence of the hidden state sequence into the hidden state to obtain an encoding sequence.
[0074] It can be understood that the position coding refers to adding (embedding) position information into the vector of each hidden state, improving the understanding of the sequence by the model, and the specific way of position coding can include but is not limited to absolute position coding, relative position coding, etc.
[0075] The self-attention mechanism enables each element in the sequence to pay attention to and weight other elements in the entire sequence to generate a new output representation. The multi-head self-attention mechanism works by processing multiple attention heads in parallel to enhance the diversity and accuracy of feature extraction, capture complex dependency relationships between different positions in the sequence, and improve the modeling ability of the model for long-distance information and multi-perspective features.
[0076] The target sequence input to each second module is determined, and the target sequence input to the first second module is the encoded sequence, and the target sequence input to the non-first second module is the output of the previous second module. The step of obtaining the output of the target sequence processed by the second module includes: For each second module, the corresponding target sequence is input into the second module, and the multi-head self-attention mechanism is adopted by the multi-head attention mechanism submodule. For each attention head, the correlation strength between elements at different positions in the target sequence is captured, and the correlation strength between any two elements (which can be the same) in the target sequence is represented by a weight. The higher the correlation strength, the greater the weight.
[0077] For each attention head, the weight is dynamically calculated for the target sequence, and the target sequence is updated according to the weight. The updated target sequence obtained by each attention head is integrated to obtain a first feature sequence.
[0078] The first feature sequence is input into the feature encoding submodule, and the first feature sequence is sequentially processed by the feature encoding submodule through first residual connection and layer normalization, feedforward neural network processing, and second residual connection and layer normalization to obtain a second global feature sequence. The second feature sequence is taken as the output of the second module, and the second feature sequence output by the last second module is taken as the global feature sequence.
[0079] Among them, the residual connection and layer normalization stabilize the data distribution of the output on the basis of preserving the input (the second global feature sequence or the output of the feedforward neural network), prevent the problem of small gradient in the deep network, and optimize and improve the modeling ability. The feedforward neural network independently transforms the features at each position, enhancing the expression ability of the model.
[0080] By stacking the second module, hierarchical abstraction of features is realized, and residual connection and layer normalization are used to ensure stable training of deep networks. Compared with a single-layer structure, more complex temporal dependencies can be captured, and the expression ability and prediction accuracy of the model can be significantly improved.
[0081] In a possible implementation, the second module employs a multi-head self-attention mechanism to dynamically calculate weights for the target sequence, and updates the target sequence according to the weights to obtain the first feature sequence, including: performing multiple sets of linear transformations on the target sequence, for each set of linear transformations, obtaining a matrix set, the matrix set including a query matrix, a key matrix, and a value matrix; for each matrix set, multiplying the query matrix and the transpose of the key matrix to obtain an attention score matrix, the attention scores in the attention score matrix representing the association strength between any two elements in the target sequence; normalizing each row of the attention score matrix to convert the attention scores into weights to obtain a weight matrix, each row in the weight matrix representing the attention ratio of the corresponding element in the row to all elements in the target sequence; multiplying the weight matrix and the value matrix to obtain a second feature sequence; concatenating and dimensionally reducing all second feature sequences corresponding to the matrix sets to obtain the first feature sequence.
[0082] Specifically, the second module employs a multi-head self-attention mechanism, each attention head corresponding to a different subspace, and different attention heads independently calculating attention weights for different subspaces to capture different dimensional dependencies in the target sequence.
[0083] The specific steps of the second module for processing the target sequence to obtain the first feature sequence include: performing multiple sets of linear transformations on the target sequence, each set of linear transformations passing through three linear layers (Linear layers) to obtain a query vector (Query), a key vector (Key), and a value vector (Value) corresponding to each element, and stacking the vectors of different types according to the order of elements to obtain a query matrix, a key matrix, and a value matrix.
[0084] Each query vector, key vector, and value vector is a multi-dimensional vector, the query vector representing the content that needs to be focused on, i.e., corresponding to each element in the target sequence, and playing a role of finding relevant information at the current processing position, the key vector representing the "identity" or "feature" of each element in the target sequence, and the value vector representing the actual information content of each element in the target sequence.
[0085] The number of sets of linear transformations is the same as the number of "heads" of the multi-head attention mechanism, and for each set of linear transformations, a matrix set is obtained, the matrix set including a query matrix, a key matrix, and a value matrix.
[0086] The following takes any matrix set as an example to describe in detail the steps of obtaining the first feature sequence: The query matrix in the matrix set is multiplied by the transpose of the key matrix to obtain an attention score matrix, and the attention scores in the attention score matrix are used to represent the association strength between any two elements in the target sequence.
[0087] It can be understood that the attention score matrix is denoted as S, where an element s[i, j] represents an attention score between an i-th query vector Q i in the query matrix and a j-th key vector K j in the key matrix. The attention score is calculated by calculating the dot product of Q i and K j, multiplying each term of Q i and K j and summing up, and taking the calculated scalar as the attention score to measure the similarity between Q i and K j.
[0088] Each row in the attention score matrix is normalized by Softmax (a normalized exponential function) to convert the attention scores into weights to obtain a weight matrix. Each row in the weight matrix represents the attention ratio of the element corresponding to the row in the target sequence to all elements in the target sequence, and the sum of all elements in each row in the weight matrix is 1.
[0089] The weight matrix is multiplied by the value matrix to obtain a second feature sequence, that is, for each element in the target sequence, a weight vector corresponding to the element is determined in the weight matrix, and a second feature corresponding to the element is obtained by weighted summing all value vectors with the weight vector. The second feature sequence is obtained by the second features corresponding to all elements.
[0090] The second feature sequences corresponding to all matrix sets are spliced and dimensionally reduced to obtain a first feature sequence.
[0091] The technical solution provided by the embodiments of the present disclosure projects the feature representation into multiple different subspaces through the multi-head attention mechanism to capture complex dependency relationships in different dimensions in the sequence from multiple perspectives in parallel. This multi-angle feature extraction method greatly enhances the richness and robustness of the model, and ultimately obtains more comprehensive and accurate global features through splicing and fusion, thereby improving the accuracy of model prediction.
[0092] In one possible implementation, the estimation model is generated in the following manner: Obtain the battery parameters of the target battery history and the actual values of the multiple battery states of the target battery at each time point; Divide the multiple historical battery parameters into time periods, determine the parameter sequence of multiple sample periods, and determine the actual values of the multiple battery states at the corresponding target time point for each sample period according to the actual values of the multiple battery states of the target battery at each time point; Fine-tune the parameters of the pre-trained base model by taking the parameter sequence of the sample period as the training sample and the actual values of the multiple battery states at the corresponding target time point as the training label to obtain the estimation model; The base model is a training sample with a training label constructed based on historical battery parameters of a plurality of different batteries and actual values of a plurality of battery states of the different batteries at respective moments, and is obtained through training in a meta-learning framework.
[0093] Specifically, in traditional machine learning, a large amount of labeled data is usually used for training for a specific task to learn a mapping relationship from an input sample X to a label Y: The prediction is usually also in line with expectations through the function relationship in the test sample. However, the function is usually specific to a certain task (a prediction task for a fixed battery), that is, when predicting the battery state, only a fixed battery can achieve good prediction results. When the data set changes, if the model is not retrained, the prediction effect of the model will become very poor.
[0094] Considering that the data distribution and charge-discharge characteristics of different batteries are significantly different, there is a problem of insufficient training data when training the model based on the data of a fixed battery. If the model is directly trained based on the data of a plurality of different batteries, a large amount of data needs to be labeled, which is costly. Moreover, the differences between the batteries make it difficult for the model to distinguish common features and individual features, resulting in poor robustness of the learned features and insufficient generalization ability when applied to new batteries.
[0095] Based on the above problems, the embodiment of the present disclosure introduces a meta-learning (Model-Agnostic Meta-Learning, MAML) framework. In contrast, meta-learning is to train a task-independent model, which focuses on how to learn a generalized model from a small amount of samples, so that the model can be iteratively trained on a plurality of different battery state estimation tasks, thereby learning the commonalities and differences between tasks, and enabling the model to extract general learning rules and strategies from multiple tasks.
[0096] The purpose of meta-learning is to find a mapping relationship from a task set (prediction tasks for different batteries) to an optimal function corresponding to each task, that is In this mapping, represents the function learned by the meta-learning model. Specifically, meta-learning is regarded as learning a general learning ability function which represents the abstract learning ability of the model. On this basis, learn corresponds to a specific task, and the function is independent of a specific task and has general learning ability.
[0097] In the embodiments of the present disclosure, the training samples with labels are constructed in advance based on the historical battery parameters of several different batteries and the actual values of the plurality of battery states of different batteries at each time, and a base model is trained in a meta-learning framework, where the construction of the training samples is described above and will not be repeated here, and the structure, loss function and specific training method of the base model can be determined according to actual needs.
[0098] Since the base model is obtained by meta-training on the charge and discharge data (historical battery parameters) of a plurality of batteries, the base model has the generalization ability across batteries and can well support the joint SOC, SOE and SOH estimation task, and improve the synergy of each state estimation through the shared meta-feature extraction module.
[0099] For any target battery, the parameters of the base model can be fine-tuned using the training samples constructed from the charge and discharge data of the target battery to obtain an estimation model for performing the joint SOC, SOE and SOH estimation task of the target battery.
[0100] The following describes each step of obtaining the estimation model with any target battery as an example: The historical battery parameters of the target battery and the actual values of the plurality of battery states of the target battery at each time are obtained.
[0101] The plurality of historical battery parameters are divided into time periods, the parameter sequences of a plurality of sample periods are determined, and the actual values of the plurality of battery states at the target time corresponding to each sample period are determined according to the actual values of the plurality of battery states of the target battery at each time.
[0102] For example, the recorded running data in the charge and discharge process of the target battery are obtained, including: voltage, temperature, current, SOC, SOE and SOH, etc., where the recording time interval of the measured data in each data is 1s, the recording time interval of the true values of the battery states is 1min, the collected data is normalized to normalize the numerical values of the voltage, temperature, current and other battery parameters to a unified range, ensuring the numerical stability in the training process, and for each battery parameter, the historical battery parameters (continuous time sequence corresponding to the battery parameters) are obtained.
[0103] For each battery parameter, sampling is performed on the continuous time sequence according to a fixed time window (length of the time period) to obtain the parameter sequences of a plurality of sample periods, and for each sample period, the target time corresponding to the sample period is determined, and the SOC, SOE and SOH corresponding to the target time are obtained from the historical running data.
[0104] The parameter sequence of the sample period is taken as a training sample, and the actual values of the plurality of battery states of the corresponding target moment are taken as training labels. The parameter of the basic model is updated through multiple iteration training on the pre-trained basic model to realize parameter fine-tuning of the basic model for the target battery estimation task and obtain an estimation model.
[0105] The technical solution provided by the embodiments of the present disclosure trains a basic model in a meta-learning framework based on training samples of a plurality of different batteries in advance, so that the basic model has cross-battery generalization capability. When deployed to a new battery for a battery state prediction task, the parameter of the basic model can be fine-tuned with a small amount of training samples of the new battery, realizing high-precision joint estimation of the SOC, SOE and SOH of the new battery, solving the cross-domain estimation problem of battery states under a small sample condition, and improving the real-time performance and reliability of battery state evaluation in a storage system.
[0106] On this basis, the basic model also has self-adaptive learning capability and can dynamically adjust the model parameters according to new training samples to optimize the feature extraction effect. For example, the basic model is fine-tuned with new training samples according to a preset period (such as every month) to enable the basic model to keep pace with the times, dynamically absorb new characteristics brought by battery aging, and ensure that the prediction accuracy does not decrease over time.
[0107] In one possible implementation, the method further includes: training the initial basic model in the meta-learning framework for at least one round to obtain the basic model. The steps of each round of training include: determining the initial model applied in the current round of training, and a plurality of tasks processed in the training, for each task, determining a first sample set and a second sample set corresponding to the task, the task corresponding to one battery, the first sample set and the second sample set each including a plurality of training samples with training labels, and the first sample set and the second sample set being mutually exclusive; for each task, copying the parameters of the initial model, training the initial model with the first sample set corresponding to the task, updating the parameters of the copied initial model to obtain an intermediate model; for each task, inputting each training sample in the second sample set into the intermediate model to obtain a prediction value corresponding to each training sample, and obtaining a loss corresponding to the task according to the difference between the prediction values and the actual values of all training samples in the second sample set; summing the losses of all tasks to obtain a total loss, updating the parameters of the initial model with the total loss to obtain the initial model after the current round of training, and taking the initial model after the current round of training as the initial model for the next round of training.
[0108] Specifically, the model is iteratively trained on multiple different battery state estimation tasks in a meta-learning framework, learning the commonalities and differences between tasks, constantly optimizing the initial network weights, enhancing the model's adaptability to different battery state estimation task data, and enabling it to quickly adapt to other battery state prediction tasks. In the training phase, a cross-task training mode is adopted, and the battery state prediction of each battery is regarded as an independent task. Among the M total tasks, a specific task can be represented as All training samples corresponding to each task are divided into training data and test data , the training data is used to construct the support set, and the test data is used to construct the query set, and the support set and the query set are mutually exclusive, the intersection of the support set and the query set is an empty set, .
[0109] Each round of training includes two stages of inner learning and outer learning. Through the alternating iteration of inner learning and outer learning, the model can gradually learn a general learning ability function, which can generate the optimal learning function according to the characteristics of the task.
[0110] In the inner learning stage, the support set is applied, and the model will learn and train for the selected battery state training task. Similar to traditional machine learning methods, it focuses on the learning process of a single task, each task includes input data (voltage, temperature, current, etc.) and target output (SOC, SOE, SOH), and by using the sample data of the task, a model or function specific to the task is learned.
[0111] In the outer learning stage, the query set is applied, and based on the inner learning, multiple tasks are learned to construct meta-knowledge, i.e., cross-task general patterns and knowledge. By integrating and summarizing the learning experience of multiple tasks, meta-knowledge is generated, which can capture the commonalities and differences between different tasks. The outer learning process aims to extract the general features in the task set, so that the model can have better generalization ability and adaptability.
[0112] In the model training process, the feature extractor f (i.e., the model in this embodiment) and the meta-learner g play a key role. The main purpose of the feature extractor is to capture the most prominent feature information of each task, which is the cornerstone of the model training process. The optimization process of the feature extractor depends on the feedback signal of the meta-learner. The purpose of the meta-learner is to guide the optimization of the feature extractor. Through iterative learning of multiple tasks, the network weight parameters are adjusted so that the key feature information extracted is given a larger weight, and it is updated towards the direction of adapting to the task, thereby inducing general meta-knowledge between different tasks, i.e., a set of optimal initialization parameters. Through the mutual cooperation of the feature extractor and the meta-learner, and the alternating optimization iteration, the model can better adapt to different tasks.
[0113] At least one round of training is performed on the initial base model using the meta-learning framework. The original parameters of the initial base model are randomly initialized. In each round of training, the task parameters are trained using the support set of each task in the inner learning stage, and the loss is calculated using the query set in the outer learning stage, and the original parameters are updated. Through multiple rounds of training, a model parameter with generalization and high sensitivity is obtained, thereby obtaining the trained base model, which ensures that the base model becomes more sensitive to subtle changes in parameters when migrating to a new task. For the first round of training, the model applied is the initial base model. For non-first round of training, the starting model applied is the updated base model obtained in the previous round of training. Figure 4 A model training method flowchart provided by an embodiment of the present disclosure is shown in FIG. 1. Figure 4 As shown in FIG. 1, the model applied in each round of training is referred to as an initial model, and the steps implemented in each round of training are described as follows: The initial model applied in this round of training is determined. In order to learn the general knowledge of each task, a group of mini-batches is randomly sampled from the task space as the tasks processed in this round of training, and the tasks are one-to-one corresponding to the batteries. For each task N, a first sample set (i.e., the support set of task N in this round of training) is determined by sampling from the pre-constructed support set of the task, and a second sample set (i.e., the query set of task N in this round of training) is determined by sampling from the pre-constructed query set of the task.
[0114] It can be understood that the first sample set and the second sample set are obtained according to the sampling support set and the query set, respectively. Since the support set and the query set are obtained by dividing the training samples, the first sample set and the second sample set each include multiple training samples with training labels, i.e., parameter sequences, and the first sample set and the second sample set are mutually exclusive.
[0115] In the embodiment of the present disclosure, the number of tasks, the number of training samples in the first sample set and the second sample set in each round of training can be determined according to actual needs.
[0116] For example, the way of sampling all tasks follows the N-way K-shot mode of Few-Shot Learning. The samples of each task are randomly sampled from the source battery dataset (containing all batteries), and the classification task N represents the number of battery categories (such as various types including lithium-ion batteries, sodium-ion batteries, etc.) contained in each task, and K represents the number of labeled samples in each class.
[0117] For the battery state estimation task, N can be regarded as N different battery multi-state prediction tasks, and K is understood as K sequence numbers contained in each battery state prediction task, and K parameter sequences are extracted to form a mini-batch, for example: taking the energy storage station charging and discharging data as an example, regarding the data of one battery in each energy storage cabin as a time series task, randomly selecting N tasks from multiple energy storage battery data, and selecting K parameter sequence data for each energy storage battery. By combining the samples of different category tasks through the N-way K-shot mode, the first sample set and the second sample set of each training task are constructed in each round of training.
[0118] Inner learning stage: For each task , copy the parameters of the initial model, and extract the training samples (parameter sequences) in the first sample set Input the initial model and get the predicted value.
[0119] In the training stage, the loss function adopts a multi-task loss function, which comprehensively considers the prediction errors of SOC, SOE and SOH:
[0120] Among them, , , are weight coefficients, , , are the loss functions of each battery state, and the specific type of the loss function can be determined according to actual needs.
[0121] For example, the mean square error MSE is used as the loss function, as shown in the following formula:
[0122] In the formula, represents the length of the time series prediction range; is the initial weight of the model; is the true value; is the output value of the feature extractor, i.e. the predicted value of the model.
[0123] After the loss is calculated, the first gradient descent is performed for each task in the mini-batch, and m sets of parameters are updated for m tasks in a mini-batch.
[0124] The random gradient descent algorithm is used to minimize the loss and the parameters are updated as follows:
[0125] wherein, is the learning rate of the inner loop.
[0126] The parameters adapted to the current task are obtained by updating the parameters on the first sample set of the task for multiple iterations , and the parameters are used as the parameters of the intermediate model to obtain the intermediate model corresponding to each task in the N tasks. It can be understood that each parameter update in the inner loop can be regarded as a temporary update on the copied initial model parameters, which are only temporary parameters.
[0127] Outer loop learning stage: For each task , the training samples in the second sample set, i.e., the parameter sequence , are extracted and input into the intermediate model to obtain the predicted value corresponding to each training sample. The loss corresponding to the task is obtained according to the difference between the predicted value and the true value of all training samples in the second sample set.
[0128] The loss is calculated according to the parameters obtained by the inner loop learning , and the second gradient descent parameter update is calculated as follows:
[0129] wherein, is the learning rate of the outer loop, denoted as the meta-learning rate, which is used to control the step size of each parameter update in the outer loop.
[0130] The goal of the outer loop learning is to minimize the sum of the loss functions of the tasks. In order to accelerate the convergence speed, the loss functions of all tasks are summed up to obtain the total loss after the training of multiple tasks in a mini-batch, and the total loss is minimized as follows:
[0131] The parameters of the initial model are updated with the total loss to obtain the initial model after this round of training, and the initial model after this round of training is taken as the initial model for the next round of training.
[0132] The above process is repeated for multiple rounds of training, and through a series of batch task learning, the model gradually learns general initial parameters The set of parameters has high generalization ability, and the model obtained after the last round of training is taken as the base model.
[0133] After obtaining the trained base model, the base model can also be tested to determine whether the performance of the model meets the requirements. In the testing phase, a new task , obtain the labeled training samples of the new task , The support set and the query set of all tasks in the previous training phase are mutually exclusive, and the experience and knowledge learned in the meta-training phase are applied to the new task for fine-tuning.
[0134] The training samples are divided into a support set and a query set , a small number of training samples in the support set are used to fine-tune the model, and the optimal parameters learned before are taken as the initial parameters of the model, and after training and updating, the model parameters adapted to the task are obtained , and finally the query set is used to evaluate the model parameters .
[0135] It can be understood that the test phase only performs an internal gradient descent step, and the learning rate here is different from that in the base model pre-training phase.
[0136] It can be understood that the above detailed description of the technical effects of the present application is only intended to facilitate understanding of the present application, and in actual application of the present application, the above method can be adaptively adjusted according to actual needs.
[0137] Figure 5 A structural schematic diagram of a battery state estimation device provided by an embodiment of the present disclosure is shown in Figure 5 , the battery state estimation device 50 comprises: A parameter sequence acquisition module 501 is configured to acquire a parameter sequence of a target battery in a current time period, the parameter sequence being used to indicate a plurality of battery parameters of the target battery at each time step in the corresponding time period, and the battery parameter being measurement data used to describe physical characteristics of the battery. The battery state estimation module 502 is configured to input the parameter sequence into a pre-trained estimation model, and obtain predicted values of a plurality of battery states of the target battery at a target time point output by the estimation model, the target time point being a time point indicated by a next time step of a current time period, and the battery states including a state of charge, an energy state and a health state. The estimation model is trained according to a plurality of training samples with training labels, the training sample is a parameter sequence of the target battery in a sample period, and the training label is an actual value of the plurality of battery states at the corresponding target time point.
[0138] In one possible implementation, the estimation model includes a hidden state extraction layer, a global feature extraction layer and a state prediction layer. The parameter sequence is input into the pre-trained estimation model, and the predicted values of the plurality of battery states of the target battery at the target time point output by the estimation model are obtained, including: The parameter sequence is input into the hidden state extraction layer, and a hidden state sequence output by the hidden state extraction layer is obtained, the hidden state sequence including a hidden state of each time step, and the hidden state of each time step indicating a temporal dependency of the battery parameter of the time step and the battery parameters of other time steps. The hidden state sequence is input into the global feature extraction layer, and the hidden state sequence is subjected to feature extraction by the global feature extraction layer using a self-attention mechanism to obtain a global feature sequence, the global feature sequence including a global feature of each time step, and the global feature of each time step being obtained according to an association strength of the hidden state of the time step and the hidden states of all time steps. The global feature of the last time step in the global feature sequence is taken as a target global feature, the target global feature is input into the state prediction layer, the target global feature is mapped to a value range corresponding to each battery state by the state prediction layer, and the predicted values of the plurality of battery states at the target time point are obtained and output.
[0139] In one possible implementation, the hidden state sequence output by the hidden state extraction layer is obtained, including: The hidden state sequence is obtained by the hidden state extraction layer, including a forward hidden state sequence of the parameter sequence extracted by a forward gated recurrent unit in a time step order and a backward hidden state sequence of the parameter sequence extracted by a backward gated recurrent unit in a time step reverse order, the hidden state of each time step in the forward hidden state sequence indicating a temporal dependency of the battery parameter of the time step and the battery parameters of other time steps before the time step, and the hidden state of each time step in the backward hidden state sequence indicating a temporal dependency of the battery parameter of the time step and the battery parameters of other time steps after the time step. The hidden state sequence is obtained by combining the forward hidden state sequence and the backward hidden state sequence.
[0140] In a possible implementation, the global feature extraction layer adopts a self-attention mechanism to perform feature extraction on the hidden state sequence to obtain a global feature sequence, including: The global feature extraction layer performs position encoding on the hidden state sequence to add position information of each hidden state in the hidden state sequence into the hidden state to obtain an encoded sequence; Each element in the encoded sequence is linearly transformed to obtain a query vector, a key vector and a value vector corresponding to each element; For each query vector, the similarity between the query vector and all key vectors is calculated by dot product as an attention score to obtain an attention score matrix, and the attention score is used to quantify the association strength between the hidden state corresponding to the query vector and the hidden state corresponding to the key vector; The attention scores in the attention score matrix are converted into weights, and each element in the encoded sequence is weighted and summed with the value vector corresponding to the element to obtain an initial global feature corresponding to the element, and an initial global feature sequence is obtained from the initial global features corresponding to all elements; The initial global feature sequence is sequentially subjected to first residual connection and layer normalization, feedforward neural network processing, second residual connection and layer normalization to obtain a global feature sequence.
[0141] In a possible implementation, the estimation model is generated in the following manner: Obtain the historical battery parameters of the target battery and the actual values of the plurality of battery states of the target battery at each time point; Divide the plurality of historical battery parameters into time periods to determine a parameter sequence of a plurality of sample periods, and determine the actual values of the plurality of battery states at the corresponding target time point for each sample period according to the actual values of the plurality of battery states of the target battery at each time point; Take the parameter sequence of the sample period as a training sample, and take the actual values of the plurality of battery states at the corresponding target time point as a training label, and fine-tune the parameters of the pre-trained base model to obtain an estimation model; The base model is obtained based on a plurality of different batteries, historical battery parameters and actual values of a plurality of battery states of different batteries at each time point, and is trained by a meta-learning framework.
[0142] In a possible implementation, the initial base model is trained at least one round by a meta-learning framework to obtain a base model; Each round of training includes the following steps: determine an initial model applied in the current training, and a plurality of tasks of the training process, for each task, determine a first sample set and a second sample set corresponding to the task, the task corresponding to one battery, the first sample set and the second sample set each including a plurality of training samples with training labels, and the first sample set and the second sample set being mutually exclusive; for each task, copy parameters of the initial model, train the initial model with the first sample set corresponding to the task, update the parameters of the copied initial model, and obtain an intermediate model; for each task, input each training sample in the second sample set into the intermediate model, obtain a prediction value corresponding to each training sample, and obtain a loss corresponding to the task according to a difference between the prediction value and an actual value of all training samples in the second sample set; sum the losses of all tasks to obtain a total loss, update the parameters of the initial model with the total loss, and obtain an initial model after the current training, and use the initial model after the current training as an initial model for a next round of training.
[0143] The apparatuses of the embodiments of the present disclosure can perform the methods provided by the embodiments of the present disclosure, and the implementation principles are similar. The actions performed by each module in the apparatuses of the embodiments of the present disclosure are corresponding to the steps in the methods of the embodiments of the present disclosure. The detailed function description of each module of the apparatus can be referred to the description of the corresponding method in the foregoing description, and will not be repeated here.
[0144] In addition, in the embodiments of the present disclosure, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit that includes the function of the module or unit.
[0145] In the embodiments of the present disclosure, an electronic device (computer device / apparatus / system) is provided, which includes a memory, a processor, and a computer program stored in the memory. The processor executes the above computer program to implement the steps of the method provided by any optional embodiment of the present disclosure, and achieves the corresponding technical effects.
[0146] In one optional embodiment, an electronic device is provided, Figure 6 A structural schematic diagram of an electronic device provided by the embodiments of the present disclosure is shown in Figure 6As shown, the electronic device 60 includes a processor 601 and a memory 603. The processor 601 and the memory 603 are connected, for example, through a bus 602. Optionally, the electronic device 600 can further include a transceiver 604, which can be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that the transceiver 604 is not limited to one in actual application, and the structure of the electronic device 600 does not constitute a limitation on the embodiments of the present disclosure.
[0147] The processor 601 can be a CPU (Central Processing Unit, central processing unit), a general-purpose processor, a DSP (Digital Signal Processor, digital signal processor), an ASIC (Application Specific Integrated Circuit, application specific integrated circuit), an FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure. The processor 601 can also be a combination of computing functions, such as one or more microprocessor combinations, combinations of DSP and microprocessor, etc.
[0148] The bus 602 can include a channel for transmitting information between the above-mentioned components. The bus 602 can be a PCI (Peripheral Component Interconnect, peripheral component interconnect) bus or an EISA (Extended Industry Standard Architecture, extended industry standard architecture) bus, etc. The bus 602 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the middle, but it does not mean that there is only one bus or only one type of bus.
[0149] The memory 603 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions that are not to be changed by the computer; a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions for execution by the computer; an EEPROM (Electrically Erasable Programmable Read-Only Memory), a CD-ROM (Compact Disc Read-Only Memory) or other optical disk storage; a magnetic disk storage or other magnetic storage devices; or any other medium that can be used to carry or store computer programs and that can be accessed by a computer, without limitation.
[0150] The memory 603 is configured to store a computer program for implementing the embodiments of the present disclosure, and the processor 601 is configured to control the execution of the computer program stored in the memory 603. The processor 601 is configured to execute the computer program stored in the memory 603 to implement the steps shown in the foregoing method embodiments.
[0151] The electronic device in the embodiments of the present disclosure can include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (Personal Digital Assistant), a PAD (Tablet Personal Computer), a PMP (Portable Multimedia Player), a vehicle terminal (for example, a car navigation terminal), a wearable device, and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like.
[0152] The embodiments of the present disclosure provide a computer readable storage medium having stored thereon a computer program, and the computer program is executable by a processor to implement the steps and corresponding contents of the foregoing method embodiments.
[0153] The embodiments of the present disclosure also provide a computer program product including a computer program, and the computer program is executable by a processor to implement the steps and corresponding contents of the foregoing method embodiments.
[0154] It is to be noted that the computer-readable storage medium mentioned above in the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0155] In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus or device. In the present disclosure, the computer-readable signal medium can include a data signal that propagates in a baseband or as part of a carrier wave, carrying computer-readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium that can send, propagate or transmit the program for use by or in connection with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium can be transmitted in any suitable medium, including but not limited to a wire, an optical fiber, an RF (radio frequency) or the like, or any suitable combination of the above.
[0156] Computer program code for carrying out operations of the present disclosure can be written in one or more programming languages or combinations of languages including an object-oriented programming language such as Java, Smalltalk, C++ or a conventional procedural programming language such as the "C" programming language or similar programming languages. The program code can execute entirely on a user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of the latter, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0157] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the description, claims, and drawings of the present disclosure, and the above, are used to distinguish like objects, and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged, where appropriate, so that the embodiments of the present disclosure described herein can be carried out in sequences other than the one illustrated or described herein.
[0158] It should be understood that, although the various operation steps in the flowcharts of the embodiments of the present disclosure are indicated by arrows, the implementation order of the steps is not limited to the order indicated by the arrows. Unless otherwise specified herein, in some implementation scenarios of the embodiments of the present disclosure, the implementation steps in each flowchart can be executed in other orders as required. In addition, part or all of the steps in each flowchart can include multiple sub-steps or multiple stages based on the actual implementation scenario. Part or all of the sub-steps or stages can be executed at the same time, and each of the sub-steps or stages can also be executed at different times. In the scenario where the execution times are different, the execution order of the sub-steps or stages can be flexibly configured as required, and the embodiments of the present disclosure do not limit this.
[0159] The above is only an optional implementation of some implementation scenarios of the present disclosure, and it should be pointed out that, for ordinary skilled persons in the technical field, other similar implementation manners based on the technical idea of the present disclosure without departing from the technical concept of the present disclosure also belong to the protection scope of the embodiments of the present disclosure.
Claims
1. A method for estimating the state of a battery, characterized in that, include: Obtain the parameter sequence of the target battery in the current time period. The parameter sequence is used to indicate various battery parameters of the target battery at each time step in the corresponding time period. The battery parameters refer to measurement data used to describe the physical characteristics of the battery. The parameter sequence is input into a pre-trained estimation model to obtain the predicted values of multiple battery states of the target battery at the target time, as output by the estimation model. The target time is the time indicated by the next time step of the current time period. The battery states include state of charge, state of energy, and state of health. The estimation model is trained based on multiple training samples with training labels. The training samples are the parameter sequences of the target battery during the sample time period, and the training labels are the actual values of multiple battery states at the corresponding target time.
2. The method according to claim 1, characterized in that, The estimation model includes: a hidden state extraction layer, a global feature extraction layer, and a state prediction layer; The step of inputting the parameter sequence into a pre-trained estimation model to obtain the predicted values of multiple battery states of the target battery at the target time, output by the estimation model, includes: The parameter sequence is input into the hidden state extraction layer to obtain the hidden state sequence output by the hidden state extraction layer. The hidden state sequence includes the hidden state at each time step, and the hidden state at each time step indicates the time dependency of the battery parameters at that time step and the battery parameters at other time steps. The hidden state sequence is input into the global feature extraction layer, and the global feature extraction layer uses a self-attention mechanism to extract features from the hidden state sequence to obtain a global feature sequence. The global feature sequence includes global features at each time step, and the global features at each time step are encoded according to the correlation strength between the hidden state at the time step and the hidden states at all time steps. The global features of the last time step in the global feature sequence are taken as the target global features. The target global features are input into the state prediction layer. The state prediction layer maps the target global features to the value range corresponding to each battery state, and obtains and outputs the predicted values of multiple battery states at the target time.
3. The method according to claim 2, characterized in that, The step of obtaining the hidden state sequence output by the hidden state extraction layer includes: The hidden state extraction layer extracts the forward hidden state sequence of the parameter sequence in the order of time steps using the forward gated loop unit, and extracts the backward hidden state sequence of the parameter sequence in the reverse order of time steps using the backward gated loop unit. The hidden state of each time step in the forward hidden state sequence indicates the temporal dependency between the battery parameters of the time step and the battery parameters of other time steps before the time step. The hidden state of each time step in the backward hidden state sequence indicates the temporal dependency between the battery parameters of the time step and the battery parameters of other time steps after the time step. By combining the forward hidden state sequence and the backward hidden state sequence, a hidden state sequence is obtained.
4. The method according to claim 2, characterized in that, The global feature extraction layer includes a first module and multiple second modules connected in sequence; The step of extracting features from the hidden state sequence using a self-attention mechanism through the global feature extraction layer to obtain a global feature sequence includes: The first module performs position encoding on the hidden state sequence, adding the position information of each hidden state in the hidden state sequence to the hidden state, and obtaining the encoded sequence. Determine the target sequence for the input of each second module. For the first second module, the target sequence is the encoded sequence. For non-first second modules, the target sequence is the output of the previous second module. For each second module, the corresponding target sequence is input into the second module, and the second module uses a multi-head self-attention mechanism to dynamically calculate the weights for the target sequence, and updates the target sequence according to the weights to obtain a first feature sequence. The weights are used to characterize the correlation strength between any two elements in the target sequence. The first feature sequence is sequentially subjected to a first residual connection and layer normalization, a feedforward neural network, and a second residual connection and layer normalization to obtain the second feature sequence. The second feature sequence output by the last second module is taken as the global feature sequence.
5. The method according to claim 4, characterized in that, The step of dynamically calculating weights for the target sequence using a multi-head self-attention mechanism through the second module, and updating the target sequence according to the weights to obtain the first feature sequence includes: The target sequence is subjected to multiple sets of linear transformations. For each set of linear transformations, a matrix set is obtained, which includes a query matrix, a key matrix, and a value matrix. For each set of matrices, the query matrix is multiplied by the transpose of the key matrix to obtain the attention score matrix, where the attention score is used to characterize the association strength between any two elements in the target sequence. Normalize each row of the attention score matrix and convert the attention score into weights to obtain a weight matrix. Each row in the weight matrix represents the attention ratio of the element corresponding to that row in the target sequence to all elements in the target sequence. Multiply the weight matrix by the value matrix to obtain the second feature sequence; The first feature sequence is obtained by concatenating and dimensionality reduction of the second feature sequences corresponding to all matrix sets.
6. The method according to any one of claims 1-5, characterized in that, The estimation model is generated in the following manner: Obtain the historical battery parameters of the target battery and the actual values of multiple battery states of the target battery at various times; The historical battery parameters are divided into time periods to determine the parameter sequence of multiple sample time periods. Based on the actual values of multiple battery states of the target battery at each time period, the actual values of multiple battery states at the corresponding target time are determined for each sample time period. Using the parameter sequence of the sample time period as training samples and the actual values of multiple battery states at the corresponding target time as training labels, the parameters of the pre-trained basic model are fine-tuned to obtain the estimated model. The basic model is a training sample with training labels constructed based on the historical battery parameters of several different batteries and the actual values of multiple battery states of different batteries at various times, and is trained using a meta-learning framework.
7. The method according to claim 6, characterized in that, The method further includes: training the initial base model at least once using a meta-learning framework to obtain the base model; Each round of training includes the following steps: The initial model for this round of training and the multiple training tasks are determined. For each task, the first sample set and the second sample set corresponding to the task are determined. The task corresponds one-to-one with the battery. The first sample set and the second sample set each include multiple training samples with training labels, and the first sample set and the second sample set are mutually exclusive. For each task, the parameters of the initial model are copied, the initial model is trained using the first sample set corresponding to the task, the parameters of the copied initial model are updated, and an intermediate model is obtained. For each task, each training sample in the second sample set is input into the intermediate model to obtain the predicted value corresponding to each training sample. Based on the difference between the predicted values and the true values of all training samples in the second sample set, the loss corresponding to the task is obtained. The losses of all tasks are summed to obtain the total loss. The parameters of the initial model are updated with the total loss to obtain the initial model after this round of training. The initial model after this round of training is used as the initial model for the next round of training.
8. A battery state estimation device, characterized in that, include: The parameter sequence acquisition module is used to acquire the parameter sequence of the target battery in the current time period. The parameter sequence is used to indicate various battery parameters of the target battery at each time step in the corresponding time period. The battery parameters refer to measurement data used to describe the physical characteristics of the battery. The battery state estimation module is used to input the parameter sequence into a pre-trained estimation model and obtain the predicted values of multiple battery states of the target battery at a target time, as output by the estimation model. The target time is the time indicated by the next time step of the current period. The battery state includes state of charge, state of energy, and state of health. The estimation model is trained based on multiple training samples with training labels. The training samples are the parameter sequences of the target battery during the sample time period, and the training labels are the actual values of multiple battery states at the corresponding target time.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.