## 1 Introduction
The results reveal clear advantages of the MVO-based approach, with significant reductions in energy losses and consistently lower CO\({}_{2}\) emissions in both connected and islanded modes. Its robust and repeatable performance, along with high computational efficiency, suggests strong potential for real-world implementation. This dual-mode capability represents an important advancement over typical single-mode optimization studies, offering MG operators a more versatile tool for maintaining reliability during both normal and emergency conditions. This work delivers significant contributions both academically and for the energy sector. From an academic perspective, it proposes a novel mathematical formulation for the optimal scheduling of BESS in AC microgrids operating in both grid-connected and islanded modes. The model incorporates detailed technical constraints, such as power balance, voltage limits, and current capacities, often oversimplified in previous studies. Additionally, it introduces a master-slave optimization architecture combining the MVO algorithm with a power flow analysis based on Successive Approximations, enabling efficient and repeatable resolution of complex multi-objective problems. For the energy sector, the study provides a robust and applicable tool for enhancing microgrid planning and operation. Its validation on a realistic 33-node system with actual demand and PV generation profiles demonstrates its practical relevance. The proposed strategy effectively reduces energy losses and CO\({}_{2}\) emissions while ensuring compliance with system stability and security standards. These features make it a valuable solution for energy planners and system operators aiming to integrate storage and renewable energy in modern distribution networks, contributing to smarter and more sustainable energy management. In particular, the dual emphasis on loss minimization and emissions reduction reflects two critical priorities in current power systems. Losses directly impact the efficiency of electricity delivery, while emissions are a growing environmental concern, especially in densely populated or highly polluted regions such as Medellin [29] or Shanghai [30], where seasonal air quality thresholds may be exceeded. By modeling photovoltaic generation under Maximum Power Point Tracking (MPPT) mode, the framework ensures full utilization of the available solar resource. In this context, the optimization strategy not only balances power flow and storage behavior but also enables the efficient and complete use of renewable energy within the operational limits of the system. The remainder of this paper is organized as follows: Section 2 introduces the mathematical modeling of the AC MG, operating under both grid-dependent and self-powered modes, incorporating a comprehensive set of constraints to reflect realistic operation in the presence of DERs. Section 3 details the proposed master-slave optimization framework based on MVO/SA. Section 4 describes the test system setup, including the comparison algorithms and the optimizer parameters selected through a systematic tuning process, while Section 5 presents and analyzes the simulation results. Finally, Section 6 summarizes the main conclusions and outlines directions for future research.