*2.2. Working Principle*

Since the electrical frequency is set by the grid former which is usually a SG, the analysis is started from the mechanical behavior of the SG. Under the assumption of the friction absence the rotation motion of SG's rotor can be expressed by:

$$J\frac{d\omega}{dt} = T\_m - T\_{\varepsilon\prime} \tag{1}$$

where *Tm* is the mechanical torque produced by the prime mover and *Te* is the electromagnetic torque applied to the rotor. From the Equation (1) it can be easily understood that the frequency transient depends on the ratio between the torque difference and the inertia. Given a SG, the inertia is fixed and the mechanical torque is provided by a governor with a slow response. Therefore, during a load change which induces an abrupt variation of the electromagnetic torque, the frequency experiences either an over-shooting or a drop in addition to a long recovery process usually accompanied by oscillations due to the low speed of the governor's response.

The working principle of VSG is to compensate the slow response of the mechanical system by injecting or absorbing active power to the grid. The motion equation of SG's rotor is then changed into:

$$J\frac{d\omega}{dt} = T\_m + \frac{\Delta P\_{VSG}}{\omega} - T\varepsilon = (T\_m + \Delta T\_m) - T\_{\varepsilon\prime} \tag{2}$$

where Δ*PVSG* is the compensating power injected by the VSG. This direct compensation is achieved by active power control and the compensated power is then transformed into compensated torque. Consequently, there are three origins of torques influencing the motion of the rotor: the prime mover torque, *Tm*, the virtual mechanical torque Δ*Tm* resulted from the active power of VSG and the electromagnetic torque *Te* given by electric loads.

Differently from VSG, the proposed method aims at damping the frequency oscillations during the transients by means of regulating the reactive power. The motion equation of SG's rotor is thus changed into:

$$f\frac{d\omega}{dt} = T\_m - \frac{f\_{LPF}(P\_{load})}{\omega} = T\_m - f\_{LPF}(T\_c),\tag{3}$$

where the function *fLPF*() stands for low-pass filtering behaviour. The high-frequency attenuation is achieved by additional reactive power absorption or injection which smooths the change of electromagnetic torque.

Figure 1 shows the dynamic equivalent model of SG in the dq rotating frame. All the parameters have been transformed to the stator side. For clarity, the losses and the presence of dampers are ignored. Subscripts *<sup>d</sup>* and *<sup>q</sup>* respectively represent the variables or parameters on d-axis and q-axis; Superscript *<sup>r</sup>* refers to the dq-frame; *Vf* and *if* are the excitation voltage and current; *v* is the terminal voltage of SG; *i* is the armature current; *φ* is the stator flux; *Ll* is the armature leakage inductance; *Lm* is the magnetizing inductance and *Lf l* is the field winding leakage inductance.

d-axis (rotor) equivalent circuit q-axis (rotor) equivalent circuit

**Figure 1.** Equivalent dynamic model of SG seen at stator side in the dq frame set on the rotor.

As is known, the dq terminal voltages of SG are function of the stator flux, of its derivative and of the speed of the reference frame coinciding, at steady state, with the angular frequency. This is expressed, under lossless condition, as:

$$\begin{cases} \boldsymbol{\upsilon}\_d \boldsymbol{r} = \frac{d\boldsymbol{\phi}\_d \boldsymbol{r}}{dt} - \omega \boldsymbol{\phi}\_q \boldsymbol{r} \\ \boldsymbol{\upsilon}\_q \boldsymbol{r} = \frac{d\boldsymbol{\phi}\_q \boldsymbol{r}}{dt} + \omega \boldsymbol{\phi}\_d \boldsymbol{r} \end{cases} \tag{4}$$

Therefore, in symmetric situation, the instantaneous active electric power of SG can be derived as:

$$P\_t = \frac{3}{2} v\_d \,^r \dot{i}\_d \,^r + \frac{3}{2} v\_q \,^r \dot{i}\_q \,^r = \frac{3}{2} \omega (\phi\_d \,^r \dot{i}\_q \,^r - \phi\_q \,^r \dot{i}\_d \,^r) + \frac{3}{2} (\frac{d \phi\_d \,^r}{dt} \, \dot{i}\_d \,^r + \frac{d \phi\_q \,^r}{dt} \, \dot{i}\_q \,^r), \tag{5}$$

