*5.3. Data-Driven Controller*

Even though data-driven controllers applied to VSC-based STATCOMs have been used in the past, most of them have been aimed at auxiliary control and not the converter itself [8,15]. Data-driven controllers enable a faster response which is an important feature demanded by any STATCOM model given that it needs to provide voltage support after an external event such as faults or connection/disconnection of loads.

The data-driven based STATCOM model proposed in this work is based on the response of the conventional VSC model. In fact, the data-driven controller consists only of inputs and outputs data and avoids the use of complex mathematical algorithms, which makes it suitable for a large power system that usually requires a high computational burden. The proposed data-driven strategy that is discussed in a general way in Section 4, is now described in terms of the VSC variables for its implementation.

To set-up the controller, it is not required to know any information about the models of the VSC and the grid. The only requirement is the definition of variables available for control and measurement, as well as a required operating point, that is, a set-point. We call these external variables accommodated in a vector *w*. To denote the desired value of the external variables at the equilibrium, that is, a set-point, we use the notation *w*∗. Then error variables are denoted by Δ*w* = *w* − *w*∗. Then a set of measurements containing *w*(1), *w*(2), ..., *w*(*T*) can be used to generate Δ*w*(1), Δ*w*(2), ..., Δ*w*(*T*), simply by subtracting the operating point value.

In this case, we selected Δ*id*, Δ*iq*, Δ*vdc*, Δ*vac*, and Δ*v<sup>d</sup> <sup>c</sup>* , Δ*v q <sup>c</sup>* as the external variable, since they are typically the available measurements in practice. Moreover, the variables Δ*v<sup>d</sup> <sup>c</sup>* , Δ*v q <sup>c</sup>* will permit implementation of the controller, as they provide the voltage reference for the VSC in terms of *dq*-components.

As described in Section 3.1, the collection of data on these variables permits us to obtain the coefficient matrix *P*, which replaces the requirement of a model, since it contains sufficient information about the dynamics of the to-be-controlled system. Then, the matrix inequality shown in (11) is implemented using MATLAB and external optimization tools, in this case we used *Yalmip*. To set up (11), it is necessary to define the adequate sizes of *Psi* # (in this case *N* = 2 and *q* = 6) and *V* (with the same dimension as *P*. It thus remains to define the matrix *C* that contains the parameters of the candidate controller. For ease of implementation, we chose a PI configuration as the candidate controller with the following equations:

$$\begin{aligned} \Delta \upsilon\_c^d &= -K\_1 \Delta i\_d - K\_2 \Delta i\_q - K\_3 \Delta \upsilon\_{dc} - K\_4 \Delta \upsilon\_{ac} \\ &- K\_5 z\_1 - K\_6 z\_{2\prime} \end{aligned} \tag{25}$$

$$\begin{aligned} \Delta \upsilon\_c^q &= -G\_1 \Delta i\_d - G\_2 \Delta i\_q - G\_3 \Delta \upsilon\_{dc} - G\_4 \Delta \upsilon\_{ac} \\ &- G\_5 z\_3 - G\_6 z\_4 \end{aligned} \tag{26}$$

where the variables *z*1, . . ., *z*<sup>4</sup> are obtained by discrete-time integration, that is,

$$
\sigma \begin{bmatrix} z\_1 \\ z\_2 \\ z\_3 \\ z\_4 \end{bmatrix} = \begin{bmatrix} z\_1 \\ z\_2 \\ z\_3 \\ z\_4 \end{bmatrix} + \begin{bmatrix} \Delta v\_{dc} \\ \Delta v\_{ac} \\ \Delta v\_{dc} \\ \Delta v\_{ac} \end{bmatrix} \tag{27}
$$

The controller therefore has the following representation:


As defined in (8), and as exemplified in (15), the factorization of *C*(*σ*) leads to the coefficient matrix *C*. Finally, the gains *K*1, ..., *K*<sup>6</sup> and *G*1, ..., *G*<sup>6</sup> are numerically computed by solving (11). Although every version of the software is portable enough to work with different versions, in the present work, it might be of interest that we used MATLAB R2021a, YALMIP R20210331, and the standard LMILAB solver available in MATLAB. The latter was used as a default option, but the results were also corroborated by using SEDUMI 1.1 as a solver. The reader can refer to [32] for more information and more suitable options.

The realization of the controller in terms of a flow diagram is shown in Figure 3. In the following sections, we discuss the performance of the proposed data-driven controller with respect to the model-based strategy introduced in the previous section.

**Figure 3.** Data-driven controller for a VSC-based STATCOM model.
