1 Introduction

Global pollution and climate change challenges pose a significant threat to human existence. Some developed countries have declared their intention to phase out their diesel and gasoline vehicle fleets in favor of electric cars (EVs) in the near future in an effort to reduce their carbon emissions [1]. Nonrenewable resources like petroleum will eventually run out because of their limited quantity. Alternative energy sources, such as solar and wind, are also viable options. However, these methods necessitate the construction of enormous, complex, and expensive power plants. In addition, such plants necessitate the use of exceptionally skilled workers [2]. Therefore, most modern portable consumer devices employ lithium-ion batteries to lessen their reliance on traditional fuels. In addition, the automotive industry is suffering a huge setback due to the rising price of crude oil. As a result, it is very necessary to design automobiles that can run on alternative fuels in order to combat this problem [3]. It is commonly recognized that switching from fossil fuels to renewable energy will bring about the desired shift in our society [4]. To solve the issues, the installation of EV has attracted significant attention and has become appealing options for academic researchers and car professionals owing to its promising qualities in terms of decreasing greenhouse gas emissions [5]. Battery is playing a wide role in driving the electric vehicle. The most common rechargeable batteries are lithium-ion, lead-acid, and metal-nickel-hydride. Since LIBs are a form of reusable, rechargeable battery, they dramatically reduce chemical fuel consumption and carbon emissions. Hence, LIBs are being most popularly used due to its several advantages over other batteries [6]. Because of the relevance and current obstacles, developing enhanced battery management systems (BMS) for EVs has been a hot research area. Various estimates are used in battery management systems, including the state of charge (SoC), state of health (SoH), state of energy (SoE), state of power (SoP), state of temperature (SoT), and status of safety (SoS). In general, the tightly connected SoC and SoH monitorings are the primary concerns and the foundation for improving dependability and ensuring safety [7]. The SoC estimation of battery checks how much power is left in a battery during a charge–discharge cycle. This keeps the battery safe from being overcharged or over discharged. The SoH estimation is used to figure out how much longer the battery will work or how many more times they can be charged and discharged. This will tell the need to buy new battery [8]. The remaining sections of this article are laid out as follows: Existing work has been reported in Sect. 2. The proposed work and methodology are explained in Sect. 3. Section 4 consists of results and discussion followed by conclusion in Sect. 5.

2 Related work

More than half of all greenhouse gas emissions come from the transportation and electricity production sectors since these industries use fossil fuels as their primary energy source. The electrification of transport and the reduction of carbon emissions from power plants are two promising approaches [9]. But, the problem in EV is the battery. The prediction of accurate SoC of battery is very crucial task. The manufacture and implementation costs of Li-ion batteries can be greatly reduced if their SoC is accurately predicted. However, because current sensor technology prevents accurate measurements from being taken outside of a laboratory setting, this SoC is notoriously difficult to quantify. [10]. There are various methods for SoC estimation and finding error while prediction of SoC. It is possible to classify SoC estimating strategies into different groups like direct measurement, estimated terminal voltage, estimated impedance, Kalman filter, and the Coulomb counting technique [11]. The open-circuit voltage method is utilized largely for the purpose of determining the relationship between the open-circuit voltage (OCV) and the SoC of the battery. Subsequently, a matching OCV–SoC table is constructed through the utilization of discharge experiments in order to estimate the SoC based on the mapping relationship between the two methods. A battery model is constructed using the model-based technique in order to build a time-domain space state equation for the purpose of predicting the SoC. This allows the model-based technique to identify the internal properties of the battery [10]. The adaptive approaches provide a more accurate simulation of the chemical effect and nonlinear charge characteristics of the batteries by using support vector machine, back propagation neural network, fuzzy neural network, and radial basis neural network [12]. Academic interest in the data-driven approach has grown in recent years because it is straightforward and does not necessitate a fixed battery model or precise calculation to estimate the battery's SoC. As a result of the fact that the correlations between the battery SoC and the observable variables (voltage, charge/discharge current, resistance, etc.) may be learned autonomously from the data, several studies have applied numerous traditional machine learning approaches in order to simulate the nonlinear characteristics of batteries [13]. Common learning methods include things like artificial neural networks, support vector machines, and semi-supervised learning, among other things [14]. Deep learning is a subset of machine learning that can efficiently capture the correlations between observed signals and SoC by employing multilayer deep neural networks with nonlinear transformations to extract feature information from input samples.

