1. Introduction
Estimating battery state parameters within battery-powered embedded systems is an indispensable task for proper system operation. One of the battery’s most important state parameters is the state of charge (SoC). It represents the ratio of the current remaining capacity to the maximum battery capacity [
1,
2]. Within a battery-powered system, the SoC value is used not only to provide real-time information about the remaining battery lifetime but also to prevent accelerated battery degradation due to overcharge and over-discharge.
Accurately estimating the SoC value is challenging due to the varying technical and environmental behavior of the battery, including the effects of aging, temperature fluctuations, and charge–discharge cycles [
3,
4,
5]. The list of challenges is even longer when the SoC estimation needs to be implemented on energy and computationally constrained platforms such as battery-powered embedded systems.
Countless SoC estimation methods have been developed to enhance estimation accuracy [
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18]. Most research introducing novel SoC estimation methods primarily focuses on quantifying accuracy separately or together with computational time achieved on general-purpose machines. A few papers that discuss implementations on actual embedded platforms provide computational complexity analysis along with accuracy analysis [
19,
20,
21,
22] but without analysis of the SoC algorithm’s impact on total system energy consumption.
Enhancing the energy efficiency of battery-powered devices is a crucial issue [
23], especially for battery-powered embedded systems with low operating currents and battery capacities, such as IoT sensor nodes [
24], wireless sensor networks [
25], battery-powered medical devices, and others. To increase energy efficiency, these systems typically operate in two modes: active mode, when data are being processed, and low power mode, when the system is inactive. Implementation of an SoC estimation algorithm, to be executed while the system is in active mode, requires the selection of an algorithm with low computational cost. Effective usage and implementation of such algorithms can reduce the duration of the active mode and extend the remaining useful lifetime of the battery. In the context of energy-constrained battery-powered embedded systems, selecting an SoC estimation algorithm may be easier if a comprehensive evaluation, considering both accuracy and energy consumption, is available. Therefore, an analysis that correlates these two important metrics for SoC estimation algorithms should enable easier selection of SoC estimation algorithms that have the potential to be implemented on battery-powered embedded systems.
In this paper, various SoC estimation methods have been reviewed to identify SoC estimation algorithms that may provide a good trade-off between computational cost and accuracy and which have the potential to be implemented as a pure software solution on an embedded platform. The extended Kalman filter (EKF) [
5] has been identified as a well-suited choice. The recursive algorithms execute periodically with an estimation rate, acquiring voltage and current samples during each run cycle and processing these samples based on the estimator’s state history. Therefore, there is flexibility in selecting the estimation rate, as reducing the estimation rate may decrease the estimator’s accuracy, but if this decrease is acceptable, it leads to energy savings.
This study aims to quantify the portion of total system energy consumption consumed by an SoC estimation algorithm in the case of low-power embedded systems. It also investigates how variations in the estimation rate impact both the accuracy of SoC estimation and the overall system energy consumption, with the goal of identifying the optimal estimation rate for a recursive SoC estimation algorithm. Finally, it evaluates the trade-offs between selecting a more complex, energy-demanding, high-accuracy algorithm and a simpler, low-energy, lower-accuracy alternative.
This research first conducts a theoretical analysis, deriving dependencies of the SoC estimation error and energy consumption on the algorithm’s estimation rate for a case of an ideal recursive estimator. The estimation error has been quantified by root mean square error (RMSE), whereas we introduced relative algorithm consumption (RAC) to quantify energy consumption. The derived dependencies then serve as the primary research criteria during further analysis. Additionally, an optimization cost function is introduced to enable the numerical determination of the optimal sampling period in scenarios where the configuration of the battery-powered system (including consumption, algorithm duration, CPU clock speed, etc.) and discharge profiles are well known.
To demonstrate the application of the theoretical analysis in a real-world scenario, two EKF algorithms of varying complexities were implemented and evaluated based on their estimation accuracy and the duration of a single run cycle. One of the algorithms is from the category of the computationally simpler algorithms and employs a simple Rint battery model. The algorithm is less precise and has a relatively low energy consumption due to lower computational complexity. The second analyzed algorithm is the EKF, which employs a 2nd-order RC battery model and belongs to the category of complex computational algorithms. It exhibits a high estimation precision and a relatively high energy consumption due to higher computational complexity. The algorithms have been implemented on a PC to verify the functionality and accuracy of the algorithms. To obtain the duration of algorithms single run cycles, both algorithms have been implemented on a microcontroller-based embedded platform.
The paper contributes to the evaluation of algorithms for SoC estimation and the trade-off between invested energy and accuracy. The contributions could be summarized in the following way:
After a comprehensive review of the literature, the research gap in the area of energy consumption analysis of SoC estimation algorithms has been identified.
The impact of the estimation rate of recursive SoC estimation algorithms on total energy consumption and estimation accuracy of a battery-powered embedded system has been theoretically quantified.
Two extended Kalman filters of different complexities have been implemented on an embedded platform and compared in terms of algorithm accuracy and computational complexity.
The foundation for a future development of energy-efficient SoC estimation for battery powered embedded systems has been laid.
The rest of the paper is organized as follows: In
Section 2, the SoC estimation algorithms are reviewed in terms of energy consumption. Theoretical considerations as well as the discussion on the fundamental concepts important for the trade-off between accuracy and energy consumption analysis are given in
Section 3.
Section 4 describes the experimental setup and the experimental procedures. The extracted values of the estimation model parameters are presented in
Section 5. The results obtained are presented in
Section 6. Concluding remarks and directions for future work are presented in
Section 7.
2. Related Works
Numerous methods for estimating a battery SoC have been developed. Understanding their overall performance, especially in terms of accuracy and computational complexity, is crucial for selecting the one that best meets specific system and battery requirements. The proper way to begin the selection process is to review the existing methods and classify them based on their common characteristics, application fields, advantages, disadvantages, and computational complexity [
5].
Several research papers deal with the classification of SoC estimation algorithms based on different selection criteria. Compared to the other research papers that perform classification of SoC estimation algorithms [
2,
4], the paper [
5] provides the most detailed classification of the existing SoC estimation methods, classifying them into six different categories: conventional methods, filter-based methods, observer-based methods, data-driven methods, hybrid methods, and other estimation methods.
Conventional methods are easy to implement and have an acceptable SoC estimation accuracy under certain conditions, therefore qualifying as a possible solution for implementation on embedded platforms [
12,
13,
14]. However, most of these methods are not used for online battery SoC estimation because they require knowledge of the initial SoC values, involve significant experimental investments, and have low resilience to measurement noise [
1]. Data-driven methods are too complex in terms of computational complexity, and that disqualifies them from being implemented on modest computational platforms such as embedded systems [
15,
16,
17]. Hybrid methods are primarily developed to increase SoC estimation accuracy for specific applications, without analyzing their execution performances. Model-based methods seem the best solution, with a potential to provide the best trade-off between SoC estimation accuracy and algorithm complexity [
6,
7,
8,
9,
10,
11,
18,
26,
27,
28,
29] and are the most suitable choice for online SoC estimation with respect to the high estimation accuracy and reasonable computing effort [
30]. Consequently, the model-based methods appear to be a good choice for implementation on resource-constrained embedded platforms.
The implementation process of model-based SoC estimation methods includes two main steps: (1) battery modeling and extraction of parameters; (2) selection and implementation of an observer estimation algorithm [
31,
32]. Selection of a battery model is the first and crucial step, as the computational performance and accuracy of SoC estimation heavily depend on the model selected [
33]. The battery model refers to physical aspects of a battery, such as electrical, thermal, aging, and a combination of these [
34]. Based on [
4,
35], battery models can be classified into three types, two of which are extensively used within estimation algorithms: physics-based electrochemical models [
36,
37,
38], and electrical equivalent circuit models [
39,
40]. Electrochemical models have high accuracy because they describe reactions inside batteries based on chemical/electrochemical kinetics and transport equations [
30]. Thus, they are built upon partial differential equations that are difficult to solve with online estimation methods [
35,
41]. Some of the most used physics-based electrochemical models are the pseudo-two-dimensional model [
41] and single particle model [
42]. Electrical equivalent circuit models depict the dynamic characteristics of batteries by utilizing a combination of electrical elements, such as voltage sources, resistors, and capacitors, to describe a battery’s behavior. The parameters used within this model depend on a battery’s aging status and its operating conditions, thus resulting in a gradual degradation of SoC estimation accuracy over time [
30]. However, compared to the other models, the electrical equivalent circuit models have the potential to provide the best trade-off between model complexity and accuracy and have been widely used within different estimation algorithms [
31,
43]. Some of the electrical equivalent circuit models are the internal resistance model [
44], the nth-order RC model [
45], and the partnership for a new generation of vehicles (PNGV) model [
46]. Compared to the other models of this type, the 2nd- and 1st-order RC models are extensively employed because they offer the most balanced compromise between complexity and precision for different discharge profiles.
After selecting a battery model, it is required to perform model parameter identification by either online or offline identification methods [
47,
48]. The online parameter identification methods [
49,
50] include determination of parameter values during SoC algorithm execution, whereas the offline parameter identification methods use experimental data to determine values of model parameters before the model is deployed within an observer estimation algorithm. Because the battery’s technical characteristics and environmental factors change during operation, online methods for identification of parameters provide better corrections of SoC estimation during operation but lead to a complex implementation and a higher SoC computational time. On the other hand, under certain conditions, offline estimation methods provide reasonable accuracy and at the same time reduce the SoC estimation complexity.
Numerous model-based algorithms can be used to estimate the SoC value. Among them, the algorithms from the Kalman filter family are widely used, because of their simplicity, in combination with various electrical models [
51]. Because a battery is modeled as a nonlinear system, a non-linear Kalman filter must be used to estimate the SoC value [
31]. Extended Kalman filter (EKF) requires less computing power compared to the other non-linear Kalman filters or filter-based estimation techniques in general [
52,
53,
54]. However, in most practical implementations, the adaptive extended Kalman filter (AEKF) is utilized instead of the EKF. The AEKF operates similarly to the EKF, but it adjusts the measurement and noise matrices during estimation to enhance robustness to noise, which is very important in real applications.
Many research papers present EKF and AEKF implementations that utilize electrical battery models. The paper [
55] proposes an online model-based SoC estimation method that utilizes an AEKF. The 1st-order RC network is used as the equivalent circuit, and model parameters are estimated online using the recursive least square (RLS) method with multiple forgetting factors. The accuracy of the proposed method was tested within a simulation environment, indicating a maximum absolute error less than 0.015%. The EKF presented in the paper [
56] provides strong robustness to the uncertainty of the model and the initial value of the noise covariance matrix. The battery model used is the 2nd-order RC model, and the parameters are extracted offline. Battery current and voltage are measured by a custom measurement system based on an STM32 microcontroller. The algorithm presented in [
57] can estimate SoC and state of health (SoH) simultaneously. An AEKF uses the 1st-order RC battery electrical model, with online parameter identification based on the RLS method. The reported estimation accuracy is about 2%.
The paper [
58] proposes a hybrid approach to achieve a better trade-off between accuracy and computational complexity. The proposed approach combines a low computational cost ampere-hour integral SoC estimation method and an AEKF of high accuracy. It is demonstrated that accuracy is almost the same compared to the case when only an AEKF is utilized while computational cost is reduced by almost 25%. The paper [
21] compares two model-based algorithms for SoC estimation, unscented Kalman filter (UKF) and EKF, in the sense of computational time and accuracy, in the case of signals with different noise levels. Both algorithms utilize the 1st-order RC network and are implemented on the Linux-based embedded platform, Raspberry Pi. It is demonstrated that the UKF requires more computational time in comparison to the EKF, at the same time providing high accuracy and robustness to noise. The work in [
22] utilizes the 1st-order RC model and implements EKF on an FPGA platform to achieve a real-time SoC computation. It introduces computational techniques, so matrix multiplication time is up to 4 times reduced compared to the conventional matrix multiplications. This is a rare case where results of computational time on a real platform are provided. The paper [
59] presents an EKF based on the 1st-order RC electrical model. The battery model parameters are extracted offline, using the RLS method. The EKF is first analyzed in MATLAB/Simulink (
https://www.mathworks.com/) and then implemented on a PIC18F4550 microcontroller. A similar implementation on the Arduino embedded platform is performed within research in [
19]. Paper [
20] introduces dual EKF, which enables a high robustness to the noise of the current sensor and incorrect filter initialization. The algorithm simultaneously estimates battery state and the 2nd-order RC model parameters. This filter is implemented on the Linux-based embedded platform NXP KL25Z128. Besides the SoC and model parameter estimation, the algorithm estimates the SoH and system state of power. It is demonstrated that the achieved estimation error does not exceed 5%.
Table 1 provides a summary of the mentioned research papers, employing SoC estimation algorithms based on EKF or AEKF algorithms coupled with battery electrical models. For each entry in
Table 1, the battery model used, the parameter identification method, and the type of estimation algorithm. Additionally, each paper is categorized based on the type of analysis conducted: (A) for accuracy analysis, (C) for computational complexity analysis, and (E) for algorithm energy consumption analysis.
Reviewing the papers that utilize battery state of charge (SoC) estimation methods based on recursive model-based algorithms reveals that all of them conduct accuracy analysis. However, only a few of them evaluate computational complexity, even those implementing algorithms on embedded platforms. None of the analyzed papers includes an analysis of the algorithms’ energy consumption. In our paper, we conduct a detailed theoretical analysis of recursive model-based SoC estimation algorithms to establish a systematic approach for evaluating their energy consumption. We apply this analysis to two actual implementations based on the EKF to validate the theoretical results. The theoretical analysis and results that demonstrate the potential of such an analysis in real battery-powered applications are presented in the further text.
3. Theoretical Considerations and Metrics
In the case of a battery-powered embedded system with integrated battery SoC estimation, it is possible to separate the instantaneous power of the SoC estimation algorithm
deom the instantaneous power of the rest of the system
. The total instantaneous battery output power
is then the sum of the two powers, as presented in
Figure 1.
The value of instantaneous power without the SoC estimation, , depends on the consumption of various hardware and software components that are part of the system and not directly involved in the SoC estimation. These components may be various hardware elements, such as sensors and actuators, and the software that implements the complete system logic (without the SoC estimation) on a CPU based embedded platform. The instantaneous power of an SoC estimation algorithm, , is determined by the power consumption of hardware and software components that are part of the SoC estimation algorithm. The hardware components may be shunt resistors for current sensing, operational or instrumentational amplifiers, AD converters, etc. In a general case, the SoC estimation algorithm logic may be implemented in the form of a separate integrated circuit, a dedicated hardware block within a programmable logic device, or as a software only solution implemented on a CPU.
The accuracy and energy consumption of a recursive model-based SoC estimation algorithm are heavily impacted by the estimation period. This section presents a theoretical analysis aimed at numerically quantifying how the estimation rate affects both estimation accuracy and energy consumption. The goal is to derive a general optimization metric that can be used to fine-tune the estimation rate, balancing accuracy and energy efficiency. The first subsection establishes a set of equations that will serve as key metrics for the analysis, while the second introduces the extended Kalman filter, used to validate the theoretical findings.
3.1. Analysis of Estimation Period Influence on an SoC Algorithm Estimation Accuracy and Energy Consumption
In this subsection, a relation that quantifies the impact of different estimation periods on the estimation accuracy and energy consumption of an SoC algorithm is derived. The analysis is divided into three parts. The first part examines how the estimation period affects the accuracy of SoC estimation, whereas the second part analyzes the energy consumption of the algorithm. The third part introduces the optimization criteria that can be used to determine the optimal estimation period.
3.1.1. Estimation Algorithm Accuracy as a Function of Estimation Period
Different metrics are used for assessing the accuracy of state of charge (SoC) estimation algorithms. Common metrics include, among others, absolute maximum error (AME), mean absolute error (MAE), standard deviation (SD), and root mean square error (RMSE) [
26]. For now, there is no consensus in the literature which of the metrics is the most appropriate. In this paper, the RMSE is used due to the possibility to make an elegant theoretical analysis and its moderate stringency. Some other metrics might be more useful for a specific application, but the focus of this paper is to show that it is possible to achieve a trade-off between accuracy and energy consumption, and RMSE is used as an exemplary metric. The methodology presented may be used for arbitrary metrics.
If the difference between the estimated and true SoC values at the ith estimation instant is represented as
e[
i], and there is a total of N estimation instants during a full battery discharge, then the RMSE is expressed by the following equation:
To express RMSE as a function of the estimation period
, it is essential to first establish ground truth or reference SoC values that will be used as nominally accurate values for calculations of RMSE for various estimation periods. For this purpose, the SoC values obtained with the Coulomb counter algorithm (
) running at the minimum (base) estimation period
available on the system are used. When
represents the SoC values obtained with a recursive model-based SoC estimation algorithm at a selected estimation period
(
), then the corresponding RMSE is defined by the following equation:
In the general case, the RMSE (3) encapsulates two errors: the error due to the utilized model and the error occurring because of the increase in the estimation period. To separate these errors and provide for theoretical analysis of influence of the estimation period on estimation accuracy, the SoC values obtained with the recursive model-based estimation algorithm (
) running at minimal estimation period
are used. The three different used SoC values (
,
, and
), with corresponding differences
,
, and
, are illustrated in
Figure 2.
Based on
Figure 2, it is possible to define two different RMSEs:
- -
, quantifying the quality of estimator when executing at a minimum sampling period; this error is due to the model used not being absolutely accurate. The error arises from the difference between
and
,
, and can be expressed by the relation
where
- -
, representing the error between the estimator running at a minimum estimation period
and the estimator running at an arbitrary estimation period
. The error arises from the difference between
and
,
, and can be expressed by the relation
where
From
Figure 2, total instantaneous error of an estimator running at an arbitrary estimation period
is
. The total RMSE, as defined by (3), may be expressed as function of (4) and (6)
Assuming that
and
are uncorrelated, the total RMSE can be expressed as a function of
and
, by the equation
The Equation (9) combines two errors and enable analysis of influence of the estimation period on estimation accuracy separately from the analysis of the model-based accuracy.
While the value of
can be determined by measurement only, it is possible to analyse
theoretically. For the sake of the analysis, the assumption is that the values of
are obtained with an ideal recursive model-based estimator whose
equals 0. If such an estimator executes with minimal estimation period
on a battery powered embedded system whose battery capacity is
and whose average battery load current is
, the number of estimators run cycles
, during a full battery discharge interval
is given by
and the sequence of the estimated SoC values
is
If the estimator executes with estimation period
, there are
estimator run cycles during a full battery discharge interval
and the corresponding estimated SoC values
are
The two SoC sequences are illustrated in
Figure 3, for one full battery discharge interval, and
. As mentioned above, the estimator is presumed to be ideal when executing at the minimum estimation period.
As seen in the figure and inferring from (11) and (13), represents a decimated, by factor , version of . The area between and corresponds to the deviation of the decimated estimator to the original and consists of identical regular subareas (shown in ochre) and a truncated terminal subarea (shown in green).
A detailed view of a
kth regular subarea is shown in
Figure 4. The blue dots represent ideally estimated SoC values (
) whereas red dots represent decimated ideally estimated SoC values (
).
There is a total of
samples (always an integer since
is a multiple of
) of
in the regular subinterval, and a total of
samples in the terminal subinterval. It is possible to derive an equation quantifying error of the decimated estimator compared to the ideal
The squared error sum over a regular
kth discharge subinterval
, and the squared error sum over the truncated terminal subinterval
can be expressed as
Now,
(6) can be expressed as a function of
In the case when
is a multiple of
(and consequently
), then
, and Equation (17) simplifies to
Equations (17) and (18) are suitable for a numerical analysis of influence of the estimation period
on RMSE (3). For such an analysis, it is useful to determine the range of values of the estimation period wherein the analysis makes sense. The estimation period cannot be smaller than the base estimation period
. Regarding the maximum possible estimation period, it is determined from the duration of full battery discharge for a given battery load
—when two executions of the estimation algorithm are performed over the entire period, at the beginning and at the end of the period. In that case
and the maximum estimation period
is
When estimating at the maximum estimation period,
(18) reaches its maximum value, obtained after substitution of (19) in (18) and application of the assumption
From now on, Equations (17) and (18) will be used as the SoC estimation accuracy metrics.
3.1.2. Estimation Algorithm Consumption as a Function of Estimation Period
A recursive SoC estimation algorithm periodically executes within the software of a microprocessor. If the estimation period is
, the duration of execution of a single run cycle of the algorithm lasts a portion of the period
. During the execution, the current consumption of the algorithm may be represented by a current
. The current originates from the microprocessor consumption due to the additional duration of its activity, as well as the consumption of peripheries used only for the estimation (AD converter(s) and accompanying circuitry). When the algorithm is not executing, its current consumption is zero. The above is illustrated in
Figure 5.
The relative battery consumption (
) may be expressed as a portion of battery capacity consumed for its SoC estimation during a full discharge interval
where
is average current of the SoC estimation algorithm,
is the estimation period, and
is the number of the estimator run cycles during a full battery discharge interval (12).
For the algorithm current consumption as shown in
Figure 5, the average algorithm consumption
is
Since the battery load current
consists of current consumption of the SOC estimation algorithm
and the current consumption of the rest of the system
, the number of the algorithm run cycles during a full battery discharge interval
(12) may be written as
After substitution of (22) and (23) in (21), and simplifying
, there is
It has been mentioned earlier that the minimum estimation period is determined by . The minimum estimation period cannot be lower than the algorithm run cycle duration , but it could be further restricted by system characteristics, for example, the conversion time of the AD converter.
From (24) implies that, when the average current consumption of the rest of the system is negligible when compared to the algorithm execution consumption , becomes close to 1.
3.1.3. Estimation Algorithm Performance as a Function of Estimation Period
As shown above,
increases as the estimation period increases. At the same time,
decreases. Thus, it should be attainable to identify a value of estimation period
when these two metrics are balanced, that is, there are acceptable both error and current consumption. To combine two different quantities, those should be normalized with respect to maximum values:
This is a multi-objective optimization method, which could in general be tackled by various optimization strategies. Since it cannot be told which objective is more important, and due to its relative simplicity, the weighted sum method has been chosen. Then, the analytic form of the estimator performance metrics
could be defined as
where
and
are weights for energy consumption and accuracy respectively, dependant on their relative importance, both in the range
and under the limitation
. The optimal value
is obtained as the value of estimation period when the estimator performance has a maximum.
Obtained estimator performance Equation (26) can also be used to compare the two algorithms A
1 and A
2 in terms of achieved performance for a selected estimation period
and a given discharge rate. This parameter is named estimators’ performance ratio (
r), and it is defined as:
If r is greater than 1, then A1 achieves better performance for the selected estimation period; otherwise, A2 provides better performance. However, it should be noted that the two performances might not have a maximum value for the same value of estimation period.
3.2. Computational Complexity of Extended Kalman Filters
To apply the theoretical analysis and showcase its potential for selecting the right algorithm based on well-defined energy requirements, this research focused on selecting two representative algorithms with differing computational complexity while keeping other features, such as initial estimation capability, constant. It was also important to select algorithms that could be implemented purely in software on resource- and energy-constrained platforms. On the basis of a literature review, model-based methods for SoC estimation were chosen, as they offer the best trade-off between accuracy and complexity [
60]. The extended Kalman filter (EKF) was selected for its lower computational requirements compared to other nonlinear filters. However, in many practical cases, the adaptive extended Kalman filter (AEKF) is preferred due to its improved noise filtering, even though it requires slightly more computational power [
20]. This can reduce the need for additional hardware and software required when implementing the algorithm on low-cost embedded platforms with noisy current and voltage readings. Although the AEKF is often favored in practical applications due to its enhanced noise filtering, it operates on almost the same fundamental principles as the standard EKF. The primary difference is that AEKF continuously adapts its noise matrices during runtime, adding slight complexity and requiring more computational power. Given that the AEKF offers improvements over the EKF, which are not relevant for this research but also increase demand for resources, it was chosen to proceed with the EKF in this research. On the basis of implementations in [
19,
20,
21,
22,
59], it is demonstrated that the EKF provides sufficient accuracy for online SoC estimation while maintaining low computational complexity, making it suitable for implementation on embedded platforms.
EKF algorithm state equations in discrete time domain as well as utilized battery models, and their parameters are described in
Appendix A. In a general case, all the battery model parameters are temperature dependent. Because the focus in this research is to analyse EKF algorithm from a computational complexity perspective, from now on in this research, the temperature effects will be neglected, and all the experiments will be conducted at the same ambient temperature.
The EKF is a recursive algorithm that executes periodically, where two procedures are conducted at each execution: predict and update.
Table 2 outlines the steps performed in each algorithm iteration.
The steps presented in
Table 2 include various matrix operations like addition (A), subtraction (S), multiplication (M), division (D), inversion (I), and transposition (T). To obtain algorithms of different complexities, two EKF algorithms that utilize two battery models are analyzed. Utilized battery models determine the computational complexity of the algorithm by the order of the matrices involved in the calculations. One of the algorithms is from the category of the computationally simpler algorithms and employs a simple Rint battery model. The algorithm is less precise and has a relatively low energy consumption due to lower computational complexity. The second analyzed algorithm is the EKF, which employs a 2nd-order RC battery model and belongs to the category of complex computational algorithms. It exhibits a high estimation precision and a relatively high energy consumption due to higher computational complexity.
Table 3 presents the number of matrix operations within each step as well as the total number of basic mathematical operations such as addition (a), subtraction (s), multiplication (m), and division (d).
As seen in
Table 3, the number of matrix operations remains consistent regardless of the model used. However, since the matrix order depends on the utilized model, so does the total number of basic operations. When the EKF is implemented on embedded platforms, the duration of computation depends on both the number and types of the fundamental operations. For instance, execution time of multiplication is significantly longer than in a case of subtraction or addition. In the case of a simple Rint model, all matrices are of the 1st order, meaning that all the matrix operations are performed as scalar operations, thus significantly reducing the computational time. In opposition, the 2nd-order model involves matrices of the 3rd order, so the number of basic mathematical operations and computational time are increased. In an ideal case, the execution time of an SoC algorithm based on the EKF equals the duration of all the basic operations performed in each step. In addition, the ratio of two different model-based EKF cycle run execution times depends on the ratio of the numbers of operations within algorithms. As seen in
Table 3, the EKF algorithm based on the 2nd-order RC model contains about 8 times more operations than the EKF algorithm based on the simple Rint model. Therefore, it is expected that the EKF based on the 2nd-order RC model executes at least 8 times longer and consumes 8 times more energy than the EKF based on the simple Rint model. However, accuracy improvements achieved with the EKF based on a 2nd-order RC model may not be proportional.
4. Experimental Setup
The equations derived in the previous section describe the relationship between algorithm estimation accuracy and energy consumption as a function of the estimation period. The values of the parameters introduced within these equations must be experimentally determined before the optimization of estimation period is performed. To identify these parameters and validate the theoretical results in a real-world scenario, a series of measurement procedures were carried out. A low-cost microcontroller-based system, named the battery evaluation system (BES), was developed to simplify this process. Within
Appendix A are described hardware and software implementation details of BES, while this subsection outlines the experimental procedures for extracting battery parameters and assessing the impact of the estimation period on the accuracy and energy consumption of the EKF algorithm.
A single-cell Tattu LiPo battery with a capacity of 500 mAh and a maximum discharge rate of 45C has been used. The values of the battery’s voltage and current are sampled with the AD converter integrated inside the BES and streamed to a PC, where they are logged and processed offline within a corresponding Python script.
The BES is used to generate battery load currents of different amplitudes that mimic a system consumption profile. To obtain the values of voltage and current during a full battery discharge interval, the following procedure is conducted:
- (1)
Battery is fully charged until it reaches its full charge voltage of 4.25 V
- (2)
Battery rests for 2 h
- (3)
Battery is fully discharged with a selected current, until its terminal voltage reaches a terminal value of 3.2 V
- (4)
Battery rests for 4 h
Steps 1–4 are repeated for different discharge rates: C/5 (100 mA), C/2 (250 mA), C (500 mA), 2C (1 A), and 3C (1.5 A). During the discharge process, the values of battery voltage and current are obtained with the minimum (base) sampling period () available on the BES, which is 2.176 ms.
After the data acquisition process is completed, post-processing is performed offline by means of custom Python scripts. To analyze the influence of different estimation periods on (9) and (21), a data decimation technique is performed so variable estimation periods are obtained from the analyzed dataset.
Two types of EKF algorithms, of different computational complexities, are implemented:
- (1)
Kalman 0 (K0)—Kalman algorithm that utilizes simple Rint model.
- (2)
Kalman 2 (K2)—Kalman algorithm that utilizes the 2nd-order RC model.
The Python scripts were used for analysis of the algorithms’ accuracy, whereas C implementations of both algorithms were run on a STM32H7 microcontroller to obtain the algorithms’ run cycle execution time.
The microcontroller hardware configuration is detailed in
Table 4. The EKF implementations were designed as pure bare-metal solutions, operating on a minimum hardware configuration. All peripherals were disabled, code execution is performed from Flash memory, and the cache memory was deactivated.
For all the tests, the estimation period varied from the minimum estimation period available on the BES, (2.176 ms), to the maximum estimation period defined by (19). At the maximum estimation period, there are only two EKF run cycles during a full discharge interval: one at the beginning and one at the end of the interval.
Table 5 shows the minimum and maximum estimation periods for the different discharge rates.
The values of
and
, as defined in
Section 3.1.1 are obtained from values of battery voltage and current at the minimum estimation period.
, as defined in (24), is calculated from EKF cycle run execution time measured on embedded platform
, the used battery capacity of 500 mAh, and consumption of the embedded platform
.
The normalized values and are used to find the optimal estimation period for the selected algorithms by application of the estimator performance function (26). Three different optimization criteria were considered for further analysis:
- (1)
OPT: Algorithm accuracy and energy consumption are equally important, so ;
- (2)
OPTA: The algorithm accuracy is more important than energy consumption, so and ;
- (3)
OPTE: The algorithm accuracy is less important than energy consumption, so and .
5. Estimated Value of the Model Parameters
The extraction of the values of battery parameters was performed first in the experiment. As a result, obtained are the open circuit voltage (OCV) as a function of SoC [
61] and values of resistors and capacitors [
51,
53,
54,
55,
56]. All the parameter extractions were performed offline, using dedicated Python scripts that implement polynomial and exponential fitting techniques.
Figure 6a represents the OCV obtained by averaging battery terminal voltage during charge (green) and discharge (red) for a charge/discharge rate of C/10.
After the OCV function has been obtained, polynomial functions of different orders are tried to find the best numerical approximation.
Figure 6b illustrates RMSE for different orders of polynomials in the range from 2 through 19. It is noticeable from the figure that RMSE changes a little from the 9th order of polynomial. Since the increase of the polynomial order yields a negligible increase of accuracy yet increases the computational complexity, the polynomial of the 9th order has been used in the subsequent work. The coefficients of the polynomial are given in
Table 6.
To extract R and C values for both the simple Rint and the 2nd-order RC battery model, the battery is discharged with the dynamic current load profile shown in
Figure 7. Parts of the battery terminal voltage waveform used to extract corresponding parameters are also shown in the figure.
The applied discharge profile produces periodical current pulses over the full discharge interval. To obtain the parameters with a resolution of 1% SoC, the current pulse length equals 18s, and the pulse amplitude equals 1 A (2C). The pause between discharge pulses should be at least 10 times longer than impulse length so the battery has enough time to relax.
When determining the values of model parameters, instead of using a single average value for the entire SoC range, the method [
18] improves the accuracy of SoC estimation algorithms by using averaged values across several smaller SoC ranges. Rint as a function of SoC, for the simple Rint model, is given in
Figure 8. The dashed red lines represent Rint averaged over SoC ranges, chosen to follow Rint changes and improve SoC estimation accuracy. The averaged values are presented in
Table 7.
Averaging values across smaller SoC ranges improves algorithm accuracy, with the best results achieved using the smallest possible intervals. Maximum accuracy is obtained when the number of intervals matches the number of Rint calculation points. However, smaller intervals increase resource, including storage and computational time, usage. Therefore, it is important to balance accuracy and resource consumption. In this research, regions were chosen to enhance accuracy in the range 10–100% of SoC, as a battery is mostly used when SoC is within this range. The region limits for estimation for the Rint model, presented in
Table 8, are also used as limits for 2nd-order RC model parameters. The 2nd-order RC model parameters as a function of SoC are given in
Figure 9. The dashed lines present averaged parameters over SoC ranges, the same as in the case of the simple Rint model. The averaged values are presented in
Table 8.
7. Conclusions
Selecting an SoC algorithm for battery-powered microcontroller-based embedded platforms is challenging due to the lack of information in the literature regarding algorithm energy consumption. This paper conducts a detailed theoretical analysis to lay the foundation for quantifying the energy consumption of recursive model-based SoC algorithms, which are suitable for implementation on resource-constrained embedded platforms. Consequently, a set of equations was derived, and the estimation period was identified as a configurable parameter that can be adjusted to reduce the algorithms’ energy consumption. To link accuracy and energy consumption, the paper proposes an estimator performance equation as a function of the estimation rate, enabling the selection of the optimal estimation rate. Results obtained within this paper demonstrate that there is an acceptable deviation between values obtained with derived equations and values obtained by experiments. Therefore, the theoretical approach may provide acceptable results and reduce experimentation time.
Two types of extended Kalman filters, utilizing models of different complexities, are implemented to evaluate their relative computational complexity per single run cycle on a real embedded platform. It has been obtained that the EKF based on the 2nd-order RC model is 30% slower compared to the EKF based on the simple Rint model in the case of implementation on an STM32H7-based microcontroller. These results are used to demonstrate the potential that the equation derived in this work has in selecting optimal estimation periods and designing low-consumption SoC algorithms for resource-constrained embedded platforms. It has been shown that choosing the optimal sampling period can significantly reduce energy consumption with a slight degradation of SoC estimation accuracy for systems where total system currents are comparable to the current of the microcontroller running the algorithm. For systems with current discharge rates ranging from C/5 to C/200, energy reduction can reach up to 71%. Besides selecting the optimal estimation period, the derived set of equations can also be used to determine which algorithm performs better for the selected estimation period.
It has been demonstrated that, for different SoC algorithms, there are different optimal estimation periods for a selected optimization criterium. This paper establishes a foundation for future work, which may involve the use of different quantifications of accuracy, different optimization strategies, and the development of an algorithm that alternates between different estimators and/or adapts estimation periods based on consumption dynamics. Also, the experimental verification of the results could be extended to other battery load profiles.