which indicates that the output active power of SG is a result of the developed torque and of the rate of change of magnetic stored energy. Hence in the rotating reference frame, the electromagnetic torque can be expressed as:

$$T\_{\varepsilon} = \frac{3}{2} p (\phi\_d{}^r i\_q{}^r - \phi\_q{}^r i\_d{}^r)\_{\prime} \tag{6}$$

where *p* is the number of pole pairs. According to the equivalent circuit shown above, the flux is obtained as:

$$\begin{cases} \phi\_d r = L\_{md}{}^r i\_f - (L\_{ld}{}^r + L\_{md}{}^r) i\_d{}^r \\ \phi\_q r = -(L\_{lq}{}^r + L\_{mq}{}^r) i\_q{}^r \end{cases} . \tag{7}$$

Based on (6) and (7) the electromagnetic torque can be rewritten as:

$$T\_c = \frac{3}{2} p \left( L\_{md}{}^r i\_f - \Delta L\_{mdq}{}^r i\_d{}^r \right) i\_q{}^r,\tag{8}$$

where <sup>Δ</sup>*Lmdq<sup>r</sup>* = (*Lmd<sup>r</sup>* <sup>−</sup> *Lmq<sup>r</sup>* ). The high frequency part of *Te* can thus be expressed as:

$$\hat{T}\_{\varepsilon} = \frac{3}{2}p\left( (L\_{md}{}^{r}\mathbf{i}\_{f} - \Delta L\_{mdq}{}^{r}\mathbf{i}\_{d}{}^{r})\mathbf{i}\_{q}{}^{r} - \Delta L\_{mdq}{}^{r}\mathbf{i}\_{d}{}^{r}(\mathbf{i}\_{q}{}^{r} + \mathbf{i}\_{q}{}^{r})\right),\tag{9}$$

where the over-line symbol represents the low frequency component of the variable while the hat symbol represents the high frequency component. The partial differentials of *T*ˆ *e* respecting to the high frequency currents are:

$$\begin{cases} \frac{\partial \mathcal{T}\_c^-}{\partial i\_d^{r,\tau}} = -\frac{3}{2} p \Delta L\_{mdq}{}^r i\_q^r\\ \frac{\partial \mathcal{T}\_c^-}{\partial i\_q^{r,\tau}} = \frac{3}{2} p \left( L\_{md}{}^r i\_f - \Delta L\_{mdq}{}^r i\_d{}^r \right) \end{cases} \tag{10}$$

Since in (10) the currents are the main variables, vector diagrams are drawn so that the internal current of the SG can be associated to the current that is provided by the ancillary service actuator.

Figure 2a shows the vector diagram of the SG variables under normal generative operation. Two sets of dq-frames: r-dq-frame and c-dq-frame have been drawn respectively according to the rotor position and the coupling point voltage. Therefore, in the following passage, r-d-axis, r-q-axis, c-d-axis and c-q-axis are used in short to refer to the d,q axes oriented on the rotor and on the grid voltage respectively. *E*<sup>0</sup> represents the no-load electromotive force lying on q-axis of rotor (r-q-axis). *θ* is the torque angle and *ϕ* is the power angle. c-dq-frame leads r-dq-frame by (*π*/2 − *θ*) and, *θ* should be an acute angle under stable condition. In case of ohmic-inductive loads, *ϕ* should be an acute angle with the armature current *i* lagging the terminal voltage *v*.