This can be accomplished through the use of the method known as "deep learning." In recent years, RNN, which is a strategy to predicting sequence data that is based on neural networks and deep learning, has seen a rise in popularity among academics. [15]. Various SoC estimation methods are shown in Fig. 1.

Fig. 1
figure 1

Different SoC estimation methods

3 Proposed work

This research proposes an optimized deep learning approach-based data-driven method for estimating SoC. Since deep learning excels at approximating nonlinear functions, it has become a common data-driven solution to solving the battery SoC estimation problem. Previous works track SoC data in relation to temperature changes only. They neglected to account for the impact of C-rate variation on the estimated state of charge. As C-rates control how quickly a battery charges and discharges, C-rate is one of the most important aspects that has to be considered while estimating SoC. A battery's capacity is often specified in units of 1C. But estimation of SoC at 1-C is not always correct. Draining of a battery at a varied C-rate theoretically uses the same calculations as draining a battery at a constant C-rate of 1-C, but in practice, there is likely to be some internal energy loss. These energy losses are getting converted to heat and can reduce the capacity of battery by up to 5% at higher C-rates. So, in this paper author has considered the C-rate also for estimating the SoC more precisely. In existing works, the effect on the internal resistance along with SoC and varying temperature is rarely considered. In this paper, author analyzed the change in internal resistance with respect to the varying temperature and at different level of SoC by using optimized deep learning strategy. Variation of voltage with respect to the discharging capacity at different temperature has also been considered in this article and reduces the SoC estimation error to 0.3199%.

A battery's “C-rate” is the rate at which it may be charged or discharged in relation to its total capacity. It is a typical term for describing a battery's ability to send or receive electrical current. C-rate is commonly expressed as a power factor for the battery. A battery with a 1000 mAh capacity, for instance, would be discharged at a current of 1000 mA (1A) at a rate of 1C. Similar to how 2C means to charge the battery at a current of 2A, 2C means to charge the battery at a pace of 2000mA. Battery performance, capacity, and lifespan are all affected by the C-rate. Faster charging and discharging are possible with higher C-rates, but this trade-off may shorten the battery's useful life due to increased heat and stress.

A battery with a lower C-rate may take longer to charge or discharge, but it will likely have a longer lifespan. It is important to remember that different battery chemistries call for various C-rates. It is common for lithium-ion batteries to have higher C-rates than lead-acid ones. To guarantee safe and optimal functioning, C-rates should be set according to the manufacturer's requirements and guidance. This paper proposes a Bayesian bidirectional long short-term memory (Bayes BiLSTM) technique for SoC estimation and prediction of error. Bayesian modeling and bidirectional LSTM architecture have been brought together in this method. The model's goal is to include uncertainty estimation in BiLSTM network forecasts. The structure of the proposed algorithm is shown in Fig. 2. The groundwork for developing the network model is laid during data preprocessing. Existing numerical inconsistencies will impair the speed and effectiveness of the model's training due to the variable magnitudes and magnitude units of the gathered battery data indicators for voltage, current, SoT, SoH, and SoC. Therefore, normalizing the data samples is necessary to reduce the impact of scale between the indicators and preserve the model's accuracy and generalizability. As shown in Eq. 1, the autocorrelation function (ACF) provides a quantitative representation of the linear connection that exists between the values of a time series and its lagging observations.

