**Fabio Mandrile 1, Salvatore Musumeci 1,\*, Enrico Carpaneto 1, Radu Bojoi 1, Tomislav Dragiˇcevi´c <sup>2</sup> and Frede Blaabjerg <sup>3</sup>**


Received: 17 August 2020; Accepted: 11 September 2020; Published: 15 September 2020

**Abstract:** In modern power electronics-based power systems, accurate modeling is necessary in order to analyze stability and the interaction between the different elements, which are connected to it. State space modeling seems a valid approach to study the modes of a certain system and their correlation with its states. Unfortunately, this approach may require complicated calculations and it is difficult to model advanced or emerging control techniques for grid-tied converters, such as cascaded controllers (e.g., voltage and current) and virtual synchronous generators (VSGs). Moreover, this approach does not allow an easy reconfiguration of the modeled system by adding, removing of modifying certain elements. To solve such problems, this paper presents a step-by-step approach to the converter modeling based on the Component Connection Method (CCM). The CCM is explained in detail and a practical example is given, by modeling one exemplary VSG model available in the literature. The obtained model is finally validated experimentally to demonstrate the practical accuracy of such approach.

**Keywords:** Component Connection Method; power electronics-based systems; stability analysis; state-space methods; virtual synchronous generators

#### **1. Introduction**

The transition to power systems involving more power electronics-based converters represents a challenge today. An increase in the penetration of inverter-interfaced renewable energy sources (such as wind and sun) may lead to instabilities within the power system [1,2]. For this reason, accurate converter models, taking into consideration both the converter hardware parameters and its control algorithm, will be necessary. Moreover, some grid codes are now requiring dynamic models on different degree of details for simulation and analysis at the power system level [3,4].

Several techniques are presently available for this purpose. The most popular are frequency domain analysis using impedance models and the eigenvalue analysis using state-space models [5]. Regarding the impedance models, various approaches are available in the literature [6–11], as well as experimental procedures [12] to obtain the black-box frequency response of a converter without knowing its internal parameters. Regarding the system-level analysis, the Generalized Nyquist Criterion can be used [13] if the individual equivalent impedance models are available. However, impedance models fail to provide an immediate comprehension of the poles in the system and how they are influenced by the system parameters. Moreover, by observing the Bode plot of the equivalent impedance of a converter, the effect of some poles can be canceled by corresponding zeros of the system.

On the contrary, the state-space approach has the advantage of clearly identifying the modes of the system under study and their correlation both to its states (e.g., controller, filter) using participation factors [14] and to the system parameters using sensitivity analysis. Moreover, the state-space model can provide an immediate feedback of the different poles time constants, without incurring the effects of zero-pole cancellation that can be present in the impedance model representation.

Traditionally, compared to synchronous generators, grid-connected inverters have been working with much smaller time constants. These time constants are related to both the physical hardware of the converters (i.e., grid side filters) and the digital controllers. However, to obtain a higher integration of renewable energy sources, inverters may be required to provide ancillary services to the grid, in order to maintain its stability and quality (frequency, voltage and harmonic content). These services typically operate with much slower time constants, in the order of magnitude of the line frequency or less. For these reasons, a multi time scale analysis of the system may be necessary. Also, simplified models may be desirable, focusing only on certain phenomena, to reduce the computational burden of otherwise extensive simulations to assess the stability and the behavior of the system.

However, state-space modeling is a very difficult task when dealing with complex systems internally interconnected. An increase in the number of state variables, inputs and outputs of the system leads to complicated matrix expressions. Moreover, another disadvantage is its low flexibility: if components are added, removed or modified, the modeling process must be repeated from the beginning. This disadvantage is particularly evident when modeling converters equipped with advanced cascaded or more emerging controllers. Such controllers may be implemented to provide additional features beyond the traditional current or voltage control of grid-connected converters and are an enabling technology to integrate more renewable energy sources in the future power systems.

An example of outer advanced controller are the virtual synchronous generators (VSGs), which can provide virtual inertia, harmonic compensation and reactive support during voltage dips [15–22].

The literature proposes some examples of state-space modeling of such controllers [18], but following a monolithic approach, i.e., deriving the complete model at once. This kind of approach is feasible, but it lacks of flexibility, modularity and scalability (i.e., if something changes, the model must be derived again). Moreover, the number of state variables involved dramatically increases the order of the obtained system. This complexity leads to a larger modeling effort and it is prone to errors. Therefore, troubleshooting cannot be easily done during the derivation of the model.

A valid methodology to tackle such issues is the Component Connection Method (CCM). This method solves the lack of modularity and simplifies the modeling procedure, reducing both the analytical effort and the probability of making mistakes during the derivation, by separately modeling the single components of the system and then linking them using sparse interconnection matrices, as shown in Figure 1.

To provide a global and practical perspective on this technique, this paper reviews the requirements of power electronics modeling in power systems and the most recent applications of CCM to this matter. Moreover, it contributes with a generalized step-by-step Component Connection Method (CCM)-based modeling approach of the individual converter unit, considering both the hardware and the control part. Compared to the classical CCM theory and existing applications, purely algebraic blocks are introduced in this paper and it is described how to include them in the CCM in a completely general way. Such blocks have no physical meaning in power systems applications, but they simplify the modeling of power electronics controllers (e.g., calculating the current references starting from the power setpoints and the grid voltage).

This paper is organized as follows. In Section 2 the state of the art of CCM applied to power electronics-based power systems is reviewed, along with its most recent applications. Section 3 presents a step-by step procedure of CCM-based modeling. A practical particular example of such method by modeling the Simplified Virtual Synchronous Compensator (S-VSC) [23], is given in Section 4. Section 5 presents some analyses, which can be performed thanks to the state-space model and the experimental validation of the presented case study. Finally, the conclusions are provided in Section 6.

**Figure 1.** Modular state-space modeling of a grid connected converter including controllers.

#### **2. State-Space Modeling Literature**

With the spread of distributed generation and microgrids based on power electronics converters, accurate and efficient modeling techniques have become necessary. Such methods must guarantee flexibility (i.e., being easily applicable to different systems), scalability (i.e., can model more than one converter and can merge multiple grid sub-portions) and various detail level, depending on the specific analysis needed.

