# Generic EMT Grid Following Voltage Source Converter with SVPWM Modulation

**Reviewers:** Eduardo Prieto Araujo (UPC), Josep Fanals Batllori (eRoots)

## Context

Voltage Source Converters (VSC) are widely used in power systems for a variety of applications, such as wind and photovoltaic generation, High Voltage Direct Current (HVDC) transmission, and Flexible AC Transmission Systems (FACTS). The model described here is a detailed Electromagnetic Transient (EMT) model of a grid-following VSC, which is a type of VSC that is synchronized with the grid, using its frequency and phase. This model, obtained from the many works developed at CITCEA-UPC (Centre d’Innovació Tecnològica en Convertidors Estàtics i Accionaments) such as [1], [2] and [3], is useful for studying the fast-dynamics of the VSC and its interaction with the grid.

## Model use, assumptions, validity domain and limitations

The model described allows performing EMT studies of the dynamics of a grid-following voltage source converter. It is specially useful in applications where there are fast-transients to be studied, being able to describe phenomena ranging from short-circuits to switching events or even lightning [1].

The assumptions made are:

- The DC side of the converter is considered as an ideal DC voltage source \(E_{DC}\).
- The AC-side of the converter is connected to the grid through an AC filter formed by a resistance \(R\) and an inductance \(L\). The AC voltage in the converter side is \(v_{c}^{abc}\).
- The system is considered to be balanced, and the positive and negative sequence are not considered.
- The synchronization with the grid is controlled by a PLL, and it is done by imposing that the \(v_d = 0\). This design criteria allows to relate active and reactive power with one of the components of the current. It only considers the fundamental frequency.
- The VSC is assumed to be a 2-level converter, meaning that there are 2 IGBTs per phase.

Although it can be used for low-frequency phenomena such as transient stability or inter-area oscillations, the number of calculations to capture the dynamics is much greater than Phasor models, and result in much higher execution times. It is not useful to calculate unbalanced situation as the model is based on the positive sequence. It does not consider harmonics, as it uses a simplified PLL that only takes the fundamental frequency.

## Model description

The model can be described with the following schematic:

As it can be seen, there are several control blocks that act over the converter to determine the operating point. For a Grid Following VSC, these are:

- The Clarke/Park transformation blocks, which convert the electrical variables into the
*\(\alpha\beta\)*and*qd0*reference frames. - The Phase-Lock Loop (commonly referred to as PLL), which tracks the grid voltage and synchronizes the converter with the grid angle.
- The Outer Loop, which provides active and reactive power control by setting a current reference from a power reference.
- The Inner Loop, or Current Loop, which corrects the converter voltage to provide the reference current.
- The modulation block, which models the switching of the IGBTs that create an AC voltage from a DC source using Pulse-Width Modulation (PWM).

A detailed explanation of each block is provided in the following subsections.

### Clarke and Park transformations

Assuming a three-phase balanced system, the electrical variables can be expressed in the *abc* reference frame as:

where \(X\) is the amplitude of the voltage or current, \(\theta\) is the angle of the voltage or current. The Clarke transformation [4] is used to convert the three-phase variables into an orthogonal reference frame. The transformation matrix is given by:

which applied to the *abc* variables in balanced conditions, results in the *\(\alpha\beta0\)* variables:

noting that \(x_0 = 0\) since it is a balanced system. The electrical variables in this new reference are still sinusoidal. It is desirable to have constant valued variables to be able to implement typical PI control over the signal more easily. This is done using the Park transformation [5], converting the *\(\alpha\beta\)* variables into a rotating reference frame. The transformation matrix is given by:

which applied to the *\(\alpha\beta\)* variables, results in the *\(dq0\)* variables:

As it can be seen, the Park transformation is dependent of the angle \(\hat{\theta}\), which is the angle of the rotating reference frame, and it can be different to the angle of the voltage \(\theta\). If the electrical variable is synchronized with the rotating reference frame, then \(\theta = \hat{\theta}\) and \(x_d = 0\).

### PLL

The goal of the PLL is to track the grid frequency and angle, as it is needed to establish the operating points of the converter using the control loops. The design of this controller is detailed in [6]. As stated earlier, when the voltage is synchronized with the reference frame (in this case, the grid), \(v_d = 0\). To perform this tracking, the control applied considers a PI controller, yielding the following control structure:

Using the Park transformation over the grid measured voltages, and assuming a small phase difference between the output of the converter and the grid voltage, the linearization \(v^g_d = E_m \sin(\delta) \approx E_m \delta\) can be applied in order to simplify the closed-loop transfer function for the tunning of the controller. \(E_m\) is the peak value of the grid voltage and \(\delta = \theta - \hat{\theta}\) is the angle difference between the measured and the reference frame angle. The linearized control structure is the following:

