Multi-step ahead thermal warning network for energy storage system based on the core temperature detection

The energy storage system is an important part of the energy system. Lithium-ion batteries have been widely used in energy storage systems because of their high energy density and long life. However, the temperature is still the key factor hindering the further development of lithium-ion battery energy storage systems. Both low temperature and high temperature will reduce the life and safety of lithium-ion batteries. In actual operation, the core temperature and the surface temperature of the lithium-ion battery energy storage system may have a large temperature difference. However, only the surface temperature of the lithium-ion battery energy storage system can be easily measured. The estimation method of the core temperature, which can better reflect the operation condition of the lithium-ion battery energy storage system, has not been commercialized. To secure the thermal safety of the energy storage system, a multi-step ahead thermal warning network for the energy storage system based on the core temperature detection is developed in this paper. The thermal warning network utilizes the measurement difference and an integrated long and short-term memory network to process the input time series. This thermal early warning network takes the core temperature of the energy storage system as the judgment criterion of early warning and can provide a warning signal in multi-step in advance. This detection network can use real-time measurement to predict whether the core temperature of the lithium-ion battery energy storage system will reach a critical value in the following time window. And the output of the established warning network model directly determines whether or not an early emergency signal should be sent out. In the end, the accuracy and effectiveness of the model are verified by numerous testing.

and even lead to thermal runaway in severe cases 5 . The cause and influence of the rise of core temperature are shown in Fig. 1. So it is very important to monitor and predict the temperature of the energy storage system.
Due to the heat generation and heat dissipation inside the lithium battery energy storage system, there may be a large temperature difference between the surface temperature and the core temperature of the lithium battery energy storage system 6 . When the heating of the battery is large, the core temperature of the energy storage system will be significantly higher than the surface temperature, and the core temperature of the energy storage system will first reach the critical point. Therefore, in the design of the energy storage system thermal management system, if only the surface temperature is used to determine the safety level of the energy storage system, the energy storage system may be in a dangerous state. However, usually, only the surface temperature of the lithium battery energy storage system can be measured in real-time. As one of the key parameters of thermal state estimation, core temperature is difficult to measure directly 7 . Although there have been studies to measure the internal temperature of the battery in situ by integrating the temperature sensor 8 , it has not been commercialized due to the increased cost and uncertain potential threat. So it is necessary to predict and estimate the core temperature of the lithium battery energy storage system.
At present, the research of lithium-ion batteries' core temperature estimation is mainly divided into mathematical analysis method based on model and data-driven method based on data. Researches established different models to estimate the temperature distribution of lithium-ion batteries [9][10][11][12][13][14][15] . Although they can accurately estimate the real temperature distribution of lithium-ion batteries, it is difficult to use them for real-time estimation due to a large number of equations and parameters. To reduce the computational complexity and complexity of the model, researchers proposed the node methods to estimate the temperature of several key nodes of lithiumion batteries [16][17][18][19] , which can accurately estimate the core temperature of the lithium-ion battery, and have been widely used. However, it may be time-consuming to obtain the heating parameters in the model 2 . In addition, the researchers proposed a new non-invasive measurement of the core temperature of the lithium-ion cell 20,21 . This method does not need to build a parameter-based model, but rather solves the relationship between the core temperature and outside surface temperature distribution as functions of time. But these methods all need some parameter information of battery and some calculation.
Deep learning has been widely used in various fields, because even novices are easy to carry out end-to-end learning without human intervention 22 . If there are enough reliable data, an excellent prediction network can be trained. Long and short-term memory neural network (LSTM) is an excellent recurrent neural network, and has been widely used in safety monitoring. Li et al. combined the long-term memory neural network with the equivalent circuit model of lithium battery by adaptive enhancement method and proposed a fault diagnosis method based on voltage prediction 23 . Wang et al. proposed a power prediction and anomaly detection method based on LSTM neural network, and its advantages are verified by real experiments 24 . In order to avoid the complex process of model building and parameter identification, many researchers have used data-driven methods based on a large number of real data and deep learning to predict the temperature of lithium-ion batteries 2,25,26 . However, most of these studies only predict temperature, seldom predict multi-step temperature changes and give early warning.
The main work of this paper is as follows. Firstly, this paper introduces the method of estimating the core temperature using the two-node equivalent thermal network model of the battery, and points out the shortcomings of the current work. Then, combining multi-step temperature prediction and thermal warning, a multi-step ahead thermal warning network for lithium-ion battery energy storage system is established to judge whether the temperature is out of bounds in multiple future steps. The multi-step ahead thermal warning network is an integrated model of two long and short-term memory neural networks. Two long and short-term memory neural networks are used to train the slow and fast characteristics related to the core temperature changes of the energy storage system. And the neural network established in this paper is a classification network. The model is then trained with a large amount of data. The input of the model is measurable data, and the surface temperature difference between two sampling points is introduced. And the output of the model is 0-1 signals representing www.nature.com/scientificreports/ whether the core temperature is abnormal at the next few sampling points. In this paper, the ability of core temperature early warning is added to the trained model. Unlike the simple method of judging whether or not the predicted temperature is out of bounds, the multi-step thermal warning network established in this paper directly implements the function of early warning for core temperature anomalies of the energy storage system, which reduces the judgment operation and improves the safety of energy storage system.

