1. Introduction
The increasing integration of renewable energies into electricity systems has driven the need for efficient management of energy resources. Renewable sources, such as solar and wind, have an intermittent and hardly predictable production, which requires advanced solutions to balance supply and demand. In this context, hybrid energy storage systems (HESS) play a key role by allowing greater flexibility in grid operation and improving the stability of the power system.
The Energy Management System (EMS) is an essential component in these systems, as it optimizes energy flow, minimizes costs and maximizes battery life. An efficient EMS must be able to coordinate different levels of control, from strategic management based on artificial intelligence to real-time regulation of energy conversion devices.1 Several EMS solutions have been proposed in the literature, focusing on optimizing power distribution, extending battery life or reducing operating costs.2,3 For example, filter-based power management strategies have been developed for HESS, which aim to avoid premature degradation of storage devices by keeping them within safe operating limits.4 In addition, the integration of digital twin technology and machine learning in EMSs has shown significant improvements in the performance and capabilities of advanced energy systems.5 However, many of these solutions lack a modular and scalable design to enable their integration into various applications, especially in the context of electric vehicle charging infrastructure and grid support. The EMS proposed in this paper, developed within the scope of the EU HAVEN project,6 addresses this gap by combining a multilevel control strategy with advanced predictive algorithms and a modular digital twin-based approach, making it an adaptable and innovative solution. Moreover, the EMS developed operates at three levels: the high-level cloud-hosted EMS uses artificial intelligence to forecast renewable generation, load consumption and battery life; the Medium-Level EMS, which dynamically manages the microgrid; and the Low-Level EMS, which monitors real-time performance.7
HAVEN is a project that introduces an innovative HESS solution along with advanced control strategies to support various applications, including electrical grid stabilization and EV charging infrastructure. The system integrates high-energy batteries, high-power batteries, and cognitive power electronics devices to optimize energy use and enhance system reliability. A key innovation of HAVEN is its modular Digital Twin platform, which allows for the simulation, optimization, and real-time monitoring of the HESS, enabling more efficient and sustainable energy management. The project follows a top-down methodology, starting from a grid-scale perspective to adapt the system to specific use cases.
This article describes in detail the structure of the EMS developed under the HAVEN project. In Section II, the general architecture of the system is presented. Section III details the three levels of the EMS, explaining its key functions and algorithms. Section IV presents the results obtained in the case studies, and finally, Section V presents the conclusions of the work.
2. General structure
The EMS of the HAVEN project is based on a hierarchical architecture designed to optimize energy flow in HESS. Its structure is composed of several key elements that enable efficient management of energy resources, ensuring stability, flexibility and operational efficiency.
As shown in
Figure 1, the HESS is composed of two types of batteries: a high energy (HE) battery, optimized to store and supply energy for long periods, and a high power (HP) battery, designed to respond quickly to variations in demand. Each of these batteries is connected to a DC/DC converter and a Low-level Edge Device that hosts the low-level EMS, which is responsible for real-time monitoring and regulation.