For this purpose, various levels of complexity and detail have been proposed during the years. At first, the focus was on low frequency subsynchronous oscillations, neglecting the faster behavior of current/voltage controllers [24]. In such cases, the inverter was considered as an ideal voltage source, controlled in amplitude and frequency by active and reactive droop controllers. However, such level of simplification is not always accurate in predicting instabilities or poorly damped resonances occurring at higher frequencies (innermost current or voltage control bandwidth and grid-side filters resonance frequency). Therefore, more accurate models have been proposed [25,26].

Given these requirements and summarizing the benefits of state-space modeling briefly mentioned in Section 1:


CCM is a valid modeling approach. In fact, the main advantage of CCM is the possibility of decomposing an articulated system into its fundamental blocks, which can then be individually modeled, and the possibility of reconfiguring the system by simply adding new blocks or just modifying the interconnection matrices. Such advantage is especially beneficial when modeling a single converter unit. This allows an easy an quick derivation of the state-space model of the converter, even when a single or more control layers (e.g., current controller) or hardware component (e.g., grid side filter) are modified in a later stage of the design.

CCM has been traditionally used at power system level to analyze multi-node networks with several conventional generating units or loads starting from [27]. Later, it has been specifically used to model the early grid applications of power electronics: static var compensators and HVDC transmission systems [28,29]. This method has gained renewed interest in the last decade, when it was applied to modern power electronics-based power systems. First, in 2014 CCM was applied to the specific modeling of wind farms and their connection to the main grid [8,30,31]. The same research evolved then in CCM modeling applied to multi converter power system, being able to include highly detailed inverter models (i.e., including accurate control loops and digital delays models) in wider inverter-based power systems.

CCM is currently used to analyze the stability and the interaction among conventional (i.e., phase locked loop (PLL)-based) and new controllers (i.e., Synchronverters) for renewable generation [32–34]. In these works, the CCM is the first stage of a more advanced state-space μ-analysis [34] to consider the uncertainties of the modeled plants.

CCM is still also currently adopted in power system studies, to include inverter-based grid nodes into larger scale studies (e.g., Subsynchronous torsional interactions [35]). In such cases, its flexibility is exploited in order to simplify the modeling procedure neglecting aspects at frequency out of the range of interest (e.g., digital control delay). The history of CCM is schematically summarized in Figure 2.

**Figure 2.** Applications and trends of CCM in time.

#### **3. Generalized CCM Modeling Approach**

This section considers a step-by-step procedure to model a grid-connected three-phase two level inverter, interfaced to the grid by means of an LCL filter and is depicted in Figure 3. The DC supply of the inverter is considered to be an ideal voltage source. Thanks to the modular approach guaranteed by the CCM, a more accurate model of the DC source, or even the model of a more complex DC side, e.g., a DC microgrid [36,37], can be easily included. The grid is modeled as a Thévenin equivalent circuit.

**Figure 3.** Diagram of the system to be modeled.

The CCM consists of the modular analysis of the system under modeling. First, the single components are identified and linearized around the chosen operating point. Then, the connections between the components are defined by means of sparse interlinking matrices. Finally, the state-space model of the overall system is obtained by linear algebra calculation.

This process is performed by the following general step-by-step procedure described below:


$$\begin{cases} X\_k &= \ \ A\_k X\_k + B\_k \mathcal{U}\_k \\\\ \mathcal{Y}\_k &= \ \mathcal{C}\_k X\_k + D\_k \mathcal{U}\_k \end{cases} \quad k = 1 \ldots n \tag{1}$$

where *Xk* represents the state variables vector of the block, *Uk* the inputs of the component and *Yk* its outputs. The matrices *Ak*, *Bk*, *Ck* and *Dk* are the component state-space matrices. Examples of the dynamic components are LCL filters and integral regulators.

4. Algebraic components are defined to simplify the modeling procedure. In a traditional state-space representation, only dynamic components are defined. However, this distinction can be very useful when it comes to the modeling of a controller. Many algebraic calculations, such as divisions, lead to complicated linearized expressions and it can be convenient to simplify the process by defining such algebraic components. They do not have state variables, but only inputs *Uk* and outputs *Yk* related as:

$$Y\_k = D\_k U\_k \qquad k = n+1 \ldots n+m \tag{2}$$

Droop controllers, sums and divisions to calculate the current reference from the active and reactive power references are examples of algebraic blocks.

5. The vector of the state variables of the global system *Xs* is the aggregate of the *Xk* state variable vectors of the single components. The list of the components inputs *U* and the list of the components outputs *Y* can be defined in an equivalent way as follows:

$$\begin{array}{rcl} X\_s & = & [X\_1 \dots X\_n]' \\\\ \downarrow \mathcal{U} & = & [\mathcal{U}\_1 \dots \mathcal{U}\_{n+m}]' \\\\ Y\_s & = & [\mathcal{Y}\_1 \dots \mathcal{Y}\_{n+m}]' \end{array} \tag{3}$$

6. An aggregated model is defined by composing the individual system matrices as follows:

$$\begin{cases} \begin{array}{rcl} \dot{X}\_s &=& A\_d X\_s + B\_d \mathcal{U} \\\\ \mathcal{Y}\_s &=& \mathcal{C}\_d X\_s + D\_d \mathcal{U} \end{array} \end{cases} \tag{4}$$

where:

$$\begin{array}{rcl} A\_{\mathfrak{a}} &=& \begin{bmatrix} A\_{1} & 0 & \cdots & 0 \\ 0 & A\_{2} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & A\_{n} \end{bmatrix} \\\\ B\_{\mathfrak{a}} &=& \begin{bmatrix} B\_{1} & 0 & \cdots & 0 & 0 & \cdots & 0 \\ 0 & B\_{2} & \cdots & 0 & 0 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & B\_{n} & 0 & \cdots & 0 \end{bmatrix} \\\\ C\_{\mathfrak{a}} &=& \begin{bmatrix} C\_{1} & 0 & \cdots & 0 \\ 0 & C\_{2} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & C\_{n} \\ 0 & 0 & \cdots & C\_{n} \\ \vdots & \vdots & \ddots & \vdots \\ 0 & \cdots & \cdots & 0 \end{bmatrix} \\\\ D\_{\mathfrak{a}} &=& \begin{bmatrix} D\_{1} & 0 & \cdots & 0 \\ 0 & D\_{2} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & D\_{n+m} \end{bmatrix} \end{array} \tag{5}$$