Battery core temperature
Equivalent thermal network model. The battery equivalent thermal network model is shown in Fig. 2 27,28 . Here, Q is the heat generation rate of lithium-ion batteries, R 1 and R 2 denote the thermal resistances between the inside and the surface of the battery and between the surface and the environment, respectively, and C 1 and C 2 are the corresponding internal and surface heat capacity of the battery. Finally, T in , T s , and T amb denote the core, the surface temperature of the battery, and the ambient temperature of the environment, respectively. The mathematical expression of heat transfer is as follows 29,30 : Under a large load current, the heat generation of the battery arises mainly from the ohmic heat 17 , which is proportional to the internal resistance of the battery by i is the battery terminal current, R denotes the internal resistance of the battery. Since the internal resistance of the battery does not vary greatly with SOC, as long as the battery in a limited region ranging from 20 to 80% of the SOC, R is assumed to be a function of the battery's core temperature T in only 17 .
Parameter identification of equivalent thermal network model. In this section, we illustrate a general procedure for identifying the input, output, and parameters of the model. Applying the following discretization. and setting Δt = 1, Eqs. (2) and (3) reduce to where (1) www.nature.com/scientificreports/ Here, Eq. (7) describes that the change of core temperature of the battery is related to heat production and the temperature difference between core temperature and surface temperature; while Eq. (8) entails that the change of the surface temperature of the battery is related to not only the difference between the core temperature and the surface temperature, but also the difference between the surface temperature and the ambient temperature. Since Eq. (7) is decoupled from Eq. (8), coefficients a 1 and a 2 are first estimated using the forgetting factor recursive least squares method in the first stage, followed by an estimation of b 1 and b 2 in the second. As soon as coefficients a 1 , a 2 , b 1 , and b 2 are determined, model parameters K 1 , K 2 , C 1 , C 2 are obtained by solving Eq. (9).
As an effective approach for system identification, the forgetting factor recursive least squares (FFRLS) algorithm identifies the parameters by minimizing the squares of the generalized errors. FFRLS formulas are deduced as Summary. After the parameters of the model are identified, we can use the state estimation method to predict the core temperature of the battery according to the thermal model. At present, the joint Kalman filter is a good and often used method. However, there are still shortcomings in this method. Because the two-node equivalent thermal network model of the battery has been greatly simplified, there is a certain error between the estimation of the core temperature and the real value. The two-node equivalent thermal network model assumes that some parameters are constant, but in fact, due to the changes of battery temperature and SOC, the parameters of the model are usually time-varying. The identification of time-varying parameters is time-consuming work. So this paper designs a multi-step ahead thermal warning network for the energy storage system based on the core temperature detection.

Methods
Model. Multi-step ahead thermal warning network. The multi-step ahead thermal warning network established in this paper is shown in Fig. 3. The number of neurons in each hidden layer and the activation function used are illustrated in brackets in Fig. 3. The input of the model connects two integrated LSTM networks, each of which includes two LSTM layers. The number of neurons in the two LSTM layers of the first LSTM network is 64 and 32 respectively, and the number of neurons in the second LSTM network is 64 and 16 respectively. A dropout layer is added after each LSTM layer to prevent overfitting. The probability of dropout is 0.5. Then, the outputs of two LSTM networks are connected in series through the concatenation layer. Then two fully connected layers are connected. The number of neurons in the first fully connected layer is 32, and the activation function is tanh. The number of neurons in the second fully connected layer is 2. The second fully connected layer determines the number of categories. Finally, the output is obtained through the softmax layer and the classification layer, and the classification layer takes the cross entropy as the loss function. The LSTM cell, dropout layer, softmax and cross entropy are explained in detail in the next section.
The workflow and schematic diagram of the multi-step ahead thermal warning network for the energy storage system is shown in Fig. 4. The sampling time Δt set in this paper is 1 s. The inputs of the neural network are the measured surface temperature T s , heat Q, SOC of lithium battery, ambient temperature T amb, and the surface temperature difference ΔT s between the two adjacent sampling times for 20 s. Then the inputs are passed to the hidden layer. Features are extracted and mapped through the integrated LSTM layer, and fused through the fully  www.nature.com/scientificreports/ connected layer. Then the output of the fully connected layer refracts to the probability between 0-1 through the softmax layer. The real output is 0 and 1. 0 means that the core temperature of the lithium battery energy storage system will not reach the critical value in the next 10 s, and the warning should not be given; 1 means that the core temperature may exceed the limit in the next 10 s, and the energy storage system operation may be dangerous, which needs early warning. Then the output of softmax and the real output calculate the network loss through cross entropy, and calculate the gradient of loss to update the weight and deviation of each hidden layer. This process is repeated until the end of the iteration.

