An Optimal Power Control Strategy for Grid ‐ Following Inverters in a Synchronous Frame

: This work proposes a power control strategy based on the linear quadratic regulator with optimal reference tracking (LQR ‐ ORT) for a three ‐ phase inverter ‐ based generator (IBG) using an LCL filter. The use of an LQR ‐ ORT controller increases robustness margins and reduces the quadratic value of the power error and control inputs during transient response. A model in a synchronous reference frame that integrates power sharing and voltage–current (V–I) dynamics is also proposed. This model allows for analyzing closed ‐ loop eigenvalue location and robustness margins. The proposed controller was compared against a classical droop approach using proportional ‐ resonant controllers for the inner loops. Mathematical analysis and hardware ‐ in ‐ the ‐ loop (HIL) experiments under variations in the LCL filter components demonstrate fulfillment of robustness and performance bounds of the LQR ‐ ORT controller. Experimental results demonstrate accuracy of the proposed model and the effectiveness of the LQR ‐ ORT controller in improving transient response, robustness, and power decoupling.


Introduction
Due to the inherent low inertia present in voltage-source inverters (VSI), microgrid control is becoming an important object of study nowadays in order to improve penetration of renewable energy. Microgrid control is generally defined by levels. In [1], the authors present a hierarchical scheme that divides VSI controllers in different levels. First, voltage-current (V-I) control level is used to regulate the VSI current and voltage waveforms according to a specific reference without having significant harmonic distortion [2]. The power control level, or primary control level, regulates VSI power sharing to the microgrid. This power sharing could occur in grid-connected or islanded mode. For the grid-connected mode, the power grid imposes the voltage amplitude and frequency in the point of common coupling (PCC). In this mode, the VSI behaves as grid-follower. In islanded mode, the voltage and frequency in the PCC is determined by each of the generators in the microgrid. Typically, droop control is used in this control level because it allows to distribute power generation among VSI proportionally without communication. Higher control levels are in charge of maintaining microgrid's power quality and regulating power sharing from a microgrid to the power grid or even another microgrid.
Droop control is used with proportional-resonant (PR) or proportional-integral (PI) controllers to regulate power sharing as shown in Figure 1 [3,4]. To share power from the inverter to the main grid, the droop Equations (1) and (2) are used: ω = ω 0m P -P 0 (1) E = E 0n Q -Q 0 (2) where ω 0 , E 0 , P 0 , and Q 0 are the operating frequency, amplitude, and reference values for the active/reactive power, respectively. Coefficients m and n are known as the droop gains. As analyzed in [2] and [5], the stability of the grid-connected IBG is mainly determined by the primary control level parameters. These parameters are the cut-off frequency of the power calculation lowpass filter and the coefficients m and n. Due to the fact that droop controllers do not require a communication link between generators, this control method has become popular for VSI primary control. However, droop controllers are based on the assumption that active and reactive power are directly related to VSI output voltage amplitude and frequency. In addition, droop controllers rely on a low-pass filter that is used to separate the dynamics from the V-I and primary control levels. Thus, some common issues have been widely reported for droop controllers such as performance fulfilment [6][7][8], dependency on line impedance values [1,3,9], and frequency and voltage deviations from the nominal values [3].
Many approaches for improving droop control performance have been developed [2,[10][11][12][13][14][15][16][17]. Most of them are based on adding supplementary loops to improve transient response, power quality, harmonic power sharing, or robustness. The gain selection of the supplementary loops is commonly based on heuristic methods and do not rely on an open-loop IBG model to use modern control design methods. Closing several loops of feedback control and designing with heuristic methods does not guarantee robustness of the closed-loop system [18].
For grid-following IBG control, it is common to implement output current controllers. Some of the most relevant publications in this area may be found in [19][20][21][22][23][24][25][26][27][28]. The open-loop state-space models for these controllers allow the use of modern control methods such as LQR, Kalman filters, or robust controllers based on H ∞ theory. However, these models do not include power sharing dynamics and rely on a higher control level to regulate active and reactive power.
In this work, a state-space model that integrates V-I and power sharing dynamics for grid connected inverters is presented. This model is developed in a synchronous d-q frame to improve active and reactive power decoupling. The grid voltage is modeled as a constant vector that is included as an external known disturbance. In addition, the active and reactive power dynamics are included in the output equation of the state-space system. This type of model allows for using modern control analysis techniques such as singular value diagrams, Nyquist diagrams, root loci, and robustness margins estimations.
An optimal power sharing controller that minimizes a power tracking performance index is also presented. This tracking index measures the active and reactive power deviations and also measures the energy in the control inputs. The novelty of this work is based on how the nonlinear dynamics of the active and reactive power were linearized in the output of a state-space model in the dq frame. This allowed development a controller that minimizes the tracking error in the output of this statespace model. The methodology used in this work can be extended to other control methods such as H or model predictive control (MPC). Furthermore, this approach has many advantages over other approaches found in literature: First, this approach is intended to minimize the energy in the states and inputs, which means better transient response, reduced tracking error, and fewer power losses during transient responses. Second, the use of an LQR controller has many robustness properties regarding gain and phase margins as shown in [18]. Third, the controller is effective in reducing active and reactive power coupling. Finally, this approach does not use resonant filters that may affect sensitivity and robustness under parameter variations. The linear quadratic regulator with optimal reference tracking (LQR-ORT) controller was designed to meet certain robustness and performance margins under uncertainties in the LCL filter components. Hardware-in-the-loop (HIL) simulations and experimental results validate the results of this approach compared to a classical PR-Droop controller found in the literature. This work is an extension of [29] in the sense that it includes HIL simulations under component variations, experimental results in a physical setup, and deeper analysis and conclusions.
Section 2 shows the mathematical model in the dq frame that was used to compute the LQR-ORT controller. The LQR-ORT mathematical development is presented in Section 3. Section 4 presents the simulation and experimental results divided in three subsections: robustness and stability analysis, simulation results using HIL tools, and experimental results in a real testbench. Finally, the conclusion and future work are presented in Section 5.

Mathematical Model
The mathematical model is based on the circuit shown in Figure 2. The output of a three-phase inverter E is connected through an inductor-capacitor-inductor (LCL) output filter to a stiff voltage source V g that represents the main grid. Input inductor current, capacitor voltage, and output current are denoted by I l , V c , and I o , respectively. The state-space model of this circuit for each phase in the ABC frame is given by

Ea Eb Ec
The main grid voltage V g is assumed as a balanced three-phase signal with an amplitude of 120V RMS and an angular frequency ω c 2π60Hz. The state-space model (3) is transformed to a synchronous frame using the well-known dq transformation as follows [30]: w dq =T dq w abc (4) where w abc w a w b w c T is some vector in the ABC frame representing each state variable and The state-space model of the inverter in the dq frame is shown in (6). When T is synchronized with the main grid, V g becomes static with a constant value V gdq V gd 0 T , where V d represents the peak amplitude of the main grid voltage.
The output of the state-space model is used to represent the active and reactive power received by the main grid as follows: Formulating the inverter model in the dq frame allows for expressing active and reactive power in the output equation using linear terms under nominal conditions in the main grid. This implies that not only can an optimal controller be computed to regulate power sharing but also modern robustness and stability assessment methods can be used to analyze power dynamics.
It is also important to remark that the system (6) must be discretized in order to implement it physically. Thus, the state vector must be augmented using a delay or integrator transfer function to account for the delay caused by the PWM switching [31]. The discrete-time integrator also allows for reducing the steady-state error in the closed-loop system. The resulting systems is given by where X x dq E i T , T s is the sampling period, and the upper bar ∎ represents the discrete-time transformation. The auxiliary integral of the input is represented by E i . The discrete-time state-space system can be rewritten as follows: The output matrix C is given by

Discrete LQR-ORT Controller Design
The complete scheme of the LQR-ORT controller is presented in Figure 3. The LQR controller K d is obtained using a modified cost function that weights the tracking error and control input. The use of a modified cost function requires the computation of an auxiliary optimal reference tracking (ORT) matrix K ν ν to solve the optimization problem. Finally, since the classic LQR problem does not consider the influence of external disturbances, the superposition principle is used to account for the power contribution of V dq . Superposition can be applied because the grid-following inverter was expressed in (6) as a linear state-space model that not only considers V-I dynamics but also include active and reactive power computations.

Computation of Suboptimal LQR Controller
Unlike classic LQR approaches, the LQR controller in this work must achieve a non-zero final state [18]. To achieve this, the power tracking error is defined by e dq k = CX[k]-r k (11) where r k is the reference for the LQR controller and X k is the augmented state vector defined in (8). The discrete LQR-ORT cost function is given by [18]: where S p and Q p are both symmetric and positive semi-definite weighting matrices and R p is a symmetric positive definite weighting matrix. Note that unlike the classic LQR cost function, (12) includes only input and error signals and does not include the state vector X k . To solve this minimization problem, the modified discrete algebraic Riccati equation (DARE) must be solved [18]: The suboptimal controller matrix K d is given by

Optimal Reference Tracking Matrix
The reference signal r[k] introduces an additional equation to the optimization problem similar to (13). This equation is solved offline to obtain a control law that minimizes (12) [18]: where is an auxiliary matrix similar to S p . Assuming a step reference signal r k , and solving (15) with infinite horizon such that ν k ν k 1 : For the LQR-ORT, the control law is given by [18] or, in a compact form: where The product K ν ν is the optimal reference tracking matrix (ORT). As shown in Figure 3, this matrix transforms a vector in the units of r k to a vector in the units of E dq k such that (12) is minimized.

Main Grid Power Contribution Calculation Using Superposition Principle
As V gdq is not considered in (12) to compute the LQR-ORT controller, its effects on the injected power must be subtracted from the raw reference signal P ref Q ref T to obtain the net power reference r k as shown in Figure 3. Thus, the superposition principle must be applied to the closed-loop system: To analyze the power contribution of V gdq , the closed-loop system (19) must be simulated with r k 0 0 T . The power contribution of V gdq is computed using the expression where I ̿ od and I ̿ oq are the output current values when (19) reaches steady state with nominal values of V gdq . Since Y V and K ν ν are computed offline based on ideal components, there may be slight deviations in the experimental steady-state output values. To avoid these deviations, the integral of the power error is added to r k as in Figure 3. This integral is calculated using a low-gain K s to not affect stability margins nor transient response. The net reference R z is then defined as follows: where R z Ζ r k , with Ζ • being the z-transform operator. Terms P and Q represent the unfiltered measured power injected to the main grid.

Simulation and Experimental Results
For this section, the parameters shown in Table 1 were used. To perform the dq transformation and grid synchronization, a PLL-SOGI with parameters K SOGI , K pPLL , and K iPLL was implemented [32]. The state-space model (22) was obtained by substituting the parameters from Table 1 in (6). Then, the system was discretized and augmented with integrators using (8).  The values of the weighting matrices Q p and R p were selected so that the closed-loop system reaches steady state in less than 0.5s with an overshoot less than 10%. The following state feedback controller was obtained using (13) and (14): The desired refence was selected to be a constant vector P ref Q ref T . Using (16), the optimal tracking matrix K ν ν was obtained: K ν ν= 117.9714 11.5883 11.5883 -117.9714 .
Outer integrator gain K s was selected to reduce steady-state error such that closed-loop dynamics and stability margins were not affected.

Robustness and Stability Analysis
The continuous LQR controller has guaranteed robustness properties such as infinity gain margin and a minimum phase margin of 60° [18]. However, these margins become reduced when the LQR controller is discretized. Studies performed in [33] and [34] show that minimum robustness margins for the discrete LQR are reduced depending on many factors such as eigenvalue location, controllability, and observability. To perform robustness and stability analysis on the LQR-ORT controller, the open-loop system L z K z G z shown in (25) was used.
Stability margins were calculated using the disk margin method [35]. The disk margin method is used for estimating structured robustness under multiplicative uncertainties for MIMO systems. The disk-based margins are calculated considering all loop interactions and frequencies.
Thus, the open-loop system L showed a gain margin of 12.03 dB and a phase margin of 52.23°, which is appropriate for inverter control applications.
From (19), it can be inferred that the stability of the power contribution of V depends on the eigenvalue locations of the closed-loop state matrix A T -B T K d . Thus, the stability of the complete closed-loop system is assessed by analyzing the return difference I L -1 , which determines the closed-loop eigenvalues.
The operator λ • refers to the eigenvalue computation.
To assess robustness against parameter variations, the components in the LCL filter were defined as stochastic elements with a uniform variation of ±65% around parameters shown in Table 1. Thus, a Monte Carlo stability test was performed with 50 random instances of L based on parameter variations using the same controller K d [36]. This way, all interactions between parameter variations were evaluated instead of varying one parameter at the time.

HIL Experimental Robustness Assessment
To assess performance robustness, a real-time hardware-in-the-loop (HIL) experiment was performed. The LQR-ORT performance was compared against the classical proportional-resonant (PR) droop controller developed in [13]. The LQR-ORT controller and the PR-Droop controller were implemented in a dSPACE SCALEXIO real-time simulation platform.
The general scheme of the HIL experiment is shown in Figure 5. The circuit shown in Figure 2 was implemented in an OPAL-RT OP5700 real-time simulator using IGBT transistor models with a PWM switching frequency of 10 kHz. Each of the 50 component variations were programmed in the OP5700 in order to assess performance robustness under different component scenarios in a hardware-in-the-loop experiment (HIL).  The dSPACE and the OP5700 were physically connected as shown in Figure 6. Step response robustness under component variations was assessed and summarized in Table 2   After a component variation of -42% (ID 28), the PR-Droop controller is more susceptible to becoming unstable than the LQR-ORT. Furthermore, the PR-Droop controller becomes completely unstable after a variation of 58.6% (ID 42), whereas the LQR-ORT becomes completely unstable after a variation of 62.7% (ID 49).  For scenario 41, The LQR-ORT transient response remains robust with some coupling between active and reactive power, whereas the PR-Droop response becomes more oscillating and the coupling increases. Finally, for scenario 42, the LQR-ORT shows a slight increase in switching noise and the PR-Droop becomes unstable. These results demonstrate that the LQR-ORT performance is more robust for component variation than the classic PR-Droop controller.

Experimental Results
Experimental results were obtained using the setup shown in Figure 8. This setup uses four Danfoss 2.2 kVA inverters with LCL filters and four sensor boxes with voltage and current LEM sensors. These four inverters may be dynamically connected to the AC bus. The AC bus may be also dynamically connected or disconnected from the main grid using solid-state relays handled with a PLC. To implement control algorithms, a dSPACE 1006 simulator was used to read signals from the sensor boxes and send the 10 kHz PWM pulses via optical fiber.   Figure 9. First, the inverter started without injecting energy to the main grid. A step reference of 300 W and 200 Var was set at t 1 = 0.35 s and t 2 = 1.05 s, respectively. The LQR-ORT shows lower settling time, less noise, and a smoother transient response under a step reference compared to the PR-Droop controller. In addition, the LQR-ORT controller shows a negligible steady-state error compared to the PR-Droop controller. In addition, at t 1 and t 2 , the LQR-ORT controller shows better decoupling compared to the PR-Droop controller.
The decoupling of the LQR-ORT controller is produced by the transformation and the intrinsic robustness properties of the LQR controllers. In addition, the PR-Droop controller has less decoupling because droop curves are not completely independent [5]. The normalized cost was calculated using (12) divided by the highest achieved cost during the simulation. The normalized cost of the PR-Droop controller is about 2.92 times higher compared to the LQR-ORT controller. This implies that the LQR-ORT controller spends less energy tracking reference signals.

PR-Droop LQR-ORT
To evaluate the performance of the LQR-ORT controller under unbalanced and nonlinear loads, the scheme shown in Figure 10 was implemented. This scheme used a solid-state demultiplexer symbolized as "switch 2" that selected between linear balanced, linear unbalanced, and nonlinear loads. The linear load was selected to be an RL series circuit with R = 171.42 Ω and L = 0.4571 H. The linear unbalanced load was selected as an RL series circuit with Ru = {171.42, 200, 600} Ω and L = 0.4571 H. Finally, for the unbalanced load, a three-phase noncontrolled rectifier with an RLC parallel circuit with RNL = 1200 Ω, CNL = 100 μF, and LNL = 2 mH was used.  The results of this experiment are shown in Figure 11. First, the inverter injected 400 W and 400 VAr to the main grid with the linear balanced load connected to the output of the inverter (Figure 11 a,b). At this time, the output current of the inverter had a Total Harmonic Distortion (THD) of 10.8% and the balanced linear load had a THD of 6.71%. At t = 0.7 s, the unbalanced load was connected. This generated a small disturbance in the active power, which was restored in less than 0.2 s. In addition, the THD of the output current and the load decreased to 10.7% and 6.55%, respectively (Figure 11c). The low disturbance in the injected power and the decrease in the THD indicate that the LQR-ORT controller is robust under unbalanced loads. Finally, at t = 2.5 s, the nonlinear load was connected. This generated a slightly larger disturbance in the active power, which was restored in less than 0.2 s as well. In addition, the THD of the output current increased to 10.98% and the load current THD increased to 126.02%. (Figure 11d). It can be noticed that the THD of the output current did not have considerable increase under nonlinear load conditions. Despite the changes in the load conditions under nonlinear or unbalanced loads, the injected power of the LQR-ORT remains accurate without distortion.

Conclusions
The LQR-ORT controller presented in this work yields a better transient response and higher decoupling compared to the classical PR-Droop control approach as can be seen in the experiment results. The model presented in this work integrates V-I and power sharing dynamics in a single state-space model. Using this new model allows performing modern analysis methods of stability and robustness. Stability and robustness analyses show that the LQR-ORT controller has robust performance and stability under uncertainties in components and multiplicative uncertainties. The robustness against component variations is important for heavy duty applications, where environmental conditions may affect component specification through time. It is also important to remark that, unlike the classic PR-Droop controller, the LQR-ORT controller does not require lowpass filters to perform power calculation. Thus, the power dynamics are not separated from voltagecurrent dynamics allowing to obtain smoother and faster transient responses.