**3. Problem Formulation**

#### *3.1. Objective Function*

The goal of the model is to minimize the total system costs (TSC) considering DG. The model utilizes a two-stage stochastic mixed-integer linear programming model. The investment variables that do not depend on the scenarios are established in the first stage. In the second stage, dependent or stochastic operation variables that depend on the scenarios are determined.

TSC are composed of two terms (Equation (1)). The first term corresponds to the first-stage variables that determine the number of new units such as wind turbines, PV modules, and transformers to install. The second term corresponds to the second-stage variables whose values are obtained after the outcome of scenario ω is known. See [18] for details.

$$\min TSC = \sum\_{t \in \Omega^{T}} \beta\_{t} \left( c i\_{t} + \sum\_{k \in \Omega^{K}} N\_{k}^{\text{h}} \sum\_{\omega \in \Psi\_{k}^{\omega}} \gamma\_{k,\omega} \text{com}\_{t,k,\omega} \right) \tag{1}$$

Total costs are updated using the present worth factor, β*<sup>t</sup>* = 1/(1 + *d*) *t* .

The interest rate, *i*, is used to calculate the annualized investment cost payment rates. The payment contributions for the three technologies, namely, transformers, wind turbines, and PV modules, are obtained in Equations (2), (3) and (4), respectively.

$$ca^{\text{SS}} = \frac{c i^{\text{SS}} \left(1 + i\right)^{LC^{\text{SS}}}}{\left(1 + i\right)^{LC^{\text{SS}}} - 1} \tag{2}$$

$$ca^{pv} = \frac{c i^{pv} \left(1 + i\right)^{LC^{pv}}}{\left(1 + i\right)^{LC^{pv}} - 1} \tag{3}$$

$$ca^{wd} = \frac{c i^{\text{wd}} \left(1 + i\right)^{LC^{wd}}}{\left(1 + i\right)^{LC^{wd}} - 1}.\tag{4}$$

After having determined the payment rates, the investment costs are calculated as shown in Equations (5) and (6).

$$c\dot{\boldsymbol{\alpha}}\_{t} = \sum\_{\boldsymbol{m} \in \Omega^{\bar{S}\bar{S}}} c\boldsymbol{a}^{\bar{S}\bar{S}} \boldsymbol{Y}\_{t}^{\bar{S}\bar{S},\boldsymbol{n}} + \sum\_{\boldsymbol{m} \in \Omega^{L}} \left( c\boldsymbol{a}^{\bar{p}\boldsymbol{v}} \boldsymbol{Y}\_{t}^{\bar{p}\boldsymbol{v},\boldsymbol{n}} + c\boldsymbol{a}^{\bar{u}\boldsymbol{d}} \boldsymbol{Y}\_{t}^{\bar{u}\boldsymbol{d},\boldsymbol{n}} \right); \boldsymbol{t} = \boldsymbol{1} \tag{5}$$

$$c\dot{\boldsymbol{\varepsilon}}\_{t} = \sum\_{n \in \Omega^{\rm SS}} c\boldsymbol{\alpha}^{\rm SS} \boldsymbol{Y}\_{t}^{\rm SS,n} + \sum\_{n \in \Omega^{L}} \left( c\boldsymbol{a}^{\rm pv} \boldsymbol{Y}\_{t}^{\rm pv,n} + c\boldsymbol{a}^{\rm wd} \boldsymbol{Y}\_{t}^{\rm wd,n} \right) + c\dot{\boldsymbol{\varepsilon}}\_{t-1}; \ t > 1. \tag{6}$$

The operation and maintenance total costs (Equation (7)) take into account the cost of losses (Equation (8)), the penalty for the energy not supplied (Equation (9)), the cost of purchase of energy from substations (Equation (10)), as well as renewable DG candidates' operation and maintenance costs (Equation (11)).

$$\text{con}\_{t,k,\omega} = \text{closs}\_{t,k,\omega} + \text{cns}\_{t,k,\omega} + \text{css}\_{t,k,\omega} + \text{cner}\_{t,k,\omega}; \forall (t,k,\omega) \tag{7}$$

$$\text{closs}\_{t,k,\omega} = c^{\text{loss}} \sum\_{n,m \in \Omega^N} S^{\text{base}} R^{n,m} I\_{t,k,\omega}^{\text{spr},n,m}; \forall (t,k,\omega) \tag{8}$$

$$\mathfrak{c}ns\_{t,k,\omega} = \mathfrak{c}^{\text{us}} \sum\_{n \in \Omega^{\text{l}}} S^{\text{bus}} P\_{t,k,\omega'}^{\text{us},n} \colon \forall \begin{pmatrix} t,k,\omega \end{pmatrix} \tag{9}$$

$$\text{csc}\_{t,k,\omega} = \mathfrak{c}\_{k,\omega}^{\text{SS}} \, f\_t^{\text{SS}} \sum\_{n \in \Omega^{\text{SS}}} S^{\text{base}} P\_{t,k,\omega}^{\text{SS},n} \, \forall \, (t,k,\omega) \tag{10}$$

$$
gamma\_{t,k,\boldsymbol{\omega}} = S^{\rm base} \sum\_{n \in \Omega^{\rm L}} \left( \boldsymbol{\omega} m^{\rm pr} P\_{t,k,\boldsymbol{\omega}}^{\rm pr,n} + \boldsymbol{\omega} m^{\rm uud} P\_{t,k,\boldsymbol{\omega}}^{\rm uud,n} \right); \; \forall (t,k,\boldsymbol{\omega}). \tag{11}$$