Network layer interpretation. LSTM cell. LSTM network is a recurrent neural network (RNN). RNN
network is a kind of artificial neural network for sequence data; it attempts to simulate time-related or sequencerelated behavior 31 . The hidden structure of RNN is the memory of the network, and the current state is affected by both the current input and the previous state. This structure enables RNN to effectively process time series data 32 . With the development of back-propagation and computing efficiency, RNN has been applied in various fields. However, RNN performs poorly in long-term sequences, and information from earlier moments has little effect on the output of the current moment. Another disadvantage of RNN is that gradient disappearance and gradient explosion may occur during back-propagation. This is because small gradients or weights multiply many times in multiple time intervals, and gradients will shrink to zero asymptotically. However, when the gradient is too small or disappears, the network can't adjust the weight in the direction of reducing the error, which makes the RNN network stop learning and cannot learn the long-term dependence 33 . In order to overcome the long-term dependence of RNN, Jürgen Schmidhuber et al. proposed a recursive neural network with long and short-term memory in 1997 34 . Compared with simple RNN, LSTM adds a state in the hidden layer to maintain the long-term state, and this newly added state is called cell state 35 . The input of LSTM includes the output value, the input value and the cell state of the previous time, and the output includes the output value and the cell state of the current time. Similar to the classical RNN, LSTM is composed of input layer, hidden layer and output layer. And LSTM has the form of repetitive module chain of neural network. However, the hidden layer of LSTM adopts a special memory mechanism, and the repeat module of LSTM has different structures. References [36][37][38][39][40][41] explained the working mechanism of the LSTM unit. The structure of the LSTM cell is shown in Fig. 5.  www.nature.com/scientificreports/ The top line from C t−1 to C t in Fig. 2 represents the transport of cell state, which is also the key to LSTM. LSTM acquires the ability to delete or add information to the cell state through a structure called gate. The gate consists of a Sigmod neural network layer and a bitwise multiplication operation. The activation function of the Sigmod neural network layer is shown in Eq. (11). It can convert the input signal to a value between 0 and 1, so as to determine how many input signals can pass through. 0 means no signal is allowed to pass, 1 means all signals are allowed to pass.
LSTM consists of three kinds of gates: forgetting gate, input gate and output gate 42 . The forgetting gate determines what information should be forgotten in the previous cell state C t−1 . First, the output h t−1 of the previous time and the input x t of the current time are accepted, and the signal f t is output through the Sigmod layer. Then f t is a value from 0 to 1, which is multiplied by C t−1 to determine the information retained in C t−1 . As shown in Eq. (12).
The input gate determines the new information to be entered in the cell state. First, x t and h t−1 are input into the Sigmod layer, and a value i t between 0 and 1 is output. At the same time, x t and h t−1 create a new state candidate vector C t with values between − 1 and 1 through a tanh neural network layer. Then i t and C t are multiplied to determine which information is added to the cell state C t at the current time. As shown in Eqs. (13) and (14).
The cell state is updated according to the output of the forgetting gate and the input gate, as shown in Eq. (15).
The output gate determines what the LSTM cell outputs. First, x t and h t−1 are input into Sigmod layer, and a value o t between 0 and 1 is output. Then the updated cell state Ct is converted to a function between − 1 and 1 by a tanh function (as shown in Eq. (16)). The new output is obtained by multiplying o t and Ct, which is also the input signal at the next moment. The process is shown in Eqs. (17) and (18).
Dropout. Dropout layer is to prevent overfitting due to many model parameters but few training samples 43 . The principle of Dropout is shown in Fig. 6.
Firstly, a certain proportion of hidden neurons are randomly deleted, and the input and output neurons remain unchanged. Then the input is propagated forward through the modified network, and the loss is propagated back through the modified network, so that only the neurons that have not been deleted will update the corresponding parameters. Repeat the process. In this way, every two hidden nodes may not appear at the same www.nature.com/scientificreports/ time, and the update of weights no longer depends on the interaction of hidden nodes with fixed relationship, which prevents some features from having effect only under other specific features. In addition, Dropout can also be regarded as an average model. Hidden neurons are deleted randomly each time, so different samples correspond to different models.
Softmax and cross entropy. In deep learning, Softmax and Cross entropy are common and important functions. And Softmax and Cross entropy are usually used in multi-classification neural networks. Suppose that the original outputs of the neural network are y 1 , y 2 ,…, y n . Then the output after Softmax is shown in Eq. (19).
So Softmax can map the input to a real number between 0 and 1, and ensure that the sum is 1, so that the output of each node becomes a probability value.
Cross entropy is usually used as the loss function of the network to determine the closeness between the actual output and the expected output. As shown in Eq. (20), the probability distribution p is the expected output and the probability distribution q is the actual output. Cross entropy represents the distance between the actual output probability and the expected output probability. The smaller the cross entropy is, the closer the two probability distributions are.
The combination of Softmax function and Cross entropy function can greatly simplify the gradient of loss function. The formula is shown in Eq. (21). Where L is the cross-entropy loss function; b i is the real distribution; a i is the predicted distribution, that is, the output of Softmax; and z i is the output of neurons.

