Method and device for training battery state of charge prediction model based on dynamic time sequence mask and sample missing compensation
The battery state of charge prediction model training method based on dynamic timing mask and sample missing compensation solves the robustness and adaptability problems caused by signal missing, and realizes accurate prediction of battery state of charge under actual working conditions.
Patent Information
- Application Number
- CN202511121732.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-10-17
AI Technical Summary
Existing battery state of charge prediction models have poor robustness and engineering adaptability in scenarios such as signal loss, acquisition packet loss, or sensor failure under actual working conditions.
A battery state of charge prediction model training method based on dynamic timing masking and sample missing compensation is adopted. The timing electrical signals are masked respectively through the current, voltage and temperature mask channels in the mask network. The encoder and decoder are used to reconstruct the signal, and the state of charge is predicted through the prediction network. The mask probability and replacement features are dynamically updated to adapt to the signal missing scenario.
The robustness and generalization ability of the battery state of charge prediction model in signal loss conditions are improved, ensuring that the battery state of charge can still be accurately predicted in a variety of signal loss scenarios.
Smart Images

Figure CN120806032A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of electric power and artificial intelligence, and particularly relates to a training method and device of a battery state of charge prediction model based on dynamic time sequence masking. BACKGROUND
[0002] In an intelligent power management system, accurately estimating the battery state of charge is one of the key technologies. Among them, a hybrid model composed of a Transformer and an LSTM is widely used to process battery time sequence data. By utilizing the powerful global dependence modeling capability of the Transformer and the excellent time sequence memory capability of the LSTM, an end-to-end SOC prediction framework is constructed.
[0003] However, the training data used by the above prediction model generally does not consider scenarios such as signal loss, acquisition packet loss, or sensor failure under actual working conditions, which leads to poor robustness and engineering adaptability of the trained model. SUMMARY
[0004] The present application provides a battery state of charge prediction model training method, device, equipment and storage medium based on dynamic time sequence masking and sample loss compensation, which can solve at least one of the above technical problems.
[0005] According to an aspect of the present application, a battery state of charge prediction model training method based on dynamic time sequence masking and sample loss compensation is provided, comprising:
[0006] Based on the mask probability and mask replacement features of the current mask channel, the voltage mask channel and the temperature mask channel in the mask network, the current, voltage and temperature at each time in the sample time sequence electrical signal are respectively masked to simulate signal loss, and a masked time sequence electrical signal is obtained;
[0007] Based on the encoder and decoder in the battery state of charge prediction model, the masked time sequence electrical signal is sequentially encoded and decoded to obtain a reconstructed time sequence electrical signal;
[0008] Based on the prediction network in the battery state of charge prediction model, the reconstructed time sequence electrical signal is subjected to state of charge prediction to obtain a predicted state of charge;
[0009] Based on the current error, voltage error and temperature error between the sample time sequence electrical signal and the reconstructed time sequence electrical signal at each same time, the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel is updated;
[0010] Based on the predicted state of charge and the true state of charge corresponding to the sample time sequence electrical signal, a state of charge prediction loss is determined;
[0011] update the mask replacement features of the current mask channel, the voltage mask channel and the temperature mask channel respectively and the model parameters of the battery state of charge prediction model based on the state of charge prediction loss.
[0012] According to another aspect of the present application, a device for training a battery state of charge prediction model based on dynamic time sequence mask and sample missing compensation is provided, comprising:
[0013] a time sequence mask module configured to perform mask processing on the current, voltage and temperature of each time point in the sample time sequence electrical signal respectively based on the mask probability and the mask replacement feature of the current mask channel, the voltage mask channel and the temperature mask channel in the mask network respectively to simulate signal missing and obtain a mask time sequence electrical signal;
[0014] an encoding and decoding module configured to sequentially encode and decode the mask time sequence electrical signal based on the encoder and the decoder in the battery state of charge prediction model to obtain a reconstructed time sequence electrical signal;
[0015] a prediction module configured to perform state of charge prediction on the reconstructed time sequence electrical signal based on the prediction network in the battery state of charge prediction model to obtain a predicted state of charge;
[0016] a mask probability updating module configured to update the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel respectively based on the current error, the voltage error and the temperature error between the sample time sequence electrical signal and the reconstructed time sequence electrical signal at each same time point;
[0017] a prediction loss calculation module configured to determine a state of charge prediction loss based on the predicted state of charge and the real state of charge corresponding to the sample time sequence electrical signal;
[0018] a model updating module configured to update the mask replacement features of the current mask channel, the voltage mask channel and the temperature mask channel respectively and the model parameters of the battery state of charge prediction model based on the state of charge prediction loss.
[0019] According to an aspect of the present application, an electronic device is provided, comprising at least one processor and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the processor, and the processor is configured to acquire the instructions from the memory and execute the instructions to enable the processor to perform the training method of the battery state of charge prediction model based on dynamic time sequence mask and sample missing compensation according to any of the embodiments of the present application.
[0020] According to an aspect of the present application, there is provided a non-transitory computer-readable storage medium storing computer instructions for providing to a computer to instruct the computer to perform a method for training a battery state-of-charge prediction model based on dynamic timing mask and sample missing compensation according to any one of the embodiments of the present application.
[0021] By adopting the technical scheme of the present application, the current, voltage and temperature at each time in the sample timing electrical signal are respectively subjected to mask processing to simulate signal missing based on the mask probability and mask replacement feature of the current mask channel, voltage mask channel and temperature mask channel in the mask network, so as to obtain the mask timing electrical signal. In this way, the timing electrical signal is subjected to mask processing by using the mask probability and mask replacement feature of each electrical signal channel in the mask network, so as to simulate the situation of signal missing. The mask timing electrical signal is sequentially encoded and decoded based on the encoder and decoder in the battery state-of-charge prediction model, so as to obtain the reconstructed timing electrical signal; the reconstructed timing electrical signal is subjected to state-of-charge prediction based on the prediction network in the battery state-of-charge prediction model, so as to obtain the predicted state-of-charge. In this way, the battery state-of-charge prediction model can perform feature reconstruction and state-of-charge prediction on the timing electrical signal with signal missing. Then, the mask probability of the current mask channel, voltage mask channel and temperature mask channel is updated based on the current error, voltage error and temperature error between the mask timing electrical signal and the reconstructed timing electrical signal at each same time. In this way, the mask probability of the mask network can be updated by using the error between the mask timing electrical signal and the reconstructed timing electrical signal. At the same time, the state-of-charge prediction loss is determined based on the predicted state-of-charge and the true state-of-charge corresponding to the timing electrical signal; the mask replacement feature of the current mask channel, voltage mask channel and temperature mask channel and the model parameters of the battery state-of-charge prediction model are updated based on the state-of-charge prediction loss. In this way, the mask replacement feature of the mask network is updated by using the state-of-charge prediction loss. In this way, the mask probability and mask replacement feature of the mask network can be dynamically updated in the training process of the battery state-of-charge prediction model, so as to dynamically change the situation of signal missing, thereby enabling the battery state-of-charge prediction model to adapt to various signal missing scenarios and improving the generalization ability thereof.
[0022] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0023] The accompanying drawings are used to better understand the present application, and do not constitute a limitation on the present application. Among them:
[0024] Figure 1is a flowchart of a training method of a battery state of charge prediction model based on dynamic timing mask and sample missing compensation according to an embodiment of the present application;
[0025] Figure 2 is a structural block diagram of a power load prediction model according to an embodiment of the present application;
[0026] Figure 3 is a flowchart of a training device of a battery state of charge prediction model based on dynamic timing mask and sample missing compensation according to an embodiment of the present application;
[0027] Figure 4 is a block diagram of an electronic device for implementing the method according to an embodiment of the present application. DETAILED DESCRIPTION
[0028] Exemplary embodiments of the present application are described herein with reference to the accompanying drawings, in which various details are set forth to assist in an understanding of the present application. It will be apparent to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Likewise, the present application contemplates that the various features described herein can be used separately or in any combination.
[0029] Figure 1 is a flowchart of a training method of a battery state of charge prediction model based on dynamic timing mask and sample missing compensation according to an embodiment of the present application.
[0030] As shown in Figure 1 , the training method of the battery state of charge prediction model comprises:
[0031] S110, based on the mask probabilities and mask replacement features of the current mask channel, the voltage mask channel and the temperature mask channel in the mask network, respectively, the current, the voltage and the temperature at each time in the sample time series electrical signal are masked to simulate signal missing, and the masked time series electrical signal is obtained;
[0032] S120, based on the encoder and the decoder in the battery state of charge prediction model, the masked time series electrical signal is sequentially encoded and decoded to obtain the reconstructed time series electrical signal;
[0033] S130, based on the prediction network in the battery state of charge prediction model, the reconstructed time series electrical signal is subjected to state of charge prediction to obtain the predicted state of charge;
[0034] S140, based on the current error, the voltage error and the temperature error between the sample time series electrical signal and the reconstructed time series electrical signal at each same time, the mask probabilities of the current mask channel, the voltage mask channel and the temperature mask channel are updated;
[0035] S150, determine a state of charge prediction loss based on the predicted state of charge and the real state of charge corresponding to the time-series electrical signal;
[0036] S160, update the mask replacement features of the current mask channel, the voltage mask channel and the temperature mask channel, and the model parameters of the battery state of charge prediction model based on the state of charge prediction loss.
[0037] It can be understood that, in the training process, the dynamic mask of the sample time-series electrical signal is realized by dynamically adjusting the mask probability of the mask network. And each time the mask is compensated for the missing signal of the mask feature by the mask replacement feature. At the same time, the mask replacement feature is also dynamically adjusted during each training to realize dynamic compensation for the missing signal.
[0038] Exemplarily, as shown in Figure 2 The encoder in the battery state of charge prediction model can adopt a DyT-Transformer encoder without normalization, the decoder can adopt a bidirectional LSTM decoder (BiLSTM), and the prediction network can adopt a network structure of a fully connected layer.
[0039] Exemplarily, the encoder adopts a Transformer architecture, and in some examples, a DyT module can be used instead of the normalization layer therein. The encoder includes a plurality of network layers, each network layer including an MHSA (Multi-Head Self-Attention) sublayer and an FFN (Feed-Forward Neural Network) sublayer. And each sublayer is followed by a residual connection and a DyT activation sublayer, which performs a learnable element-wise transformation operation to stabilize training and suppress activation saturation. Therefore, each network layer in the encoder can include the following structures in series: a multi-head self-attention sublayer; a residual connection + a DyT activation sublayer, a feed-forward network sublayer, and again a residual connection + a DyT activation sublayer.
[0040] The feed-forward network sublayer can include two fully connected layers (FC) in series, an activation layer and a Dropout (a regularization technique) layer.
[0041] In this example, in each network layer in the encoder, the MHSA component enables each time step to focus on all other time steps, capturing global dependencies, and the FFN introduces feature nonlinearity and dimension transformation, so that multiple such network layers are stacked to deepen the representation ability of the battery state of charge prediction model for input features.
[0042] Exemplarily, since the normalization layer (LayerNorm) in the traditional Transformer structure relies on cross-sample statistics, it is vulnerable to outliers, and therefore, the embodiment adopts a DyT function instead of the normalization layer. Specifically, the DyT function is as follows:
[0043] DyT(x) = tanh(a x).
[0044] where a is a learnable parameter with input amplitude adaptive adjustment capability, which maintains near-zero linearity and suppresses extreme values, and can guarantee training stability and numerical robustness.
[0045] In the present example, compared with the traditional normalization layer, the mean and variance of the activation layer do not need to be calculated, and the DyT function directly realizes similar nonlinear mapping by introducing the tanh function and the learnable parameter a, thereby reducing the computational overhead. DyT is an element-wise operation that can directly replace the normalization layer without modifying other parts of the network. Moreover, DyT reduces the computational load of the encoder, and the speed in the inference stage can be improved by more than 50% compared with the traditional normalization layer, and the training time is also reduced. At the same time, the Transformer model using DyT is comparable in performance to the Transformer model using normalization, and even slightly surpasses it.
[0046] Thus, the network layer in the above encoder is stacked N times to enhance the model's deep expression capability for input features, and the output result is the context-enhanced time series electrical signal coding feature H enc ∈R T×d .
[0047] Exemplarily, in order to enhance the time series modeling capability, the present example cascades a bidirectional LSTM decoder after the DyT-Transformer encoder. The decoder receives the context representation of all time steps as input, extracts dynamic evolution features in the sequence by simultaneously modeling the forward and backward time dependence, and generates the context-enhanced hidden representation of each time step. Specifically, the BiLSTM processes the time series electrical signal coding feature, and generates the context-enhanced hidden representation of each time step by connecting the forward and backward hidden states, while outputting the reconstructed time series electrical signal.
[0048] Exemplarily, in the prediction network, a fully connected layer is used to map the h t generated by the decoder to a scalar, and a Sigmoid function is used to limit the output range [0, 1] to represent the normalized State of Charge (SOC):
[0049] SOC t = σ(W o ·h t +bo )。
[0050] where W o and b o are output layer learnable parameters.
[0051] where σ(·) denotes the Sigmoid function, defined as:
[0052]
[0053] The Sigmoid operation ensures that the SOC prediction values are normalized and have physical interpretability, which allows them to be directly compared with the true SOC values obtained by the ampere-hour integration method.
[0054] In actual engineering, incomplete data often occurs in battery sensing signals due to packet loss, sensor abnormalities, or extreme environments. The dynamic timing masking training mechanism proposed in the embodiments of the present application actively, intelligently, and dynamically masks part of the input information during the training process, so that the battery state of charge prediction model can accurately predict the battery state of charge even if part of the signal is missing, thereby improving the practicality and robustness of the battery state of charge prediction model.
[0055] The embodiments of the present application propose a mask probability dynamic self-adaptive updating mechanism based on model training feedback, which introduces a feedback signal in the model training process to dynamically adjust the masking probability of the input timing electrical signal, thereby improving the robustness and generalization ability of the battery state of charge prediction model in various signal missing scenarios. Moreover, this mechanism can actively focus on the weak prediction area of the prediction model, and can solve the problem of being unable to cope with the actual signal abnormality due to single masking of the signal.
[0056] In the mask network, the input data is a timing electrical signal with a length of n:
[0057] X=[x1,x2,…,x n ]。
[0058] where x t =[I t ,V t ,T t ],t∈[1,n] represents the current I t , voltage I t and temperature T t at time t. Therefore, the input data is a real number type two-dimensional matrix with a size of n x 3.
[0059] After masking by the mask network, the output data is a masked timing electrical signal as follows:
[0060]
[0061] It can be understood that part of the elements in the input data of the mask network are replaced by the masked fill value, and the other unmasked positions remain the original value, so as to obtain the output data of the mask network. And the output data is used as the input data of the battery state of charge prediction model.
[0062] It can be understood that the current mask channel in the mask network is used to process the current time sequence signal, the voltage mask channel in the mask network is used to process the voltage time sequence signal, and the temperature mask channel is used to process the temperature time sequence signal.
[0063] It can be understood that the mask network can use a matrix to represent the mask probability and mask replacement feature of each channel, and then multiply or convolve the matrix with the time sequence electrical signal in the input network, so as to obtain the corresponding mask time sequence electrical signal.
[0064] It can be understood that the initial value of the mask probability and mask replacement feature on each channel of the mask network can be preset, and the mask probability and mask replacement feature on each channel can be updated each time the above steps S110 to S160 are executed. Or the mask probability and mask replacement feature on each channel of the mask network remain unchanged for a period of time, and steps S110 to S160 are executed for another period of time to update the mask probability and mask replacement feature on each channel.
[0065] It can be understood that based on the current error, voltage error and temperature error between the sample time sequence electrical signal and the reconstructed time sequence electrical signal at each same time, the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel is updated respectively.
[0066] It can be understood that since there is a correlation between the current, voltage and temperature at the same time, the current error, voltage error and temperature error at the same time also have certain correlation.
[0067] Exemplarily, if the difference between the current error, voltage error and temperature error at the same time is not large, the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel can be continuously increased, so that the signal loss of the next mask time sequence electrical signal is more serious. In this way, the battery state of charge prediction model is trained, and the generalization ability of the battery state of charge prediction model can be further enhanced.
[0068] Exemplarily, if the difference among the current error, the voltage error and the temperature error at the same time is large, the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel can be reduced respectively to weaken the signal missing of the next mask time sequence electrical signal, and the model parameters can be adjusted, so that the prediction accuracy of the battery state of charge prediction model can be improved in the next training.
[0069] According to the above embodiment, based on the mask probability and the mask replacement feature of the current mask channel, the voltage mask channel and the temperature mask channel in the mask network, the current, the voltage and the temperature at each time in the time sequence electrical signal of the power management system are respectively masked to simulate signal missing to obtain the mask time sequence electrical signal. In this way, by using the mask probability and the mask replacement feature of each electrical signal channel in the mask network, the time sequence electrical signal is masked to simulate the situation of signal missing. Based on the encoder and the decoder in the battery state of charge prediction model, the mask time sequence electrical signal is encoded and decoded in turn to obtain the reconstructed time sequence electrical signal; based on the prediction network in the battery state of charge prediction model, the reconstructed time sequence electrical signal is predicted to obtain the predicted state of charge of the power management system. In this way, the battery state of charge prediction model can reconstruct the time sequence electrical signal with signal missing and predict the state of charge. Then, based on the current error, the voltage error and the temperature error between the mask time sequence electrical signal and the reconstructed time sequence electrical signal at each same time, the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel is updated. In this way, the mask probability of the mask network can be updated by using the error between the mask time sequence electrical signal and the reconstructed time sequence electrical signal. At the same time, based on the predicted state of charge and the real state of charge corresponding to the time sequence electrical signal, the state of charge prediction loss is determined; based on the state of charge prediction loss, the mask replacement feature of the current mask channel, the voltage mask channel and the temperature mask channel and the model parameters of the battery state of charge prediction model are updated. In this way, the mask replacement feature of the mask network is updated by using the state of charge prediction loss.
[0070] Therefore, the embodiment of the present application can not only provide the time sequence electrical signal simulating the signal missing situation to the battery state of charge prediction model for training, but also dynamically update the mask probability and the mask replacement feature of the mask network to dynamically change the simulated signal missing situation, so that the trained battery state of charge prediction model can adapt to various signal missing scenarios and has good generalization ability.
[0071] Figure 2 is a structural block diagram of a battery state of charge prediction model of an embodiment of the present application.
[0072] In an implementation, based on the mask probability and the mask parameter of each of the current mask channel, the voltage mask channel and the temperature mask channel in the mask network, the current, the voltage and the temperature at each time in the timing electrical signal of the power management system are respectively masked to simulate signal loss to obtain a masked timing electrical signal, comprising: determining the current masking mask, the voltage masking mask and the temperature masking mask at each time based on the mask probability of each of the current mask channel, the voltage mask channel and the temperature mask channel; subtracting 1 from the current masking mask, the voltage masking mask and the temperature masking mask at each time respectively to obtain the reverse current masking mask, the reverse voltage masking mask and the reverse temperature masking mask at each time; for each time, the product between the current masking mask, the voltage masking mask and the temperature masking mask at the time and the current, the voltage and the temperature at the corresponding time in the timing electrical signal, and the product between the reverse current masking mask, the reverse voltage masking mask and the reverse temperature masking mask at the time and the mask replacement feature of the current mask channel, the voltage mask channel and the temperature mask channel are respectively summed to obtain the mask current, the mask voltage and the mask temperature at each time; and determining the masked timing electrical signal based on the mask current, the mask voltage and the mask temperature at each time.
[0073] Exemplarily, the current masking mask at each time is determined based on the mask probability of the current mask channel at each time. The voltage masking mask at each time is determined based on the mask probability of the voltage mask channel at each time. The temperature masking mask at each time is determined based on the mask probability of the temperature mask channel at each time.
[0074] Exemplarily, according to any of the above masking probabilities p t,j , the sampling masking mask is as follows:
[0075] M t,j ~ Bernoulli (1-p t,j ).
[0076] Wherein, p t,j represents the masking probability of the jth feature at time t, for example, the current masking probability at time t, M t,j represents the masking mask of the jth feature at time t, for example, the current masking mask at time t.
[0077] Exemplarily, the value of the masking mask is 0 or 1. For example, 0 represents masking, and the mask replacement feature can be used to replace the corresponding feature. 1 represents keeping the original feature unchanged.
[0078] Exemplarily, for the reverse masking mask, it can be: 1-M t,j . The value of the reverse masking mask is 0 or 1. For example, 1 represents masking, and the mask replacement feature can be used to replace the corresponding feature. 0 represents keeping the original feature unchanged.
[0079] Exemplarily, the above summation process is a masking operation, as follows:
[0080]
[0081] where x t,j represents the jth feature at time t in the sample time series electrical signal, such as current, voltage or temperature at time t, mask j is a learnable parameter corresponding to the jth feature, i.e., the mask replacement feature of the corresponding channel, and the mask replacement feature is automatically optimized during the training process, represents the feature value after masking processing.
[0082] According to the above embodiment, the learnable mask token is used as the masking fill value, which is optimized together with the model parameters during the training process, which helps the model to automatically learn the optimal compensation method of the missing signal, and further improves the distinguishing ability and overall robustness of the masking point. In this way, sampling can ensure that difficult and error-prone positions have a higher probability of being masked, so that the model can focus on improving the short board capability.
[0083] In one embodiment, based on the current error, voltage error and temperature error between the mask time series electrical signal and the reconstructed time series electrical signal at each same time, the mask probability of each of the current mask channel, the voltage mask channel and the temperature mask channel is updated, including: in the case that the difference between the current error, the voltage error and the temperature error at the first time is less than the preset difference threshold, based on the product between the current error, the voltage error and the temperature error at the first time and the dynamic error step length, the mask probability of each of the current mask channel, the voltage mask channel and the temperature mask channel at the first time is increased.
[0084] Exemplarily, if the current error, the voltage error and the temperature error at the same time are not much different, the above product is superimposed on the basis of the original mask probability to obtain a new mask probability.
[0085] Exemplarily,
[0086] where clip ensures that f(ε t,j ) = ε t,j / ε max is a normalized error feedback function, and a (k) represents a learnable dynamic step length hyperparameter at the kth epoch, represents the mask probability before updating, represents the mask probability after updating.
[0087] According to the above embodiment, if the differences among the current error, the voltage error and the temperature error at the same time are not large, the mask probability of the current error channel, the voltage error channel and the temperature error channel can be continuously increased, so that the signal loss of the next mask time sequence electric signal is more serious, and the battery state of charge prediction model is trained, and the generalization ability of the battery state of charge prediction model can be further enhanced.
[0088] In an embodiment, further comprising: in the case that the difference between the current error, the voltage error and the temperature error at the second time is greater than the difference threshold, based on the product between the current error, the voltage error and the temperature error at the first time and the dynamic error step length, reducing the mask probability of the current error channel, the voltage error channel and the temperature error channel at the first time.
[0089] For example, if the differences among the current error, the voltage error and the temperature error at the same time are large, the mask probability of the above product is reduced to obtain a new mask probability.
[0090] For example,
[0091] According to the above embodiment, if the differences among the current error, the voltage error and the temperature error at the same time are large, the mask probability of the current error channel, the voltage error channel and the temperature error channel can be reduced, so that the signal loss of the next mask time sequence electric signal is weakened, and at the same time, the model parameters can be adjusted, so that the prediction accuracy of the battery state of charge prediction model can be improved in the next training.
[0092] In an embodiment, the above method further comprises: taking the average of the current error, the voltage error and the temperature error at each time to obtain an average reconstruction error; determining a step length attenuation coefficient based on the ratio between the average reconstruction error and the historical maximum reconstruction error; and obtaining the dynamic error step length based on the product between the step length attenuation coefficient and the maximum error step length.
[0093] For example, the step length α is automatically adjusted according to the current overall average error (k) If the error is large, the step length is large, and the mask probability is adjusted fast. If the error is small, the step length is small, and the change of the mask probability tends to be stable. Specifically:
[0094]
[0095] Wherein, γ represents the maximum error step length, and the value range is 0 to 1, and ε max represents the historical maximum reconstruction error, represents the prediction error ε of each feature at all time steps in this training t,jThe average value of the current error, the voltage error and the temperature error at each time point is determined according to the following formula:
[0096]
[0097] According to the above-mentioned embodiments, the step attenuation coefficient is determined according to the difference between the average error between the current error, the voltage error and the temperature error at each time point and the historical maximum error, and the product between the coefficient and the maximum error step is used as the dynamic error step. The error step can be dynamically adjusted, and the adjustment accuracy of the mask probability can be improved.
[0098] In an embodiment, the current masking mask, the voltage masking mask and the temperature masking mask at each time point are determined based on the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel, comprising: determining the current masking mask, the voltage masking mask and the temperature masking mask at each time point based on the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel at each time point.
[0099] In an embodiment, the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel is updated based on the current error, the voltage error and the temperature error between the mask time sequence electrical signal and the reconstructed time sequence electrical signal at each same time point, comprising: determining the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel as a preset initial mask probability in the case that the number of updates of the mask network or the battery state of charge prediction model is less than a preset number threshold; updating the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel based on the current error, the voltage error and the temperature error between the mask time sequence electrical signal and the reconstructed time sequence electrical signal at each same time point in the case that the number of updates of the mask network or the battery state of charge prediction model is greater than the number threshold.
[0100] When the battery state of charge prediction model just starts training, for example, in the first third of the training progress, the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel is determined as a preset initial mask probability and remains unchanged.
[0101] For example, within the first 10 or 20 times of training, a fixed masking probability strategy is adopted, and the initial masking probability value is uniformly set as:
[0102] In this example, the masking position can be randomly generated by Bernoulli sampling. In this training stage, the battery state of charge prediction model uses a lower masking probability for random masking training, gradually masters the basic feature expression rule of the time sequence electrical signal, so as to ensure that the learning of the battery state of charge is not disturbed by excessive masking in the early training stage.
[0103] In the later stage of training, a dynamic masking mechanism with prediction error feedback is introduced, and the reconstruction error ∈ of each feature position in the last round of training is used to adaptively adjust the masking probability p used in the current round of training, so as to sample the masking mask. t,j t,j
[0104] According to the above embodiment, in the early stage of training, the battery state of charge prediction model uses a lower masking probability for random masking training, gradually masters the basic feature expression rule of the time series electrical signal, thereby ensuring that the learning of the battery state of charge is not disturbed by excessive masking in the early stage of training. In the later stage of training, the reconstruction error of each feature position in the last round of training is used to adaptively adjust the masking probability used in the current round of training, so as to improve the generalization ability of the battery state of charge prediction model.
[0105] Figure 3 is a structural block diagram of a training device of a battery state of charge prediction model based on dynamic time series masking and sample missing compensation according to an embodiment of the present application.
[0106] As shown in Figure 3 , the training device of the battery state of charge prediction model based on dynamic time series masking and sample missing compensation comprises:
[0107] The time series masking module 310 is configured to perform masking processing on the current, voltage and temperature of each time point in the sample time series electrical signal based on the masking probability and the masking substitute feature of the current masking channel, the voltage masking channel and the temperature masking channel in the masking network, respectively, to simulate signal missing and obtain a masked time series electrical signal.
[0108] The encoding and decoding module 320 is configured to sequentially encode and decode the masked time series electrical signal based on the encoder and the decoder in the battery state of charge prediction model, to obtain a reconstructed time series electrical signal.
[0109] The prediction module 330 is configured to perform state of charge prediction on the reconstructed time series electrical signal based on the prediction network in the battery state of charge prediction model, to obtain a predicted state of charge.
[0110] The masking probability updating module 340 is configured to update the masking probability of the current masking channel, the voltage masking channel and the temperature masking channel based on the current error, the voltage error and the temperature error between the sample time series electrical signal and the reconstructed time series electrical signal at each same time point.
[0111] The prediction loss calculation module 350 is configured to determine a state of charge prediction loss based on the predicted state of charge and the true state of charge corresponding to the sample time series electrical signal.
[0112] The model updating module 360 is configured to update the mask substitute features of the current mask channel, the voltage mask channel and the temperature mask channel, and the model parameters of the battery state-of-charge prediction model based on the state-of-charge prediction loss.
[0113] In an embodiment, the timing mask module comprises:
[0114] The mask determination unit is configured to determine the current shielding mask, the voltage shielding mask and the temperature shielding mask at each of the time points based on the mask probabilities of the current mask channel, the voltage mask channel and the temperature mask channel.
[0115] The reverse mask determination unit is configured to subtract 1 from the current shielding mask, the voltage shielding mask and the temperature shielding mask at each of the time points respectively to obtain the reverse current shielding mask, the reverse voltage shielding mask and the reverse temperature shielding mask at each of the time points.
[0116] The mask execution unit is configured to, for each of the time points, sum the product of the current shielding mask, the voltage shielding mask and the temperature shielding mask at the time point and the current, voltage and temperature at the corresponding time point in the sample timing electrical signal, and the product of the reverse current shielding mask, the reverse voltage shielding mask and the reverse temperature shielding mask at the time point and the mask substitute features of the current mask channel, the voltage mask channel and the temperature mask channel respectively, to obtain the mask current, the mask voltage and the mask temperature at each of the time points.
[0117] The mask signal determination unit is configured to determine the mask timing electrical signal based on the mask current, the mask voltage and the mask temperature at each of the time points.
[0118] In an embodiment, the mask probability updating module comprises:
[0119] The first probability updating unit is configured to, in a case where the differences between the current error, the voltage error and the temperature error at the first time point are all less than a preset difference threshold, increase the mask probability of each of the current mask channel, the voltage mask channel and the temperature mask channel at the first time point based on the product of the current error, the voltage error and the temperature error at the first time point and a dynamic error step length respectively.
[0120] In an embodiment, the mask probability updating module further comprises:
[0121] a second probability updating unit, configured to, in a case that a difference between the current error, the voltage error and the temperature error at the second time moment is greater than the difference threshold, reduce the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel at the first time moment based on a product between the current error, the voltage error and the temperature error at the first time moment and a dynamic error step length.
[0122] In an implementation manner, the apparatus further comprises a dynamic error step length determination module, which specifically comprises:
[0123] an average reconstruction error determination unit, configured to average the current error, the voltage error and the temperature error at each time moment to obtain an average reconstruction error;
[0124] a step length attenuation coefficient determination unit, configured to determine a step length attenuation coefficient based on a ratio between the average reconstruction error and a historical maximum reconstruction error;
[0125] a dynamic step length determination unit, configured to obtain the dynamic error step length based on a product between the step length attenuation coefficient and a maximum error step length.
[0126] In an implementation manner, the mask determination unit is specifically configured to:
[0127] determine a current masking mask, a voltage masking mask and a temperature masking mask at each time moment based on the mask probability of the current mask channel, the voltage mask channel and the temperature mask channel at each time moment.
[0128] In an implementation manner, the mask probability updating module is specifically configured to:
[0129] in a case that the number of times of updating of the mask network or the battery state of charge prediction model is less than a preset number threshold, determine the mask probability of each of the current mask channel, the voltage mask channel and the temperature mask channel as a preset initial mask probability;
[0130] in a case that the number of times of updating of the mask network or the battery state of charge prediction model is greater than the number threshold, update the mask probability of each of the current mask channel, the voltage mask channel and the temperature mask channel based on the current error, the voltage error and the temperature error between the mask time sequence electrical signal and the reconstructed time sequence electrical signal at each same time moment.
[0131] The specific functions and examples of each module and sub-module of the system of the embodiments of the present application are described in the related description of the corresponding steps in the above method embodiments, which will not be described here.
[0132] The acquisition, storage and application of the user personal information in the technical scheme of the present application comply with relevant laws and regulations and do not violate public order and good customs.
[0133] According to embodiments of the present application, the present application also provides a system and a readable storage medium.
[0134] Figure 4 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application described and / or claimed in this document.
[0135] As shown in Figure 4 The electronic device 800 includes a computing unit 801 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 802 or a computer program loaded into a random access memory (RAM) 803 from a storage unit 808. Various programs and data required for the operation of the electronic device 800 can also be stored in the RAM 803. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0136] Various components in the electronic device 800 are connected to the I / O interface 805, including an input unit 806, such as a keyboard, a mouse, etc., an output unit 807, such as various types of displays, a speaker, etc., the storage unit 808, such as a magnetic disk, an optical disk, etc., and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0137] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the training method of the battery state of charge prediction model based on dynamic timing mask and sample missing compensation. For example, in some embodiments, the training method of the battery state of charge prediction model based on dynamic timing mask and sample missing compensation can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the above-described method for training a battery state-of-charge prediction model based on a dynamic timing mask and sample missing compensation can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the method for training a battery state-of-charge prediction model based on a dynamic timing mask and sample missing compensation by any other appropriate means (e.g., by means of firmware).
[0138] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0139] Program code for carrying out operations of the methods of the present application can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, and partially on a remote machine or entirely on a remote machine or server.
[0140] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable storage medium can include, without limitation, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
[0141] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0142] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0143] The computer system can include clients and servers. This relationship can be. The servers are typically remote from the clients with the interactions between them occurring over a communication network. The relationship between client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The servers can be cloud servers, servers of a distributed system, or servers incorporating blockchain.
[0144] It should be understood that the steps shown in the various forms above can be reordered, added to, or deleted from. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technology disclosed in the present disclosure are achieved, which is not limited herein.
[0145] The specific embodiments described above are not intended to be limiting, and persons skilled in the art will appreciate that various modifications, combinations, sub-combinations and alternatives can be made to the specific embodiments without departing from the principles of the application. Any further modifications, equivalents and / or alternatives thereof are intended to fall within the scope of the present application.
Claims
1. A training method for a battery state-of-charge prediction model based on dynamic timing masking and sample missing compensation, characterized in that: include: Based on the masking probabilities and masking replacement features of the current mask channel, voltage mask channel, and temperature mask channel in the masking network, the current, voltage, and temperature at each moment in the sample time series electrical signal are masked to simulate signal loss and obtain the masked time series electrical signal; Based on the encoder and decoder in the battery state of charge prediction model, the masked time series electrical signal is encoded and decoded in sequence to obtain a reconstructed time series electrical signal; Based on the prediction network in the battery state of charge prediction model, the state of charge is predicted on the reconstructed time series electrical signal to obtain a predicted state of charge; updating the mask probabilities of the current mask channel, the voltage mask channel, and the temperature mask channel based on the current error, voltage error, and temperature error at each same moment between the sample time series electrical signal and the reconstructed time series electrical signal; determining a state-of-charge prediction loss based on the predicted state of charge and a true state of charge corresponding to the sample time-series electrical signal; Based on the state of charge prediction loss, the mask replacement features of each of the current mask channel, the voltage mask channel, and the temperature mask channel, as well as the model parameters of the battery state of charge prediction model are updated.
2. The method according to claim 1, characterized in that The method performs masking processing on the current, voltage, and temperature at each moment in the sample time series electrical signal based on the respective mask probabilities and mask parameters of the current mask channel, the voltage mask channel, and the temperature mask channel in the mask network to simulate signal missing, thereby obtaining a masked time series electrical signal, including: Determining the current masking mask, the voltage masking mask, and the temperature masking mask at each of the moments based on the respective masking probabilities of the current masking channel, the voltage masking channel, and the temperature masking channel; Subtracting the current shielding mask, voltage shielding mask, and temperature shielding mask at each of the moments from 1, respectively, to obtain the reverse current shielding mask, reverse voltage shielding mask, and reverse temperature shielding mask at each of the moments; For each of the moments, summing the products of the current masking mask, the voltage masking mask, and the temperature masking mask at the moment with the current, voltage, and temperature at the corresponding moment in the sample time series electrical signal, and summing the products of the reverse current masking mask, the reverse voltage mask, and the reverse temperature mask at the moment with the mask replacement features of the current mask channel, the voltage mask channel, and the temperature mask channel, respectively, to obtain the mask current, mask voltage, and mask temperature at each of the moments; The mask timing electrical signal is determined based on the mask current, mask voltage and mask temperature at each of the moments.
3. The method according to claim 2, characterized in that The updating of the respective mask probabilities of the current mask channel, the voltage mask channel, and the temperature mask channel based on the current error, voltage error, and temperature error at each same moment between the sample time series electrical signal and the reconstructed time series electrical signal includes: When the differences between the current error, the voltage error, and the temperature error at the first moment are all less than a preset difference threshold, the mask probability of the current mask channel, the voltage mask channel, and the temperature mask channel at the first moment is increased based on the product of the current error, the voltage error, and the temperature error at the first moment and the dynamic error step, respectively.
4. The method according to claim 3, characterized in that Also includes: When the difference between the current error, the voltage error, and the temperature error at the second moment is greater than the difference threshold, the mask probability of the current mask channel, the voltage mask channel, and the temperature mask channel at the first moment is reduced based on the product of the current error, the voltage error, and the temperature error at the first moment and the dynamic error step, respectively.
5. The method according to claim 3 or 4, characterized in that Also includes: averaging the current error, the voltage error, and the temperature error at each of the moments to obtain an average reconstruction error; determining a step size attenuation coefficient based on a ratio between the average reconstruction error and a historical maximum reconstruction error; The dynamic error step size is obtained based on the product of the step size attenuation coefficient and the maximum error step size.
6. The method according to claim 3 or 4, characterized in that The determining of the current masking mask, the voltage masking mask, and the temperature masking mask at each of the moments based on the respective masking probabilities of the current masking channel, the voltage masking channel, and the temperature masking channel includes: Based on the mask probabilities of the current mask channel, the voltage mask channel, and the temperature mask channel at each of the moments, the current mask, the voltage mask, and the temperature mask at each of the moments are determined.
7. The method according to claim 1, characterized in that The updating of the respective mask probabilities of the current mask channel, the voltage mask channel, and the temperature mask channel based on the current error, voltage error, and temperature error at each same moment between the sample time series electrical signal and the reconstructed time series electrical signal includes: When the number of updates of the mask network or the battery state of charge prediction model is less than a preset number threshold, determining the mask probability of each of the current mask channel, the voltage mask channel, and the temperature mask channel to be a preset initial mask probability; When the number of updates of the mask network or the battery state of charge prediction model is greater than the number threshold, the mask probability of the current mask channel, the voltage mask channel, and the temperature mask channel are updated based on the current error, voltage error, and temperature error at each identical moment between the sample time series electrical signal and the reconstructed time series electrical signal.
8. A training device for a battery state-of-charge prediction model based on dynamic timing masking and sample missing compensation, characterized in that: include: A timing mask module is used to mask the current, voltage, and temperature at each moment in the sample timing electrical signal based on the mask probabilities and mask replacement features of the current mask channel, voltage mask channel, and temperature mask channel in the mask network to simulate signal absence and obtain a masked timing electrical signal; An encoding and decoding module, configured to encode and decode the masked time series electrical signal in sequence based on an encoder and a decoder in a battery state of charge prediction model to obtain a reconstructed time series electrical signal; A prediction module, configured to perform state of charge prediction on the reconstructed time series electrical signal based on a prediction network in a battery state of charge prediction model to obtain a predicted state of charge; a mask probability updating module, configured to update the mask probability of each of the current mask channel, the voltage mask channel, and the temperature mask channel based on the current error, voltage error, and temperature error at each identical moment between the sample time series electrical signal and the reconstructed time series electrical signal; a predicted loss calculation module, configured to determine a predicted state of charge loss based on the predicted state of charge and a true state of charge corresponding to the sample time series electrical signal; A model updating module is used to update the mask replacement features of the current mask channel, the voltage mask channel, and the temperature mask channel, as well as model parameters of the battery state of charge prediction model based on the state of charge prediction loss.
9. An electronic device, characterized in that: include: at least one processor, and a memory communicatively coupled to the at least one processor; In which, the memory stores instructions that can be executed by the processor, and the processor is used to obtain the instructions from the memory and execute the instructions, so that the processor can execute the training method of the battery state of charge prediction model based on dynamic timing mask and sample missing compensation according to any one of claims 1-7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to be provided to a computer to instruct the computer to execute the training method of the battery state of charge prediction model based on dynamic timing mask and sample missing compensation according to any one of claims 1 to 7.