## 2 Methodological Proposal for Community-Based Urban Microgrid Planning
### Deterministic Planning Model  
The deterministic approach to the planning problem seeks to determine the type and capacity of the assets of the microgrids that minimize investment and operating costs. Therefore, the formulation of planning models with reliability requirements is presented below. Planning models with the incorporation of reliability requirements: Reliability requirements guarantee islanded operation of the microgrids, in the event of contingencies in the power grid. This aspect was achieved by the optimal combination of photovoltaic generators and energy storage systems. Regarding the PV inverters, two possible configurations for microgrids are considered:  
* Alternative 1: photovoltaic solar system with on-grid inverter technology, an inverter charger and batteries. * Alternative 2: photovoltaic solar system with hybrid inverter technology with or without batteries. The microgrids can operate in islanded mode incorporating the necessary assets that guarantee their operation. For Alternative 1, an inverter charger must always be included, to which the batteries are connected, and which together with the photovoltaic generator guarantees power supply to the users. The planning tool must decide on the most economical alternative, and this will depend mainly on the time period during which a fault occurs (morning, afternoon, night), on the stochastic behavior of energy consumption and on other factors that make it impossible to decide a priori on one of the two configuration alternatives as the optimal one. The installed power of the PV system is determined by Equations (1) and (2):  
\[P_{instb}\leq M.x_{po} \tag{1}\]  
\[P_{insth}\leq M.x_{ph} \tag{2}\]  
\[x_{po}+x_{ph}\leq 1 \tag{3}\]  
Since the planning tool must decide whether to install solar panels with on-grid inverter technology (decision variable \(P_{instb}\)), or panels with hybrid inverter technology (decision variable \(P_{insth}\)), the binary variables \(x_{po}\) and \(x_{ph}\) are used, which, along with Inequality (3), ensure that both have different values. These variables are applied as constraints to the panel's installed power with on-grid and hybrid inverter technologies, using the _Big-M_ method [37], as observed in Inequalities (1) and (2). In this case, the power that can be injected into the grid is presented in (4) and (5):  
\[P_{pv}(t)=P_{instb}.PV_{1 kW}(t) \tag{4}\]  
\[P_{pv}(t)=P_{insth}.PV_{1 kW}(t) \tag{5}\]  
where \(PV_{1 kW}(t)\) is the power generated by 1 kW of panels installed in the study region, which is given by the generation profile for each hour of the analysis horizon. Additionally, the power that can be injected into the grid is limited by solar generation, as presented in Inequality (6):  
\[P_{out}(t)\leq P_{pp}(t) \tag{6}\]  
Additionally, the energy constraints of the battery storage system are determined by (7)-(9):  
\[E(t)\geq 0,2.E_{bes} \tag{7}\]\[E(t)\leq 0,9.E_{bess} \tag{8}\]  
\[E(t)=E(t-1)+P_{ch}(t).\eta_{c}.\Delta t-P_{dch}(t)/\eta_{d}.\Delta t \tag{9}\]  
where \(E_{bess}\) corresponds to the energy of the battery to be installed and represents another decision variable of the optimization problem that is included in the objective function of each model. Furthermore, \(P_{ch}(t)\) and \(P_{dch}(t)\) are the charging and discharging power of the battery; \(\eta_{c}\) and \(\eta_{d}\) are coefficients that determine the performance of the battery in charging and discharging, respectively. \(t\) is the index associated with the study horizon, which takes values from 0 to 8759. \(\Delta t\) indicates the resolution of the data (1 h in this paper). Inequalities (7) and (8) represent the technical limits of battery charge. Batteries should not be charged above 90% of their capacity, nor discharged below 20% [38].