Figure 1. Generalized HAVEN EMS hierarchy and structure.
These control devices communicate with a Mid-level Edge Device, where the corresponding EMS is hosted. This system enables advanced management strategies to optimize energy usage. One such strategy is peak shaving,8 which reduces energy consumption during high-demand periods by utilizing storage to lower peak loads, preventing grid overloads and reducing peak demand costs. Additionally, RES production balancing ensures efficient use of renewable energy and storage, avoiding energy spillage while maximizing self-consumption. Load levelling further enhances stability by distributing energy demand evenly over time, mitigating fluctuations and promoting predictable consumption patterns. Another key feature of the system is real-time pricing, which dynamically adjusts battery charging and discharging based on market energy price variations to minimize costs and enhance economic efficiency. Furthermore, the HESS connects to a DC bus, enabling direct power supply to certain loads. However, to interface with the main electric grid, an additional inverter, specifically a DC/AC converter, is required.
3. Multi-layer EMS structure levels
The HAVEN’s EMS plays a crucial role in optimizing the performance and longevity of the HESS. This EMS is designed to efficiently manage energy flow by leveraging predictive and optimization algorithms that improve system performance and economic viability. The system is structured to operate at a strategic level, making long-term optimization decisions based on forecasts of energy consumption, renewable generation, and battery health status. Moreover, the short-term decisions should also be taken into account, and for this purpose, the mid-level and the low levels are also relevant steps of the general structure.
3.1 High-level
EMS
The High-Level EMS consists of three interconnected modules that perform predictions to support the optimization process carried out in Mid-Level EMS. Three key components are the 24h_Load_Prediction algorithm for 24-hour consumption forecasting, the remaining useful life (RUL) estimation algorithm and the RES forecasting. These modules work together to improve the adaptability and efficiency of energy management. The EMS processes large data sets, including historical consumption patterns, real-time sensor data and weather forecasts, integrating this information to support the generation of optimized charging and discharging strategies, which are calculated in the lower layers of the EMS. This ensures the cost-effectiveness and reliability of HESS operation, while providing strategic information to the mid-level EMS.
Accurate forecasting of energy demand is essential for efficient EMS. The 24h_Load_Prediction algorithm predicts energy consumption patterns for the next 24 hours, allowing the system to anticipate and adapt to varying energy needs. This model is based on regression trees, which are well suited to handle non-linear relationships in energy forecasting.9 The algorithm dynamically adapts to changes in consumption patterns, integrates real-time data, and refines its predictions to improve accuracy. The 24h_Load_Prediction algorithm processes variables such as temperature, historical energy consumption and temporal factors such as time, day and month to account for seasonal variations. It distinguishes between weekdays, weekends and holidays to refine forecasts. The forecasting model follows a structured approach, starting with data preprocessing to clean and structure the input information. The regression tree model is then trained and validated before being used in real-time adjustments.
Efficient battery management is critical to the longevity and economic viability of energy storage systems. The RUL algorithm predicts the remaining life of lithium-ion batteries within HAVEN HESS, enabling strategies that prevent unexpected failures and optimize battery utilization. RUL prediction is based on Gaussian Process (GP) regression, a probabilistic machine learning approach that learns from empirical battery performance data rather than relying on predefined degradation models. This method is very flexible and adapts to various battery types and conditions, while providing confidence intervals for RUL predictions, improving the reliability of decision making. The RUL prediction framework consists of several key processes, as it is more deeply explained in.10,11 The initialization phase establishes operational parameters and selects processing modes. The data processing module collects and organizes battery data, including state of charge, depth of discharge, temperature, and equivalent full cycles. The training module uses historical data to generate GP models that capture battery degradation trends. Finally, the prediction module estimates RUL based on real-time battery conditions and predicted usage scenarios. The algorithm can be run at different levels, including low-level edge devices for localized predictions, mid-level edge devices for refining predictions, and cloud-based processing for long-term analysis and maintenance planning.
The RES forecast algorithm is a deep learning framework for renewable energy forecasting. The model integrates climatological and meteorological data representing various environmental conditions. The forecasting model processes solar irradiance, wind characteristics, atmospheric parameters and temporal characteristics, generating specific forecasts with high temporal granularity. In addition, a resource-to-energy conversion module translates resource forecasts into power generation estimates, optimizing power distribution and grid integration. This approach addresses the inherent variability of renewable resources, ensuring efficient energy planning, increased grid stability and enhanced sustainability of renewable energy systems.
3.2 Medium-level
EMS
This section provides an overview of the medium-level EMS which is designed to manage energy flow optimally within a microgrid which integrates three energy sources: AC grid, RES (aggregated without distinction between types), and a HESS along with the connected loads. In such a configuration, the medium-level EMS plays a pivotal role by determining the optimal power setpoints to minimize operational costs, maximize RES utilization, and mitigate battery degradation. The mid-level EMS management approach capitalizes on the distinct characteristics of the two batteries: the HE battery, with its higher energy density, is utilized for handling significant energy exchanges over extended durations, while the HP battery is optimized for rapid response, higher ramp rates, and frequent cycling, effectively addressing short-term power imbalances and fluctuations in demand or RES output.
To meet these goals, a two-layer control structure has been designed that mimics the framework in,12 with important changes implemented:
• A receding time horizon has been replaced with a dynamic time horizon that shortens as time goes by.
• The RUL present in the high-level EMS was used to estimate battery degradation.
• A feedback mechanism has been introduced in which actual measurements and states coming from components are directly fed to the two layers.
• The formulation of constraints, including power balance and the power capacity limits of batteries and the utility grid from,12 has been adopted. The specific parameter values have been determined based on the case study and are presented in
Table 1.
Table 1. Case study’s parameters.
| Capacity [kWh] | Pmax_discharge [kW] | Pmax_charge [kW] |
|---|
| HE battery | 158 | 86 | 86 |
| HP battery | 56 | 222 | 222 |
| Grid | - | 180 | 0 |
The layered approach enables the system to separate long-term planning from real-time control, thereby accommodating both the slow dynamics associated with forecast-based planning and the rapid fluctuations of actual operating conditions.
In each layer, a discrete-time optimization problem is solved to determine optimal power setpoints, with different time horizons and update intervals. The Upper Layer (UL) operates over a longer prediction horizon, typically on the order of hours, while the Lower Layer (LL) uses a shorter horizon of minutes to manage immediate system dynamics and to address predictions’ errors. Unlike a traditional receding time horizon approach, where only the first setpoint is implemented and the entire horizon shifts forward at each update, this EMS setup recalculates the optimal values at each triggering without rolling the time horizon. Instead, as time advances, the prediction horizon itself gradually shortens, allowing the EMS to explore and implement all pre-computed setpoints over the full span of the optimization window. This approach ensures that each setpoint is evaluated and applied as part of the optimization outcome, rather than discarding planned setpoints as would occur in a rolling horizon. The result is a more comprehensive usage of the optimized values, with greater flexibility in tracking the system’s goals over time.
Figure 2 provides a graphical representation of the medium-level EMS architecture and its interfaces with the other components within the microgrid.

