## 2 Mixed-Integer Nonlinear Programming Model
### Set of Constraints  
The set of constraints associated with optimal siting and sizing of D-STATCOMs in electrical distribution grids is associated with active and reactive power balance equations in nodes, voltage drops in lines, and binary constraints related with installing the D-STATCOMs, among others. All the constraints of the studied problem are listed below:  
\[p_{ij,t}-R_{ij}I_{ijh}^{2}-\sum_{k:\{j\}\in\mathcal{L}}p_{jkh}=P_{ jh};\{j\in\mathcal{N},\;h\in\mathcal{H}\}, \tag{2}\]  
\[q_{ij}-X_{ij}I_{ijh}^{2}-\sum_{k:\{j\}\in\mathcal{L}}q_{jkh}=Q_{ jh}-q_{j}^{cr}\;\{j\in\mathcal{N},\;h\in\mathcal{H}\}, \tag{3}\]  
\[V_{ji}^{2}=V_{ii}^{2}-2\Big{(}R_{ij}p_{ijh}+X_{ij}q_{ijh}\Big{)}+ \Big{(}R_{ij}^{2}+X_{ij}^{2}\Big{)}I_{ijh}^{2},\;\{(i,j)\in\mathcal{L},\;h\in \mathcal{H}\}, \tag{4}\]  
\[I_{ijh}^{2}=\frac{p_{ijh}^{2}+q_{ijh}^{2}}{V_{ih}^{2}},\;\{(i,j) \in\mathcal{L},\;h\in\mathcal{H}\}, \tag{5}\]  
\[-x_{j}q_{j}^{cr,\max}\leq q_{j}^{cr}\leq x_{j}q_{j}^{cr,\max},\;\{j\in \mathcal{N}\}, \tag{6}\]  
\[\sum_{j\in\mathcal{N}}x_{j}\leq N_{\max}^{cr} \tag{7}\]  
\[V^{\min}\leq V_{jh}\leq V^{\max},\;\{h\in\mathcal{H},\;j\in \mathcal{N}\}, \tag{8}\]  
\[x_{j}\in\{0,1\},\;j\in\mathcal{N}, \tag{9}\]  
where \(p_{ijh}\) and \(q_{ijh}\) represent the active and reactive power flows, respectively, that travel from node \(i\) to node \(j\) during the period of time \(t\); \(p_{jkh}\) and \(q_{jkh}\) have the same definitions as have been mentioned for nodes \(j\) and \(k\), respectively; \(P_{jh}\) and \(Q_{jh}\) represent the active and reactive power consumption, respectively, at node \(j\) for each period of time \(h\) (note that these loads have been formulated as constant power consumption); \(q_{j}^{cr}\) is the reactive power injection of the dynamic reactive power compensator, i.e., the D-STATCOM connected to the node \(j\); \(V_{ih}\) and \(V_{jh}\) are the magnitudes of the voltage profiles at nodes \(i\) and \(j\), respectively, in the period of time \(t\); \(q_{j}^{cr,\max}\) represents the maximum upper bound of the reactive power injection by the D-STATCOM connected at node \(j\); and \(V^{\min}\) and \(V^{\max}\) represent the minimum and maximum voltage regulation bounds allowed, respectively, for all the nodes of the grid. The variable \(x_{j}\) determines the installation (\(x_{j}=1\)) or number (\(x_{j}=0\)) of a D-STATCOM in the node \(j\). In addition, \(N_{\max}^{cr}\) represents the maximum number of D-STATCOMs available for installation in the electric distribution network. The interpretation of the mathematical model aimed at the optimal siting and sizing of D-STATCOMs for dynamic reactive power compensation in electric distribution grids, as defined from Equations (1) to (9), is as follows: Equation (1) corresponds to the objective function associated with minimizing the costs of the annual energy losses added with the annualized investment costs in D-STATCOMs. Equations (2) and (3) represent the active and reactive power balance expressions, respectively, applied to each node at each period of time. Equation (4) corresponds to the voltage drop at each line as a function of the power and current flow. Equation (5) denotes the average apparent power definition (i.e., application of the second Tellegen theorem) calculated in the sending node of the line. The inequality constraint in Equation (6) is a box-type constraint that defines the capability of injecting/absorbing reactive power into/from the D-STATCOM device if its binary variable is activated for the node \(j\). The inequality expression in Equation (7) defines the maximum number of dynamic reactive power compensators that can be installed along the electric distribution test feeder, which is a limitation typically imposed by the grid operator. The box-type constraint in Equation (8) corresponds to the voltage regulation bounds allowed for all nodes of the network at any period of time; these bounds are typically selected between \(\pm 5\%\) and \(\pm 10\%\) for medium-voltage grids in the Colombian context.