Abstract
Home energy management systems have emerged as a crucial solution for enhancing energy efficiency, reducing carbon emissions, and facilitating the integration of renewable energy sources into homes. To fully realize their potential, these systems’ performance must be optimized, which involves addressing multiple objectives, such as minimizing costs and environmental impact. The Pareto frontier is a tool widely adopted in multi-objective optimization within home energy management systems’ operation, where a range of optimal solutions are produced. This study uses the Pareto curve to optimize the operational performance of home energy management systems, considering the state health of the battery to determine the best answer among the optimal solutions in the curve. The main reason for considering the state of health is the effects of the battery’s operation on the performance of energy systems, especially for long-term optimization outcomes. In this study, the performance of the battery is measured through a physical model named PyBaMM that is tuned based on swarm intelligence techniques, including the Whale Optimization Algorithm, Grey Wolf Optimization, Particle Swarm Optimization, and the Gravitational Search Algorithm. The proposed framework automatically identifies the optimal solution out of the ones in the Pareto curve by comparing the performance of the battery through the tuned physical model. The effectiveness of the proposed algorithm is demonstrated for a home, including four distinct energy carriers along with a 12 V 128 Ah LFP chemistry Li-ion battery module, where the overall cost and carbon emissions are the metrics for comparisons. Implementation results show that tuning the physical model based on the Whale Optimization Algorithm reaches the highest accuracy compared to the other methods. Moreover, considering the state of health of the battery as the selecting criterion will improve home energy management systems’ performance, particularly in long-term operation models, because it guarantees a longer battery lifespan.
1. Introduction
Energy systems are essential tools for supporting energy planners and decision makers because they model long-term scenarios, particularly in the context of fluctuating and evolving energy policies [1]. Home energy management systems (HEMSs) are energy systems typically used to schedule and manage technologies in a smart home. Managing the energy sources in response to dynamic prices and carbon dioxide (CO2) limitation signals from the power grid is the primary responsibility of HEMSs [2]. Therefore, HEMS optimization is a multi-objective problem that requires balancing various key factors. An optimal solution in such a context must achieve a trade-off between competing objectives. The literature shows that the ϵ-constraint method [3] and the weighted sum method [4] are the methods most widely adopted by the scientific community, both resulting in a set of optimal solutions known as a Pareto curve or Pareto frontier [3]. A Pareto curve represents a graphical overview of the optimal answers, enabling a comparative analysis of these options. In this method, each optimal solution for the optimization problem, which no other answer outperforms across all the objectives, is a point on the graph. The selection of the best solution is then guided by the planner’s preferences. There are two common approaches for selecting the most appropriate answer from the Pareto set: weighting and interactive methods. In the former approach, a coefficient is determined for each objective that represents the importance of them [5]. On the other hand, interactive methods work based on expert feedback [3], and the final answer is selected accordingly.
Although various studies have considered different objectives for optimizing HEMSs, nearly all share a common goal: reducing energy cost. In general, the energy cost comes from two main sources: purchasing energy from the grid and maintenance, including the cost of storage units. Batteries or storage units are critical components of each energy management system, particularly those integrating renewable energy sources. Among various battery technologies, lithium-ion batteries have gained widespread use in energy systems due to their outstanding characteristics, such as a high energy density and low self-discharge rate [6]. Given the fact that these types of batteries must be replaced after losing a certain level of capacity, estimating the state of health (SOH) is essential for its stable and reliable operation. This estimation must be achieved through accurate numerical modeling [7].
The current numerical models generally fall into two main categories: equivalent circuit models (ECMs) and physics-based models (PBMs) [8]. While ECMs use electrical circuits composed of basic components, PBMs are based on the physical phenomena within the battery, leading to more accurate but also more complex models [3]. Regarding the accuracy of PBMs, various physics-based tools have been developed to model batteries. The authors of [9] propose a hybrid physics-based and data-driven electrochemical state estimation framework for lithium-ion batteries. The proposed battery model is developed by systematically integrating a full-order pseudo-two-dimensional model with a long short-term memory recurrent neural network. The authors of [10] combine an improved long short-term memory network with the extraction of physical health indicators derived from charging–discharging cycles to measure the SOH of a battery. Moreover, this study uses a modified grey wolf optimizer for hyperparameter tuning to further enhance the machine learning performance. The authors of [11] use a transfer learning strategy to measure the SOH of a battery. In this study, the authors re-train a convolutional neural network based on physical data of lithium-ion batteries. To further improve the algorithm, this study uses 3D histogram feature extraction on the input data. A novel SOH estimation method based on a cross-generative adversarial network is proposed in [12]. This study uses an adaptive boosting algorithm to develop an SOH estimation model for individual cells by integrating extreme learning machine techniques. Handling incomplete data for training machine learning algorithms is the main purpose of this study.
Another widely used physics-based model for battery simulation is PyBaMM (Python Battery Mathematical Modeling), an open-source framework designed to model the electrochemical behavior of batteries [13]. PyBaMM provides versatile parameter sets for simulating the performance of batteries under various conditions, including different charging and discharging profiles, temperature effects, and numerical models [14]. Although PyBaMM provides various parameter sets validated by developers [15], it is important to note that these default sets are not universally applicable to all batteries. Since each battery has unique characteristics, PyBaMM requires fine-tuning using manufacturer-provided data to accurately model a specific battery. To address this, the authors of [3] focus on grid-search optimization, using the mean absolute error between PyBaMM results and the battery manufacturer’s datasheet as an objective function. Then, the authors integrate PyBaMM into an HEMS to account for the effect of the SOH on the system. Unfortunately, although grid search is a valuable optimization technique, it is computationally expensive, particularly in the case of tuning the parameter set in PyBaMM. Therefore, Ref. [3] separates parameters into three sets, electrical, thermal, and aging, and tunes them sequentially. However, this separation strategy undermines the potential dependency of the parameters. To improve the tuning process, this paper employs swarm intelligence algorithms [16] capable of accurately tuning the parameters in PyBaMM. Specifically, this study evaluates four well-known swarm intelligence algorithms: the Whale Optimization Algorithm (WOA) [17], Grey Wolf Optimization (GWO) [18], Particle Swarm Optimization (PSO) [19], and the Gravitational Search Algorithm (GSA) [20]. Leveraging the capabilities of swarm intelligence algorithms, this paper focuses on the simultaneous tuning of physical battery models, preserving their potential relationships. After tuning the parameters, they are incorporated into the multi-objective optimization problem of the HEMS, which is solved using a Pareto curve [21]. In the proposed HEMS, a home includes four distinct energy carriers, which are the electricity network, the natural gas network, the cooling internal network, and the district heating network. Finally, the best answer in the Pareto curve is determined automatically and based on the SOH of the batteries. The main contributions of this study are as follows:
- -
- Enhancing the accuracy of the battery model by tuning parameters with swarm intelligence.
- -
- Preserving the relationships between parameters by simultaneously tuning the battery model.
- -
- Comparing the performances of well-known swarm intelligence algorithms in the tuning problem.
The rest of the paper is organized as follows: Section 2 discusses the proposed methodology and its parameter tuning for lithium-ion batteries, along with the integration of the battery model and its SOH into an HEMS. Section 3 presents the implementation results and comparisons. Section 4 concludes the study.
2. Proposed Methodology
This section outlines the proposed methodology, which is divided into four subsections on information extraction, tuning, the home energy management system, and selection of the optimal solution from the Pareto curve.
2.1. Information Extraction
As mentioned earlier, PyBaMM provides a wide range of parameter sets for different battery types. To select the appropriate parameter set, designers must extract relevant information from the battery datasheet. Typically, the following key specifications are required for properly tuning PyBaMM:
- -
- Battery chemistry: A battery can typically contain lithium iron phosphate (LFP), nickel manganese cobalt oxide (NMC), or nickel cobalt aluminum (NCA). The modeler must configure the chemistry of the battery in PyBaMM based on the battery datasheet.
- -
- Charging mode: In general, there are three main charging modes, constant current (CC) charging, constant voltage (CV) charging, and constant current–constant voltage (CC-CV) charging. CC-CV is the most commonly used charging mode for battery testing by manufacturers. To model a battery, the modeler must configure PyBaMM based on the reported mode.
- -
- Electrode geometry: Although it is not commonly reported in a battery’s datasheet, it is essential for assessing other electrical properties, such as current densities.
After extracting the mentioned information, the numerical model in PyBaMM must be selected. Selecting a model requires balancing between computational burden and accuracy. Figure 1 illustrates the computational complexity and accuracy of various numerical models. As shown in the Figure, the physics-based models include the Single Particle Model (SPM) [22], Single Particle Model with Electrolyte [21], and the Doyle–Fuller–Newman Model, also known as the Pseudo-Two-Dimensional Model (PS2D) [23].
Figure 1.
Numerical model comparison.
2.2. Tuning
The main goal of this stage is to align the model as closely as possible with the experimental data provided by the manufacturer. As mentioned earlier, battery manufacturers typically provide discharge curves at different C-rates, discharge curves at various temperatures, and degradation curves for 1-C cycles [3], which are used in this paper to tune the parameters of PyBaMM. The proposed tuning method is inspired by [3], where two stages are determined for tuning:
- -
- Sensitivity analysis: Given the large number of parameters in PyBaMM, we consider just the most effective ones that are determined by sensitivity analysis. In this analysis, the effect of each parameter on PyBaMM accuracy is measured based on two empirical values: the default PyBaMM value and twice that default. Each parameter is tested separately by evaluating model accuracy at the default value and at twice the default. The resulting change in accuracy indicates how strongly that parameter influences the overall model performance. Parameters with the greatest influence are then selected as the final parameter set.
- -
- Tuned value: After selecting the effective parameters, we tune them based on swarm intelligence algorithms.
Due to the complexity of the problem, the authors of [3] tune the parameters sequentially: (1) electrochemical parameter tuning, (2) thermal parameter tuning, and (3) degradation parameter tuning. In contrast, swarm intelligence algorithms search the entire ranges of the parameters simultaneously. Additionally, these algorithms are computationally more efficient. The superior tuning performance of swarm intelligence algorithms compared to classical methods, such as grid search, has also been demonstrated in other studies [24,25]. Consequently, this study uses four well-known swarm intelligence algorithms to tune PyBaMM’s parameters, using the minimization of the mean absolute error (MAE) between the manufacturer’s data and PyBaMM’s performance as the objective function. The overall structure of the proposed method is illustrated in Figure 2. Swarm intelligence algorithms operate based on a population of feasible answers. The initial population is generated randomly, while subsequent generations are produced according to specific criteria, such as the best answer found. The core concept of the most swarm intelligence algorithms is identifying the best answer within the population and moving towards it to discover even better answers. These algorithms follow an iterative structure, continuing their process until a predefined stopping criterion is met. In this study, each feasible answer, or individual within the population, represents a set of values corresponding to each parameter in the parameter set.
Figure 2.
Flowchart of the proposed tuning approach.
- -
- Whale Optimization Algorithm (WOA) [17]: This optimization algorithm is inspired by the social behavior and hunting strategies of humpback whales, specifically their bubble-net feeding mechanism, where spiral-shaped bubbles are used to trap prey. The algorithm consists of three main phases: encircling prey, exploiting the best solution, and searching for new solutions. During exploitation, it copies whales converging on the optimal solution, while exploration diversifies the search to avoid local optima by allowing candidate solutions to move randomly within the search space.
- -
- Grey Wolf Optimization (GWO) [18]: This optimization algorithm is inspired by the social hierarchy and hunting strategies of grey wolves in nature. It simulates the leadership-based structure of wolf packs, where wolves are classified as alpha, beta, delta, or omega, representing different roles in decision making and social dominance. The algorithm models the cooperative hunting process, which includes three key stages: encircling prey, hunting by converging on the best solutions, and attacking or diverging to explore the search space. By balancing exploitation and exploration, GWO effectively finds optimal or near-optimal solutions for complex optimization problems.
- -
- Particle Swarm Optimization (PSO) [19]: This optimization algorithm is inspired by the collective behavior of swarms, such as flocks of birds or schools of fish, as they search for food. PSO models a population of particles that represent potential solutions moving through the search space. Each particle adjusts its position based on its own best-known position and the global best-known position. This process involves updating velocities and positions iteratively to balance exploration and exploitation.
- -
- Gravitational Search Algorithm (GSA) [20]: This optimization algorithm is inspired by the principles of Newtonian gravity and mass interactions in physics. In GSA, potential solutions are treated as objects with masses that interact through gravitational forces. The masses attract each other, and their movement is influenced by the gravitational force, which is proportional to the quality of the solutions. Heavier masses, representing better solutions, attract lighter ones, guiding the search toward optimal solutions. The algorithm balances exploration and exploitation by dynamically adjusting gravitational parameters, enabling it to effectively solve a wide range of optimization problems.
2.3. Home Energy Management System
An HEMS is a real-time energy scheduling system for appliances in a home that optimizes energy consumption. To operate, the HEMS receives forecasted loads, ambient temperature, solar irradiation, and the mobility information of electric vehicles (EVs) as the inputs and then optimizes the energy consumption in the system.
To evaluate the battery performance in a home, this paper uses the HEMS presented in [20], where a Mixed-Integer Linear Programing (MILP)-based optimization approach is developed to optimize scheduling in 15 min intervals. The researchers in [20] use MILP because real-time scheduling requires a lightweight yet reliable optimization strategy. Four general networks, a natural gas network, an electricity network, a district heating network, and an internal cooling network, are considered, where each network is composed of different energy-related elements. The proposed HEMS employs two renewable energy sources: photovoltaic (PV) and solar thermal (ST) systems, with solar irradiance serving as the primary energy source. Moreover, the HEMS uses two static energy storage systems, a Battery Energy Storage System (BESS) and a Thermal Storage System (TSS), for electricity and heating, respectively. Additionally, an EV is incorporated into the system, functioning similarly to the BESS by utilizing the Vehicle-to-Grid (V2G) approach during its availability. The interconnection between energy carriers is facilitated by Heat Pumps (HPs) and Absorption Chillers (AChs), linking heating and internal cooling systems. Furthermore, as indicated by the architecture, bidirectional energy exchange between the HEMS and external networks is available only for electricity and district heating.
The HEMS is responsible for scheduling the included appliances to minimize the operational cost and carbon emissions. This study adopts the augmented ε-constraint (AUGMECON), presented in [26], to generate the Pareto curve and solve the optimization problem. The mathematical model of the battery is presented in Equations (1)–(12). For a more detailed explanation of the HEMS, please refer to [21].
As Equations (1a) and (1b) represent, the primary objectives of the HEMS are to minimize both energy costs and CO2 emissions. To measure the overall cost of the system, this paper considers buying/selling power from/to the grid (, ), buying/selling heating power from/to the grid (, ), and the cost of buying natural gas from the network (). Additionally, the level of CO2 is calculated based on bought power, heating power, and gas at each time step.
As mentioned earlier, PV and ST are the main renewable energy sources in the considered HEMS. Equations (2a)–(2d) model the energy generation of these sources. As these equations indicate, the output of both resources depends on the solar irradiance and the surface area of the panels.
Furthermore, six equations are designed to implement the integrated battery in the HEMS. In this paper, the discharged power of the battery can either be used in the home or sold to the grid, as modeled by Equation (3a). Equations (3b) and (3c) prevent simultaneous charging and discharging of the battery, where is a binary variable. Additionally, Equation (3d) measures the battery’s state of charge (SoC), ensuring a minimum level at the initial time step (Equation (3e)) and maintaining it within a predefined range (Equation (3f)).
In addition, the designed HEMS includes an EV, which serves as an additional storage system. The main difference between the EV and the BESS lies in their availability. While the BESS is always available in the system, the EV is only available during specific time periods. The EV is modeled using Equations (4a)–(4k).
Home appliances such as washing machines and dishwashers can be categorized as TSELs, since their operation can be shifted in time according to the optimal HEMS schedule to provide greater flexibility. Accordingly, their behavior is modeled using Equations (5a)–(5f). Constraint (5b) ensures that only one phase can operate at a time, while (5c) specifies the duration of each phase from start to finish. Constraint (5d) links the operation of the device between consecutive time steps, ensuring correct transitions between start and end states. Constraint (5e) maintains operational consistency across all phases, and (5f) restricts the maximum number of times the device may be turned on within a day.
mCHP technology operates on gas and simultaneously generates heat and electricity. As a result, it serves as the interconnection point for all energy carriers in the designed HEMS. The operational constraints of the mCHP are defined by Equations (6a)–(6e).
HPs play a vital role in improving the energy efficiency of smart buildings. Their coefficient of performance is typically greater than one, depending on environmental conditions, which makes them an attractive replacement for conventional boilers in high-efficiency buildings. The operational constraints of the HP are defined by Equations (7a)–(7c).
Furthuremore, Equations (8a)–(8f) model the HESS. The flexibility of the home’s heating carrier is managed by the HESS, whose mathematical formulation is similar to that of the BESS. As a result, the model does not allow heat to be charged and discharged at the same time. Moeover, Equations (9a)–(9c) model the HHS.
Balancing the energy flows among the different carriers is another essential aspect that must be captured in the HEMS model. This balancing mechanism is represented by Equations (10a)–(12b).
2.4. Optimal Solution
Considering the research scope of this paper, the optimal solution provided by the Pareto curve results in Section 2.3 is the one that achieves the highest SOH for the battery based on the tuned model of Section 2.2. Specifically, the battery’s operational conditions for the optimal solutions are applied to the tuned PyBaMM model to measure the SOH of the battery at the end of the cycles. Then, the profile that yields the highest SOH is selected as the optimal answer.
It is important to note that PyBaMM operates at the cell level, while the HEMS manages batteries at the module or pack level. To bridge this gap, all parameters such as voltage, current, and capacity must be scaled appropriately from the cell level to the module level. This transformation ensures that the operational profiles derived for the entire battery system align with PyBaMM simulations. In this paper, the scaling strategy proposed in [3] is employed to convert the cell level to the battery pack level.
3. Implementation Results and Comparisons
This section analyzes the results of integrating a lithium-ion battery into the HEMS and begins by outlining the characteristics of a lithium-ion cell, with an emphasis on the tuning of the most influential parameters based on swarm intelligence algorithms. After selecting the best tuning algorithm, the battery’s performance is measured for all the 15 Pareto curve solutions of the HEMS, aiming to determine the best solution according to the battery’s SOH. The implementation of this study is performed in PyBaMM version 24.11.2 on a machine equipped with an AMD Ryzen 9 8945HS w/ Radeon 780M Graphics 4.00 GHz processor and 32 GB of RAM.
3.1. Battery Information
Information extraction begins with selecting the chemistry of the cell, where an LFP-type lithium cell obtained from CEGASA PORTABLE ENERGY [27] is used. Table 1 outlines the main characteristics of the selected cell, while the experimental performance of the battery is demonstrated in Figure 3. Afterwards, a proper dataset in PyBaMM must be determined for modeling the cell. This study employs Prada2013 [28], chosen based on cell chemistry. It is worth noting that despite the developers’ recommendation, the dataset is a composite of various sources, and the developers have acknowledged certain discrepancies within it [15]. Information extraction will be completed by selecting an appropriate physical model. This study uses the SPMe model, which represents the best compromise between accuracy and computational complexity.
Table 1.
Integrated battery properties.
Figure 3.
Electrochemical, thermal, and aging plots from manufacturer’s datasheet.
3.2. Tuning Results
As mentioned in Section 2.2, we use the same parameter subsets as [3], with the addition of just one parameter, Electrode width [m], this being a highly impactful parameter in the electrochemical category. Then, we tune all parameters simultaneously to preserve their potential interrelationships. Furthermore, a lumped thermal model is used for modeling the cell’s thermal behavior and accounts for factors such as Solid–Electrolyte Interface (SEI) layer growth, lithium plating, particle fracture/cracking, and the loss of active material to measure the cell’s aging.
Producing feasible answers in swarm intelligence algorithms is another important step that must be taken. The feasibility of the answers can be compromised for two main reasons: the generation of random numbers for the initial population and changes during the processes of algorithms. To address the problem, this study considers a valid interval for the values in each answer. Each value must fall in the interval of [default value, 2 × default value], using the default values proposed in [3]. The initial random values are selected from this interval, and at the end of each iteration of the algorithms, any value falling outside the range is adjusted back within bounds. Additionally, each swarm intelligence algorithm needs some pre-defined coefficients to run. As an instance, PSO requires predefined values for inertia, cognitive, and social coefficients. All the needed coefficients and implementation parameters of the swarm intelligent algorithms are provided in Appendix A. Table 2 shows the selected parameters alongside the tuned values, measured by different algorithms.
Table 2.
Tuned parameters in Prada2013.
3.3. Tuning Comparison
Minimizing the MAE is the main objective of the tuning algorithms, making this the best criterion for comparing these methods. To assess the overall accuracy, this study uses the overall MAE, calculated as the sum of the MAEs across different categories. The error rates, resulting from the tuning methods, are presented in Table 3. It must be emphasized that since the selected battery’s datasheet provides information at the cell level, the results from PyBaMM are also measured at the cell level. As the table shows, the Whale Optimization Algorithm results in the highest level of accuracy among the implemented swarm intelligence algorithms.
Table 3.
The error rate of tuning algorithms.
Although WOA demonstrates superior performance compared to the other optimization methods, it is important to emphasize that the alternative algorithms also yield valuable and competitive results, with no considerable performance gap among them. Nevertheless, given that WOA achieves the best overall accuracy and lowest error, this section primarily focuses on detailing and analyzing the results obtained via this algorithm. Figure 4, Figure 5 and Figure 6 compare the results obtained via WOA with the results shown in [3] for aging, electrochemical, and thermal fields, respectively. As shown in Table 3 and Figure 4, Figure 5 and Figure 6, the proposed method based on WOA achieves a lower overall error compared to [3], indicating that PyBaMM is tuned with WOA more accurately. The flowchart of WOA for tuning PyBaMM is presented in Figure 7. As shown, the process begins with generating the initial population of agents, where each agent represents a potential set of parameters for PyBaMM. Next, the fitness of each agent is evaluated; in this study, the overall MAE, as presented in Table 3, is used as the fitness value. After identifying the best agent, the one with the lowest overall MAE, the other agents are guided toward it. This movement is governed by two characteristic behaviors of whales: encircling and the bubble-net attack strategy. Finally, once the stopping criterion is reached, the best agent in the final population is selected as the optimal solution.
Figure 4.
Aging comparison: WOA (bule line), Jin 2024 [3] (orange), and original (dotted line).
Figure 5.
Electrochemical comparisons: WOA (bule line), Jin 2024 [3] (orange), and original (dotted line).
Figure 6.
Thermal comparisons: WOA (bule line), Jin 2024 [3] (orange), and original (dotted line).
Figure 7.
WOA flowchart.
3.4. Degradation Comparison
In the previous section, the best-performing swarm intelligence algorithm for tuning PyBaMM was identified. This section focuses on comparing the accuracy of the tuned PyBaMM with WOA against other battery degradation models. To draw this comparison, the bucket model [29] is selected as a reference due to its simplicity and widespread use in battery studies. The bucket model conceptualizes a battery as a reservoir or tank of energy. In this model, the battery’s state of charge is represented by the energy level in the tank, and the power flow determines whether the battery is being charged or discharged. The model tracks the accumulation and depletion of energy over time, providing a simple yet effective way to estimate battery degradation and state of health without requiring detailed electrochemical modeling. Equation (13) shows how the model calculates degradation.
where shows the degradation level of charging or discharging a lithium-ion battery with regard to power, , and is its lifespan. In this equation the degradation is measured based on KW and the lifespan is based on hours. To determine the correlation between charging–discharging and degradation, the bucket model assumes that a lithium-ion battery reaches 20% of degradation after 8000 working cycles. With this assumption, the degradation factor per each power transaction is equal to . In addition, this model considers a small influence for the maximum experienced power which is equal to .
Since the bucket model is particularly designed to measure the degradation of batteries, aging is used to compare the tuned PyBaMM with WOA and the bucket model. Figure 8 illustrates the comparison. As the figure shows, the tuned PyBaMM with WOA generates more accurate aging results compared to the bucket model.
Figure 8.
Comparison between tuned PyBaMM with WOA and bucket model.
3.5. Tuned Battery Integration
Integrating a realistic battery model in the HEMS is the reason for tuning PyBaMM in this study. As mentioned earlier, PyBaMM works at a cell level; however, for integration into the HEMS, it must be scaled to the pack or battery level. This study uses the same strategy in [3] and scales the cell level to the battery level by arranging cells in series and in parallel for simplicity. This transformation is reported in Table 4. In addition, the results and comparisons in Section 3.3 revealed that WOA performs better than the other algorithms. Subsequently, this section integrates the WOA-tuned PyBaMM into the HEMS.
Table 4.
Battery pack properties.
It is important to note that the HEMS optimization adopts a post-optimization lexicographic evaluation, in which SOH is examined only after the scheduling process is completed. Consequently, SOH is not treated as an objective within the HEMS formulation. This approach aligns with the central aim of this study, which is to tune and validate PyBaMM with high fidelity.
To analyze the behavior of the integrated battery pack, this study utilizes operational conditions obtained from running the HEMS and measures the experienced SOH. After analyzing the behavior of the battery pack in the HEMS, the most appropriate solution in the Pareto curve is selected, based on the SOH level. We select the solution with the highest SOH as the best answer in the Pareto curve because it indicates that the integrated battery has a longer lifespan, enabling extended energy conversion. Figure 9 illustrates 15 solutions in the Pareto curve resulting from the HEMS and corresponding SOHs. Case 5 has the highest SOH, while Case 15 has the lowest among them. Therefore, this study selects Case 5 as the final solution. Also, Table 5 details the SOH values of the Pareto curve solutions, along with their corresponding CO2 and cost levels. The values in the table show that the levels of degradation of the battery for different solutions are small and close to each other because of running the HEMS just for 24 h. A detailed explanation of the battery degradation in each scenario is provided in Appendix B.
Figure 9.
Pareto curve with SOH levels.
Table 5.
SOHs of Pareto curve solutions.
4. Conclusions
In this study, we have provided a solution for home energy management system optimization based on Pareto curves, where the SOH of the battery is considered as the main indicator to select the best solution. The indicator in this study is measured through a physical model in PyBaMM that is tuned based on the information provided by the battery’s manufacturer. The proposed tuning strategy is composed of two stages: sensitivity analysis and tuning. While the significant parameters in PyBaMM, electrochemical, thermal, and aging, are selected by sensitivity analysis, tuning finds the best values for the selected parameters. Reaching the minimum MAE between the results of PyBaMM and the information provided by the manufacturer is the main objective of tuning. Unlike previous studies that used optimization strategies with high computational complexity, this study employs well-known swarm intelligence algorithms, WOA, GWO, PSO, and GSA, to tune the parameters in PyBaMM. Regarding the computational complexity of swarm intelligence algorithms, this study tunes all the parameters simultaneously to keep the potential interconnection between the parameters. Additionally, the structure of swarm intelligence algorithms gives us the ability to search for a wider range of possible answers in comparison to previously used methods like grid-search algorithms. Implementation and comparison results show that the Whale Optimization Algorithm outperforms the other tested algorithms in terms of accuracy. According to the results, WOA reaches an MAE of 1.044223, while this metric is 1.163615, 1.223034, 2.261593, and 2.655768 for the method reported in [3], Grey Wolf Optimization, Particle Swarm Optimization, and the Gravitational Search Algorithm, respectively.
Furthermore, this study integrates the WOA-tuned battery model into an HEMS framework to investigate the influence of a battery’s operation on its SOH. The considered energy framework is aimed at reducing the cost of energy while controlling the environmental impacts. This study analyzes 15 solutions obtained from running the HEMS to find out which scenario degrades the battery less than the others. Battery replacement is a long-term expense in energy systems that will be managed significantly by considering SOH.
In the current study, the tuned PyBaMM is incorporated into the HEMS in a passive manner. Since comparing the performance of different tuning methods was the primary objective of this study, the integration approach follows the same passive strategy used in previous works, such as [3]. However, there are studies, such as [30], in which the battery model is actively embedded within the HEMS optimization loop, and these works provide key inspiration for our future research.
Author Contributions
Conceptualization, M.R., C.P. and Á.G.M.; Methodology, M.R., C.P. and Á.G.M.; Investigation, M.R., C.P. and Á.G.M.; Writing—original draft, M.R.; Writing—review & editing, C.P. and Á.G.M.; Supervision, C.P. and Á.G.M. All authors have read and agreed to the published version of the manuscript.
Funding
This work has been funded by the Universidad Politécnica de Madrid Project “SDGine for Healthy People and Cities”, which received funding from the European Union’s Horizon 2020 Research and Innovation Programme under the Marie Sklodowska-Curie grant agreement no. 945139 and from REPSOL, S.A.
Data Availability Statement
The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding author.
Conflicts of Interest
The authors declare that this study received funding from REPSOL, S.A. The funder was not involved in the study design, collection, analysis, interpretation of data, the writing of this article or the decision to submit it for publication.
Nomenclature
| Abbreviations | |
| ACh | Absorption Chiller |
| AUGMECON | Augmented -Constraint |
| BCD | Basic Cooling Demand |
| BESS | Battery Energy Storage System |
| BHD | Basic Heating Demand |
| BNGD | Basic Natural Gas Demand |
| CC | Constant Current Charging |
| CC-CV | Constant Current–Constant Voltage |
| CV | Constant Voltage Charging |
| ECM | Equivalent Circuit Model |
| EV | Electric Vehicle |
| FEL | Flexible Electrical Load |
| GSA | Gravitational Search Algorithm |
| GWO | Grey Wolf Optimization |
| HEMS | Home Energy Management System |
| HESS | Heating Energy Storage System |
| HHS | House Heating System |
| HP | Heat Pump |
| LFP | Lithium Iron Phosphate |
| MAE | Mean Absolute Error |
| mCHP | Micro Combined Heat and Power |
| MILP | Mixed-Integer Linear Programing |
| NCA | Nickel Cobalt Aluminum |
| NFEL | Non-Flexible Electric Load |
| NMC | Nickle Manganese Cobalt Oxide |
| NGD | Natural Gas Demand |
| PBM | Physic-Based Model |
| PS2D | Pseudo Two-Dimensional Model |
| PV | Photovoltaic System |
| PSO | Particle Swarm Optimization |
| PyBaMM | Python Battery Mathematical Modeling |
| SCD | Space Cooling Demand |
| SHD | Space Heating Demand |
| SOE(_B) | State of Energy (for Battery-Based Technology) |
| SOE(_Th) | State of Energy (for Thermal-Based Technology) |
| SoC | State of Charge |
| SOH | State of Health |
| SPM | Single Particle Model |
| SPMe | Single Particle Model with Electrolyte |
| ST | Solar Thermal System |
| TSEL | Time-Shiftable Electric Load |
| TSS | Thermal Storage System |
| V2G | Vehicle-to-Grid |
| WOA | Whale Optimization Algorithm |
| Sets | |
| d | Set of time-shiftable devices |
| p | Operation phases of time-shiftable devices |
| Timesteps | |
| Parameters | |
| Timestep length per hour | |
| Temperature deviation from the set point | |
| Charge–discharge efficiency of technology | |
| Electrical/thermal efficiency of mCHP | |
| Buying/selling energy price | |
| Maximum power/heat/gas network limits | |
| Carbon intensity of energy consumption | |
| APV/ST | Area of PV/ST systems [m2] |
| COPHP | Heat pump’s coefficient of performance |
| h/px, max/min | Max/min power of technology x [kWh] |
| It | Soral irradiance [kW/m2] |
| Lower heating value of gas | |
| Number of cells | |
| Nm | TSEL’s max operation times per day |
| Number of Pareto curve solutions | |
| pd,pph | Phase power of TSEL [kW] |
| R/Cin | Equivalent thermal resistance/capacitance of the house [°C/kW]/[kWh/°C kg] |
| Rxh/dix | Charge–discharge rate of technology x [kWh] |
| soeEV,arr/dep | EV’s state of energy at arrival/departure [kWh] |
| soex,ini | Initial energy state of technology x [kWh] |
| soex,max/min | Max/min energy state of technology x [kWh] |
| Tin,max/min | Max/min house temperature set [°C] |
| Ttout | Temperature outside of the house [°C] |
| Subscripts | |
| Battery module level | |
| Cell level | |
| Parallel connections | |
| Series connections | |
| Variables | |
| Energy | |
| Natural gas bought (import) from the network | |
| Natural gas consumption of technology | |
| Power/heat import/export from/to the external network | |
| Charge–discharge power/heat of storage systems | |
| Power/heat of technology used domestically/sold to external network | |
| Generation or consumption power/heat of technology | |
| Capacity | |
| State of energy/heat of technology | |
| Temperature | |
| House temperature | |
| Voltage | |
| TSEL operational/start/end phase binary state | |
| Operational binary variable of technology | |
Appendix A
Swarm intelligence algorithms require specific parameters to be determined prior to execution. Given the significant influence of these parameters on the performance of each algorithm, the parameters and the values used in this study are detailed in Table A1. Regarding the scope of this study, we do not detail how each intelligent algorithm works or what the parameters are. To study more about the algorithms and the corresponding parameters, please refer to [17,18,19,20]. Also, each intelligent algorithm was run five times, due to their inherent randomness. Although the results across runs were similar, this study reports the run with the lowest MAE for each algorithm.
Table A1.
Swarm intelligence algorithm running parameters.
Appendix B
As mentioned in Section 3.5, to select the best solution from the Pareto set, this study evaluates a battery’s SOH based on its experienced operational conditions, including current, C-rate, and power, in each scenario. The solution with the highest SOH is then chosen as the best option. This section details the experienced operational conditions and SOH for each scenario. Figure A1 illustrates the operational conditions and SOH of the battery corresponding to each scenario.
Figure A1.
Experienced SOH, current, C-rate, and power.
References
- Chang, M.; Thellufsen, J.Z.; Zakeri, B.; Pickering, B.; Pfenninger, S.; Lund, H.; Østergaard, P.A. Trends in tools and approaches for modelling the energy transition. Appl. Energy 2021, 290, 116731. [Google Scholar] [CrossRef] [Scilit]
- Fiorini, L.; Aiello, M. Automatic optimal multi-energy management of smart homes. Energy Inform. 2022, 5, 68. [Google Scholar] [CrossRef] [Scilit]
- Jin, L.; Kazemi, M.; Comodi, G.; Papadimitriou, C. Assessing battery degradation as a key performance indicator for multi-objective optimization of multi-carrier energy systems. Appl. Energy 2024, 361, 122925. [Google Scholar] [CrossRef] [Scilit]
- Marler, R.T.; Arora, J.S. The weighted sum method for multi-objective optimization: New insights. Struct. Multidiscip. Optim. 2010, 41, 853–862. [Google Scholar] [CrossRef] [Scilit]
- Khezri, R.; Mahmoudi, A. Review on the state-of-the-art multi-objective optimisation of hybrid standalone/grid-connected energy systems, IET Generation. Transm. Distrib. 2020, 14, 4285–4300. [Google Scholar] [CrossRef] [Scilit]
- Li, P.; Luo, S.; Zhang, L.; Liu, Q.; Wang, Y.; Lin, Y.; Xu, C.; Guo, J.; Cheali, P.; Xia, X. Progress, challenges, and prospects of spent lithium-ion batteries recycling: A review. J. Energy Chem. 2024, 89, 144–171. [Google Scholar] [CrossRef] [Scilit]
- Yang, B.; Qian, Y.; Li, Q.; Chen, Q.; Wu, J.; Luo, E.; Xie, R.; Zheng, R.; Yan, Y.; Su, S.; et al. Critical summary and perspectives on state-of-health of lithium-ion battery. Renew. Sustain. Energy Rev. 2024, 190, 114077. [Google Scholar] [CrossRef] [Scilit]
- Ng, M.F.; Zhao, J.; Yan, Q.; Conduit, G.J.; Seh, Z.W. Predicting the state of charge and health of batteries using data-driven machine learning. Nat. Mach. Intell. 2020, 2, 161–170. [Google Scholar] [CrossRef] [Scilit]
- Dong, G.; Gao, G.; Lou, Y.; Yu, J.; Chen, C.; Wei, J. Hybrid physics and data-driven electrochemical states estimation for lithium-ion batteries. IEEE Trans. Energy Convers. 2024, 39, 2689–2700. [Google Scholar] [CrossRef] [Scilit]
- Ma, Y.; Shan, C.; Gao, J.; Chen, H. A novel method for state of health estimation of lithium-ion batteries based on improved LSTM and health indicators extraction. Energy 2022, 251, 123973. [Google Scholar] [CrossRef] [Scilit]
- Cao, Z.; Gao, W.; Fu, Y.; Kurdkandi, N.V.; Mi, C. A general framework for lithium-ion battery state of health estimation: From laboratory tests to machine learning with transferability across domains. Appl. Energy 2025, 381, 125086. [Google Scholar] [CrossRef] [Scilit]
- Ren, Y.; Tang, T.; Jiang, F.; Xia, Q.; Zhu, X.; Sun, B.; Yang, D.; Feng, Q.; Qian, C. A novel state of health estimation method for lithium-ion battery pack based on cross genera-tive adversarial networks. Appl. Energy 2025, 377, 124385. [Google Scholar] [CrossRef] [Scilit]
- Li, R.; O’KAne, S.; Huang, J.; Marinescu, M.; Offer, G.J. A million cycles in a day: Enabling high-throughput computing of lithium-ion battery degradation with physics-based models. J. Power Sources 2024, 598, 234184. [Google Scholar] [CrossRef] [Scilit]
- Cano-Domingo, C.; Jiménez-Ramos, A.; Stoean, R.; Modesto, D. Evolutionary Optimization in Battery Parametrization for Synthetic Data Generation. Procedia Comput. Sci. 2024, 246, 3024–3033. [Google Scholar] [CrossRef] [Scilit]
- Parameters Sets—PyBaMM v23.4.1 Manual. Available online: https://pybamm.readthedocs.io/en/latest/source/api/parameters/parameter_sets.html (accessed on 12 December 2025).
- Omar, M.; Yakub, F.; Abdullah, S.S.; Rahim, M.S.A.; Zuhairi, A.H.; Govindan, N. One-step vs. horizon-step training strategies for multi-step traffic flow forecasting with direct particle swarm optimization grid search support vector regression and long short-term memory. Expert Syst. Appl. 2024, 252, 124154. [Google Scholar] [CrossRef] [Scilit]
- Mirjalili, S.; Lewis, A. The Whale Optimization Algorithm. Adv. Eng. Softw. 2016, 95, 51–67. [Google Scholar] [CrossRef] [Scilit]
- Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey Wolf Optimizer. Adv. Eng. Softw. 2014, 69, 46–61. [Google Scholar] [CrossRef] [Scilit]
- Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the ICNN’95-International Conference on Neural Networks, Perth, WA, Australia, 27 November–1 December 1995; Volume 4, pp. 1942–1948. [Google Scholar]
- Rashedi, E.; Nezamabadi-Pour, H.; Saryazdi, S. GSA: A Gravitational Search Algorithm. Inf. Sci. 2009, 179, 2232–2248. [Google Scholar] [CrossRef] [Scilit]
- Kazemi, M.; Papadimitriou, C.; Paterakis, N.G.; Dukovska, I.; Kok, K. Optimal Design of Multi-Carrier and Multi-Objective Home Energy Management System. In Proceedings of the 2023 International Conference on Smart Energy Systems and Technologies (SEST), Mugla, Türkiye, 4–6 September 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 1–6. [Google Scholar]
- Marquis, S.G.; Sulzer, V.; Timms, R.; Please, C.P.; Chapman, S.J. An asymptotic derivation of a single particle model with electrolyte. J. Electrochem. Soc. 2019, 166, A3693. [Google Scholar] [CrossRef] [Scilit]
- Doyle, M.; Fuller, T.F.; Newman, J. Modeling of galvanostatic charge and discharge of the lithium/polymer/insertion cell. J. Electrochem. Soc. 1993, 140, 1526–1533. [Google Scholar]
- Tani, L.; Rand, D.; Veelken, C.; Kadastik, M. Evolutionary algorithms for hyperparameter optimization in machine learning for application in high energy physics. Eur. Phys. J. C 2021, 81, 170. [Google Scholar] [CrossRef] [Scilit]
- Altay, E.V.; Altay, O.; Özçevik, Y. A Comparative Study of Metaheuristic Optimization Algorithms for Solving Real-World Engineering Design Problems. CMES-Comput. Model. Eng. Sci. 2024, 139, 1039–1094. [Google Scholar] [CrossRef] [Scilit]
- Mavrotas, G. Effective implementation of the ϵ-constraint method in Multi-Objective Mathematical Programming problems. Appl. Math. Comput. 2009, 213, 455–465. [Google Scholar]
- CEGASA. LFP Cell Datasheet. Available online: https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/180/P3_2D00_Datasheet-Cell--3232-LFP-26650.pdf (accessed on 12 December 2025).
- Prada, E.; Di Domenico, D.; Creff, Y.; Bernard, J.; Sauvant-Moynot, V.; Huet, F. A simplified electrochemical and thermal aging model of LiFePO4-graphite Li-ion batteries: Power and capacity fade simulations. J. Electrochem. Soc. 2013, 160, A616. [Google Scholar] [CrossRef] [Scilit]
- Reniers, J.M.; Mulder, G.; Ober-Blöbaum, S.; Howey, D.A. Improving optimal control of grid-connected lithium-ion batteries through more accurate battery and degradation modelling. J. Power Sources 2018, 379, 91–102. [Google Scholar] [CrossRef] [Scilit]
- JLin, J.; Qiu, J.; Zhang, C.; Lu, X.; Tao, Y.; An, S. An Encryption-Based Coordinated Kilowatt and Negawatt Energy Trading Framework. IEEE Internet Things J. 2025, 12, 48962–48977. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).









