# Optimal Sizing of Battery Energy Storage System for Implicit Flexibility in Multi-Energy Microgrids
## 1 Introduction
### Contribution and Novelty  
The literature review clearly shows that the economic potential of MESs to provide _explicit flexibility_--defined as the request from system operators to vary the scheduled power exchange through ancillary services or DR programs--has been extensively investigated. Likewise, the _implicit flexibility_ of MESs, defined as the ability to optimize internal operations to reduce electricity bill costs mainly through energy arbitrage and peak shaving, has also been examined. However, to the best of the authors' knowledge, no existing study has specifically assessed the economic value of implicit flexibility in an MES and how this value may vary under different system designs or operational strategies. While some studies (e.g., [24; 25; 26]) have addressed similar questions, they are limited to electric-only configurations and do not consider the multi-energy dimension. This study aims to fill that gap by investigating the optimal sizing of a BESS integrated into a real MEMG when considering the provision of implicit flexibility. To achieve this, a block-structured MILP model is developed to simulate the operation of all system components. The optimization framework, called HOMES (hierarchical optimization for multi-energy systems), is implemented in Python 3.11, using Pyomo library [27] for mathematical modeling and Gurobi [28] as the solver. The MEMG at the Leonardo Campus of Politecnico di Milano is the case study analyzed in this work [29]. Particular attention is given to accurately representing the structure of the natural gas and electricity bills (hereby referring to Italy), including the modeling of innovative schemes such as a _peak shaving tariff_ linked to the capacity market's remuneration and a _negative electricity injection scheme_ allowed to storage assets--namely, energy withdrawn from the grid not for self-consumption but for later re-injection. The former has been introduced by Resolution 566/2021 of the Italian Regulatory Authority ARERA [30] and is intended to recover the costs associated to the Italian capacity market in a cost-reflective way. The latter, follows Resolution 109/2021 of ARERA [31] and indicates that withdrawn, stored, and re-injected energy is exempt from network charges, which can significantly impact the profitability of pure BESS arbitrage operations in behind-the-meter operations. In addition, this paper focuses on the impact of the DAM price signal and the design of the power-based tariff on the MEMG's optimal scheduling through two specific sensitivity analyses. First, it quantifies how much the DAM price daily spread would need to increase compared to current levels to make pure energy arbitrage economically attractive. Second, it explores how increasing the capacity-based charge during system-wide peak hours could further incentivize the MEMG to limit its maximum power withdrawal during those specific hours. The focus on implicit flexibility is particularly relevant in real-world scenarios where access to the ancillary services market may be restricted, complex or economically unattractive for distributed MES. Moreover, by analyzing a real MEMG and incorporating the actual structure of the Italian gas and electricity bills, the study provides actionable insights that can support investment decisions and policy evaluations in the context of emerging prosumer-driven systems. The main contributions of this study are threefold. First, it quantifies the economic value of integrating a BESS into an MEMG to provide implicit flexibility under the current Italian electricity bill scheme, highlighting how this value evolves with the battery's size. Second, it proposes a novel modeling approach for _negative injected electricity_ (_NIE_), offering insights into how regulatory changes may enhance the profitability of BESS energy arbitrage and prompt the self-dispatching capacity of MESs. Finally, it examines how modifications to the DAM price signal and power-based tariff design can incentivize grid-connected users to better respond to system needs.