In (5), it must be noted that the *Ba* and *Ca* matrices must be extended by adding null elements to compensate for the algebraic blocks. In particular, a number of null columns equal to the total number of inputs of all the algebraic blocks must be attached to the *Ba* matrix. Also several null rows equal to the sum of the algebraic block outputs must be attached to the *Ca* matrix.

7. Define the connection matrices, to connect the single components. These matrices *T* are sparse and connect the inputs and outputs of the system as follows:

*U* = *TuyY* + *TusUs*

$$\begin{array}{rcl} \Upsilon\_{\sf s} &=& T\_{\sf s} \mathcal{Y} + T\_{\sf ss} \mathcal{U}\_{\sf s} \end{array} \tag{6}$$

8. The global linearized system state-space model can be obtained as:

$$\begin{cases} \begin{array}{rcl} \dot{X}\_{\sf s} &=& A\_{\sf s} X\_{\sf s} + B\_{\sf s} \mathcal{U}\_{\sf s} \\\\ Y\_{\sf s} &=& C\_{\sf s} X\_{\sf s} + D\_{\sf s} \mathcal{U}\_{\sf s} \end{array} \end{cases} \tag{7}$$

where:

$$\begin{array}{rcl} A\_s & = & A\_d + B\_a T\_{uy} W \mathbf{C\_d} \\\\ B\_s & = & B\_a T\_{uy} W D\_a T\_{us} B\_a T\_{us} \\\\ \mathbf{C\_s} & = & T\_{sy} W \mathbf{C\_d} \\\\ D\_s & = & T\_{sy} W D\_a T\_{us} + T\_{ss} \\\\ W & = & \left( I - D\_a T\_{uy} \right)^{-1} . \end{array} \tag{8}$$

when the system structure is modified, *U* and *Y* must be modified according to the new blocks, as well as the connection matrices.

As mentioned in the introduction, the CCM is useful when performing a multi time scale analysis of a system. The reason behind this kind of analysis is that the most recent controllers, enabling power electronic converters provide ancillary services to the grid (e.g., VSGs) typically work on different time scales. The inner control loops (voltage, current) are operating at the time scale of the switching frequency. On the other hand, the outer level controllers, managing for example the virtual inertia, operate with time constants in the order of magnitude of seconds. To perform a simplified analysis with a traditional state-space modeling approach, the system has to be completely remodeled, meaning time loss and possibility of introducing errors. The CCM solves this problem: the user can easily exclude some levels of the system by substituting them with purely algebraic blocks. This way the computational burden for simulations is reduced, while preserving the correctness of the analysis at the time scale of interest. This simplification affects only the state variables of the *k*-th excluded block, but does not affect its inputs and outputs. Therefore, a dynamic block can be transformed into an algebraic block and the global system is easily derived again, without any need to change the connection matrices. The poles relative to the neglected blocks will not be present in the global system anymore. The pole map of the system and a participation factors analysis, which will be described in Section 5, are a good starting point to decide which blocks can be neglected to perform which study, since they give a clear and straightforward view of the time constant of each pole and which blocks are related to them.

Moreover, the CCM is flexible and solves also the issues related to the comparison or improvements of the inverter control and hardware. In fact, CCM decompose an articulated system into its fundamental blocks, which can then be individually modeled, and allows the reconfiguration of the system by simply adding new blocks or just modifying the interconnection matrices. Such advantage is especially beneficial when modeling a single converter unit. The benefits are especially evident in comparison to the traditional monolithic modeling approach, which has to be repeated again when any part of the system is modified. This flexibility of CCM allows an easy and quick derivation of the new state-space model of the converter, even when a single or more control layers (e.g., current controller) or hardware component (e.g., grid side filter) are modified in a later stage of the design.

A practical example of the CCM superiority can be done by comparing it with the traditional state-space modeling. The literature [18] gives examples of VSG modeling with traditional techniques. In this example the complete state-space model of a grid-connected converter controlled with a cascaded VSG is described. However, the equivalent model is obtained directly, with a monolithic approach. The result is a 19 × 19 state variable matrix, with no easy identification of which part of this matrix corresponds to which block of the converter. With the CCM, as demonstrated by the approach of (5), this is not the case. Each functional block of the system under study corresponds to a well defined matrix, which can be modified in a later stage. For example, in case a different current control strategy is implemented in a later stage of the design, its inputs and outputs will not probably change, but only its internal structure. Several controllers can be therefore compared, as well as different approximations of the delay of the digital controller.

#### **4. Modeling of the S-VSC**

In this section, an example of the application of the CCM is given. The system under study is the Simplified Virtual Synchronous Compensator (S-VSC). This model has been chosen as a representative of a VSG-based controller providing ancillary services to the grid. However, CCM can be applied to model any other controller available in the literature, by being a general modeling approach.

The system consists of the inverter hardware part, its control (current controller and S-VSC) and the connection to the equivalent grid, as shown in Figure 4. The system is modeled in per unit with *Vb* base voltage, *Sb* base power and ω*<sup>b</sup>* base angular speed.

More details on this model are available in the literature [23].

#### *4.1. Defining System Inputs and Outputs*

First, the inputs and the outputs of the system are defined. The system inputs *Us* are defined to model the possible electrical perturbations that can influence the system. In particular, step variations in the active and reactive power references (Δ*P*∗ *ext*, Δ*Q*<sup>∗</sup> *ext*), grid frequency Δω*g*, grid voltage amplitude Δ*Eg* and grid voltage phase angle Δφ*<sup>g</sup>* variations. This choice allows full testing of the system under not-rated operating conditions.

The system outputs *Ys* are arbitrarily selected, depending on the quantities of interest. In this example, they have been chosen as follows:

