scieee AI-readable full text Open interactive document viewer

Cost-Effective Operation of Microgrids: A MILP-Based Energy Management System for Active and Reactive Power Control

García Caro, Sebastián; Bracco, Stefano; Parejo Matos, Antonio; Fresia, Matteo; Guerrero Alonso, Juan Ignacio; León de Mora, Carlos

Abstract

Microgrids (MGs) have emerged as a potential solution for the integration of Distributed Energy Resources (DERs) into the distribution network. In this sense, to effectively manage MGs, it is essential to implement Energy Management Systems (EMSs). This entails not only performing the unit commitment but also considering the voltage and reactive power technical constraints and managing ancillary services. This paper contributes with a comprehensive EMS for the optimal management of active and reactive power of a generic grid-tied MG composed of Renewable Energy Sources (RESs), Battery Energy Storage Systems (BESSs), Diesel Generator (DGs) units and loads, with the goal of reducing the operating costs of the facility. The EMS includes models for the power electronics units to apply reactive power management and a generic formulation for the management of the startup and shutdown cycles of dispatchable units. Furthermore, a detailed modeling of BESS and DG units is presented, reflecting the actual behavior of the devices. The MG is modeled as a multi-busbar network, with the application of the power flow equations to establish the link between power flows and nodal voltages. All the constraints are linearized to formulate the EMS as a Mixed-Integer Linear Programming (MILP) optimization problem. The EMS is validated in a real facility: the CATEPS Microgrid Living-Lab. The results demonstrate the operational effectiveness of the EMS in different seasons, exhibiting a reduction in costs ranging from 21.84 % in summer to a 5.69 % in winter compared to a scenario with RES production but without energy management. In addition, a comprehensive examination of reactive power and voltage management is presented. Furthermore, an empirical assessment of the power flow equations linearization demonstrated minimal discrepancy in the results when compared with those obtained with the non-linear equations, exhibiting a mean absolute error of 8.8e-5 p.u. and 3.2e-5 rad in voltage magnitude and phase angle, respectively, in the most unfavorable scenario. A sensitivity analysis of the startup and shutdown cycles management of the BESS reveals a negligible effect on operational costs, yet it provides a mechanism for managing the battery stress by reducing the number of startups in a complete week from 28 to 16 in summer and from 37 to 24 in winter. The dependence between the maximum charging and discharging power on the state of charge of the BESS is also assessed in the use case.

Full text

