*2.2. Statcom Model and Control*

The StatCom model used on this paper consists of an equivalent transformer that emulates the voltage source converter operation. This transformer is connected in one side to a capacitor bank and, on the other side to the electric grid through a coupling transformer [25], Figure 2. One important feature of this model is the possibility to be included in transient stability studies of the power systems. The internal AC voltage of the StatCom is defined by,

$$V\_{\rm int} = k m\_a E\_{\rm dc} e^{j\phi} \tag{4}$$

where *k* is a known constant; *Edc* is the DC voltage on the capacitor terminals; *φ* is the phase angle of *Vint* in phasor form, and; *ma* in this model emulated the index modulation to regulate the voltage magnitude.

**Figure 2.** StatCom model with dynamic control gains.

Three PI controllers are used to regulate the StatCom dynamic performance, the main objective is to control the voltage magnitude at the point of common coupling (PCC), but an auxiliary signal could be included. In this scheme, the controlled voltage is after internal losses of the VSC, *Vac*, before the PCC transformer. The real and reactive power of the presented equivalent circuit is defined by [25],

$$P\_{\rm ac} = V\_{\rm ac}^2 G - k m\_a V\_{\rm ac} E\_{\rm dc} [G \cos \gamma + B \sin \gamma]$$

$$Q\_{\rm ac} = -V\_{\rm ac}^2 B - k m\_a V\_{\rm ac} E\_{\rm dc} [G \sin \gamma - B \cos \gamma] \tag{5}$$

where *γ* = *θac* − *φ*, represents the angular aperture between the internal voltage of VSC model and terminals, after internal losses, *G* and *B*. This angle is the second control variable to guarantee the desired exchange of active power, in this case only the required active power from the grid for losses compensation of the StatCom, *G* and *Gsw*, the last one represents the switching losses. These power flow equations are solved together with the electrical grid.

The dynamic performance is evaluated by the resulting equations of the equivalent circuit in Figure 2. In the DC bus,

$$
\vec{u}\_c = \mathbb{C}\_{dc}\mathbb{E}\_{dc} \tag{6}
$$

where *ic* = −*IdcR* − *Idc*, also,

$$I\_{dcR} = \frac{P\_{\text{bac}}}{E\_{dc}}\tag{7}$$

where *Idc* is the output of the first PI controller with *Edc* <sup>−</sup> *<sup>E</sup>nom dc* as its input. Two controller gains, *KPEdc* and *KIEdc* are needed.

The capacitor cannot inject active power, so it is necessary one regulator to guarantee the physical condition that only active power losses are absorbed from the grid. Therefore, a second PI controller is employed for this task, where the input is *P*0*ac* and the output is *γ*, *KPP*<sup>0</sup>*ac*, and *KIP*<sup>0</sup>*ac* are needed.

Finally, a deviation from the nominal value (initial condition), *ma*, is calculated by a third PI controller. This deviation helps to regulate *Vac*. The adaptive PI controller input is defined as the difference between the desired and actual voltage magnitude, *Vac* − *V*<sup>∗</sup> *ac*; also, two gain values must be properly specified for the StatCom connected to the electric grid, *KPV ac* and *KIV ac*. In total, six gains must be defined for the StatCom controllers. This model captures the main behavior in steady state and dynamic performance of the StatCom. Different to other models presented in the literature for this device, this model includes a phase-shifting transformer and an equivalent shunt susceptance, resulting in an explicit representation of the voltage source converter (VSC) in both sides the AC and DC, respectively. The reader interested in reviewing more details of this model can consult [25].

#### **3. Dynamic Controllers' Gains**

In some power systems, a low damping ratio is exhibited. Therefore, the tuning procedure of each controller is a task of precision; moreover, if several gains must be defined, a critical control design stage is presented. An alternative solution for this scenario is to analyze any steady-state condition, and then some gains could be updated online to attain better dynamic performance.

With our strategy it is possible to update all controllers' gains but, to exemplify the relevance of the proposal only some of them are dynamically calculated: the gains for the StatCom *KPV ac* and *KPP*<sup>0</sup>*ac* and for each PSS, *Ks* and *Tw*. A similar behavior in practice is expected, where only some of them could be retuned by an online procedure. Table 1 exhibits the main steps in proposed control design procedure. The first step consists in use typical gain values obtained around the steady state condition, which are present in Table 2 for the StatCom, and in Table 3 for the generators.

**Table 1.** Main stages in the proposed procedure to attain adaptive controllers.


**Table 1.** *Cont.*


**Table 2.** Gains of StatCom controller.


**Table 3.** Gains of Generator controller.