Figure 2. Medium-level EMS architecture and its interfaces.
The UL receives from the high-level EMS predicted profiles of RES generation, load consumption and electricity cost on a daily basis. Moreover, the UL receives the State of Charge (SOC) from the HE battery pack. Once triggered, the UL calculates optimized power setpoints for the grid and the HE battery, then forwards them to the LL. The optimization problem in the UL is a constrained nonlinear programming problem (NLP) in which the objective function to be minimized considers the conflicting objectives of minimizing electricity costs from the utility grid and mitigating battery degradation.
On the other hand, the LL receives the power setpoints from the UL as well as real-time measurements and states from the microgrid’s components. With this data, the LL dynamically adjusts power setpoints not only for the utility grid and HE battery but also for the HP battery. The LL’s objective is to adjust the UL-provided power setpoints to maintain power balance while reacting to immediate changes in the microgrid. To achieve this, it prioritizes allocating power deviations to the HP battery pack through a constrained optimization problem. The objective function is designed to minimize the discrepancy between the UL’s setpoints and the recalculated setpoints within the LL.
In this setup, the UL is triggered every hour, meaning it updates its outputs based on the most recent inputs every 60 minutes. The LL is triggered every minute, allowing it to respond to real-time fluctuations, to reduce the mismatch between forecast and actual profiles, ensuring stable and efficient operation of the microgrid.
C. Low-level
EMS
The Low-Level EMS functions as the supervisory unit for a single energy storage system (ESS) within the HESS, aggregating and monitoring BMS data, voltage levels, and power flow based on mid-level Edge Device’s parameters. The computational unit of the Low-Level EMS, the Low-Level Edge Device is integrated into the DC/DC converter. The Low-Level EMS provides an abstraction layer for the underlying ESS, delivering microgrid and battery system parameters to the upper parts of the EMS and offering a uniform control interface. The Edge Board can be modularly integrated into the converter to enable cognitive functionalities such as state estimation, impedance measurement and integration into a multi-layer EMS structure or omitted when such capabilities are unnecessary. It operates independently from the converter controller, which regulates performance based on predefined parameters; however, these parameters can be modified and influenced by the Mid-Level Edge Device. One EES, with every internal block, is depicted in
Figure 3.

Figure 3. Internal blocks of an Energy Storage System.
The Low-Level Edge Device will communicate with the converter via SPI (Serial Peripheral Interface) to enable its parametrization, perform state monitoring, and provide the necessary compute power to execute algorithms, such as the calculation of impedance from a PRBS (Pseudo Random Binary Sequence) measurement. Additionally, the Low-Level Edge Device serves as a cloud connection point, enabling cloud communication for incorporating cloud-computed results into the EMS and facilitating updates to the converter firmware. The edge device utilizes cloud API to support cloud-to-edge functionalities, allowing remote monitoring, triggering, and redeployment of its own software.
Each EES with a Low-Level EMS can be seen as an independent unit, which could be added, removed or replaced. Hence the three-layer architecture enables flexibility of up and down scaling of the whole system. In case more energy storage systems are needed to fulfill the demands of the microgrid, they can be added by considering the voltage levels in the inner HESS microgrid for the converter design and by adjusting the algorithms in the cloud and mid-level
EMS.
This architecture allows the battery system, when combined with the smart converter, to be utilized as a cohesive energy solution for lower complexity applications, leveraging the same cloud-based algorithms. While this approach offers the advantage of a streamlined solution, it also presents reduced flexibility in terms of interfaces and computing power requirements, which can be addressed by integrating the Mid-Level Edge Device into the system, further increasing the flexibility of the EMS to be tailored to its use case.
4. Case study results
In this section, the performance of the proposed high-level and medium-level EMSs is evaluated through a simulation scenario. The objective is to assess how effectively the EMSs can optimize energy usage in a residential microgrid environment under realistic and dynamic operating conditions. The analysis considers synthetic daily profiles for electricity costs from the utility grid, RES generation, and load consumption.
Figure 4 and
Figure 5 illustrate these profiles, highlighting seasonal variations by representing one summer and one winter condition. Specifically, RES generation is modeled to reflect photovoltaic output, which notably, during summer, exhibits a higher amplitude and longer duration compared to winter due to increased solar irradiance and longer daylight hours. On the other hand the residential load consumption was simulated to increase during winter. The figures also highlight the differences between the high-level EMS’s daily forecast and the actual simulated measurements. This discrepancy allows for a robust assessment of the EMS’s capability to manage deviations from expected conditions and adapt control strategies accordingly. Additionally, the utility grid is modelled with two distinct tariffs: a daytime rate of 0.10 €/kWh (applicable from 06:00 to 22:00) and a nighttime rate of 0.05 €/kWh (applicable from 22:00 to 06:00). This dual-rate pricing model introduces an additional layer of complexity, as the EMSs must balance energy costs with availability and demand in real-time.