Results
Parameter setting and training network. This paper uses MATLAB to establish the multi-step ahead thermal warning network and training network. In this paper, "Adam" algorithm is used. This paper changes the network input, predicted time-steps of the network output, training parameters and the probability of dropout. Then we test different networks. The results of the tests are shown in Figs. 7,8,9 and 10. In Fig. 7, We can see that when the difference between two sampling points is added to the model input, the accuracy and F1 score of the model are improved. When the temperature difference and heating difference are added to the model input, the effect of the model can be greatly improved. However, the accuracy and F1 score of the model will be decreased by adding the SOC difference. The results in Fig. 8 show that the accuracy of the model will decrease www.nature.com/scientificreports/ with the increase of the model's predicted time steps. When the number of time steps is five or ten, the prediction accuracy is higher. And when the number of time steps is further increased, the accuracy of the model decreases greatly. Figure 9 shows that when the dropout parameter is small, the ability to prevent overfitting is poor, and the accuracy of the model is also low. When the dropout parameter is too large, the accuracy of the model will also decline. 0.5 should be a good value for the dropout parameter, which can make the accuracy of the model reach 97%. In Fig. 10, we can see that when the training epochs are small or the initial learning rate is small,   www.nature.com/scientificreports/ increasing the other side can effectively improve the prediction ability of the model. However, when both of them are large, the model may be overtrained and the generalization ability of the model will be reduced. The best inputs are the surface temperature T s , heat Q, SOC of lithium battery, ambient temperature T amb , and the surface temperature difference ΔT s . The probability of dropout is 0.5. The best training parameters are set as follows. 'ExecutionEnvironment' is cpu; 'MaxEpochs' is 600; 'SequenceLength' is longest; 'GradientThreshold' is 1; 'InitialLearnRate' is 0.001. In this paper, 12,100 s lithium battery data is used to generate the training input of the neural network model by the sliding window method. And 0-1 value is generated according to whether the core temperature of the lithium battery in the next 10 s corresponding to each window reaches the critical value, which is regarded as the training output of the neural network model. The length of each sliding window is 20 s. After automatic training, a better multi-step ahead thermal warning network model is obtained. The training-process curve is shown in Fig. 11. Accuracy. Accuracy is the ratio of the number of samples correctly classified to the total number of samples.
It is shown in Eq. (22). Precision. Precision represents the proportion of the number of correct predictions in the result with a prediction of 1. Its significance is to judge whether the results of the model can "find the right one". It is shown in Eq. (23).

Recall.
Recall represents the proportion of the number of samples correctly predicted in samples with a real value of 1. Its significance is to judge whether the results of the model can "find all". As shown in Eq. (24). F1-score. F1 score is the harmonic average of precision and recall. This is because precision and recall are sometimes contradictory indicators, and they need to be considered together. As shown in Eq. (25). www.nature.com/scientificreports/

Conclusion
In this paper, a novel multi-step ahead thermal warning network is proposed for the energy storage system as the core temperature overrun warning. Various methods are compared to prove the accuracy advantage of the proposed model. By changing the input of the model, it can be seen that when only adding the surface temperature difference of two sampling points, the accuracy and F1 score of the model are the highest and can reach more than 97%. Besides, the insertion of the dropout layer to the thermal warning network benefits the predicted effect of the model. When the dropout parameters are selected properly, the accuracy of the model can be improved by about 2%. During the process of network training, the integrated selection of MaxEpochs and InitialLearnRate has a great influence on the model. Both overtraining and undertraining of the network will reduce the generalization capability of the network. The highest accuracy of the proposed multi-step ahead thermal warning network can reach more than 97%. It can be found that the prediction step of 10-steps is also effective. The proposed network can accurately estimate the core temperature in the next 10 s and provide the early-warning signal according to the measurement of the previous 20 s, which saves significant time for the thermal protection of the large-scale energy storage system.

Data availability
The datasets generated during the current study are available from the corresponding author on reasonable request.