**PartA: FPFA with D-STATCOM**

1. The voltages at all busses are assigned as substation bus voltage.

$$
\begin{bmatrix}
\mathbf{V\_a} \\
\mathbf{V\_b} \\
\mathbf{V\_c}
\end{bmatrix} = \begin{bmatrix}
1\angle 0^\circ \\
1\angle -120^\circ \\
1\angle 120^\circ
\end{bmatrix} \tag{8}
$$


$$[\mathbf{I}\_{\rm abc}]\_{\mathbf{k}} = [\mathbf{II}\_{\rm abc}]\_{\mathbf{k}} + [\mathbf{I} \mathbf{sh}\_{\rm abc}]\_{\mathbf{k}} + [\mathbf{IC}\_{\rm abc}]\_{\mathbf{k}} \tag{9}$$

$$\left[\mathbf{I}\_{\text{abc}}\right]\_{\mathbf{jk}} = \left[\mathbf{I}\_{\text{abc}}\right]\_{\mathbf{k}} \tag{10}$$

$$\left[\mathbf{I\_{abc}}\right]\_{\mathbf{j}} = \left[\mathbf{I\_{abc}}\right]\_{\mathbf{j}\mathbf{k}} + \left[\mathbf{II\_{abc}}\right]\_{\mathbf{j}} + \left[\mathbf{I\_{S\mathbf{b}c}}\right]\_{\mathbf{j}} + \left[\mathbf{I\mathcal{C}\_{\mathbf{abc}}}\right]\_{\mathbf{j}} \tag{11}$$

$$\left[\mathbf{I}\_{\text{abc}}\right]\_{\text{ij}} = \left[\mathbf{I}\_{\text{abc}}\right]\_{\text{j}} \tag{12}$$

$$[\mathbf{I}\_{\text{abc}}]\_{\mathbf{i}} = [\mathbf{I}\_{\text{abc}}]\_{\mathbf{i}\mathbf{j}} \tag{13}$$

where:

[Iabc]<sup>k</sup> : Line current matrix at bus-k;

[ILabc] jk : Line current in branch-jk;

[ILabc]<sup>k</sup> : Load current matrix at bus-k;

[Ishabc]<sup>k</sup> : Line current matrix drawn by shunt admittance at bus-k;


$$\left| [\mathbf{V\_{abc}}]\_{\mathbf{i}}^{\mathbf{r}} - [\mathbf{V\_{abc}}]\_{\mathbf{i}}^{\mathbf{r}-1} \right| \le [\varepsilon\_{\mathbf{abc}}] \tag{14}$$

where 'r' is the iteration number.


$$
\begin{bmatrix}
\Delta \mathbf{V\_a} \\
\Delta \mathbf{V\_b} \\
\Delta \mathbf{V\_c}
\end{bmatrix}^\gamma = \begin{vmatrix}
\mathbf{V\_a^{sp}} \\
\mathbf{V\_b^{sp}} \\
\mathbf{V\_c^{sp}}
\end{vmatrix} - \begin{vmatrix}
\mathbf{V\_a^{cal}} \\
\mathbf{V\_b^{cal}} \\
\mathbf{V\_c^{cal}}
\end{vmatrix}^\gamma \tag{15}
$$

$$[\Delta \mathbf{V}\_{\text{abc}}]^\gamma \le [\varepsilon\_{\text{abc}}] \tag{16}$$

where [∆V] *γ* is the mismatch matrix for the voltage and its size is 3 · n × 1, and 'n' is the total number of PV buses.

9. If the Equation (16) is not satisfied, then the incremental current injection matrix at D-STATCOM bus is calculated with Equation (17) to maintain the specified voltages:

$$[\Delta \mathbf{I}]^\gamma = [\mathbf{Z}\_{\rm PV}]^{-1} \cdot [\Delta \mathbf{V}]^\gamma \tag{17}$$

where [ZPV] is the sensitivity matrix for the PV bus with its size 3 · n × 3 · n. The formation of this matrix is presented in [30].

10. The incremental reactive current injection matrix at D-STATCOM bus is obtained with Equation (18):