Figure 4. RES generation in summer and winter conditions.

Figure 5. Load profiles in summer and winter conditions.
Throughout the 24-hour period, the forecasted signals are generated at a 15-minute resolution, while the actual measurements are sampled every minute.
The parameters adopted in this case study are listed in
Table 1 (with “discharge” and “charge” for the grid referring to the ability to draw energy from or feed energy into the grid, respectively). In this analysis, the ability to feed energy back into the grid is not considered.
Figure 6 and
Figure 7 present the results of the medium-level EMS optimization for summer and winter conditions, respectively. Regardless of the batteries’ initial states, the EMS determined these power profiles and operating conditions consistently when running the same profile.

Figure 6. Medium-level EMS results for summer conditions.

Figure 7. Medium-level EMS results for winter conditions.
In both scenarios, the HP battery exhibits a more dynamic and oscillatory profile, reflecting its role in managing short-term deviations between forecasted and actual load consumption. On the contrary, the HE battery follows smoother, longer-term dynamics, prioritizing overall energy balancing.
During summer, the HE battery remains largely inactive for a significant portion of the day, only engaging when there is substantial energy excess or deficit. Meanwhile, the HP battery frequently charges and discharges to accommodate fluctuations in renewable generation and load demand. In winter, both batteries display increased activity, particularly the HE battery, which undergoes multiple charge and discharge cycles throughout the day. This behavior is driven by higher energy demand and lower renewable generation compared to summer, requiring a more active role in energy management.
Finally, the cost of grid electricity (blue curve) shows variations aligned with the tariff structure, influencing battery operation to minimize energy costs.
Table 2 highlights the economic benefits of the proposed solution. By extrapolating the obtained results to represent a full-year scenario, assuming a 50% distribution of summer and winter conditions, a reduction of 31.7% in electricity costs and in grid energy import, as well as the complete elimination of RES curtailment have been quantified.
Table 2. Impact of HESS and EMS integration.
| Scenario | Electricity Cost [€/year] | Grid Import [MWh/year] | RES Curtailment [MWh/year] |
|---|
| Without HESS & EMS | 61349 | 636 | 142 |
| With HESS & EMS | 41850 (−31.7%) | 434 (−31.7%) | 0 (−100%) |
These findings underscore the added value of the proposed approach, which integrates both the HESS and layered EMSs for optimized load management, demonstrating its potential to enhance energy efficiency and reduce operational costs.
5. Conclusions
In this work, a hierarchical EMS has been developed within the framework of the European HAVEN project, structured in three levels: a high-level EMS, where some prediction or forecasting algorithms are implemented; a mid-level EMS, in charge of the dynamic management of the microgrid; and a low-level EMS, which monitors the stability and performance of the system in real time. This architecture allows for a comprehensive optimization of the energy flow, minimizing operating costs and maximizing the useful life of the batteries.
The high-level EMS developed incorporates advanced prediction and optimization algorithms. In particular, the 24h_Load_Prediction model allows estimating energy demand 24 hours in advance, facilitating more efficient resource management. On the other hand, the RUL algorithm estimates the remaining useful life of the batteries using automatic learning techniques, which allows optimizing the utilization and useful life of the batteries.
The proposed medium-level EMS optimally manages energy flow within a microgrid while balancing operational cost, RES utilization, and batteries’ longevity. Its two-layer control structure separates long-term planning from real-time adjustments, with the UL optimizing power setpoints based on forecasted profiles and the LL dynamically refining them using real-time
data.
The Low-Level EMS oversees individual energy storage systems within the HESS, independently aiming to achieve the setpoints of the mid-level EMS while still allowing the converter to maintain grid stability. It utilizes the edge board for efficient communication and cognitive functionalities. Its modular design allows for scalable integration of ESS units into a HESS, promoting efficient energy management in microgrid environments.
The future works of the developments described within this paper are double. On one hand, these developments will be deployed into Edge devices and will be demonstrated within the three real use cases of the HAVEN project, analyzing the EMS’s performances in the pilots. On the other hand, the digital twin of these developments will be demonstrated in the virtual use case of the project, serving for replicability of the proposed solution.
Ethics & consent
Ethical approval and consent were not required.