$$ {\text{x}}_{k} \, = \, \sum\nolimits_{i = k + 1}^{n} {{\raise0.7ex\hbox{${\left( {v_{t} - \overline{v}} \right)\left( {v_{t - k} - \overline{v}} \right)}$} \!\mathord{\left/ {\vphantom {{\left( {v_{t} - \overline{v}} \right)\left( {v_{t - k} - \overline{v}} \right)} {\sum\nolimits_{i = 1}^{n} {\left( {v_{t} - \overline{v}} \right)^{2} } }}}\right.\kern-0pt} \!\lower0.7ex\hbox{${\sum\nolimits_{i = 1}^{n} {\left( {v_{t} - \overline{v}} \right)^{2} } }$}}} $$
(1)
Fig. 2
figure 2

Structure of the proposed methodology

For data preprocessing of variable, below equation Eq. 2 is used where \(X_{{\left( {x_{m,} x_{o} } \right)}}\) is the separation between the two observations and \(x_{mi}\) is the value of variable \(i\) in the target observation, whereas \(x_{oi}\) is the value of variable \(i\) in the other observation.

$$ X_{{\left( {x_{m,} x_{o} } \right)}} = \sqrt {\sum\limits_{i = 1}^{n} {\left( {x_{mi} - x_{oi} } \right)} } $$
(2)

As shown in Eq. 3, the [0,1] range is transferred to the actual values by means of the minimal maximum function.

$$ a^{*} = \left[ {{\raise0.7ex\hbox{${\left( {a - a_{\min } } \right)}$} \!\mathord{\left/ {\vphantom {{\left( {a - a_{\min } } \right)} {\left( {a_{\max } - a_{\min } } \right)}}}\right.\kern-0pt} \!\lower0.7ex\hbox{${\left( {a_{\max } - a_{\min } } \right)}$}}} \right] $$
(3)

where \(n\) is the total number of observations and \({\text{x}}_{k}\) is the autocorrelation with a lag of k. The data point at time \(t\) is denoted by \(v_{t}\), whereas the sample mean is represented by \(\overline{v}\), normalized data are represented by the symbol \(a^{*}\), the actual measured data are represented by the symbol \(a\), and the minimum and maximum measure values are expressed as \(a_{\min }\) and \(a_{\max }\), respectively. After this, data segregation is used followed by Bayes-BiLSTM to train the model. This study applies the idea of Bayesian optimization to the process of optimizing the network's hyperparameters in a way that improves the accuracy of lithium battery SoC prediction as in Eq. 4. The optimized hyperparameter \(a^{*}\) and Bayes' theorem is illustrated in Eqs. 4 and 5, respectively. The pseudocode of the proposed algorithm is shown in Table 1

$$ a^{*} = \mathop {\arg \min }\limits_{a \in A} f(a) $$
(4)
$$ B\left( {f|K} \right) = \left[ {{\raise0.7ex\hbox{${B\left( {K|f} \right)B\left( f \right)}$} \!\mathord{\left/ {\vphantom {{B\left( {K|f} \right)B\left( f \right)} {B(K)}}}\right.\kern-0pt} \!\lower0.7ex\hbox{${B(K)}$}}} \right] $$
(5)
Table 1 Pseudocode of proposed algorithm

4 Results and discussion

The Bayes-BiLSTM SoC estimation algorithm that was presented in the paper has been implemented in MATLAB/SIMULINK. In order to conduct an exhaustive study of the effectiveness of the suggested strategy, two distinct test cases have been taken into consideration. In the first scenario, SoC was estimated at a variety of temperatures; in the second scenario, various C-rates were taken into consideration to ensure the robustness of the suggested method. The performance was evaluated in comparison with more conventional algorithms, each of which does not take into account both the temperature and the C-rate simultaneously.

A visual representation of the input datasets is shown in Figure 3. The data include readings of both current and voltage. The dataset is mined for its features. In this context, only relevant features are retrieved, such as current, voltage, and Soc, while the rest of the data is discarded. It represents the change in current and voltage with time at constant temperature of 293 K and at the charging rate of 1C. This figure also depicts the change in voltage w.r.t. SoC at 293 K and 1 C charging rate.

Fig. 3
figure 3

a Battery current w.r.t. time, b battery voltage w.r.t. time, and c voltage w.r.t. SoC

