## 2 Proposed Model
### Mathematical Formulation
The constraint of Equation (9) defines the energy contributed by each installed generator during period \(t\), where \(f(tec_{k})\) represents the generation equation associated with the technology \(tec_{k}\) of generator \(k\). A description of the generation equations is provided in the appendix (Appendix A ). \[p_{tt} =f(tec_{k}) \forall k\in\mathcal{U},\forall t\in\mathcal{T} \tag{9}\]To allow for the activation and deactivation of diesel generators for each period, the constraint of Equation (10) is employed. \[v_{kt}\leq w_{k} \forall k\in\mathcal{U},k\mid te_{k}=D,\forall t\in\mathcal{T} \tag{10}\]  
The constraint of Equation (11) ensures a balance between the power generated and demanded. On the left side, the power of the generators, the power supplied by the battery to the network, and the unsupplied demand are summed. On the right side, the demand, the power sent to batteries, and the surplus energy are aggregated. \[\sum_{k\in\mathcal{U}}p_{kt}+\sum_{l\in\mathcal{B}}b_{lt}^{-}+s_{t}^{-}=d_{t} +\sum_{l\in\mathcal{B}}b_{lt}^{+}+s_{t}^{+} \forall t\in\mathcal{T} \tag{11}\]  
Constraints of Equations (12)-(18) model the behavior of the battery. The constraint of Equation (12) ensures that in a given period the battery is not charging and discharging simultaneously. The constraint of Equation (13) represents the state of charge of the batteries at time \(t\), considering the previous state of charge, the energy received and supplied to the network, the self-discharge coefficient (\(\alpha\)), and the charge (\(\eta_{b}at_{c}\)) and discharge (\(\eta_{b}at_{d}\)) efficiencies. Additionally, Equation (14) calculates the minimum state of charge of the battery (\(soc\_min\)), where \(DOD\_max\) represents the maximum depth of discharge of the battery bank, and \(soc\_max\) is the maximum state of charge of the battery. Constraints (15) and (16) set limits for the maximum and minimum energy in the battery, while constraints of Equations (17) and (18) establish limits on the power that can be charged or discharged from the battery in each period [35]. \[bc_{lt}+bd_{lt}\leq 1 \forall l\in\mathcal{B},\forall t\in\mathcal{T} \tag{12}\] \[soc_{lt}=soc_{lt-1}*(1-\alpha)+b_{lt}^{+}*\eta\_{bat_{c}}-\frac {b_{lt}^{-}}{\eta\_bat_{d}} \forall l\in\mathcal{B},\forall t\in\mathcal{T}\] (13) \[soc\_min_{l}=soc\_max_{l}*(1-DOD\_max_{l}) \forall l\in\mathcal{B}\] (14) \[soc_{lt}\leq soc\_max_{l}*q_{l} \forall l\in\mathcal{B},\forall t\in\mathcal{T}\] (15) \[soc_{lt}\geq soc\_min_{l}*q_{l} \forall l\in\mathcal{B},\forall t\in\mathcal{T}\] (16) \[b_{lt}^{+}\leq soc\_max_{l}*bc_{lt} \forall l\in\mathcal{B},\forall t\in\mathcal{T}\] (17) \[p_{tt} =f(tec_{k}) \forall k\in\mathcal{U},\forall t\in\mathcal{T} \tag{9}\]0  
To prevent both energy not supplied and surplus energy in the same period, an additional control constraint of Equation (19) is added. The Not Supplied Cost is presented in Appendix C.  
\[p_{tt} =f(tec_{k}) \forall k\in\mathcal{U},\forall t\in\mathcal{T} \tag{9}\]1  
Additionally, to ensure technical parameters such as the requirement for renewable energies to have a reference, either diesel or battery, constraints of Equations (20) and (21) are employed. This model utilizes the large M technique, which involves multiplication by a significantly large value, in this instance, the total number of generators \(|\mathcal{U}|\). This ensures that solar or wind power is utilized only when they have the mentioned reference. \[p_{tt} =f(tec_{k}) \forall k\in\mathcal{U},\forall t\in\mathcal{T} \tag{9}\]2 \[p_{tt} =f(tec_{k}) \forall k\in\mathcal{U},\forall t\in\mathcal{T} \tag{9}\]3Finally, constraints of Equations (22)-(29) define the variable domains.