## 2 Proposed Model
### Mathematical Formulation  
The microgrid sizing problem is formally defined first. The set or portfolio of generation units is denoted by \(\mathcal{U}\), and the set of batteries is denoted by \(\mathcal{B}\). Each generator \(k\) is associated with a technology \(tec_{k}\) within the set \(\mathcal{G}\). The set of time periods in the programming horizon is represented by \(\mathcal{T}\). An example of the defined sets is presented in Table 1. Additionally, the decision variables are classified into strategic and operational, as demonstrated in Table 2. Strategic variables determine the infrastructure to be installed, while operational variables are employed to evaluate the performance of the designed microgrid. \begin{table}
\begin{tabular}{l l} \hline \hline
**Set** & **Description** \\ \hline \(\mathcal{G}\): & \(\{S:SolarPhotovoltaic,W:WindPower,B:Battery,D:DieselGeneration\}\) \\ \(\mathcal{U}\): & \(\{gen_{1},gen_{2},gen_{3},\dots gen_{k}\}\) \\ \(\mathcal{B}\): & \(\{bat_{1},bat_{2},bat_{3},\dots bat_{l}\}\) \\ \(\mathcal{T}\): & \(\{t_{1},t_{2},\dots t_{\mathcal{H}}\}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Definition of sets. Figure 1: Research Algorithm. The objective function in Equation (1) minimizes the total cost of the system, estimated through the levelized cost of energy (LCOE). It is defined as the sum of the total cost of the system divided by the total annual energy supplied. The LCOE indicates the minimum price level at which each kilowatt generated must be sold for the project to be profitable. It considers the cost of infrastructure (\(cost\_Inf\)), the fixed operational cost (\(cost\_fopm\)), and the variable operation and maintenance costs (\(cost\_vopm\)), annually adjusted through the capital recovery factor (CRF), \(d_{t}\) indicates the demand at time \(t\). The objective function also incorporates penalties for unsupplied energy (\(cost\_s^{-}\)) and surplus energy (\(cost\_s^{+}\)). \[\min\frac{(cost\_Inf+cost\_fopm)*CRF+cost\_vopm+cost\_s^{+}*\left(\sum_{t\in \mathcal{T}}s_{t}^{+}\right)+cost\_s^{-}*\left(\sum_{t\in\mathcal{T}}s_{t}^{ -}\right)}{\sum_{t\in\mathcal{T}}(d_{t}-s_{t}^{-})} \tag{1}\]  
The infrastructure cost is given by Equation (2). Note that subscripts have been added to the variables to indicate which set they belong to; for example, for the upfront investment (\(cost\_up\)), a \(k\) has been added, indicating that it belongs to set \(U\) (portfolio of generation units). Therefore, \(cost\_up_{k}\) represents the upfront investment of generation technology \(k\). The same is done throughout the equations of the document. Equation (2) also considers replacement (\(cost\_r\)), and salvage cost (\(cost\_s\)). Operational costs of Equations (3) and (4) consider expenses associated with energy generation from each source. The variable cost (\(cost\_op\)) factors in the cost of diesel fuel, which depends on coefficients \(f0\) and \(f1\). These coefficients correspond to the intercept and slope of the fuel consumption curve, with typical values of \(f0=0.246\) L/kW h and \(f1=0.08145\) L/kW h [35]. Diesel cost further depends on the generated power, nominal rate (\(G\_max\)), and fuel cost (\(\rho_{FC}\)). Finally, a rate (\(\Delta\)) is included to represent tax incentives for renewable energies (see Appendix B) [35; 36]. \[ \begin{split} cost\_Inf&=\sum_{k\in\mathcal{U}}cost\_ up_{k}*\Delta*w_{k}+\sum_{l\in\mathcal{B}}cost\_up_{l}*\Delta*q_{l}+\sum_{k\in \mathcal{U}}cost\_r_{k}*\Delta*w_{k}\\ &\quad+\sum_{l\in\mathcal{B}}cost\_r_{l}*\Delta*q_{l}-\sum_{k\in \mathcal{U}}cost\_s_{k}*w_{k}-\sum_{l\in\mathcal{B}}cost\_s_{l}*q_{l}\end{split}  \tag{2}\]  
\[cost\_fopm=\sum_{k\in\mathcal{U}}cost\_fopm_{k}*w_{k}+\sum_{l\in\mathcal{B}} cost\_fopm_{l}*q_{l} \tag{3}\]