Now, the PI controller needs to be tuned in order to provide the desired response. The following closed-loop transfer function models the response of the PLL:

which corresponds to a second-order response, where \(\hat{\theta}(s)\) is the estimated grid angle, \(\theta(s)\) is the voltage angle, \(\zeta\) is the damping factor, \(\omega_n\) is the natural frequency. The PI controller block function is given by:

where \(k_p\) and \(\tau_{PLL}\) denoting the gains of the proportional gain and the PLL time constant, respectively. These parameters can be computed using the following expressions, obtained after working with the expressions of the closed loop transfer functions:

A typical value for the damping ratio is \(\zeta = \frac{1}{\sqrt{2}}\), PLL natural frequency could be set to a given frequency (i.e, 50 Hz, or 1 kHz), depending on the desired response (the higher the frequency, the more aggressive). It is a choice of the user to set the desired values of the controller, setting exactly two of the four parameters (\(\omega_n\), \(\tau_{PLL}\), \(\zeta\), \(k_p\)). The peak voltage \(E_m\) is a parameter given by the utility characteristics.

### Current control

The current control is used to determine the converter voltage that has to be applied in order to maintain the current at the setpoint. The model presented uses the Internal Model Control method (IMC), described in [7], which provides PI controllers tuned in terms of the machine parameters (in this case \(R\) and \(L\)) with the desired response. The control is based on the electric relationship between the variables:

which can be transformed into the *qd* frame to obtain the following equation:

where \(\omega\) is the angular frequency of the grid obtained in the PLL, and \(v_{g}^d = 0\). The block diagram associated to this system is the following:

As it can be seen, there is a coupling between the *q* and *d* components. This can be dealt by the controller by designing a two dimension controller, or by decoupling the components and independently controlling each component. The later approach is the chosen in this model, using the following expression:

where \(\hat{v}^{q}\) and \(\hat{v}^{d'}\) are the controller output voltages. The equations are now decoupled using the expression:

Applying the Laplace transformation and reordering, the following relation holds:

The following schematic represents the closed-loop block diagram for the current loop:

The transfer function of this block diagram, considering \(G_c = K^{icl}_p + \frac{K^{icl}_i}{s}\) is:

where \(i^{qd*}(s)\) is the reference current for *q* or *d* axis, \(i^{qd}(s)\) is the measured current. The controller gains can be selected as \(K^{icl}_p = \frac{L}{\tau_c}\) and \(K^{icl}_i = \frac{R}{\tau_c}\), where \(\tau_c\) is the time constant of the current loop, such that the complete closed-loop transfer function is represented as the following first-order response:

The resulting PI controller is the following:

The converter voltage setpoint obtained from this loop (\(v_c^{qd}\)) is then used to modulate the IGBT pulses and generate the AC voltage from the DC source. However, the modulation block can be omitted in some simplified models, and it can be considered to be directly the actual converter voltage, maintaining the notation without the setpoint indicator (\(*\)). This modulation will be explained in Section 3.6.

### Active and reactive power control

The previous section made use of the current setpoints to control the converter. These setpoints can be determined directly by the user, or they can be obtained from the power setpoints (P*, Q*), which would still come from the user. To derive the controls, firstly the instantaneous power theory [8] is described briefly for the synchronous frame *dq0*.

The voltage and current phasors can be expressed in the *dq0* frame as:

The complex power phasor, as well as the active and reactive power values, can now be obtained with:

As a design choice of the PLL, \(v_d = 0\) to track the grid angle. Then, the expressions for current setpoints can be extracted substituting in the previous equation:

This relationship can be used to calculate directly the current setpoint for a given value of \(v^q\), which could be considered constant if the grid voltage is stable, or it can come directly from the voltage measurements. However, it is not robust when there are transient phenomena or perturbations in the grid voltage. To have a smoother response, a power loop is designed to control the current setpoints using a PI controller. The following block diagram represents the open-loop power control:

In order to tune the PI controller parameters, the closed-loop of the system is considered. In order to have the feedback loop, the power output is calculated including the current loop dynamics and the conversion from current to power using the instantaneous power theory. The following block diagram shows the complete power loop:

As it can be seen, the peak voltage is used as it assumes that the deviations with respect to the nominal will be small, and this is only to have an appropriate tuning of the controller.

Following a similar procedure to the one of the current loop, the closed-loop transfer function of the power loop can be modelled as a first-order system:

where \(\tau_p\) is the time constant of the power loop. The PI controller can be obtained with the use of the time constant of the current loop as:

The time constant \(\tau_p\) will be larger than \(\tau_c\), since the power loop is designed to have a slower response than the current loop.

### Limitations of current

The technical constraints of the VSC can be included in the controls using saturation blocks. Depending on the desired operation mode, the converter can be set to prioritize one of the current components. These operation modes are typically defined by the grid codes, although a possible implementation could be the following:

**Normal operation**: The converter will follow the \(i^q\) component setpoint, prioritizing the active power, and then \(i^d\) will be limited by the operational limits of the converter \(i^d_{max} = \sqrt{I_{max}^2 - \max{i^q, i^{q*}}}\).**Transient or fault operation**: The converter will now prioritize the \(i^d\) component, which will follow its reference, and \(i^q_{max} = \sqrt{I_{max}^2 - \max{i^d, i^{d*}}^2}\).

### Modulation

As explained in the current loop section, the converter voltage setpoint obtained can be considered directly the converter voltage, in what is called an Averaged Model, since it does not consider the switching process. However, a more complete EMT simulation will model the modulation performed to obtain the sinusoidal voltage from the DC source. The modulation will determine the switching state of the 3 pairs of IGBTs (as it is assumed to be a 2-level VSC) in order to produce a given voltage. To do so, the technique used is the Space Vector Pulse-Width Modulation (SVPWM) [9], which can be modelled with the following block diagram:

This technique projects the AC voltage that is desired to generate (which is the setpoint obtained from the control loops) into the \(\alpha\beta\) reference frame. Then, it determines in which of the 6 regions delimited by the voltage vectors of the \(2^3 = 8\) possible configurations of the IGBTs it is enclosed. Since two of the positions correspond to a short-circuit on all the phases, their output voltage will be 0, and they are at the center of the resulting hexagon, belonging to of all the regions. The complete hexagon with a vector projected into it can be seen in the following figure:

As it can be seen, the voltage \(v^{\alpha\beta}\) can be obtained by adding fractions of two of the vectors that delimit the region. The fraction is commonly known as duty cycle \(D_i = \frac{T_i}{T_z}\). The duty cycle of the zero-voltage states can be calculated using the remaining time of the PWM as \(D_0 = D_7 = \frac{1 - D_i - D_j}{2}\), while the other duty cycles have their own formulas to be calculated. Considering the symmetry of the regions, the duty cycles can be calculated referring always to the first region. Let \(D_1\) be the duty cycle of the state with lower angle than \(v^{\alpha\beta}\), and \(D_2\) the duty cycle of the state with higher angle, the following calculations are made starting from the decomposition of the setpoint voltage:

where the floor operation determines the sector of the hexagon depending on the angle of the voltage. The duty cycles can be calculated as:

where \(D_1\) and \(D_2\) are the duty cycles of the vectors that limit the sector. Now, \(D_0\) and \(D_7\) can be easily calculated.

The switching order is important, since it is desirable to have a resulting sine-like wave, while minimizing switching losses. A symmetrical pattern that starts and ends at the ⓪-state is chosen, since it helps to transition between two adjacent periods that have the voltage at two different regions, for instance. To minimize losses, the order of states will be the one that results in a single switch between states, meaning that from the state with switch positions \(000\), the next state will have \(1\) in a single switch, and the other two switches at \(0\). The following table shows all the switching states with their output voltage:

State ID | q1 | q2 | q3 | Va | Vb | Vc |
---|---|---|---|---|---|---|

$$⓪$$ | $$0$$ | $$0$$ | $$0$$ | $$0$$ | $$0$$ | $$0$$ |

$$①$$ | $$1$$ | $$0$$ | $$0$$ | $$\frac{2E_{DC}}{3}$$ | $$-\frac{E_{DC}}{3}$$ | $$-\frac{E_{DC}}{3}$$ |

$$②$$ | $$1$$ | $$1$$ | $$0$$ | $$\frac{E_{DC}}{3}$$ | $$\frac{E_{DC}}{3}$$ | $$-\frac{2E_{DC}}{3}$$ |

$$③$$ | $$0$$ | $$1$$ | $$0$$ | $$-\frac{E_{DC}}{3}$$ | $$\frac{2E_{DC}}{3}$$ | $$-\frac{E_{DC}}{3}$$ |

$$④$$ | $$0$$ | $$1$$ | $$1$$ | $$-\frac{2E_{DC}}{3}$$ | $$\frac{E_{DC}}{3}$$ | $$\frac{E_{DC}}{3}$$ |

$$⑤$$ | $$0$$ | $$0$$ | $$1$$ | $$-\frac{E_{DC}}{3}$$ | $$-\frac{E_{DC}}{3}$$ | $$\frac{2E_{DC}}{3}$$ |

$$⑥$$ | $$1$$ | $$0$$ | $$1$$ | $$\frac{E_{DC}}{3}$$ | $$-\frac{2E_{DC}}{3}$$ | $$\frac{E_{DC}}{3}$$ |

$$⑦$$ | $$1$$ | $$1$$ | $$1$$ | $$0$$ | $$0$$ | $$0$$ |

For instance, if the voltage setpoint is located in the region delimited by states \(⓪/⑦-①-⑥\) as in Figure 9, the switching order would be \(000 \rightarrow 100 \rightarrow 101 \rightarrow 111 \rightarrow 101 \rightarrow 100 \rightarrow 000\), or, if we use state identifiers, \(⓪ \rightarrow ① \rightarrow ⑥ \rightarrow ⑦ \rightarrow ⑥ \rightarrow ① \rightarrow ⓪\). This means that the duty cycles are split in two for all the states except the ⑦-state. The following figure represents state ⑥ of the mentioned pattern:

As it can be seen in Figure 10(a), the pattern needed to generate the \(v^{\alpha\beta}\) AC voltage shown in Figure 9 will change the state of one of its switches at a time and starts and ends at 0 voltage. The states \(000\) and \(111\) are those where all the switches are closed on the same side, short-circuiting the three phases, while for the rest of the cases, there is a voltage division between the isolated phase and the short-circuited couple, as can be seen from the grid equivalent in Figure 10(c).

The result of the algorithm would determine the state of the switches of the converter, and would send to each IGBT the appropiate signal (check Figure 10(b)). This corresponds to the hardware integration, but since the model is used to simulate the system, the averaged output voltage of the converter during a PWM period can be directly calculated using the duty times:

where, for the given example, \(V_1 = E_{DC} e^{j0}\) and \(V_2 = E_{DC} e^{j\frac{\pi}{3}}\), and \(D_1\) and \(D_2\) are the duty cycles calculated for the given voltage setpoint. The output voltage can be then transformed to the *abc* frame.

## Open source implementations

This model has been successfully implemented in :

Software | URL | Language | Open-Source License | Last consulted date | Comments |
---|---|---|---|---|---|

NREL | Link | PSCAD | - | 17/05/2024 | Described in 10.1109/KPEC51835.2021.9446243 |

SimplusGrid | Link | Matlab | BSD 3-clause | 14/06/2024 | ——– |

DPSim | Link | C++ | MPL-2.0 | 14/06/2024 | ——– |

## Table of references

[1] Lacerda, V. A.; Prieto-Araujo, E.; Cheah, M.; Gomis-Bellmunt, O. “Phasor Modeling Approaches and Simulation Guidelines of Voltage-Source Converters in Grid-Integration Studies”, May 2022, IEEE Access, DOI: 10.1109/ACCESS.2022.3174958

[2] Lacerda, V. A.; Prieto-Araujo, E.; Cheah, M.; Gomis-Bellmunt, O. “Phasor and EMT models of grid-following and grid-forming converters for short-circuit simulations.”, October 2023, vol. 223, núm. 109662. DOI: 10.1016/j.epsr.2023.109662

[3] Egea, A.; Junyent-Ferré, A.; Gomis-Bellmunt, O. “Active and reactive power control of grid connected distributed generation systems”. Part of: “Modeling and control of sustainable power systems”. 2012, p. 47-81.

[4] Clarke, E., “Circuit Analysis Of A-c Power System Vol I”, John Wiley and Sons, 1941

[5] Park, R. H., “Two-reaction theory of synchronous machines generalized method of analysis-part I”, AIEE Transactions, Vol. 48, Issue 3, July 1929. DOI: 10.1109/T-AIEE.1929.5055275

[6] Chung, Se-Kyo. “A phase tracking system for three phase utility interface inverters”. IEEE Transactions on Power Electronics, Vol. 15, No.3, May 2000, DOI: 10.1109/63.844502

[7] Harnefors, L.; Nee, H. P. “Model-Based Current Control of AC Machines Using the Internal Model Control Method”. IEEE Transactions on Industrial Applications, Vol. 34, No. 1, January/February 1998, DOI: 10.1109/28.658735

[8] Akagi, H., Watanabe, E., Aredes, M.: “Instantaneous power theory and Applications to power conditioning”. Wiley, Chichester (2007)

[9] Kazmierkowski, M.P., Krishnan, R., Blaabjerg, F.: Control in power electronics. Elsevier, Amsterdam (2002)

Evaluate