$$\begin{array}{rcl} \Delta I\_{\texttt{s}} &=& \left[ \Delta P\_{\texttt{ext}}^{\*} \, \Delta Q\_{\texttt{ext}}^{\*} , \Delta \boldsymbol{w}\_{\texttt{\tilde{\texttt{s}}}^{\*}} \, \Delta E\_{\texttt{\tilde{\texttt{s}}}^{\*}} \, \Delta \boldsymbol{\phi}\_{\texttt{\tilde{\texttt{s}}}^{\*}} \right]\_{\texttt{5} \times 1}^{\prime} \\\\ Y\_{\texttt{s}} &=& \left[ \Delta P\_{\texttt{i}} , \Delta Q\_{\texttt{i}} , \Delta \boldsymbol{w}\_{\texttt{r}} , \Delta \boldsymbol{\delta}\_{\texttt{s}} \, \Delta \boldsymbol{v}\_{\texttt{\tilde{\texttt{s}}}^{\dagger}}^{d} \, \Delta \boldsymbol{v}\_{\texttt{\tilde{\texttt{s}}}^{d}}^{q} \right]\_{\boldsymbol{\delta} \times 1}^{\prime} \end{array} \tag{9}$$

where Δ*Pi* and Δ*Qi* are the active and reactive powers injected by the inverter.

#### *4.2. Component Identification*

The components are identified as shown in Figure 4. *n* = 4 dynamic blocks and *m* = 2 algebraic blocks are defined as follows:


**Figure 4.** Block diagram of the modeled S-VSC [23] control with the physical system.

#### *4.3. Dynamic Components Definition*

#### 4.3.1. LCL Filter

The inverter is connected to the grid by means of an LCL filter, as depicted in Figure 5. The filter is modeled in the (*d*,*q*) frame synchronous to the S-VSC virtual rotor position θ*r*, rotating at ω*r*.

**Figure 5.** LCL model in the stationary (α,β) frame.

The equations modeling this component (in per unit) are as follows:

$$\begin{aligned} \label{eq:10} \boldsymbol{\iota}\_{i}^{dq} - \boldsymbol{\upsilon}\_{\mathcal{S}}^{dq} &=& \frac{L\_{i}}{\omega\_{b}} \left( \frac{d\boldsymbol{l}\_{i}^{dq}}{dt} + j\omega\_{r}\omega\_{b}\boldsymbol{i}\_{i}^{dq} \right) + R\_{i}\boldsymbol{i}\_{i}^{dq} \\ \boldsymbol{\upsilon}\_{\mathcal{S}}^{dq} - \boldsymbol{\upsilon}\_{\mathcal{S}}^{dq} &=& \frac{L\_{f\mathcal{S}} + L\_{\mathcal{S}}}{\omega\_{b}} \left( \frac{d\boldsymbol{l}\_{\mathcal{S}}^{dq}}{dt} + j\omega\_{r}\omega\_{b}\boldsymbol{i}\_{\mathcal{S}}^{dq} \right) + (R\_{f\mathcal{S}} + R\_{\mathcal{S}})\boldsymbol{i}\_{\mathcal{S}}^{dq} \\ \cline{3-6} \boldsymbol{\frac{C\_{f}}{\omega\_{b}}} \frac{d\boldsymbol{\upsilon}\_{c}^{dq}}{dt} &=& \boldsymbol{i}\_{i}^{dq} - \boldsymbol{i}\_{\mathcal{S}}^{dq} - j\mathbf{C}\_{f}\boldsymbol{\omega}\_{r}\boldsymbol{\upsilon}\_{c}^{dq} \end{aligned} \tag{10}$$

This block has the following state variables *XLCL*, inputs *ULCL* and outputs *YLCL*:

$$\begin{array}{rcl} X\_{\text{LCL}} &=& \left[\Delta \overset{\text{ $d$ }}{}\_{i}^{d}, \Delta \overset{\text{ $q$ }}{}\_{i}^{q}, \Delta \overset{\text{;d $}}{}\_{\text{\$ }^{q}}^{q}, \Delta \overset{\text{ $q$ }}{}\_{\text{\ $}^{q}}^{q}, \Delta \overset{\text{$ q $}}{}\_{\text{\$ }^{q}}^{q} \right]\_{6 \times 1}^{\prime} \\\\ \Delta \underline{U}\_{\text{LCL}} &=& \left[\Delta \overset{\text{ $q$ }}{}\_{i}^{d}, \Delta \overset{\text{ $q$ }}{}\_{i}^{q}, \Delta \overset{\text{ $q$ }}{}\_{\text{\ $}^{q}}^{q}, \Delta \overset{\text{$ q $}}{}\_{\text{\$ }^{q}}^{q}, \Delta \text{ov}\_{\text{r}}\right]\_{5 \times 1}^{\prime} \\\\ \underline{Y}\_{\text{LCL}} &=& \left[\Delta \overset{\text{ $q$ }}{}\_{i}^{d}, \Delta \overset{\text{ $q$ }}{}\_{i}^{q}, \Delta \overset{\text{ $q$ }}{}\_{\text{\%}}^{q}, \Delta \overset{\text{ $q$ }}{}\_{\text{\%}}^{q}, \Delta \overset{\text{ $q$ }}{}\_{\text{\%}}^{q}, \Delta \overset{\text{ $q$ }}{}\_{\text{\%}}^{q}\right]\_{6 \times 1}^{\prime} \end{array} \tag{11}$$

The output *vpcc* can be useful in the case of a multi-inverter plant where the voltage amplitude control at the plant point of common coupling (PCC) is required.

By linearizing (10), the necessary state-space matrices *ALCL*, *BLCL*, *CLCL*, *DLCL* are obtained.

#### 4.3.2. Current Controller

The current controller considered in this model has a sampling time of *Ts* and it is based on a proportional integral (PI) regulator implemented in the (*d*,*q*) synchronous reference. The proportional and integral gains of the PI regulator are *kp* and *ki*. The total delay *Td* = 1.5 · *Ts* of the digital controller and the modulation is modeled with a first order Padé approximation. A higher order approximation can easily be considered by modifying this block. The controller complete block diagram is shown in Figure 6.

**Figure 6.** Block diagram of the PI regulator and equivalent delay (PI + delay) of the digital control and modulation.

The following state variables *XInv* are identified (the integrator Δ*x dq <sup>i</sup>* and the delay model Δ*x dq <sup>d</sup>* ), as well as the inputs *UInv* and outputs *YInv* of this block:

$$\begin{array}{rcl} X\_{Inv} &=& \left[\Delta \mathbf{x}\_{i'}^{d}, \Delta \mathbf{x}\_{i'}^{q}, \Delta \mathbf{x}\_{d'}^{d}, \Delta \mathbf{x}\_{d}^{q}\right]\_{4 \times 1}^{\prime} \\\\ \Omega\_{Inv} &=& \left[\Delta \mathbf{i}\_{d'}^{\*} \Delta \mathbf{i}\_{q'}^{\*} \Delta \mathbf{i}\_{i'}^{d}, \Delta \mathbf{i}\_{i}^{q}\right]\_{4 \times 1}^{\prime} \\\\ \Upsilon\_{Inv} &=& \left[\Delta \mathbf{e}\_{i'}^{d}, \Delta \mathbf{e}\_{i}^{q}\right]\_{2 \times 1}^{\prime} \end{array} \tag{12}$$

The state-space matrices of this block are *AInv*, *BInv*, *CInv*, *DInv*.

#### 4.3.3. S-VSC Electromagnetic Equations

The electrical and magnetic equations of both virtual stator and rotor of the S-SVC [23] are (in per unit):

$$\begin{array}{rcl} v\_d & = & -R\_s i\_{rd} - \omega\_r \lambda\_q + \frac{1}{\omega\_b} \frac{d\lambda\_d}{dt} \\\\ v\_q & = & -R\_s i\_{rq} + \omega\_r \lambda\_d + \frac{1}{\omega\_b} \frac{d\lambda\_q}{dt} \end{array} \tag{13}$$

$$\begin{array}{rcl} \pi\_{rq0} \frac{d\lambda\_{rq}}{dt} & = & -\lambda\_{rq} - L\_{rq} i\_{rq} \\\\ i\_{rd} & = & \frac{\lambda\_e - \lambda\_d}{L\_s} \\\\ i\_{rq} & = & \frac{\lambda\_{rq} - \lambda\_q}{L\_s} \end{array} \tag{13}$$

where λ*d*, λ*q*, λ*rq* and λ*<sup>e</sup>* are the virtual flux linkages of the machine (*d*-axis, *q*-axis, damper winding and excitation, respectively); *ivd* and *ivq* are the machine virtual currents; *Rs* and *Ls* are the virtual stator resistance and inductance; *Lrq* and τ*rq*<sup>0</sup> are the virtual damper parameters, tuned as described in [38].

Therefore, the block state variables *XElt*, inputs *UElt* and outputs *YElt* are defined as follows:

$$\begin{array}{rcl} X\_{Elt} &=& \left[\Delta\lambda\_d, \Delta\lambda\_{q'}, \Delta\lambda\_{rq}\right]\_{3\times 1}^{\prime} \\\\ \Delta I\_{Elt} &=& \left[\Delta v\_{\mathcal{S}'}^d, \Delta v\_{\mathcal{S}'}^q, \Delta w\_{r\prime} \Delta\lambda\_{\mathfrak{c}}\right]\_{4\times 1}^{\prime} \\\\ \Upsilon\_{Elt} &=& \left[\Delta \mathbf{i}\_{\nu}^d, \Delta \mathbf{i}\_{\overline{\nu}}^q\right]\_{2\times 1}^{\prime} \end{array} \tag{14}$$

The state-space matrices *AElt*, *BElt*, *CElt*, *DElt* of this block are obtained from the linearization of (13).

#### 4.3.4. S-VSC Power Loops Equations

The active and reactive power control equations of the S-SVC [23] are (in per unit):

$$-P\_v \quad = \ 2H \frac{d\omega\_r}{dt}$$

$$\frac{d\delta}{dt} \quad = \ \left(\omega\_r - \omega\_\S\right)\omega\_b\tag{15}$$

$$-k\_\epsilon \frac{Q\_v}{V\_\S} \quad = \ \frac{d\lambda\_\epsilon}{dt}$$

where *Pv* and *Qv* are the virtual active and reactive power of the S-VSC. The S-VSC is always operated at zero reference power in order to obtain better stability and damping [23]. *H* is the inertia constant of the machine, δ is the virtual load angle of the machine (*q*-axis to grid voltage vector). *Vg* is the peak value of the voltage across the filter capacitor *Cf* and *ke* is the gain of the excitation control.

This block state variables *XPower*, inputs *UPower* and outputs *YPower* are as follows:

$$\begin{array}{rcl} X\_{\text{Pourr}} & = & [\Delta\omega, \Delta\delta, \Delta\lambda\_{\varepsilon}]\_{3 \times 1}^{\prime} \\\\ \Delta\mathcal{U}\_{\text{Pourr}} & = & \left[\Delta\upsilon\_{\mathcal{X}'}^{d}, \Delta\upsilon\_{\mathcal{X}'}^{q}, \Delta\dot{\upsilon}\_{\mathcal{U}}^{d}, \Delta\upsilon\_{\mathcal{S}}\right]\_{5 \times 1}^{\prime} \\\\ \mathcal{Y}\_{\text{Pourr}} & = & [\Delta P\_{\upsilon}, \Delta Q\_{\upsilon}, \Delta\upsilon\_{\mathcal{V}}, \Delta\delta, \Delta\lambda\_{\varepsilon}]\_{5 \times 1}^{\prime} \end{array} \tag{16}$$

The state-space matrices *APower*, *BPower*, *CPower*, *DPower* of the power loops block are again obtained by the linearization of (15).

#### *4.4. Algebraic Components Definition*

#### 4.4.1. Power Reference Calculation

In this algebraic block the following calculation is performed to obtain the current references *i* ∗ *dq* from the power references *PQ*∗ and the grid voltage *v dq g* :

$$i\_d^\* + j i\_q^\* = \frac{P^\* - jQ^\*}{v\_{\mathbb{S}^d} - jv\_{\mathbb{S}^q}} \tag{17}$$

where:

$$\begin{array}{rcl}P^\* &=& P\_{\text{ext}}^\* + P\_v\\Q^\* &=& Q\_{\text{ext}}^\* + Q\_v\end{array} \tag{18}$$

Are the sums of the external references and the S-VSC compensation power references. Due to the division involved in (17), a dedicated block is justified to simplify the modeling process. There are no state variables, while the inputs *URef* and outputs *YRef* of the block are:

$$\begin{array}{rclcrcl}\Delta U\_{\text{Ref}} &=& \left[\Delta P\_{\text{ext}}^{\*}\Delta Q\_{\text{ext}}^{\*}\Delta P\_{\text{v}}\Delta Q\_{\text{v}}\Delta \mathbf{v}\_{\text{v}}^{d}\Delta \mathbf{v}\_{\text{g}}^{d}\right]\_{6\times 1}^{\prime} \\\\ Y\_{\text{Ref}} &=& \left[\Delta \mathbf{i}\_{d'}^{\*}\Delta \mathbf{i}\_{q}^{\*}\right]\_{2\times 1}^{\prime} \end{array} \tag{19}$$

Being an algebraic block, only the *DRef* matrix is obtained.

#### 4.4.2. Grid Perturbations

This algebraic block generates the grid voltage variations *e dq <sup>g</sup>* according to the external disturbances Δω*g*, Δ*Eg*, Δφ*g*, given as system inputs.

The grid voltage vector is defined as:

$$
\varepsilon\_{\mathcal{S}}^{dq} = E\_{\mathcal{S}} \varepsilon^{-j\left(\frac{\pi}{2} - \mathcal{S}\right)} \tag{20}
$$

Any phase displacement Δφ*<sup>g</sup>* in the grid results in the variation of the load angle δ. As seen in the previous S-VSC power loops section, the grid frequency Δω*<sup>g</sup>* variation leads to a load angle variation and it is, therefore, included in (15). The vector diagram of the grid and S-VSC is shown in Figure 7, as well as the angle variation due to a phase jump in the grid.

This block is defined by the following inputs *UGrid* and outputs *YGrid*:

$$\begin{array}{rcl} \Delta I\_{Grid} &=& \left[ \Delta \delta, \Delta E\_{\mathcal{S}'} \Delta \Phi\_{\mathcal{S}} \right]\_{3 \times 1}^{\prime} \\\\ Y\_{Grid} &=& \left[ \Delta c\_{\mathcal{S}'}^{d} \Delta c\_{\mathcal{S}}^{q} \right]\_{2 \times 1}^{\prime} \end{array} \tag{21}$$

And from the matrix *DGrid*, obtained by linearizing (20).

**Figure 7.** Vector diagram of the grid voltage and the (*d*,*q*) S-VSC rotating reference frames. The angle Δφ*<sup>g</sup>* is defined as the load angle variation after a fault event.

#### *4.5. Aggregated Model*

Once all the dynamic and algebraic blocks have been defined, the aggregated model can be obtained. First the aggregated state variables *Xs*, inputs *U* and outputs *Y* are defined:

$$\begin{array}{rcl} X\_s &=& \left[ X\_{\text{LCL}}, X\_{\text{Inv}\prime} X\_{\text{Elt}\prime} X\_{\text{Power}} \right]\_{16\times 1}' \\\\ \mathbf{U} &=& \left[ \mathbf{U}\_{\text{LCL}\prime} \mathbf{U}\_{\text{Inv}\prime} \mathbf{U}\_{\text{Elt}\prime} \mathbf{U}\_{\text{Power}\prime} \mathbf{U}\_{\text{Rcf}\prime} \mathbf{U}\_{\text{Gri}} \right]\_{27\times 1}' \\\\ \mathbf{Y} &=& \left[ \mathbf{Y}\_{\text{LCL}\prime} \mathbf{Y}\_{\text{Inv}\prime} \mathbf{Y}\_{\text{Ellt}\prime} \mathbf{Y}\_{\text{Power}\prime} \mathbf{Y}\_{\text{Rcf}\prime} \mathbf{Y}\_{\text{Gri}\prime} \right]\_{19\times 1}' \end{array} \tag{22}$$

Then, the aggregated model matrices are:

$$\begin{aligned} \begin{array}{rcl} A\_{\pm} &=& \begin{bmatrix} A\_{\text{LCL}} & 0 & 0 & 0 \\ 0 & A\_{\text{LZr}} & 0 & 0 \\ 0 & 0 & A\_{\text{H}l} & 0 \\ 0 & 0 & 0 & A\_{\text{Pown}} \end{bmatrix}\_{16 \times 16} \\\ B\_{\text{z}} &=& \begin{bmatrix} B\_{\text{LCL}} & 0 & 0 & 0 & \dots & 0 \\ 0 & B\_{\text{H}w} & 0 & 0 & \dots & 0 \\ 0 & 0 & B\_{\text{H}l} & 0 & \dots & 0 \\ 0 & 0 & 0 & B\_{\text{Pown}} & \dots & 0 \end{bmatrix}\_{16 \times 27} \\\ C\_{\text{z}} &=& \begin{bmatrix} C\_{\text{LCL}} & 0 & 0 & 0 \\ 0 & C\_{\text{LZr}} & 0 & 0 \\ 0 & 0 & C\_{\text{H}l} & 0 \\ 0 & 0 & 0 & C\_{\text{Pound}} \end{bmatrix}\_{16 \times 16} \\\ &\vdots & \vdots & \vdots & \vdots \\\ D\_{\text{z}} &=& \begin{bmatrix} D\_{\text{LCL}} & 0 & 0 & 0 & 0 & 0 \\ 0 & D\_{\text{H}l} & 0 & 0 & 0 & 0 \\ 0 & 0 & D\_{\text{H}l} & 0 & 0 & 0 \\ 0 & 0 & 0 & D\_{\text{Dlow}} & 0 & 0 \\ 0 & 0 & 0 & 0 & D\_{\text{Rfr}} & 0 \\ 0 & 0 & 0 & 0 & D\_{\text{F}l\text{f}} \end{bmatrix}\_{16 \times 29} \end{array} \tag{23}$$

Note that the matrices *Ba* and *Ca* are extended with several null elements equal to the number of inputs (8 in total) and outputs (4 in total) of the two algebraic blocks. The detailed expressions of the matrices in (23) are available in the Appendix A.

#### *4.6. Connection Matrices*

Now the connection matrices can be obtained by linking the inputs *U* and the outputs *Y* of the aggregated system together with the global inputs *Us* and outputs *Ys*. The matrix *Tss* is zero, since there is no direct feed-through from the system inputs to the system outputs.The detailed expressions of the connection matrices are available in the Appendix A.

$$\begin{array}{ll} T\_{\text{ll}\text{y}\_{27\times 19}} & T\_{\text{us}27\times 5} \\\\ T\_{\text{s}\text{y}\_{6\times 19}} & T\_{\text{us}6\times 5} = 0\_{6\times 5} \end{array} \tag{24}$$

### *4.7. Derivation of the Global State Space Model*

Finally, by applying (8), the system matrices *As*, *Bs*, *Cs*, *Ds* are obtained. It must be noted that such model could have also been derived in a monolithic way, by studying the converter as a whole. However, by applying CCM, the model can be handled more easily and allows a quick and straightforward modification, in case some parts of the controller or of the physical system are changed. A practical and straightforward example of this advantage is the modification of the current feedback of the current controller. Usually, for grid-connected converters interfaced with LCL filters to the grid, two types of current feedbacks are adopted: grid side current feedback and converter side current feedback [39]. In the proposed example, the converter side current feedback was adopted. Therefore, the outputs of the LCL filter block *YLCL* features the converter side current. However, if the current

feedback is shifted to the grid side current, only the *YLCL* vector and the relative matrices *CLCL* and *DLCL* must be modified. Each other block is not altered by this modification. Also the interconnection matrices are kept constant, being the two feedbacks equivalent from a signal routing point of view. A second example of the reconfiguration by adding new blocks is represented by the addition of an external droop controller. If a primary frequency regulation is required to the plant, then an extra proportional frequency controller is added, in order to generate the necessary active power references for the control. With the adopted CCM, the existing model is not modified, but an extra algebraic block is added before the reference calculation block. This extra block will receive as inputs the nominal and the actual grid frequency and generate the active droop power reference, which is then summed to the external power references.

## **5. Analysis and Validation**

#### *5.1. Analysis of the Derived State-Space Model*

The poles λ of the system can be obtained numerically by solving:

$$\det(A\_{\delta} - \lambda I) = 0 \tag{25}$$

In Figure 8, the poles of the system (also listed in Table 1) are depicted in the complex plane. The parameters of the state-space model have been chosen according to the experimental setup and are listed in Table 2. The classical observations about the stability and damping of the system can be done. Moreover, the poles of the system can visually be distinguished as follows:


To clearly define which phenomena are related to the single poles, the analysis of the participation factors [14] can be performed. The participation factor *pik* of the *k*-th state to the *i*-th mode is defined as:

$$p\_{ik} = \Phi\_{ik} \cdot \Psi\_{ki} \tag{26}$$

where Φ*ik* is the *k*-th value of the right eigenvector Φ*<sup>i</sup>* and Ψ*ki* is the *k*-th value of the left eigenvector Ψ*i*.

From (26), the states and the modes of the system can be correlated as the results in Table 1. In this way, the poles can be associated with the physical quantities that influence them.

**Figure 8.** Pole map of the S-SVC. The poles are numbered according to Table 1.


**Table 1.** Poles and participation factors. Only significant factors are displayed (larger than 0.1).

**Table 2.** Inverter and S-VSC parameters for the state-space model and of the experimental setup.


From the point of view of a multi-timescale analysis, the poles whose time constants are too small or too large can be excluded to simplify the model. For example, in the considered case study, the model can be simplified to analyze the low frequency behavior of the system (e.g., integration in a wider network to study the inertial behavior of the system during a frequency drop), by neglecting the high frequency poles related to the LCL filter physical parameters and from the current controller, which can be approximated with a direct feed-through with no dynamics, being orders of magnitude faster than the electromechanical dynamics of the S-VSC. The blocks and their interconnections can be rearranged to obtain a simplified model. This simplified model is useful to study the low frequency interaction within a more complex network.

Moreover, the state-space model allows the study of the behavior of the system under a change of parameters. A practical example is the variation of the short circuit ratio (SCR) in the connection to the grid, representing the inverse of the magnitude of the grid impedance in per unit. This analysis is especially important for wind power applications connected to very weak grids. In fact, due to the often isolated geographical positions, long cables or overhead lines connections are necessary and SCR ranging down to 1.5 or even less have been reported [40].

In Figure 9 the SCR of the system is swept from 10 to 1.5. The S-SVC damper and excitation control parameters are tuned accordingly. As it can be seen from the pole map, the poles relative to the LCL filter (1–4) are altered in their frequency, as the grid side inductance is modified. The S-VSC stator poles (9, 10) are also affected, being the stator in an equivalent series connection with the grid inductance. The effect is a lower damping of such poles that can be however easily compensated for by increasing the virtual stator resistance *Rs*. Finally, the low frequency mechanical poles (13–15) do not lose damping, thanks to the tuning algorithm described in [38], but only change their natural frequency. The excitation control pole (16) is not modified, as it is tuned to always obtain the desired time constant.

As previously mentioned, the state-space model can be used for a wide range of analyses. Analyses of interest are, for example, the pole map for different operating points (i.e., operation under load) and the pole variation due to the influence of parametric uncertainty of the physical components (i.e., grid inductance, filter parameters) on the tuning of both the controllers and the VSG.

**Figure 9.** Pole map of the S-SVC when the SCR changes from 10 to 1.5. The arrows indicate a decrease in the SCR. The poles are numbered according to Table 1. From left to right: (**a**) Complete pole map; (**b**) Magnifications of the lower frequency poles.

## *5.2. Experimental Validation*

The obtained state-space model can then be verified by a comparison with either a simulation of the complete system (e.g., Simulink, PLECS, PSCAD and other simulation tools can be used) or experimentally.

In this case, the S-VSC has been implemented on a dSPACE DS 1007, controlling a 15 kVA three-phase inverter connected to a grid emulator, as shown in Figure 10. The control runs at *fs* = 10 kHz, which also corresponds to the switching frequency *fsw* of the converter.

**Figure 10.** Experimental setup where the controller is based on dSPACE.

The parameters of both the experimental setup and the S-VSC are listed in Table 2.

The following four tests have been performed to validate the state-space model using all the five available inputs Δ*P*∗ *ext*, Δ*Q*<sup>∗</sup> *ext*, Δω*g*, Δ*Eg* and Δφ*g*:


In the first test (Figure 11) the active power fed to the grid and the frequency of the S-VSC are compared with the outputs of the state-space model. The active power reference rises from 0.2 pu to 0.3 pu at *t* = 0.2 s. This choice allows a more general test of the state-space model. In fact, as it can be seen in (A5), a large part of the matrix *Ds* depends on the initial active and reactive power references *P*∗ <sup>0</sup> and *Q*<sup>∗</sup> <sup>0</sup>. Therefore, a non zero initial power operating point has been chosen, better to verify this part of the model. As it can be seen from Figure 11 both the S-VSC virtual speed ω*<sup>r</sup>* and the injected active power are similar to the results from the state-space model. The state space-model, as it has been described, does not take into account the non-ideal behavior of the measurement process (e.g., noise, delays), which on the other hand may affect the experimental setup.

**Figure 11.** Test 1: Step in active power reference Δ*P*∗ *ext* from 0.2 pu to 0.3 pu. From left to right: (**a**) S-VSC virtual rotor speed (Hz) from experimental test (Exp) and state-space model (SS); (**b**) Active power injected from the inverter (pu) from experimental test (Exp), filtered active power (Filt) and output of the state-space model (SS).

In the second test (Figure 12), the reactive power injected by the inverter is compared, when the reactive power reference rises from 0.1 pu to 0.2 pu. As with Test 1, the initial non-zero operating point has been chosen better to test the model. Also in this case, the obtained model is accurate enough to simulate the step transient in the reactive power reference. Again, the state-space model is not including the non-ideal behavior of the experimental setup. This non-ideal behavior can be neglected when dealing with longer timescales, such as in Test 2. In fact, the delays and the noise act with much shorter time constants, which do not affect the behavior during these transients (operating in the time scale of seconds).

**Figure 12.** Test 2: Step in reactive power reference Δ*Q*∗ *ext* from 0.1 pu to 0.2 pu. Reactive power injected from the inverter (pu) from experimental test (exp), filtered reactive power (Filt) and output of the state-space model (SS).

Test 3 (Figure 13) deals with the input relative to the grid frequency variation Δω*g*. A step frequency variation of −0.2 Hz has been applied by the grid emulator. The S-VSC tries to compensate the frequency drop by injecting active power into the grid, providing a virtual inertial effect. The state-space model well predicts both the S-VSC speed ω*<sup>r</sup>* profile (Figure 13a) and the amount of active power injected (Figure 13b). The modeling of the frequency variations, as obtained here, can be useful in system level studies, when analyzing frequency regulation and inertial support. This kind of analysis also helps studying the inertial effect resulting from a different tuning of the S-VSC (the key parameters are in this case the inertia constant *H* and the virtual damper parameters τ*rq*<sup>0</sup> and *Lrq*, which are directly related to the electromechanical damping ζ of the virtual machine [38]).

**Figure 13.** Test 3: Grid frequency step drop Δω*<sup>g</sup>* from 50 Hz to 49.8 Hz. From left to right: (**a**) S-VSC virtual rotor speed ω*<sup>r</sup>* (Hz) from experimental test (Exp) and state-space model (SS); (**b**) Active power injected into the grid (pu) from experimental test (Exp), filtered active power (Filt) and output of the state-space model (SS).

Finally, Test 4 (Figure 14) validates the behavior of the system in case of a realistic grid fault. During the fault, the voltage of the grid drops to 95% of its nominal value and a phase jump of −5◦ is applied. For such tests, the quantities of interest are the reactive power injected into the grid (Figure 14a) to provide reactive support and the virtual excitation flux of the S-VSC λ*<sup>e</sup>* (Figure 14b) to evaluate the time constant of the excitation control. As expected, the state-space model is well predicting both the shape and the amplitude of such quantities, proving itself as a good analysis tool to correctly tune the S-VSC to guarantee the desired reactive response during grid faults.

**Figure 14.** Test 4: Grid voltage drop Δ*Eg* = −5 % with phase jump Δφ*<sup>g</sup>* = −5◦. From left to right: (**a**) Reactive power injected into the grid (pu) from experimental test (Exp), filtered reactive power (Filt) and output of the state-space model (SS); (**b**) S-VSC virtual excitation flux λ*<sup>e</sup>* from the experimental test (Exp) and state-space model (SS).

### **6. Conclusions**

In this paper, a general step-by-step procedure to easily obtain the state-space model of a grid-connected converter equipped with advanced cascaded controllers using CCM is presented. This mathematical method is suitable to model cascaded controllers with interconnected signals thanks to its modular approach. Moreover, it is easily possible to modify or reconfigure the system, without remodeling it.

This approach can be used to derive state-space models of grid-tied inverters equipped with advanced cascaded controllers or emerging control techniques, such as VSGs in order to study and simulate the stability of a power system with a higher integration of renewable energy sources. In addition, state-space models are favorable in case of multi-timescale analysis of the system: the eigenvalues of the system can be obtained, as well as their correlation to the system state variables. Therefore, simplified models can be obtained, neglecting high or low frequency phenomena which are out of the scope of the analysis.

The single models obtained following this procedure can represent a useful tool for both power electronics designers and grid operators. The first can obtain preliminary information on the weak spots of the system they are designing and test their behavior under different operating conditions. From the grid side, such models would be provided by the manufacturers with different level of details [3,4] to be integrated in a more system-level analysis.

This step-by-step approach has been verified with a practical example of the modeling of a VSG model (S-VSC), which is then validated experimentally on a 15 kVA grid-connected inverter.

**Author Contributions:** Conceptualization, F.M., E.C., R.B., T.D. and F.B.; methodology, F.M. and E.C.; software, F.M.; validation, F.M.; formal analysis, F.M. and E.C.; investigation, F.M. and E.C.; resources, S.M., R.B. and F.B.; data curation, F.M.; writing–original draft preparation, F.M.; writing–review and editing, F.M., R.B., T.D. and F.B.; visualization, F.M., S.M., R.B., T.D. and F.B.; supervision, R.B., T.D. and F.B.; project administration, S.M., R.B., T.D. and F.B. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Conflicts of Interest:** The authors declare no conflict of interest.