Back to the discussion of *T*ˆ *<sup>e</sup>*, as the magnetizing inductance is proportional to the reciprocal of the magnetic reluctance, the term Δ*Lmdq<sup>r</sup>* in a salient pole machine is positive while in a round rotor machine it is close to zero. In normal generative operation, both *iq <sup>r</sup>* and (*Lmd<sup>r</sup> if* <sup>−</sup> <sup>Δ</sup>*Lmdq<sup>r</sup> id r* ) are positive. Referring to Equation (10), the partial differential of *T*ˆ *<sup>e</sup>* respecting to ˆ*id <sup>r</sup>* is negative for a salient pole rotor and zero for round rotor while the partial differential of *T*ˆ *<sup>e</sup>* respecting to ˆ*iq r* is positive for both salient pole and round rotors. So if we are able to increase ˆ*id r* and decrease ˆ*iq r* , we can attenuate *T*ˆ *<sup>e</sup>* as long as the armature current is located in the first quadrant of r-dq-frame, i.e., r-I. In other words, the target variation of armature current Δ*i* should be located in quadrant r-IV when *T*ˆ *<sup>e</sup>* > 0 and in quadrant r-II when *T*ˆ *<sup>e</sup>* < 0. Without decreasing the active power of the ancillary service actuator, the reactive power can be utilized to provide the low-pass filtering of the electromagnetic torque. As the c-dq-frame is set by the voltage at the coupling point, the current which induces reactive power flow should lie on the c-q-axis. As it is shown in Figure 2, the positive part of c-q-axis locates in quadrant r-II and the negative part in quadrant r-IV. So when a load is connected to the grid, *T*ˆ *<sup>e</sup>* > 0. To attenuate *T*ˆ *<sup>e</sup>*, the ancillary service actuator injects a positive c-q-axis current Δ*iinv* to the grid and thus forces the SG to generate Δ*i*, which is 180◦ shifted from Δ*iinv*, as shown in Figure 2b. Projecting Δ*i* to r-dq-frame, we obtain:

$$\begin{cases} \Delta i\_d \,^r = \Delta i \cdot \cos \theta\\ \Delta i\_q \,^r = -\Delta i \cdot \sin \theta \end{cases} . \tag{11}$$

The change of flux can be calculated as:

$$\begin{cases} \Delta \phi\_d r = -(L\_{ld}r^r + L\_{md}r^r) \cdot \Delta i \cdot \cos \theta\\ \Delta \phi\_q r = -(L\_{lq}r^r + L\_{mq}r^r) \cdot \Delta i \cdot \sin \theta \end{cases} \tag{12}$$

indicating both fluxes in r-d-axis and r-q-axis having been weakened. The flux change depends on the amplitude and polarity of Δ*i*, and the torque angle *θ*. The removed high-frequency part of the electromagnetic torque can be obtained:

$$\hat{\rho}\left(1-\alpha\right)\hat{T}\_{\varepsilon} = \mu\frac{3}{2}p\left(\Delta L\_{mdq}{}^{r}\mathbf{i}\cdot\Delta i\cos\left(2\theta+\varphi\right) + L\_{md}{}^{r}\mathbf{i}\_{f}\Delta i\sin\theta\right),\tag{13}$$

where *α* is the attenuation coefficient of the electromagnetic torque; *μ* is the percentage of Δ*i* in high frequency domain. The faster is the ancillary service control loop, the higher becomes the value of *μ* . In the case of a round rotor, it's only *θ* that determines the contribution of the ancillary service while in the case of salient pole rotor, the load current and the power angle matter as well. The way the ancillary service works under no-load condition is similar to changing the polarity of the controlled current Δ*iinv*.

**Figure 2.** Vector diagrams on dq-frames set by SG and coupling point voltage.

Based on the explanations above, the frequency regulation process is summarized by the block diagram shown in Figure 3. The grid former sets and regulates the frequency of the network. Since the electromagnetic torque is a result of the excitation current and the load current, changing a part of the load current will lead to changes in the electromagnetic torque. According to Figure 2, it is possible to refer the q-axis current of the PV inverter to the same reference system of the rotor. From the comparison of the two diagrams reported it can be said that even if this q-axis component of the PV inverter current calls for only reactive power from the PV plant, it still influences the electromagnetic torque seen by the SG. In order to obtain a good result, the response speed of this control loop must be faster than that of the SG exciter. Therefore, in the PV inverter a *Q(f)* control is implemented in order to smooth the electromagnetic torque transient without changing the active power injected in the grid. In particular, a linear relationship between reactive power and frequency deviation is implemented. It is:

$$Q = k(f^\* - f) \tag{14}$$

where *f\** is the reference frequency and *k* is tuned considering the maximum reactive power and the maximum allowed frequency variation. It is worth noting that, in a grid with distributed PV systems, the service can be performed by different devices, each one acting on the basis of its power rating. To summarize, the VSG method temporarily compensates the blanking period of the mechanical power unlike the proposed method which works on the transient of the electromagnetic torque.

**Figure 3.** Frequency regulation algorithm of concerning a synchronous generator and the connected loads including both the VSG method and the proposed method.