$$
\begin{bmatrix}
\Delta \mathbf{I}\_{\mathrm{D},\mathrm{a}} \\
\Delta \mathbf{I}\_{\mathrm{D},\mathrm{b}} \\
\Delta \mathbf{I}\_{\mathrm{D},\mathrm{c}}
\end{bmatrix}\_{\mathrm{j}}^{\mathrm{\gamma}} = \begin{bmatrix}
\end{bmatrix}^{\mathrm{\gamma}} \tag{18}
$$

11. In Figure 5, by applying the KCL at bus-j, the line current matrix in branch-ij is obtained as:

$$
\begin{bmatrix} \mathbf{I\_a} \\ \mathbf{I\_b} \\ \mathbf{I\_c} \end{bmatrix}\_{\mathbf{i}\mathbf{j}}^{\gamma} = \begin{bmatrix} \mathbf{I L\_a} \\ \mathbf{I L\_b} \\ \mathbf{I L\_c} \end{bmatrix}\_{\mathbf{j}}^{\gamma} - \begin{bmatrix} \Delta \mathbf{I\_{D,a}} \\ \Delta \mathbf{I\_{D,b}} \\ \Delta \mathbf{I\_{D,c}} \end{bmatrix}\_{\mathbf{j}}^{\gamma} \tag{19}
$$

With [Vabc] *γ* j and [Iabc] *γ* ij , the reactive power flow in the line [Qabc] *γ* ij is evaluated. Then, the incremental reactive current injection matrix is obtained with Equation (20):

$$
\begin{bmatrix}
\Delta \mathbf{Q}\_{\mathrm{D},\mathrm{a}} \\
\Delta \mathbf{Q}\_{\mathrm{D},\mathrm{b}} \\
\Delta \mathbf{Q}\_{\mathrm{D},\mathcal{E}}
\end{bmatrix}\_{\mathrm{j}}^{\gamma} = \begin{bmatrix}
\mathbf{Q} \mathbf{L}\_{\mathrm{a}} \\
\mathbf{Q} \mathbf{L}\_{\mathrm{b}} \\
\mathbf{Q} \mathbf{L}\_{\mathrm{c}}
\end{bmatrix}\_{\mathrm{j}}^{\gamma} - \begin{bmatrix}
\mathbf{Q}\_{\mathrm{a}} \\
\mathbf{Q}\_{\mathrm{b}} \\
\mathbf{Q}\_{\mathrm{c}}
\end{bmatrix}\_{\mathrm{i}\bar{\jmath}}^{\gamma} \tag{20}
$$

The reactive power generation matrix needed at D-STATCOM bus-j is obtained with Equation (21):

$$
\begin{bmatrix} \mathbf{Q\_{D,a}} \\ \mathbf{Q\_{D,b}} \\ \mathbf{Q\_{D,c}} \end{bmatrix}\_{\mathbf{j}}^{\gamma} = \begin{bmatrix} \mathbf{Q\_{D,a}} \\ \mathbf{Q\_{D,b}} \\ \mathbf{Q\_{D,c}} \end{bmatrix}\_{\mathbf{j}}^{\gamma - 1} + \begin{bmatrix} \Delta \mathbf{Q\_{D,a}} \\ \Delta \mathbf{Q\_{D,b}} \\ \Delta \mathbf{Q\_{D,c}} \end{bmatrix}\_{\mathbf{j}}^{\gamma} \tag{21}
$$

12. If the D-STATCOM device is able to generate limited reactive power, then find the total reactive power generation of D-STATCOM device with Equation (22). The total reactive power generation of D-STATCOM is now compared with the maximum and minimum limits of reactive power generation of D-STATCOM device limits. Equation (22) is calculated as follows:

$$\left(\mathbf{Q}\_{\rm D}\right)\_{\rm j}^{\gamma} = \left(\mathbf{Q}\_{\rm D,a}\right)\_{\rm j}^{\gamma} + \left(\mathbf{Q}\_{\rm D,b}\right)\_{\rm j}^{\gamma} + \left(\mathbf{Q}\_{\rm D,c}\right)\_{\rm j}^{\gamma} \tag{22}$$