The proposed adaptive PI controller in the StatCom scheme is defined by,

$$\begin{aligned} u(t) &= K\_P(\mathcal{e}\_1)\mathcal{e}(t) + K\_I(\mathcal{e}\_1)\mathbf{x}\_{\text{aux}} \\ \dot{u}(t) &= \mathcal{e}(t) \end{aligned} \tag{8}$$

For controlling purposes, *KP* and *KI* and the PSS constants must be defined adequately. We propose to update these gains using the adaptive control law of Figure 3, defined as Equation (9).

$$\mathcal{K}\_1(\varepsilon\_1) = \beta\_1(\varepsilon\_1)\hat{W}\_1^T \tag{9}$$

*K*<sup>1</sup> on the Equation (9), and Figure 3 is used for any of the gains to be calculated.

**Figure 3.** Schematic representation of update procedure.

<sup>|</sup>*e*1<sup>|</sup> <sup>≤</sup> *<sup>e</sup>*<sup>∗</sup> with *<sup>e</sup>*<sup>∗</sup> being a constant. The update law for *<sup>W</sup>*<sup>ˆ</sup> <sup>1</sup> is given by,

$$
\mathcal{W}\_1 = \mathcal{W}\_1 + \Gamma\_1(c\_{1\prime}\mathcal{B}\_{1\prime}\boldsymbol{\zeta})\tag{10}
$$

*<sup>ς</sup>* <sup>∈</sup> <sup>R</sup> is a positive constant; *<sup>W</sup>*<sup>1</sup> <sup>∈</sup> <sup>R</sup>*<sup>P</sup>* with positive constants and; <sup>Γ</sup><sup>1</sup> <sup>∈</sup> <sup>R</sup>*<sup>P</sup>* calculated by

$$
\Gamma\_1 = -\frac{\xi \beta\_1}{\left\| \beta\_1 \right\|^2} \varepsilon\_1 \tag{11}
$$

*<sup>β</sup>*<sup>1</sup> <sup>∈</sup> <sup>R</sup>*<sup>P</sup>* represents a non-linear relationship from the input signals, *<sup>e</sup>*1. The non-linear relationship is defined by polynomial splines, B-splines [26,27], in this paper are univariate B-spline of fourth order.

Therefore, the controllers update their performance on each sample time with Equations (9)–(11). The input space is normalized in such a way that the input error is bounded in magnitude. First the system is operating offline where learning ratio, *ς*, is defined in order to get the best performance [28,29]. Then, the dynamic gains are updated by Equation (11) and put to operate online. The results under this last condition are exhibited in Section 4.

The search begins with some typical known values of each gain Equation (12), then the training algorithm is developed to improve the dynamic system response.

$$\begin{aligned} K\_{P\_{\text{Puc}}} &= 0.002\\ K\_{P\_{\text{Vac}}} &= 5\\ T\_1 = T\_3 &= 0.05\\ T\_2 = T\_4 &= 0.01\\ V\_{\text{min}} \le V\_s &\le V\_{\text{max}}\\ V\_{\text{max}} = 0.05; V\_{\text{min}} &= -0.05 \end{aligned}$$

After that, with each operating condition the adaptive algorithm continues learning with input variables and finding the best set of controller gains. The input signals for updating PSS gains are defined by,

$$
\omega\_{11} = \omega\_{\bar{i}}(t) - \omega\_B \tag{13}
$$

$$
\sigma\_{12} = P\_m - P\_\varepsilon(t) \tag{14}
$$

The gains for the StatCom controller have only one input signal, defined by Equation (13). The online procedure consists in calculating the best value for each dynamic gain for the power system operative point. This is possible because the BSNN is updating the weighting vector as a result of input error modification.

Finally, the implementation of the B-Spline neural networks stepwise rules are presented in Table 4, where all mathematical details behind this approach are included.

In this work, B-Spline neural networks algorithm was selected because it requires less computational effort, thanks to its single layer of neurons, its structure, and the shape of the base functions, Figure 3, in contrast to the multi-layer neural networks architecture. Furthermore, the activation functions are linear with respect to the adaptive weights, with an instant learning rule that can be used to update and adjust the weights online. These conditions make the B-Spline neural networks algorithm able of modeling and regulating complex non-linear systems. With these features, a robust, optimal control system is obtained with the ability to be adapted to inherent non-linearities and external or internal disturbances of the system. One of the core aspects of selecting the use of the BSNN is that by defining the base functions a non-linear relation of the input is obtained, and the training algorithm is computationally efficient, with a numerically stable recurring relationship that works with any distribution of knot vector.


**Table 4.** 1: B-Spline Neural Network off-line training rules.
