## 1 Introduction  
### Motivation  
Nowadays, power systems face an energy transition process that involves the concepts of smart grids, distributed generation and storage, demand side management and demand response [1]. These trends in electrical grids are changing the way traditional electrical systems are planned and operated, giving way to the deployment of joint solutions for the generation, distribution and consumption of energy, such as microgrids [2].  
Microgrids are defined as small electrical power systems that incorporate distributed generation, storage systems and controllable loads, as well as information and communication technologies for the local management of energy resources [3]. They have the ability to operate both connected to the electricity grid and in islanded mode, for example, in the event of a contingency in the electricity grid [4]. Given this context, microgrids emerge as a technological response that can help modernize traditional power grids, providing resilience, greater reliability and energy sustainability [5].  
Around the world, a variety of electricity supply projects have been developed under the microgrid concept [6]. Some of them are set as a solution for remote areas and not linked to interconnected electrical systems [7]. Others function as test benches in academic and research centers to evaluate the impact of renewable energy resources on electricity grids [8]. The remaining microgrid projects are aimed at increasing the quality and reliability of power systems while providing resilience and facilitating the integration of renewable energy sources within the distribution systems [9].  
In particular, in urban communities with high rates of electricity supply interruptions (as is the case in some Latin American countries, see Table 1), there may be numerous social, economic and environmental benefits to microgrids. Possible benefits include energy self-sufficiency, promoting a sustainable energy supply, increased energy reliability, retaining economic benefits in the community, providing an alternative and competitive energy supply, and coordinated integration of renewable generation systems with energy storage and the electricity grid [10].  
Additionally, microgrids are capable of reacting, resisting and recovering quickly in the event of low-probability and high-impact events (such as hurricanes, earthquakes and floods), facilitating the rapid recovery of the power grid [12].  
In order for the benefits of microgrids to be perceived by the community, it is necessary that in the planning of microgrids, in addition to considering variables intrinsic to the traditional planning approach (such as the type and size of distributed generation technology), demand-side aspects must also be covered [13]. Some of these aspects involve the load profiles of each user in the community disaggregated by end use, as well as their diversity factor and flexible demand resources (interruptible and manageable loads).  
Therefore, this research seeks to quantify the potential benefits of urban community microgrids, based on the development of planning models, with deterministic and stochastic optimization approaches. Specifically, this work proposes a model based on: ensuring supply meets all or part of the demand (critical demand), and guaranteeing the minimum cost between investment and operation. The proposed models fulfill the dual purpose of increasing the quality and reliability of the electrical power supply for a community that decides to protect itself from faults in the electricity grid, and facilitate the integration of small-scale renewable energy sources within the distribution systems.