If Qj,min ≤ (QD) *γ* <sup>j</sup> ≤ Qj,max Then set complex power generation is as in Equation (21) If (QD) *γ* <sup>j</sup> ≤ Qj,min Then set (QD) *γ* <sup>j</sup> = Qj,min and <sup>Q</sup>D,a*<sup>γ</sup>* <sup>j</sup> = <sup>Q</sup>D,b*<sup>γ</sup>* <sup>j</sup> = <sup>Q</sup>D,c*<sup>γ</sup>* <sup>j</sup> = Qj,min/3 If (QD) *γ* <sup>j</sup> ≥ Qj,max Then set (QD) *γ* <sup>j</sup> = Qj,max and <sup>Q</sup>D,a*<sup>γ</sup>* <sup>j</sup> = <sup>Q</sup>D,b*<sup>γ</sup>* <sup>j</sup> = <sup>Q</sup>D,c*<sup>γ</sup>* <sup>j</sup> = Qj,max/3

13. Now, find the complex power generation matrix at D-STATCM bus with Equation (23):

$$
\begin{bmatrix} \mathbf{S\_{D,a}} \\ \mathbf{S\_{D,b}} \\ \mathbf{S\_{D,c}} \end{bmatrix}\_{\mathbf{j}}^{\gamma} = \begin{bmatrix} \mathbf{P\_{D,a}} \\ \mathbf{P\_{D,b}} \\ \mathbf{P\_{D,c}} \end{bmatrix}\_{\mathbf{j}} + \mathbf{j} \cdot \begin{bmatrix} \mathbf{Q\_{D,a}} \\ \mathbf{Q\_{D,b}} \\ \mathbf{Q\_{D,c}} \end{bmatrix}\_{\mathbf{j}}^{\gamma} \tag{23}
$$

where [PD,abc] j is the specified real power generation matrix of the D-STATCOM device and its value is set to zero.

14. The line current matrix injected by the D-STATCOM is obtained with the complex power generation matrix obtained in Equation (23) and bus voltage matrix as:

$$\begin{aligned} \left[\mathrm{I}\_{\mathrm{D,abc}}\right]\_{\mathrm{j}}^{\gamma} = \begin{bmatrix} \left(\mathrm{S}\_{\mathrm{D,a}}/\mathrm{V}\_{\mathrm{a}}\right)^{\ast} \\ \left(\mathrm{S}\_{\mathrm{D,b}}/\mathrm{V}\_{\mathrm{b}}\right)^{\ast} \\ \left(\mathrm{S}\_{\mathrm{D,c}}/\mathrm{V}\_{\mathrm{c}}\right)^{\ast} \end{bmatrix}\_{\mathrm{j}}^{\gamma} \end{aligned} \tag{24}$$


$$
\begin{bmatrix} SLoss\_{\texttt{a}} \\ SLoss\_{\texttt{b}} \\ SLoss\_{\texttt{c}} \end{bmatrix}\_{\texttt{ij}} = \begin{bmatrix} (\mathsf{V}\_{\texttt{a}})\_{\texttt{i}} \cdot (\mathsf{I}\_{\texttt{a}})\_{\texttt{ij}}^{\*} \\ (\mathsf{V}\_{\texttt{b}})\_{\texttt{i}} \cdot (\mathsf{I}\_{\texttt{b}})\_{\texttt{ij}}^{\*} \\ (\mathsf{V}\_{\texttt{c}})\_{\texttt{i}} \cdot (\mathsf{I}\_{\texttt{c}})\_{\texttt{ij}}^{\*} \end{bmatrix} - \begin{bmatrix} (\mathsf{V}\_{\texttt{a}})\_{\texttt{j}} \cdot (\mathsf{I}\_{\texttt{a}})\_{\texttt{ji}}^{\*} \\ (\mathsf{V}\_{\texttt{b}})\_{\texttt{j}} \cdot (\mathsf{I}\_{\texttt{b}})\_{\texttt{ji}}^{\*} \\ (\mathsf{V}\_{\texttt{c}})\_{\texttt{j}} \cdot (\mathsf{I}\_{\texttt{c}})\_{\texttt{ji}}^{\*} \end{bmatrix} \tag{25}
$$