Cost-Effective Operation of Microgrids: A MILP-Based Energy Management System for Active and Reactive Power Control Sebasti´ an García a,* , Stefano Bracco b , Antonio Parejo a , Matteo Fresia b , Juan Ignacio Guerrero a , Carlos Le´ on a a Department of Electronic Technology, Escuela Polit´ ecnica Superior, University of Seville, Seville 41011, Spain b Department of Electrical, Electronic, Telecommunications Engineering and Naval Architecture, University of Genoa, Genova 16145, Italy ARTICLE INFO Keywords: Distributed Energy Resources Energy Management Systems Microgrids ABSTRACT Microgrids (MGs) have emerged as a potential solution for the integration of Distributed Energy Resources (DERs) into the distribution network. In this sense, to effectively manage MGs, it is essential to implement Energy Management Systems (EMSs). This entails not only performing the unit commitment but also considering the voltage and reactive power technical constraints and managing ancillary services. This paper contributes with a comprehensive EMS for the optimal management of active and reactive power of a generic grid-tied MG composed of Renewable Energy Sources (RESs), Battery Energy Storage Systems (BESSs), Diesel Generator (DGs) units and loads, with the goal of reducing the operating costs of the facility. The EMS includes models for the power electronics units to apply reactive power management and a generic formulation for the management of the startup and shutdown cycles of dispatchable units. Furthermore, a detailed modeling of BESS and DG units is presented, reflecting the actual behavior of the devices. The MG is modeled as a multi-busbar network, with the application of the power flow equations to establish the link between power flows and nodal voltages. All the constraints are linearized to formulate the EMS as a Mixed-Integer Linear Programming (MILP) optimization problem. The EMS is validated in a real facility: the CATEPS Microgrid Living-Lab. The results demonstrate the operational effectiveness of the EMS in different seasons, exhibiting a reduction in costs ranging from 21.84 % in summer to a 5.69 % in winter compared to a scenario with RES production but without energy management. In addition, a comprehensive examination of reactive power and voltage management is presented. Furthermore, an empirical assessment of the power flow equations linearization demonstrated minimal discrepancy in the results when compared with those obtained with the non-linear equations, exhibiting a mean absolute error of 8.8e-5 p.u. and 3.2e-5 rad in voltage magnitude and phase angle, respectively, in the most unfavorable scenario. A sensitivity analysis of the startup and shutdown cycles management of the BESS reveals a negligible effect on operational costs, yet it provides a mechanism for managing the battery stress by reducing the number of startups in a complete week from 28 to 16 in summer and from 37 to 24 in winter. The dependence between the maximum charging and discharging power on the state of charge of the BESS is also assessed in the use case. 1. Introduction In recent years, the European Union has assumed a commitment to the energy transition. In 2021, the Fit for 55 package was enacted by the European institutions, within the framework of the European Green Deal [1]. The package promoted some challenging goals for the member states for the 2030 year, in terms of reduction of greenhouse gas emissions, penetration of Renewable Energy Sources (RESs) within the generation portfolio [2] and promotion of energy deriving from RESs and energy efficiency in buildings, which represent one of the most energy-consuming sectors at European level [3]. Following these legislative constraints, member states are promoting incentives to foster the installation of a larger share of RESs within national generation portfolios, in replacement of synchronous generators typically installed in traditional coal or gas-fired power stations. RES power plants, mainly represented by Photovoltaic (PV) and Wind Turbine (WT) installations, cannot provide the same performance as synchronous generators in terms of frequency and voltage support [4], * Corresponding author. E-mail address: [email protected] (S. García). Contents lists available at ScienceDirect International Journal of Electrical Power and Energy Systems journal homepage: www.elsevier.com/locate/ijepes https://doi.org/10.1016/j.ijepes.2025.110458 Received 24 July 2024; Received in revised form 25 September 2024; Accepted 3 January 2025 Electrical Power and Energy Systems 165 (2025) 110458 Available online 10 January 2025 0142-0615/© 2025 The Authors. Published by Elsevier Ltd. This is an open access article under the CC BY license ( http://creativecommons.org/licenses/by/4.0/ ). being connected to the distribution network through inverters. Dedicated controllers must be installed on inverters to make them participate in frequency and voltage support [5]. Moreover, PV and WT units are affected by the inherent unpredictability of the primary source, therefore being affected by possible unexpected overor under-productions. For this reason, these power plants are usually coupled to storage systems, either hydroelectric in large-scale applications [6] or Battery Energy Storage Systems (BESSs) in small scale applications [7]. BESSs are able to absorb possible surplus RES production during peak periods, delivering it back to the network during low RES production periods [8]. Integrated RES-BESS systems can participate in frequency containment and restoration reserves [9]. In addition, BESSs mitigate voltage fluctuations that may derive from fast variations of RES power output [10]. At small scale, RESs and BESSs can be identified as Distributed Energy Resources (DERs): for example, in the residential sector, these devices are installed in the nearby of buildings or on rooftops. Many DERs are connected to each other, along with loads, Electric Vehicles (EVs) charging stations and possible dispatchable generators, such as microgas turbines or Diesel Generators (DGs), in the so-called Microgrids (MGs) [11]. MGs may also be made up of plants capable of providing thermal and cooling energy, like boilers, Combined Heat and Power (CHP) units and Combined Cooling, Heat and Power (CCHP) units [12,13]. MGs are usually operated under economic or environmental objectives, aiming to minimize operational costs and/or CO 2 emissions. Moreover, they provide greater flexibility to the distribution network, if compared to the traditional paradigm [14]. Several different applications of the MG concept can be found: remote MGs (for far-away areas and small islands), mobile MGs (transportable on trailer), MGs for military compounds, health care facilities, and university campuses, MGs for data centers, MGs for ports and airports, etc. It is also important to consider how many MG installations can now take place in urban areas, in all those new neighborhoods that are being created as consequence of redevelopment projects on old industrial sites. In these new sustainable urban districts, local green energy production can help reduce the carbon footprint of cities and improve the quality of life, as assessed in [15] where the authors describe the implementation of a MG to feed a Positive Energy District (PED). In the creation of these new sustainable areas, the placement of distributed generation must be carefully evaluated to minimize the impact on the distribution network [16], even considering extreme weather events [17]. The optimal dispatching of the units composing a MG is defined by an Energy Management System (EMS), which is typically the upper level of a Supervisory Control and Data Acquisition System (SCADA). EMSs are in charge, for example, of defining the optimal scheduling of dispatchable units and the optimal active and reactive power provision by DERs: to do this, capability curves of inverters must be embedded within the EMS, as shown in [18], where they are modelled in accordance with Italian technical standards. Moreover, EMSs define the optimal profile of power exchange with the local distribution network, if the MG works in grid-connected mode; if needed, EMSs allow the MG to operate in islanded mode, when required by the distribution system operator. Furthermore, EMSs are used to optimally schedule the operation of BESSs and to apply EV smart charging strategies. The complexity of EMSs is mainly due to the multiple input data that need to be provided to optimally run it. This means economic parameters (electricity purchase and selling prices, maintenance costs, RES curtailment costs, etc.), technical data (performance curves describing the operation of DG plants at partial load, lower and upper bounds for power production, maximum and minimum charging and discharging power for BESSs usually dependent on state of charge, etc.) and environmental parameters (emission factors, etc.) [15]. Moreover, EMSs are usually coupled with forecasting tools used to estimate both loads (electrical, thermal and cooling) and renewable energy production. For instance, in [19] a machine learning probabilistic forecasting approach with robust optimization is proposed to define optimal dispatching for MGs having a high penetration of RESs, while in [20] the analysis focuses on models used to estimate the loads in a MG. A separate issue concerns the management of electric mobility within a MG, as highlighted in [21], where a study for a remote island fed by a MG with several EV charging points is reported, and in [22], where a method to improve the forecasting accuracy of EV charging demand is proposed. It is very difficult to estimate transport demand, and so the EV charging needs, as it depends not only on environmental and technical factors, but also on behavioral aspects of mobility users. 1.1. Literature review Several examples of EMSs for MGs can be found in the literature. A comprehensive review of them is presented in [23], and also in [24] where an analysis of the different optimization techniques used to address the energy management problems in MGs is proposed. A comparison of several energy management strategies in MGs is also reported in [25], by highlighting the criticalities in managing intermittent RESs and the importance of applying demand response. A large portion of the studies present in the literature models the MG as a single busbar system and neglect the impact of reactive power. The application of single busbar model implies that all the power flows among buses and all the relevant voltage phenomena are neglected. Among the studies present in the literature, [26] proposes an EMS to optimally operate a MG located in Egypt with WT, PV and DG units, with the aim of minimizing costs and emissions. In [27] and [28] the authors present a day-ahead EMS for the optimal management of a public postal facility, equipped with micro WTs and a PV system, owning a fleet of EVs for the delivery of freight. Even though these papers introduce an approximation to model the capability curves of inverters to consider reactive power, the proposed model has the potential to result in inverter overload situations, as evidenced by the results. The authors of [29] propose an optimal management strategy for a multi-energy MG operating in energy markets. The proposed scheme is hierarchical, with a lower layer made of single multi-energy MGs and with an upper layer that coordinates the MGs, applying a dynamic price mechanism, and that is interfaced with the distribution network. Nevertheless, a single busbar model is employed to describe the topology of the MGs and reactive power is neglected. A methodology to optimally operate a BESS, providing flexibility to manage PV and WT variability, is provided in [30], for a facility equipped with a microturbine and a DG, too. The purpose of the study is to try to employ the BESS as the unique flexible source, not relying on the DG. However, as in the previous studies, the MG is modelled as a single busbar system and reactive power is neglected. Other studies apply a multi-busbar model to MGs, to adhere to reality in a better way. For example, in [31] an EMS for a MG feeding residential, commercial and industrial users with PV, WT and BESS units is presented, considering the power flows among buses but neglecting the analysis of voltage phenomena, reactive power exchanges and not trying to limit the number of charging and discharging cycles of the BESS, that could reduce its useful life. The authors of [32] also consider a multibusbar model to present an EMS for wind farms combined with BESS and distributed generators. The study considers a limitation on the startup and shutdown cycles. However, this last work neglects the impact of reactive power and just consider the management of active power. A two-layer coordinated EMS to optimally manage distribution networks with grid-connected MGs is proposed in [33]. The first layer optimizes the MG operation while the second optimizes the distribution network operation. A multi-busbar model is used to model the MG. However, the management of BESS does not consider the relationship between the SoC and the exchanged power, so possible discrepancies could appear in real implementations. In addition, like other papers, it does not attempt to limit startups to short periods of time. Another study that presents the integration of a multi-busbar model within the EMS is [34], where the study case is a MG with DERs and RESs. In this last paper, Optimal Power Flow (OPF) constraints are also considered. The S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 2 authors propose a multi-objective approach, considering economic, environmental and power quality objectives. However, the problem is non-linear (NLP) and non-convex, requiring meta-heuristic optimization algorithms to solve it. In addition, BESSs are not considered within the formulation, not assessing the prominent role that they will play in scenarios with high RES penetration, due to their flexibility. Similarly, in [35] an EMS for the optimal dispatching of multi-microgrids requiring meta-heuristic optimization algorithms is presented. The proposal considers PV, WT and BESS and models the microgrid as a multi-busbar network. However, the authors just consider active power management, neglecting the effect of reactive power. In [36] the authors propose an EMS to manage virtual power plants connected to a distribution network. The problem considers RES and EV units’ management of active and reactive power management through the complete OPF equations. However, the problem is non-linear and non-convex, requiring high computational times and specific solvers. A similar approach is presented in [37] but also considering hydrogen storage as a potential solution to increase reliability and flexibility of the network. In [38] a mixed-integer second-order cone programming (MISOCP) EMS for MGs incorporating RES, BESS and DG units is proposed. The formulation employs robust optimization to ascertain the viability of the proposed solutions. The EMS manages both active and reactive power, employing a multi-busbar model with a convex formulation of the OPF equations. In [39], some of the same co-authors who contributed to the previous paper presented a MINLP based EMS for islanded MGs that was later linearized as a MILP problem. This proposal includes a multibusbar model, linearizing the OPF equations through the assumption of knowing estimated values for voltages and active and reactive power flows through lines. The proposed approach entails a hierarchical solution in which the MILP problem is initially solved and subsequently the MINLP. While proposals [38,39] are comprehensive, they lack any stipulations preventing dispatchable units (BESS and DG) from multiple activations and deactivations in short periods of time, not trying to limit the number of startup and shutdown cycles of them, that could reduce its useful life. Additionally, the BESS model does not account for the relationship between maximum power in charging/discharging states and the SoC, which could lead to inaccurate solutions regarding the BESS performance. To conclude this subsection and with the aim of provide a summary of the literature review, Table 1 outlines the principal attributes of each of the papers studied in this subsection. 1.2. Contributions As a conclusion of the literature review, few papers propose a comprehensive approach to EMSs for MGs (see Table 1): some of them apply a single busbar model to the MG, preventing the application of power flow equations and the assessment of reactive power exchange by RES inverters and of the impact of RES production fluctuations on nodal voltages. Other papers on the one hand apply a multi-busbar model to the MG, including the OPF equations, but on the other hand do not provide a detailed insight into the role that BESSs and dispatchable DERs play in MGs management, some of them without even considering reactive power control. It has been shown that the influence of startup and shutdown cycles of dispatchable units (such as BESS or DGs) is often overlooked. Furthermore, the relationship between SoC and the power that BESS can deliver is frequently disregarded, which can result in inaccurate assessments of BESS performance. Many proposals employ non-convex and non-linear formulations, requiring heuristic-based solvers to obtain the solution of the problem. Others utilize convex quadratic programming techniques, while another group employs hierarchical approaches. Furthermore, it has been observed that the usecases presented in the literature are typically constructed using synthetic MGs. In addition, some of the papers lack comprehensive information regarding the characteristics of the network or the assets. Given the state of the art, the aim of the present paper is to define a comprehensive EMS for the optimal operation of a grid-tied MG composed of distributed RES units (PVs and WTs), distributed dispatchable units (BESS and DGs) and loads, with the goal of reducing the operating costs of the facility, and considering the limitations previously identified in the state-of-the-art. The EMS has been modelled as a MixedInteger Linear Programming (MILP) problem, to ensure the existence of an optimal solution and that it represents the global minimum. In addition, linear formulations are often preferred over convex quadratic formulations due to their simplicity and the extensive support and maturity of the solvers that are available. This approach also reduces the computational capacity required. Within the EMS, dedicated models for power electronics units are inserted, taking into account the capability curves of converters. This allows to consider the impact of reactive power on the nodal voltage amplitudes, as well as managing potential penalties for reactive power exchange with the external grid. Power flow equations are linearized and also included in the EMS to link power flows and nodal voltages. Moreover, a detailed model for BESS is Table 1 Summary of the literature review. An empty cell indicate that the paper does not address the characteristic. The symbol ▴ denotes that the paper discusses the use of BESS but does not consider the relation between exchanged power and SoC. The symbol ◆ denotes that the paper is using EVs as energy storage. The symbol ■ denotes that the paper addresses the use of DGs but does not consider the inherent constraints of such systems. Paper Optimization model Reactive power control OPF equations Implementation of inverters’ capability curves Limits ON/OFF cycles of dispatchable units Use case DERs PV WT BESS DG [27,28] MILP ✔✔Synthetic ✔ ✔ ◆ [29] Hierarchical MILP     Synthetic ✔ ✔ ▴ ■ [30] Quadratic Programing     Synthetic ✔ ✔ ▴ ■ [31] MILP Just active power.   Synthetic ✔ ✔ ▴ [32] MILP DC power flow ✔Synthetic ✔▴✔ [33] Hierarchical MILP ✔Brach equations linearized ✔Synthetic ✔ ✔ ▴ ■ [34] Non-convex NLP ✔Non-convex equations   Synthetic ✔ ✔   [35] Non-convex NLP Non-convex equation just for active power   Synthetic ✔ ✔ ▴ [36,37] Non-convex NLP ✔Non-convex equations ✔Synthetic ✔ ✔ ◆ [38] MISOCP ✔SOCP formulation ✔Synthetic ✔ ✔ ▴✔ [39] Hierarchical MILP-MINLP ✔Linear formulation needing estimated grid values. ✔Synthetic ✔▴✔ This paper MILP ✔✔ Nodal equations linearized ✔✔ ✔✔ Real facility ✔✔ ✔✔ ✔✔ ✔✔ S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 3 provided, taking into account the dependence of the maximum charging and discharging power on the State of Charge (SoC) and considering constraints on the number of charging, discharging and shutdown cycles, needed to extend the useful life of the battery. Regarding DG generators, ramp-up and ramp-down constraints have been included in the EMS formulation, along with maximum and minimum operating regimes, to mimic the real behaviour of the device. A graphical representation of the EMS operation is depicted in Fig. 1. In order to strengthen the proposed EMS, its validation is carried out in the Microgrid Living-Lab installed at the CATEPS building of the Higher Polytechnic School of the University of Seville, equipped with all the aforementioned technologies. The technical characteristics of the facility (MG network and the assets deployed) are extensively commented, with the objective of facilitate their use by other researchers. Results are here presented and deeply commented, showing the operations of the MG in different seasons. Additionally, a detailed focus is provided on reactive power and voltage management. An empirical validation of the power flow equations linearization is also conducted, comparing the results obtained under both the linearized and nonlinearized formulations. Finally, the effect of the minimum number of ON/OFF charging and discharging cycles and the dependence of power with the SoC in the BESS model is also evaluated. The main contributions of the present paper are represented by: •Inclusion of dedicated models for power electronics, which consider capability curves and power factor limitations, allowing the assessment of reactive power management. •Comprehensive approach to manage dispatchable units, whereby minimum ON/OFF periods are considered in order to avoid the occurrence of multiple startups and shutdowns in short periods of time. •Application of multi-busbar model of the MG, together linearized power flow equations. Validation of the equations through comparison of the results with the complete non-linear power flow equations. •Detailed modelling of BESS, considering technical characteristics as the relation between maximum power in charging/discharging phases and SoC. Including a sensitivity analysis on the limitation on the startup/shutdown cycles limitation. •Comprehensive approach to manage DG units, taking into account the technical constraints inherent to such systems, considering its operating conditions, including ramp-up/ramp-down rates, minimum operating regime, and the number of ON/OFF cycles. •Application of the EMS to a real test-case, considering the characteristics of actual facilities and avoiding the use of synthetic usecases. The paper is organized as follows: Section 2 details the mathematical formulation of the EMS, Section 3 describes the CATEPS Microgrid Living-Lab, employed as test case, Section 4 presents and discusses the results, while Section 5 is dedicated to conclusions and also provides some possible further developments of the study. 2. EMS mathematical formulation In this section, the mathematical model of the EMS is described. The model is built as a MILP optimization problem, taking advantage of its simplicity and the extensive support and maturity of the solvers that are available compared with other kinds of convex formulations. The objective of the EMS is to minimize the operational cost of the MG while considering the technical constraints of it, maintaining the MG between feasible operational limits. The inputs of the model are the forecasted power production of all the RES units, the SoC of the BESS at the beginning of the optimization cycle, the forecasted consumption of MG, the technical performance parameters of all the energy sources of the MG (power ratings, ramp-up/down profiles, network admittance matrix, etc.) and, of course, the parameters related to costs. The outputs of the model are the power profiles (both active and reactive) of all dispatchable units and the voltage phasors and powers at all the nodes of the MG. Unless otherwise specified, all electrical units presented in this paper are expressed in the per-unit (p.u.) system, with SB and VB representing the base power and base voltage, respectively. A positive value in a power variable indicates the injection of power into the node, while a negative power value indicates the absorption of power. The formulation is presented in a generic form and can be applied to any MG. The Fig. 1. Graphical representation of the EMS operation. S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 4 time horizon is represented by T, with time being discretized into N time steps. The time interval between steps is denoted by Δt (Δt=T/N). In general, variables have two superscripts: the first indicates the asset to which it refers (e.g., PV, BESS, DG, etc.) while the second describes some characteristic of the variable. In the case of a general formulation applicable to multiple assets, the superscript symbol X is employed. Subscripts serve to indicate the index of the generating unit and the time index. 2.1. Power electronics unit model In this subsection, the constraints related to the assets connected to the MG by means of power electronics units (e.g. inverters, rectifiers, and power converters) are presented. First, these assets must meet the power rating technical limits of the power electronics (1) : (SX,max i)2≥ (PX i,t)2+ (QX i,t)2(1) where PX i,t and QX i,t are the active and reactive powers of the i th asset of technology X at time t and SX,max i the maximum apparent power that can be delivered by the power electronics. Inequality (1) is a quadratic expression, but it can be linearized considering that the constraint just defines that the hypotenuse (conformed by a right triangle whose catheti are P and Q) must be equal or lower than the apparent power of the inverter. This is the same as considering that the apparent power delivered by the inverter must be within a circle of radius the maximum rating of it. Therefore, constraint (1) can be linearized by considering a set of NPW linear constraints with the form of (2). As NPW increases, the set of constraints (2) becomes closer to the non-linear capability curve (1). Thus, the higher NPW parameter the better. SX,max i≥PX i,tcos(2 π n/NPW)+QX i,tsin(2 π n/NPW),∀n∈[1,NPW](2) Second, power electronics units can operate only within certain power factor limits. Considering that active power could be positive or negative, as could be the case of units that include a rectifier (e.g., the rectifier of a BESS), constraint (3) must hold to maintain the power factor between feasible limits in the four-quadrants: −tan(ϕX,PF i)PX i,t≤QX i,t≤tan(ϕX,PF i)PX i,t(3) where ϕX,PF i is obtained as ϕX,PF i=arccos(PFX i), being PFX i the minimum power factor at which the unit can operate. Of course, the absolute value function is non-linear. Appendix A. shows the MILP implementation of this function. If the unit can only inject energy into the grid, as is the case of PV units, the absolute value function it is not needed in constraint (3). Lastly, it is necessary to consider that some units could deliver a maximum active power value (PX,max i,t)lower than the nominal apparent power. Thus, it is necessary to impose (4) to consider this possibility. If the unit cannot absorb power (e.g., a PV inverter), the value on the lefthand side of (4) will be substituted by zero. −PX,max i≤PX i,t≤PX,max i(4) In contrast to other models used in the literature, the model presented in this subsection ensures that the power electronics operates only within its capability curve, thereby preventing both out-of-range operating zones and overload conditions. 2.2. Dispatchable units ON/OFF limitations In this subsection, a set of constraints to stablish minimum ON/OFF periods for dispatchable units (e.g., BESS or DGs) are presented. This set of constraints can be applied to all kinds of dispatchable units available in MGs. However, they only cover the case of dispatchable units with PX i,t≥0 (i.e., they are not bidirectional). Adaptation in the case of bidirectional dispatchable units such as BESS is discussed in its own subsection. In this sense, to avoid that dispatchable units are turned ON/OFF multiple times in short periods of time, constraint (5) is introduced to maintain the i th unit of technology X ON for at least NX,on timesteps: aX,tron i,t≤(1/NX,on)∑t+NX,on−1 k=taX,on i,k(5) where aX,on i,t is a binary variable indicating that the unit is ON at time step t and aX,tron i,t is a binary variable indicating that the unit has been turned ON at time step t. The value of NX,on is obtained as NX,on = ⌈TX,on/Δt⌉, where ⌈x⌉ denotes the ceiling function of x and TX,on is the minimum time that the unit must be ON. Similarly, if one wants to impose that the unit must be maintained OFF for a certain time after it has been turned OFF, constraint (6) could also be included in the model of the dispatchable unit. In this case, aX,troff i,t is a binary variable denoting that the i th unit has been turned OFF at time t and NX,off represents the number of time steps that the unit must remain OFF. aX,troff i,t≤1−(1/NX,off )∑t+NX,off −1 k=taX,on i,k(6) To obtain the binary variable aX,on i,t indicating whether the unit is ON or OFF, classical big-M constraints in (7) and (8) are imposed: PX i,t≥∊−M(1−aX,on i,t)(7) PX i,t≤MaX,on i,t(8) where M is a big positive number and ∊ a small positive tolerance to simulate a >inequality. In addition, constraints (9) and (10) are included in the unit model to obtain the binary variables that indicate when the unit has been turned ON or OFF: aX,tron i,t−aX,troff i,t=aX,on i,t−aX,on i,t−1(9) aX,tron i,t+aX,troff i,t≤1 (10) 2.3. Renewable energy source units The active power generation profiles of the RES units (e.g., PVs or WTs) are inputs for the model (obtained through forecasting techniques). However, in the case of reactive power, RES units can adapt the injection/absorption to the grid by means of the power inverters. Thus QX i,t of RES units is a decision variable. Of course, this is possible if the inverter rating constraints are met. Therefore, it is possible to use the RES inverter as a reactive energy dispatchable unit including a set of constraints as (2) and (3) in the model. 2.4. Battery energy storage system In this subsection, the model for the BESS units is introduced. First, since the BESS is connected by means of an inverter/rectifier to the electric network, a set of constraints (2) to (4) are included. In addition, as a dispatchable asset, a set of constraints described in subsection 2.2 must be included to control the ON/OFF cycles of the unit. However, as stated before, these constraints only consider the case of dispatchable units that only inject active power into the grid (e.g., DGs or CHPs). Thus, if the unit is a battery that can discharge (inject) or charge (absorb), these constraints only cover the discharging case. Therefore, it is necessary to add another set of constraints (5)-(6) and (9)-(10) to model the charging case. The superscript on in the binary variables must be replaced by ch and dis in each of the two sets of constraints to S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 5 distinguish the charging and discharging variables. Moreover, different number of minimum charging (NBESS,on,ch,NBESS,off,ch) and discharging cycles (NBESS,on,dis,NBESS,off,dis) could be defined. In addition to these, constraints (11) and (12) must be included to obtain the aBESS,ch i,t binary variable, which indicates whether the unit is in a charging state. Of course, constraint (13) must hold between ch and dis variables. If both variables are zero, the unit is OFF. Thus, the binary variable aBESS,on i,t that indicates if the unit is ON or OFF is obtained with the equality (14). −PBESS i,t≥∊−M(1−aBESS,ch i,t)(11) −PBESS i,t≤MaBESS,ch i,t(12) aBESS,dis i,t+aBESS,ch i,t≤1 (13) aBESS,dis i,t+aBESS,ch i,t=aBESS,on i,t(14) The energy model of the BESS is presented in (15): WBESS i,t+1=WBESS i,t−Δt(PBESS i,t(aBESS,ch i,t η ch i+aBESS,dis i,t(1/ η dis i))+WBESS i,t τ BESS,sd i)(15) where WBESS i,t is the energy stored by the i th unit at time t, η ch i and η dis i are the efficiency while charging and discharging, respectively; and τ BESS,sd i is the self-discharge loss expressed as the per unit loss of stored energy per hour. As can be noticed, (15) is a non-linear function due to the product of continuous variable PBESS i,t with binary variables aBESS,ch i,t and aBESS,dis i,t to model the selection of charging/discharging efficiencies. These nonlinear terms can be linearized by substituting them by two auxiliary continuous variables gBESS,dis i,t≜aBESS,dis i,tPBESS i,t and gBESS,ch i,t≜aBESS,ch i,tPBESS i,t, obtained as described in Appendix B. With this substitution, (16) is the linear equivalent of (15). WBESS i,t+1=WBESS i,t−Δt(gBESS,ch i,t η ch i+gBESS,dis i,t(1/ η dis i)+WBESS i,t τ BESS,sd i)(16) Constraints (17) and (18) are included to limit the maximum and minimum state of charge the battery can reach: WBESS i,t≤WBESS,cap iSoCBESS,max i(17) WBESS i,t≥WBESS,cap iSoCBESS,min i(18) where SoCBESS,max i and SoCBESS,min i are the maximum and minimum SoC the battery can reach and WBESS,cap i is the rated capacity of the battery. The minimum power at which the BESS must operate, both in charging and discharging mode, can be defined with constraints (19) and (20). Of course, if wanted, different minimum values could be established for the charging and discharging cases. PBESS i,t≥ − PBESS,min iaBESS,ch i,t(19) PBESS i,t≤PBESS,min iaBESS,dis i,t(20) In addition, the relationship between the SoC and the maximum power at which the battery can be charged/discharged must be considered. Typically, when charging from a low SoC, the maximum rated power can be delivered to the battery. However, when a certain SoC is reached while charging, the maximum power accepted by the BESS starts to decrease until it reaches its full capacity. Similarly, when discharging from a high SoC, the maximum rated power can be extracted from the battery. However, when a certain SoC is reached while discharging, the maximum power that can be extracted from the BESS starts to decrease until it reaches its minimum capacity. This behavior can be modeled by defining two additional linear constraints linking the SoC with the power exchanged by the BESS. Specifically, inequality (21) models the charging scenario while (22) models the discharging one. In these constraints, mBESS,ch i and mBESS,dis i are two constants obtained from equations (23) and (24), where Lch i and Ldis i are the SoC limits at which injected/absorbed power starts to decrease. This formulation differs from others in the literature in that it avoids the use of piecewise functions, which considers conditional formulation, introducing multiple binary variables. In this sense, this formulation just introduces two linear inequalities into the problem, reducing computational effort. PBESS i,t≥mBESS,ch i(SoCBESS i,t−1)(21) PBESS i,t≤mBESS,dis iSoCBESS i,t(22) mBESS,ch i=PBESS,max i/(1−Lch i)(23) mBESS,dis i=PBESS,max i/Ldis i(24) As a summary of the BESS operation, Fig. 2 shows graphically the feasible operational range defined by the constraints presented in this subsection. 2.5. Diesel generators As a dispatchable unit, the model of the DG must complain with the restrictions imposed in subsection 2.2 to limit the ON/OFF cycles. Thus, a set of constraints like the ones from (5) to (10) are included for each DG unit. In addition to the minimum ON/OFF time limitations, due to the nature of DGs, constraints (25) and (26) are included to limit the rampup (PDG,RU i) and ramp-down (PDG,RD i) rates respectively. The two aforementioned parameters are given in W/h in the datasheets (subsequently transformed into the per-unit system as all the variables in the EMS formulation). PDG i,t−PDG i,t−1≤ΔtPDG,RU i(25) PDG i,t−1−PDG i,t≤ΔtPDG,RD i(26) Moreover, DGs usually have a minimum power operating regime. To reach this operating regime, they need a certain period of time in the startup. In a similar way, they may need a certain time to shut down. Thus, to consider this possibility, constraint (27) is used to establish a minimum power in the stationary operating regime. ⎛ ⎝aDG i,t−∑ t k=t−NDG,tron −1 aDG,tron i,k−∑ t+NDG,troff −1 k=t aDG,troff i,k⎞ ⎠PDG,min i≤PDG i,t≤PDG,max (27) The left-hand side of the inequality establishes a minimum power injection in the stationary regime. The minimum power injection is deactivated when the unit is OFF or when the unit is in the startup/ shutdown periods. Specifically, the minimum power injection is deactivated for NDG,tron and NDG,troff timesteps for the startup and shutdown respectively. These variables are obtained as (28) and (29) respectively: NDG,tron =⌈PDG,min i/(ΔtPDG,RU i)⌉ (28) NDG,troff =⌈PDG,min i/(ΔtPDG,RD i)⌉ (29) where ⌈x⌉ denotes the ceiling function of x. It is worth mentioning that (27) implicitly imposes that NDG,on ≥NDG,tron +NDG,troff must be satisfied for the unit to operate. Fig. 3 shows graphically the interpretation of the variables described in this subsection. S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 6 Finally, the production cost of the i th DG unit at time t (CDG i,t) is presented in (30): CDG i,t=cfuelSBΔt(aDG i,t ρ iPDG,n i+ σ iPDG i,t)(30) where cfuel is the fuel cost (in € /L), ρ i and σ i are the fuel intercept and the fuel slope obtained from the datasheet of the DG (both units in L/kWh) [40,41], PDG,n i is the nominal power of the unit and SB is the base power used in the per-unit operations. 2.6. Electric network model The simplest way to model the electric network of a MG is to use a single bus representation, in which all assets are connected to the same electrical point. As evidenced in the introduction, this is the most common approach observed in the literature. Despite the simplicity of this modeling approach, which merely introduces two constraints to ensure the balance of active and reactive powers, it fails to consider the link between power flows (active and reactive) and nodal voltages. Additionally, it disregards the technical constraints associated with electrical variables, such as voltage limits. To address this limitation, the proposed EMS incorporates the power flow equations into the formulation. However, power flow equations are non-linear. Thus, in this subsection, a linearized version of the power flow equations is presented. Considering a MG with Nn nodes (or buses), the complex power phasor Si,t at node i and time t is given by (31): Si,t=Vi,tIi,t *=Vi,t∑Nn−1 k=0Yik *Vk,t *(31) where Vi,t and Ii,t are the voltage and injected current phasors at node i, while Yik denotes the i,k element of the network admittance matrix. It should be noted that * represent the complex-conjugate. As usual in power flow notation, the power at nodes i=0,⋯,(Nn−1)is composed by the sum of the net injected powers of the elements connected to that node. Node 0 is designated as the slack of the network (reference bus), with V0,t=1∠0 (p.u.). In this sense, the Point of Common Coupling (PCC) of the MG with the distribution network will be considered the slack node. As stated, (31) is non-linear. A possible linearization of it is to obtain the first order Taylor expansion centered at operational point V= 1∠0p.u.. The result of this linearization is shown in (32). Si,t≈∑Nn−1 k=0Yik *+(∑Nn−1 k=0Yik *)(Vi,t−1∠0)+∑Nn−1 k=0(Yik *(Vk,t−1∠0)) (32) In low-voltage networks, shunt admittances are insignificant and can be neglected. Thus, the sum of elements at columns (and rows) in the admittance matrix is zero, simplifying (32) to (33). Si,t=∑Nn−1 k=0Yik *(Vk,t *−1∠0)(33) Equation (33) can be rewritten in rectangular form as (34) considering that if the per unit system is adopted and operate in radians, Vi,t=Vi,t∠δi,t can be approximated as Vi,t≈Vi,t+jδi,t, being Vi,t and δi,t the voltage magnitude and phase angle at node i and time t. In this context, j is the imaginary unit. This is a valid approximation when voltage magnitude values are not too far from the base value and phase angle differences across lines are not large, as is the case of small size electrical networks as MGs (Re(Vi,t)=Vi,tcos(δi,t)≈Vi,t and Im(Vi,t)= Vi,tsin(δi,t)≈δi,t). Splitting the real and imaginary parts in (34) and setting ΔVk,t= Vk,t−1, equations (35) and (36) are the linearized power flow equations for the active and reactive powers at node i and time t. Where Gik and Bik are the conductance and susceptance of the branch between nodes i and k, respectively. Consequently, a set of Nn constraints for each time interval in the form of (35) and (36) are included in the model to consider the electrical network of the MG. A validation of the linearization of the power flow equations will be presented in the results section. Fig. 2. Feasible operational regions of the BESS. Fig. 3. DG startup and shutdown variables. S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 7 Pi,t+jQi,t=∑Nn−1 k=0(Gik −jBik)(Vk,t−1)−∑Nn−1 k=0(Gik −jBik)jδk,t(34) Pi,t=∑Nn−1 k=0(GikΔVk,t−Bikδk,t)(35) Qi,t= − ∑Nn−1 k=0(Gikδk,t+BikΔVk,t)(36) Introducing the network model into the optimization process allows to include suitable voltage and phase angle bounds to ensure the proper operation of the MG (37)-(38). Vmin ≤Vi,t≤Vmax (37) δmin ≤δi,t≤δmax (38) Finally, the cost of both active and reactive power absorbed/delivered from/to the distribution network (i.e., at node 0) at time t is presented in equation (39): Cgrid t=SBΔt(P0,t(cP,buy t(1−aP 0,t)+cP,sell taP 0,t)+Q0,t(cQ,buy t(1−aQ 0,t) −cQ,sell taQ 0,t)) (39) where cP,buy t and cP,sell t are the cost and revenue of active power energy at time t respectively while cQ,buy t and cQ,sell t are the penalties for reactive power absorption and injection respectively. The binary variables aX 0,t are employed to indicate whether active power (superscript P) or reactive power (superscript Q) is flowing into (aX 0,t=1) or from (aX 0,t=0) the distribution network. These variables are obtained using constraints as (7) and (8). As always, SB is the base power used in the per-unit operations. As can be noticed, (39) is non-linear due to the multiplication of the binary variables aX 0,t with the active and reactive power continuous decision variables to model the selection of buying or selling costs. As happened in the battery model, the product of binary with a continuous variable can be linearized by defining an auxiliary variable obtained as explained in Appendix B. Thus, obtaining two auxiliary variables gP 0,t≜ aP 0,tP0,t and gQ 0,t≜aQ 0,tQ0,t, equation (39) can be rewritten in a linear form as (40): Cgrid t=SBΔt(cP,buy t(P0,t−gP 0,t)+cP,sell tgP 0,t+cQ,buy t(Q0,t−gQ 0,t)−cQ,sell tgQ 0,t)(40) 2.7. Objective function The objective of the model is to minimize the operational costs of the MG. In other words, the objective is to find the solution that reduces the total price paid for energy subject to the constraints of the device models described in this section. In this sense, two primary sources of economic expenses are present in the MG model: the cost of the energy exchanged with external grid and the cost of the fuel for the DGs. Thus, the objective function can be described as follows: min∑N−1 t=0(Cgrid t+∑NDG−1 i=0CDG i,t)(41) where Cgrid t and CDG i,t are the cost of the electrical energy exchanged with the distribution network (eq. (40)) and the cost of the fuel for the i th DG (eq. (30)), respectively. N and NDG denote the number of timesteps for the optimization horizon (N=T/Δt) and the number of DG units in the MG, respectively. 3. Use case: CATEPS Microgrid Living-Lab The experimental validation of the proposed EMS has been carried out in the Microgrid Living-Lab deployed at the CATEPS building of the Higher Polytechnic School of the University of Seville. This recently constructed building houses the laboratories, administrative areas and offices of the Polytechnic School. The CATEPS building is shown in Fig. 4. The building is composed of three distinct sections: an open-plan laboratory area, an administrative zone, and the offices and research laboratories. The open-plan laboratory is located on the west side, whereas the administrative area is located on the east side. Both areas are two independent three-floor subbuildings, separated by a patio. On top of these two structures, four three-floor sub-buildings are situated transversally, housing offices and research laboratories (see Fig. 4). The Microgrid Living-Lab is a Smart Grid testbed integrated into the building’s three-phase low-voltage network, which is connected to the medium voltage distribution network through its own secondary distribution substation. The microgrid was fully operational at the beginning of 2023. The Microgrid Living-Lab network can be modeled as a radial grid with twelve busbars. Fig. 5 shows the single-line model of the MG. In this circuit model, the total energy consumption of the six previously described areas of the building is represented as six single aggregated loads connected each one to its corresponding node. In this sense, the load at N1 comprises the consumption of the open-plan laboratory, the load at N2 the consumption of the administrative area and the loads at N4 to N7 the consumption of each of the four transversal sub-buildings respectively. The consumption at these nodes comprises a considerable number of individual loads, some of them three-phase and others single phase. The latter are distributed equally in all phases in accordance with Spanish regulations [42]. Consequently, the aggregate load at the aforementioned nodes is predominantly balanced when all these loads are combined. The assets deployed in the CATEPS Microgrid Living-Lab are depicted in Fig. 6. The list of the elements and the technical specifications of them are provided below: •A total of four PV fields, each comprising 28 PV panels arranged in two strings. The panels are monocrystalline of Passivated Emitter and Rear Cell (PERC) technology, each one with a rated power of 650Wp. Each PV field has a three-phase inverter with a rated power of 15kVA. The four PV fields are of equal specifications and are installed in the same mounting position and with the same azimuth angle. •A BESS composed of six 48Vdc Lithium Iron Phosphate (LiFePO4) battery packs connected in parallel. Each battery pack has a nominal capacity of 280Ah. The BESS is equipped with six single-phase inverters/rectifiers, which are connected in two groups of three and synchronized to form a three-phase system. Each inverter/rectifier has a rated power of 10kVA. Fig. 4. CATEPS building. The Microgrid Living-Lab is deployed in this building. S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 8 •Two H-Type Darreus vertical WTs, each with a rated power of 3kWp. Both WTs are managed by the same inverter with a rated power of 5kVA. •One DG with both on-grid and backup capabilities. The DG is constructed with a four-stroke V16 diesel engine and an 800kVA threephase generator. •A control room equipped with a SCADA system for monitoring plant operations and data collection. 3.1. Input parameters and test scenarios In this subsection, the input parameters for the EMS are described. The EMS operates with a time horizon of T=24 h with aΔt =15 min timestep, resulting in 96 timesteps per optimization horizon. The active power production of the RESs and the load consumption (both active and reactive) are provided by deterministic machine learning forecasting techniques [43]. It should be noted that, although a fixed optimization horizon without overlapping has been selected to obtain the results, there is no inherent limitation in the formulation to be implemented in a rolling-horizon approach, thereby reducing possible impacts of stochasticity in renewable energy sources (RES). As mentioned above, the grid is modeled as a twelve-bus bar network as shown in Fig. 5. The characteristics of each branch are reported in Table 2. The bus bar N0 is considered the slack of the network (V0 =1p. u., δ0=0 rad). The voltage and power bases for the per unit operations are 400 V and 30kVA respectively (nominal line voltage of the grid and maximum power of the BESS respectively). The voltage limits (Vmin, Vmax) have been set to be between 0.95 and 1.05p.u. while the voltage phase limits (δmin,δmax) have been set to be between −0.1 and 0.1 rad. PV fields at nodes N8 to N11 have a maximum power rating of SPV,max i =15kVA and PPV,max i =15 kW. The minimum power factor at which PV inverters can operate is PFPV i =0.85 (both inductive and capacitive). The WT inverter has a maximum power rating of SWT,max 1 = 5kVA and PWT,max 1 =5 kW. The WT inverter can operate at a minimum power factor of PFPV i =0.8 (both inductive and capacitive). In both RES units, reactive power QX i,t is a decision variable subject to constraints (2)- (3). The BESS at node N3 has a rated capacity of WBESS,cap =80.64kWh. Fig. 5. CATEPS Microgrid Living-Lab network model. Fig. 6. Assets deployed at the CATEPS Microgrid Living-Lab. Table 2 Characteristics of each of the branches of the microgrid. Branch Cable Type Length (m) N0-N1 RZ1-K(AS) 4x(3x150mm) 36 N1-N2 RZ1-K(AS) 4x(3x150mm) 5 N2-N3 RZ1-K(AS) 4x50mm 21 N2-N4 RZ1-K(AS) 4x70mm 34 N2-N5 RZ1-K(AS) 4x(2x95mm) 31 N2-N6 RZ1-K(AS) 4x70mm 57 N2-N7 RZ1-K(AS) 4x150mm 60 N4-N8 RZ1-K(AS) 4x10mm 54 N5-N9 RZ1-K(AS) 4x10mm 77 N6-N10 RZ1-K(AS) 4x6mm 57 N7-N11 RZ1-K(AS) 4x6mm 57 S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 9 in the battery is close to the minimum level (SoCBESS,min i), the maximum power that could provide the BESS would be limited by the remaining energy stored, the time interval Δt and the efficiency of the power electronics. For the discharging case, this implicit constraint can be expressed by the inequality (43). The function of the gray dotted line in Fig. 15 can now be elucidated: it corresponds to this implicit constraint. In a similar way, inequality (44) represents the implicit constraint for the charging case. In contrast to the discharge case, this constraint has a minimal effect in the case shown in Fig. 15 (gray dotted line in the discharge area). This is because the maximum allowed SoC is closer to 100 % than the minimum allowed SoC is from 0 %. PBESS i,t≤ η dis i(SoCBESS i,t−SoCBESS,min i)WBESS,cap i Δt(43) PBESS i,t≥(SoCBESS i,t−SoCBESS,max i)WBESS,cap i η ch iΔt(44) As a conclusion for this subsection, the correct operation of the constraints that have been included into the EMS to link the state of charge (SoC) to the maximum power that can be exchanged by the BESS has been validated. However, depending on the SoC limits, constraints (43)-(44) may be more restrictive. 5. Conclusions The increasing presence of DERs requires the implementation of an effective management strategy. MGs offer an effective solution for the integration of RESs, BESS units, CCHP units, DG units, etc. in the distribution network. This paper contributes with a comprehensive EMS for the optimal operation of generic grid-tied MGs, with the objective of reducing the operational costs. The proposed EMS considers several key aspects, including active and reactive power management, the application of power flow equations, the use of specific models for power electronics units and dispatchable units, and the integration of detailed device models for BESSs and DGs. In order to reduce the computational requirements while ensuring the existence of an optimal solution that represents the global minimum, the EMS is formulated as a MILP optimization problem. Consequently, all the constraints have been linearized. The main functionalities of the proposed EMS have been assessed in a use case that involves a representative facility: the CATEPS Microgrid Living-Lab. The EMS operation of the MG was evaluated in different seasons which showed a significant cost reduction in the MG operation when using the proposed EMS, especially in the summer (21.84 %) and spring (14.84 %) scenarios. Furthermore, the operation of the DG in the proposed scenarios was examined. The findings indicated that, given the size of the DG and the current load of the building in question, its operation becomes economically viable only when electricity prices reach elevated levels. A detailed focus was given to reactive power and voltage management, showing the capacity of RES to compensate for reactive power, ensuring the operational limits of the inverters. Furthermore, to validate the linearization of the power flow equations, a comparison was conducted between the proposed power flow equations and the complete non-linear ones. In this sense, the voltage results (magnitude and angle) obtained by the proposed EMS were then contrasted with those yielded by a power flow solver employing the complete non-linear equations. The MAE metric demonstrated minimal discrepancies between the linear and non-linear equations: 8.8e-5 p.u. and 3.2e-5 rad for voltage magnitude and phase angle respectively; thereby proving the effectiveness of the proposed approach. The dispatchable units ON/OFF model constraints were assessed using the BESS as a case study, which demonstrated the ability of the proposed model to modulate the startup and shutdown periods of the device. The results indicated that the ON/OFF parameters had an imperceptible impact on the operating costs and on the total energy exchanged by the BESS. This finding suggests that the technical limitations of the device can be addressed while maintaining a minimal impact on the operational cost. For instance, the total number of startups in a typical winter week was reduced from 37 to 24 while the difference in operational costs just increased by 0.22 € , with the total energy exchanged by the BESS remaining almost constant in both scenarios (from 1657.17kWh to 1656.57kWh). Furthermore, the dependence Fig. 15. Active power exchanged by the BESS as function of the SoC. The gray lines represent the operational limits defined in the BESS model. S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 16 between the maximum charging and discharging power on the SoC was also evaluated. The results validated the linear model introduced to implement this relationship. Moreover, the results showed that the inherent relationship between the available energy in the BESS and the maximum power may be more restrictive, depending on the maximum and minimum SoC and on the delta time adopted in the optimization process. Future research will address the impact of the forecast accuracy due to the inherent stochasticity of RESs. This will involve exploring potential solutions to mitigate this aspect using probabilistic forecasting techniques and a rolling horizon optimization approach, with the aim of dynamically updating the EMS execution. The proposed EMS is intended for a tertiary control of grid-connected MGs, future research will also address the inclusion of secondary and primary control (p-f and v-q control) to support the operation of the CATEPS MG in islanded mode as well as the integration of the proposed EMS into the SCADA system. CRediT authorship contribution statement Sebasti´ an García: Writing – original draft, Software, Methodology, Investigation, Formal analysis, Data curation, Conceptualization. Stefano Bracco: Writing – original draft, Validation, Investigation. Antonio Parejo: Writing – review & editing, Visualization, Validation. Matteo Fresia: Writing – original draft, Validation, Investigation. Juan Ignacio Guerrero: Writing – review & editing, Resources, Project administration, Data curation. Carlos Le´ on: Writing – review & editing, Supervision, Project administration, Funding acquisition. Declaration of competing interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Acknowledgements The publication is part of the project TED2021-129702B-I00, funded by MICIU/AEI/10.13039/501100011033 and the European Union “NextGenerationEU”/PRTR. Appendix A. . MILP formulation for obtaining absolute values Let be x a continuous variable in the range [ − C,C]with C being a constant value. The absolute value of x can be obtained imposing the following set of constraints: x≤aM (45) x≥ (a−1)M(46) x−y≤ (1−a)M(47) x−y≥ (a−1)M(48) x+y≤aM (49) x+y≤aM (50) where a is a binary variable, M a big positive number (M≥2C) and y a positive continuous variable. Constraints (45) and (46) are used to set a=1 if x is positive and a=0 if negative. Constraints (47) and (48) are used to impose y=x when x is positive while constraints (49) and (50) are used to impose y= − x when x is negative. Therefore, imposing constraints (45)-(50) is the same that y= |x|. Appendix B. . MILP formulation to linearize the product of a binary and a continuous variable Let x be a continuous variable x∈ [ − C,C]with C being a constant value. Let be a a binary variable. The non-linear product of x and a can be linearized replacing it by a continuous auxiliary variable g≜ax if the following set of constraints are imposed: g≥ − Ma (51) g≤Ma (52) g≤x+M(1−a)(53) g≥x−M(1−a)(54) where M is a big positive number (M≥C). Constraints (51) and (52) sets g=0 if a=0 while (53) and (54) imposes g=x if a=1. Data availability The data that has been used is confidential. References [1] Filipovi´ c S, Lior N, Radovanovi´ c M. The green deal – just transition and sustainable development goals Nexus. Renew Sustain Energy Rev 2022;168:112759. https:// doi.org/10.1016/j.rser.2022.112759. [2] Kougias I, Taylor N, Kakoulaki G, J¨ ager-Waldau A. The role of photovoltaics for the European Green Deal and the recovery plan. Renew Sustain Energy Rev 2021;144: 111017. https://doi.org/10.1016/j.rser.2021.111017. [3] Gonz´ alez-Torres M, P´ erez-Lombard L, Coronel JF, Maestre IR, Yan D. A review on buildings energy information: Trends, end-uses, fuels and drivers. Energy Rep 2022;8:626–37. https://doi.org/10.1016/j.egyr.2021.11.280. [4] Chen J, Liu M, O’Donnell T. Replacement of Synchronous Generator by Virtual Synchronous Generator in the Conventional Power System. IEEE Power & Energy Society General Meeting (PESGM) 2019;2019:1–5. https://doi.org/10.1109/ PESGM40551.2019.8973650. [5] Ojo Y, Benmiloud M, Lestas I. Frequency and Voltage Control Schemes for ThreePhase Grid-Forming Inverters. IFAC-PapersOnLine 2020;53:13471–6. https://doi. org/10.1016/j.ifacol.2020.12.713. S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 17 [6] Jurasz J, Mikulik J, Krzywda M, Ciapała B, Janowski M. Integrating a windand solar-powered hybrid to the power system by coupling it with a hydroelectric power station with pumping installation. Energy 2018;144:549–63. https://doi. org/10.1016/j.energy.2017.12.011. [7] Al Essa MJM. Power management of grid-integrated energy storage batteries with intermittent renewables. J Storage Mater 2020;31:101762. https://doi.org/ 10.1016/j.est.2020.101762. [8] Brivio C, Mandelli S, Merlo M. Battery energy storage system for primary control reserve and energy arbitrage. Sustainable Energy Grids Networks 2016;6:152–65. https://doi.org/10.1016/j.segan.2016.03.004. [9] Azizipanah-Abarghooee R, Malekpour M, Karimi M, Terzija V. Integration of wind and solar energies with battery energy storage systems into 36-zone Great Britain power system for frequency regulation studies. Int J Electr Power Energy Syst 2024;156:109737. https://doi.org/10.1016/j.ijepes.2023.109737. [10] Alam MJE, Muttaqi KM, Sutanto D. Battery Energy Storage to Mitigate Rapid Voltage/Power Fluctuations in Power Grids Due to Fast Variations of Solar/Wind Outputs. IEEE Access 2021;9:12191–202. https://doi.org/10.1109/ ACCESS.2021.3051283. [11] Muhtadi A, Pandit D, Nguyen N, Mitra J. Distributed Energy Resources Based Microgrid: Review of Architecture, Control, and Reliability. IEEE Trans Ind Appl 2021;57:2223–35. https://doi.org/10.1109/TIA.2021.3065329. [12] Cao W, Xiao J-W, Cui S-C, Liu X-K. An efficient and economical storage and energy sharing model for multiple multi-energy microgrids. Energy 2022;244:123124. https://doi.org/10.1016/j.energy.2022.123124. [13] Khalafian F, Iliaee N, Diakina E, Parsa P, Alhaider MM, Masali MH, et al. Capabilities of compressed air energy storage in the economic design of renewable off-grid system to supply electricity and heat costumers and smart charging-based electric vehicles. J Storage Mater 2024;78:109888. https://doi.org/10.1016/j. est.2023.109888. [14] Majzoobi A, Khodaei A. Application of Microgrids in Supporting Distribution Grid Flexibility. IEEE Trans Power Syst 2017;32:3660–9. https://doi.org/10.1109/ TPWRS.2016.2635024. [15] Sawhney A, Delfino F, Bonvini B, Bracco S. EMS for Active and Reactive Power Management in a Polygeneration Microgrid Feeding a PED. Energies 2024;17:610. https://doi.org/10.3390/en17030610. [16] Pirouzi S, Zadehbagheri M, Behzadpoor S. Optimal placement of distributed generation and distributed automation in the distribution grid based on operation, reliability, and economic objective of distribution system operator. Electr Eng 2024. https://doi.org/10.1007/s00202-024-02458-w. [17] Zadehbagheri M, Dehghan M, Kiani M, Pirouzi S. Resiliency-constrained placement and sizing of virtual power plants in the distribution network considering extreme weather events. Electr Eng 2024. https://doi.org/10.1007/s00202-024-02583-6. [18] Fresia M, Bordo L, Delfino F, Bracco S. Optimal day-ahead active and reactive power management for microgrids with high penetration of renewables. Energy Convers Manage: X 2024;23:100598. https://doi.org/10.1016/j. ecmx.2024.100598. [19] Aguilar D, Quinones JJ, Pineda LR, Ostanek J, Castillo L. Optimal scheduling of renewable energy microgrids: A robust multi-objective approach with machine learning-based probabilistic forecasting. Appl Energy 2024;369:123548. https:// doi.org/10.1016/j.apenergy.2024.123548. [20] Tziolis G, Lopez-Lorente J, Baka M-I, Koumis A, Livera A, Theocharides S, et al. Direct short-term net load forecasting in renewable integrated microgrids using machine learning: A comparative assessment. Sustainable Energy Grids Networks 2024;37:101256. https://doi.org/10.1016/j.segan.2023.101256. [21] He H, Huang Y, Senjyu T. Microgrid load forecasting and optimization for future remote island electric vehicle mass penetration: The case of Okinawa Island. Energy Rep 2024;11:5532–41. https://doi.org/10.1016/j.egyr.2024.05.024. [22] Wu C, Jiang S, Gao S, Liu Y, Han H. Charging demand forecasting of electric vehicles considering uncertainties in a microgrid. Energy 2022;247:123475. https://doi.org/10.1016/j.energy.2022.123475. [23] Abbasi AR, Baleanu D. Recent developments of energy management strategies in microgrids: An updated and comprehensive review and classification. Energ Conver Manage 2023;297:117723. https://doi.org/10.1016/j. enconman.2023.117723. [24] Thirunavukkarasu GS, Seyedmahmoudian M, Jamei E, Horan B, Mekhilef S, Stojcevski A. Role of optimization techniques in microgrid energy management systems—A review. Energ Strat Rev 2022;43:100899. https://doi.org/10.1016/j. esr.2022.100899. [25] Sharma P, Dutt Mathur H, Mishra P, Bansal RC. A critical and comparative review of energy management strategies for microgrids. Appl Energy 2022;327:120028. https://doi.org/10.1016/j.apenergy.2022.120028. [26] Abdelsattar M, Ismeil MA, Aly MM, Abu-Elwfa SS. Energy Management of Microgrid With Renewable Energy Sources: A Case Study in Hurghada Egypt. IEEE Access 2024;12:19500–9. https://doi.org/10.1109/ACCESS.2024.3356556. [27] Bracco S, Fresia M. Energy Management System for the Optimal Operation of a Grid-Connected Building with Renewables and an Electric Delivery Vehicle. In: IEEE EUROCON 2023–20th International Conference on Smart Technologies; 2023. p. 472–7. https://doi.org/10.1109/EUROCON56442.2023.10198884. [28] Fresia M, Bracco S. Electric Vehicle Fleet Management for a Prosumer Building with Renewable Generation. Energies 2023;16:7213. https://doi.org/10.3390/ en16207213. [29] Zhao J, Wang W, Guo C. Hierarchical optimal configuration of multi-energy microgrids system considering energy management in electricity market environment. Int J Electr Power Energy Syst 2023;144:108572. https://doi.org/ 10.1016/j.ijepes.2022.108572. [30] ´ Alvarez-Arroyo C, Vergine S, de la Nieta AS, Alvarado-Barrios L, D’Amico G. Optimising microgrid energy management: Leveraging flexible storage systems and full integration of renewable energy sources. Renew Energy 2024;229:120701. https://doi.org/10.1016/j.renene.2024.120701. [31] Ereno˘ glu AK, S ¸eng¨ or ˙ I, Erdinç O, Tas ¸cıkarao˘ glu A, Catal˜ ao JPS. Optimal energy management system for microgrids considering energy storage, demand response and renewable power generation. Int J Electr Power Energy Syst 2022;136:107714. https://doi.org/10.1016/j.ijepes.2021.107714. [32] Pirouzi S. Network-constrained unit commitment-based virtual power plant model in the day-ahead market according to energy management strategy. IET Gener Transm Distrib 2023;17:4958–74. https://doi.org/10.1049/gtd2.13008. [33] Sabzalian MH, Pirouzi S, Aredes M, Wanderley Franca B, Carolina CA. Two-Layer Coordinated Energy Management Method in the Smart Distribution Network including Multi-Microgrid Based on the Hybrid Flexible and Securable Operation Strategy. Int Trans Electr Energy Syst 2022;2022:3378538. https://doi.org/ 10.1155/2022/3378538. [34] Nusair K, Alasali F. Optimal Power Flow Management System for a Power Network with Stochastic Renewable Energy Resources Using Golden Ratio Optimization Method. Energies 2020;13:3671. https://doi.org/10.3390/en13143671. [35] Wu N, Xu J, Linghu J, Huang J. Real-time optimal control and dispatching strategy of multi-microgrid energy based on storage collaborative. Int J Electr Power Energy Syst 2024;160:110063. https://doi.org/10.1016/j.ijepes.2024.110063. [36] Akbari E, Faraji Naghibi A, Veisi M, Shahparnia A, Pirouzi S. Multi-objective economic operation of smart distribution network with renewable-flexible virtual power plants considering voltage security index. Sci Rep 2024;14:19136. https:// doi.org/10.1038/s41598-024-70095-1. [37] Liang H, Pirouzi S. Energy management system based on economic Flexi-reliable operation for the smart distribution network including integrated energy system of hydrogen storage and renewable sources. Energy 2024;293:130745. https://doi. org/10.1016/j.energy.2024.130745. [38] Giraldo JS, Castrillon JA, L´ opez JC, Rider MJ, Castro CA. Microgrids Energy Management Using Robust Convex Programming. IEEE Trans Smart Grid 2019;10: 4520–30. https://doi.org/10.1109/TSG.2018.2863049. [39] Vergara PP, L´ opez JC, Rider MJ, da Silva LCP. Optimal Operation of Unbalanced Three-Phase Islanded Droop-Based Microgrids. IEEE Trans Smart Grid 2019;10: 928–40. https://doi.org/10.1109/TSG.2017.2756021. [40] Askarzadeh A. Distribution generation by photovoltaic and diesel generator systems: Energy management and size optimization by a new approach for a standalone application. Energy 2017;122:542–51. https://doi.org/10.1016/j. energy.2017.01.105. [41] Kiptoo MK, Lotfy ME, Adewuyi OB, Conteh A, Howlader AM, Senjyu T. Integrated approach for optimal techno-economic planning for high renewable energy-based isolated microgrid considering cost of energy storage and demand response strategies. Energ Conver Manage 2020;215:112917. https://doi.org/10.1016/j. enconman.2020.112917. [42] Real Decreto 842/2002, de 2 de agosto, BOE-A-2002-18099, por el que se aprueba el Reglamento electrot´ ecnico para baja tensi´ on. n.d. [43] Parejo A, Bracco S, Personal E, Larios DF, Delfino F, Le´ on C. Short-Term Power Forecasting Framework for Microgrids Using Combined Baseline and Regression Models. Appl Sci 2021;11:6420. https://doi.org/10.3390/app11146420. [44] Pe˜ nate Vera S. GridCal 2024. https://github.com/SanPen/GridCal (accessed July 4, 2024). [45] Grainger J, Stevenson WD. Power System Analysis. McGraw-Hill. Education 1994. S. García et al. International Journal of Electrical Power and Energy Systems 165 (2025) 110458 18