Figure 4 shows the change in voltage with respect to discharge current and SoC at different temperature and at the different C-rate as follows: (a) change in voltage w.r.t discharge capacity with varying temp. (b) Change in voltage w.r.t discharge capacity with varying C-rate. (c) Change in voltage w.r.t SoC (%). It represents that the voltage is linear for lower discharge rate for all temperature and C-rate and becomes nonlinear for higher discharge rate. The graph of voltage at different temperature rating is linear for lower SoC and nonlinear for higher SoC which is undesirable. But, most of the time it is linear so it is acceptable. The polarization of a battery during discharge serves as the basis for its discharge curve. A battery's energy output, shown by the area under the discharge curve, is highly dependent on its operating parameters, including the C-rate.

Fig. 4
figure 4

a Change in voltage w.r.t discharge capacity with varying temp. b Change in voltage w.r.t discharge capacity with varying C-rate, and c change in voltage w.r.t SoC (%)

During the process of discharging, a battery's voltage will decrease due to the drop. As can be seen in Fig. 5, the proposed topology effectively mitigates the drop at C-rate equal to 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1 and hence maintaining the voltage drop near to zero throughout the cycle. Electrode deterioration is one of the main concerns for the battery’s life and quality. There are two pathways that can lead to electrode deterioration. Two of these processes include structural/phase changes in the electrode and the creation and subsequent modification of a surface coating on the electrode.

Fig. 5
figure 5

Change in voltage w.r.t. current

The response rate is slowed when a surface coating is present. The rate at which charges are transferred is also slowed. This means that the charge transfer rate will decrease with cycling due to both causes. As a result of the aforementioned mechanisms, the transport rate will decrease and the electrode's impedance will rise as shown in Fig. 6 for different SoC.

Fig. 6
figure 6

Change in resistance w.r.t. temperature

Figure 7 demonstrates how, in each SoC state, resistance steadily reduces as ambient battery temperature rises; in other words, temperature and resistance are inversely connected. In comparison with high temperature, the variation of resistance with SoC is more pronounced at low temperatures. Additionally, the variation in resistance at low temperatures exhibits typical nonlinear properties. As can be seen in Fig. 8a, the suggested technique significantly lowers the SoC estimation error at various temperature.

Fig. 7
figure 7

Change in resistance w.r.t. SoC at various temperature

Fig. 8
figure 8

a SoC estimation error for various temperature and b comparison of different methods for error in SoC estimation

As can be seen in Fig. 8a, the suggested technique significantly lowers the SoC estimation error at various temperature. The calculated error while prediction of SoC at 333 K is 0.3775%; at 243 K, it is 0.6633%; at 253 K, error is 0.3396%, and at 293 K, the estimated error is 0.3199% but in other papers it is 5%, 3%, 1.7371%, 6%, 2.49% and 1.08% which is very high as compared to the proposed method. Hence, the proposed method is successfully calculating SoC with less error. A comparative analysis of different methods is also shown in Fig. 8b.

5 Conclusion

Here, data at different temperature and at different C-Rate have been gathered to show how reliable and effective the suggested approach is for making estimations. The proposed model's estimation accuracy has been compared to that of other popular models of varying architectures by the author. The proposed transformer model achieved the least amount of inaccuracy of any of the topologies compared in the study. Table 2 summarizes the various models' error metrics. From this paper, it can be concluded that:

  • Overall, the proposed approach had the lowest error rate among all the examined topologies.

  • The calculated error while prediction of SoC at 293 K is 0.3199% only.

  • By using the proposed algorithm, voltage drop has been reduced.

  • It has been observed that the variation of resistance with SoC is more pronounced at low temperatures

  • Variation in resistance at low temperatures exhibits typical nonlinear properties.

Table 2 Comparison table of different methods for error estimation while SoC calculation

So, the proposed work has effectively estimated the SoC by varying temperature and for different C-rate. This paper also considered the effect of temperature and C-rate on resistance. This algorithm reduces the error while estimation of SoC to less than 1% near about zero and hence increases the reliability.