*Article* **Proportional Resonant Current Control and Output-Filter Design Optimization for Grid-Tied Inverters Using Grey Wolf Optimizer**

#### **João Faria, João Fermeiro, José Pombo, Maria Calado and Sílvio Mariano \***

Instituto de Telecomunicações, Universidade da Beira Interior, Covilhã 6201-001, Portugal; joao.pedro.faria@ubi.pt (J.F.); fermeiro@ubi.pt (J.F.); jose.pombo@ubi.pt (J.P.); rc@ubi.pt (M.C.) **\*** Correspondence: sm@ubi.pt; Tel.: +35-127-532-9760

Received: 4 March 2020; Accepted: 10 April 2020; Published: 14 April 2020

**Abstract:** This paper proposes a new method for the simultaneous determination of the optimal control parameters of proportional resonant controllers and the optimal design of the output filter of a grid-tied three-phase inverter. The proposed method, based on the grey wolf optimization (GWO) algorithm, addresses both optimization problems as a single process to achieve a better system frequency response. It optimizes the unknown parameters by using a fitness function to find the best trade-off between the following fundamental terms: the harmonic attenuation rate; the power loss, through the damping resistor; and the current tracking error in the stationary frame, ensuring the system and grid stability. To validate the proposed optimization methodology, two case studies are considered with different output filter topologies with passive damping methods. The results obtained from the proposed optimization procedure were analyzed and discussed according to the fitness function terms.

**Keywords:** grid-tied inverter; grey wolf optimizer; PR controllers; LCL filter; passive damping

#### **1. Introduction**

The over-exploitation of non-renewable natural resources has led an overall environmental degradation on the planet. A suitable alternative solution to mitigate the environmental degradation on the planet is the use of renewable energy sources [1,2]. Nowadays, solar and wind energy are some of the most attractive renewable energy sources for electrical energy production [3]. However, to correctly accomplish the connection of this type of renewable production to the electrical grid, it is necessary to use a grid-tied inverter [4]. There are some essential factors to ensure that the coupling between the inverter and the electrical grid is carried out efficiently and meets the specified standards [5]. These factors can be roughly divided into three categories: control structures, control parameters optimization, and hardware configuration [6]. Different control structures have been applied and can be divided into linear or non-linear structures. The most commonly used controllers with a nonlinear control structure are hysteresis controllers, predictive controllers, and deadbeat controllers [7]. Hysteresis controllers are widely used because of their characteristics: simple implementation, low cost, and fast dynamic response [8,9]. However, these controllers have the disadvantages of introducing harmonics into the current shape. Furthermore, they operate with a variable switching frequency, making the output filter design more complex [10].

Predictive controllers estimate the future value of the output current based on the previous current value. These controllers provide a more precise control and lower current shape distortion. However, they require a detailed model of the system and its implementation is more complex [11]. In addition, when model plant mismatches are presented, this will influence the control accuracy and a significant performance degradation is observed [12]. Deadbeat controllers provide fast dynamics by forcing the

system's response to follow the current or voltage reference in the smallest number of time steps [13]. The deadbeat controllers require a detailed model plant and a higher sampling rate, and are very sensitive to disturbances on the system's inherent parameters.

Regarding linear control structures, the most widely used controllers found in the literature are the proportional integral (PI) controllers and proportional resonant (PR) controllers [7]. PI controllers are quite popular for their stability, efficiency, and good dynamic response to reference power change and unbalanced grid faults conditions [14]. However, when applied to the stationary frame, this type of controllers does not have the ability to follow a sinusoidal reference without a steady-state error [11]. To use this type of controller, it is necessary to transform the system variables into the synchronous frame, which requires a large amount of trigonometric calculations.

To avoid the system variables' transformations to the synchronous frame, PR controllers are used, providing a high gain around the resonance frequency, enforcing a zero steady-state error. Consequently, they present a faster control response, a simpler control structure, and a good capability to compensate harmonics components [15]. Furthermore, it is possible to combine PR controllers with selective harmonic compensators (HCs) to fulfill the constraints established by the IEEE-519 and IEEE-1547 standards. Further, to increase the domain stability, in the case of grid frequency deviations, several modifications to PR controllers have been proposed [7,16]. There are several methods in the literature for designing these controllers [17]. However, few studies address this design as an optimization process (tuning).

Indeed, optimization of control parameters is a fundamental aspect to maximize the efficiency and robustness of the system. Through this optimization process, it is possible to guarantee the stability of the system and, at the same time, improve its dynamic response in terms of overshoot, oscillation, rising, and settling times. Many conventional, statistical, and metaheuristic methods have been used to optimize the controller parameters. However, in recent years, the metaheuristic methods have emerged as a competitive approach owing to their characteristics. Therefore, metaheuristic algorithms, such as Cuckoo search optimization algorithm (CS) [18], grey wolf optimization algorithm (GWO) [19], fruit fly optimization algorithm (FOA) [6], grasshopper optimization algorithm (GOA) [20], bat optimization algorithm (BAT) [21], particle swarm optimization algorithm (PSO) [22], salp swarm optimization algorithm (SSA) [23], and whale optimization algorithm (WOA) [24], have been widely applied to optimize the controller parameters.

Another essential aspect to suppress the high-order harmonics introduced by the pulse-width modulation (PWM) technique used in grid-tied inverters is the output filter design. Different passive output filter topologies are used [25]. The *L* output filters are first-order filters that allow an attenuation of 20 dB/dec. However, this type of output filter has poor performance at higher frequency components. In this way, a large inductance is required to limit the high frequency switching ripple, which results in a bulky and expensive passive filter [26]. By including a capacitance (C), it is possible to obtain a second-order output filter (*LC*) that allows an attenuation of 40 dB/dec. This type of output filter has higher efficiency, lower cost, and smaller dimensions. The *LCL* output filters are third-order filters that allow an attenuation of 60 dB/dec and are a standard solution for grid-tied inverters. When compared with the other two, this type of filter achieves greater attenuation of high frequency components. However, the *LC* and *LCL* output filters have the disadvantage of introducing a resonance frequency in the system, which can cause distortion in the output current shape and, at the worst-case scenario, loss of stability.

To mitigate this disadvantage, several passive and active damping methods have been proposed in the literature. Passive damping methods consist in introducing passive elements in the filter structure and are classified in three groups: series passive damping (SPD), parallel passive damping (PPD), and complex passive damping (CPD) [27]. These damping methods have less control complexity and are more reliable, however, they introduce additional losses. On the other hand, active damping methods are more efficient, but require more complex control, being more selective in their action; typically need extra sensors; and are more sensitive to parameter uncertainties [28]. As a result, designing output filters and the corresponding damping method is a complex task because efficiency and damping effect are antagonistic and interrelated goals. There are several methods in the literature based on analytical solutions, simple approximations, and numerical and metaheuristic methods to obtain the *LCL*-filter configuration fulfilling the grid requirements while incurring minimal energy storage and losses, as well as total harmonic distortion (THD) [29–33]. In [30], the *LCL* filter elements were optimized for minimum energy stored using an analytic solution. In [32], an optimal design of the *LCL* filter based on a analytic solution was proposed. In [31], simple approximations were used to calculate the values of the *LCL* filter elements and minimize the power losses. In [33], a combination of partial direct-pole-placement and differential evolution algorithm was adopted to determine basic parameters of the proportional resonant controller for the grid-tied inverters using the *LCL* filter. In [34], an multiobjective evolutionary algorithm was used to design an *LCL* filter with minimum inductance cost, maximum harmonic attenuation rate, and best current tracking effect.

This paper proposes a new method, based on the GWO optimization algorithm, to determine in a single optimization process the optimal parameters of the PR current controllers and the design of the output filter. The proposed method addresses both optimization problems as a single process, to achieve a complete symbiosis and a better frequency response of the whole system. In addition, the fitness function considered tries to achieve an agreement between the fundamental terms that maximize the system efficiency. The proposed method considers the system and grid stability constraints to maximize the harmonic attenuation rate, minimize the power loss through the damping resistor, and optimize the current tracking error. To validate the proposed methodology, two case studies were considered, with different output filter structures. The first case study was carried out with a series passive damping (SPD) topology, commonly found in the literature, for comparison purposes. The second case study consists in complex passive damping (CPD) topologies, as the design of the output filter is a complex process and there is no optimal paradigm to do that. The simulation environment Matlab/Simulink® was used to carry out the simulations. The results obtained from the proposed optimization procedure are analyzed and discussed.

This paper is organized as follows. Section 2 presents the control schemes used in grid-tied inverters, emphasizing the current controllers and different output filters structures. Section 3 describes the proposed methodology, namely, the output filter topologies used, the implemented current controller, the implemented optimization algorithm, and the conditions of the optimization process. Section 4 presents the results obtained from the proposed optimization procedure. Section 5 concludes the paper and discusses the achieved results.

#### **2. Control Schemes**

In order to ensure the correct operation of a grid-tied inverter, a robust and effective control is necessary, which guarantees compliance with all operating standards for this type of converter [5]. However, despite being transversal to all grid-tied inverters, this type of control is highly complex and, therefore, has been studied with great interest by the scientific community. Figure 1 shows the main control schemes that are used in grid-tied inverters. These control scheme can be divided in four groups: in a first group, there is maximum power point tracking (MPPT), which controls the DC-DC converter responsible for extracting the maximum power from endogenous and renewable sources [35]; the second group consists of the voltage control of the DC bus. This controller is responsible for controlling the voltage on the DC bus, ensuring the energy balance of the system at any instant [36]; in a third group, there is a current control that ensures that the current injected to the electric grid follows the specified reference; finally, in a fourth group, there is a control scheme associated to the synchronism with the electrical grid and responsible for extracting its voltage characteristics [37].

**Figure 1.** Main control schemes associated with a grid-tied inverter. MPPT, maximum power point tracking; PLL, phase-locked loop.

To ensure compliance with the standards specified in [5], namely the total harmonic distortion (THD), it is essential to optimize the current controller and the design of the output filter. The current controllers and the output filters most widespread in the literature are presented below.

#### *2.1. PR Current Controller*

A well-established solution in the literatures is the use of PR controllers, illustrated in Figure 2. These controllers are characterized by only having a high gain in their resonance frequency, allowing it to achieve a zero steady-state error in the stationary frame.

**Figure 2.** Block diagram of the proportional resonant (PR) current controller. PI, proportional integral; PWM, pulse-width modulation.

The ideal transfer function of PR controllers is expressed by Equation (1), where *wn* is the resonant frequency of the controller and the parameters *kp* and *kr* are the proportional and resonant gains, respectively.

$$H(\mathbf{s}) = k\_p + k\_r \frac{\mathbf{s}}{s^2 + w\_n^2} \tag{1}$$

In Figure 3, it is possible to see a comparison of the frequency responses of PI and ideal PR controllers. Regarding the PI controllers, it is possible to verify that the gain of the PI controller is inversely proportional to the frequency, losing the ability to cancel the steady state error with increasing frequency [38]. PR controllers have a high gain around the resonance frequency and their bandwidth depends on the value of *kr*-a small value creates a very narrow band, while a large value of *kp* will cause a larger band around the resonance frequency.

**Figure 3.** Frequency response of PI and ideal PR controllers, with *kp* = 5, *ki* = 800, *kr* = 800, and *wn* = 214 rad/s.

To avoid stability problems resulting from the high gain in the resonance frequency, the non-ideal transfer function of the PR controllers is used, expressed by Equation (2). In this transfer function, the expression *wc wn* is assumed, where *wc* is the bandwidth around the resonance frequency *wn*.

$$H(\mathbf{s}) = k\_p + \frac{2k\_i(w\_\mathbf{c}\mathbf{s} + w\_\mathbf{n}^2)}{\mathbf{s}^2 + 2w\_\mathbf{c}\mathbf{s} + w\_\mathbf{n}^2 + w\_\mathbf{c}^2} \approx k\_p + \frac{2k\_i w\_\mathbf{c}\mathbf{s}}{\mathbf{s}^2 + 2w\_\mathbf{c}\mathbf{s} + w\_\mathbf{n}^2} \tag{2}$$

Using Tustin's approximation with pre-warped frequency [39] to discretize the system expressed by Equation (2), that is, considering *<sup>s</sup>* <sup>=</sup> *wn tan*- *wnTs* 2 *<sup>z</sup>*−<sup>1</sup> *<sup>z</sup>*+<sup>1</sup> , we get the following:

$$
\underbrace{\overbrace{\begin{array}{c} 1 \\ 2 \end{array}}^{\text{L}}}\_{k\_l}
$$

$$
H(\mathbf{s}) = k\_{\mathcal{V}} + \left(\frac{b\_0 + b\_1 z^{-2}}{a\_0 + a\_1 z^{-1} + a\_2 z^{-2}}\right) \tag{3}
$$

where

$$b\_0 = 2k\_r w\_c k\_t \tag{4}$$

$$b\_1 = -2k\_r w\_c k\_t \tag{5}$$

$$a\_0 = \mathcal{K}\_t^2 + 2w\_0k\_t + w\_n^2 \tag{6}$$

$$a\_1 = 2w\_n^2 - 2k\_t^2\tag{7}$$

$$w\_2 = K\_t^2 - 2w\_\varepsilon k\_t + w\_n^2 \tag{8}$$

In Figure 4, we can see the frequency response of the non-ideal PR controller in the continuous and discrete domains. As can be seen, there is a high bandwidth around the resonance frequency, allowing to increase its stability and robustness in situations of grid frequency deviations. Furthermore, the gain is now finite, but still relatively high for enforcing a zero steady-state error.

**Figure 4.** Frequency response of the non-ideal PR controller in the continuous and discrete domains, with *kp* = 5, *kr* = 800, *wn* = 314 rad/s, and *wc* = 10 rad/s.

#### *2.2. Output Filter Topologies*

Several output filter topologies have been documented in the literature to improve the coupling between the inverter and the electric grid, by limiting the current harmonics injected in the point of common coupling (PCC) [40]. The most common output filters are the *L*, *LC*, and *LCL* filters, illustrated in Figure 5.

**Figure 5.** Representation of the output filter structure of the grid-tied inverter.

The output filters *L*, where *Z1* is finite, *Z2* is infinite, and *Z3* equal to zero, are first order filters with an attenuation of 20 dB/dec. The ideal transfer function of this type of filter is given by Equation (9).

$$H(s) = \left. \frac{i\_{grid}}{u\_{inv}} \right|\_{\text{ }u\_{grid}} = 0 \quad = \frac{1}{Ls} \tag{9}$$
 
$$z\_{grid} = 0$$

The output filters (*LC*), where *Z1* is finite, *Z2* is finite, and *Z3* equal to zero, are second-order filters that allow an attenuation of 40 dB/dec. This type of structure exhibits greater performance in the attenuation of high frequency components. However, it introduces a resonant frequency in the system, causing distortions in the output current shape or loss of stability. The ideal transfer function of this type of filter is expressed by Equation (10).

$$H(s) = \left. \frac{u\_{grid}}{u\_{inv}} \right|\_{z\_{grid} = 0} = \frac{1}{s^2 LC + 1} \tag{10}$$

The *LCL* filters, considering *Z1*, *Z2*, and *Z3* are finite, are third order filters that allow an attenuation of 60 dB/dec. This type of structure offers greater attenuation of the high frequency components when compared with the filters previously described. The ideal transfer function of *LCL* filters is given by Equation (11).

$$H(s) = \left. \frac{i\_{grid}}{u\_{inv}} \right|\_{\substack{u\_{grid} = 0 \\ z\_{grid} = 0}} = 0 \tag{11}$$

Figure 6 shows six passive damping topologies that can be classified into three groups: series passive damping (SPD); parallel passive damping (PPD), and complex passive damping (CPD) [27]. Figure 6a shows an SPD topology commonly found in the literature, consisting of the introduction of an *Rd* resistance in the capacitor branch. The PPD topology, illustrated in Figure 6b,c, consists of introducing a resistance in parallel in the structure of the output filter in order to have a proper damping effect and stability. Figure 6d–f illustrate three CPD topologies that consist of introducing an impedance path (composed by resistors, inductors and capacitors) in parallel/series with the capacitor. With this type of topology, it is possible to reduce the power loss in the damping resistor at the fundamental and high order harmonics, and thus achieve greater efficiency. However, its design is a more complex process and there is no optimal paradigm to determine the filter elements.

**Figure 6.** Output filters topologies with passive damping. (**a**) SPD topology commonly found in the literature; (**b**,**c**) consists of introducing a resistance in parallel in the structure of the output filter in order to have a proper damping effect and stability; (**d**–**f**) three CPD topologies that consist of introducing an impedance path (composed by resistors, inductors and capacitors) in parallel/series with the capacitor.

#### **3. Optimization Procedure**

To determine the optimum parameters of the PR controllers and the design of the output filter, a single optimization procedure was used. Although this optimization is a more complex computational task, it provides a better frequency response of the system because both frequency responses are correlated and their performances are mutually affected. To validate the proposed methodology, two case studies with four different structures of output filters were considered, as shown in Figure 7. The first case study consists of an SPD topology commonly found in the literature, for comparison purposes. Therefore, the optimization problem with topology 1 consists in determining the optimal values for the six unknown parameters τ = *L*1, *L*2, C,*Rd*, *kr*, *kp* . As the design of the output filter is a complex process and there is no optimal paradigm, three CPD topologies were used in the second case

study. The optimization problem with topology 2 involves the determination of optimal values for the seven unknown parameters τ = *L*1, *L*2, C,*Cd*,*Rd*, *kr*, *kp* . For topologies 3 and 4, the optimization problem consists in determining the seventh and eighth unknown parameters τ = *L*1, *L*2, C,*Ld*, *Rd*, *kr*, *kp* and τ = *L*1, *L*2, C,*Cd*, *Ld*,*Rd*, *kr*, *kp* , respectively. For simulation purposes, the system illustrated in Figure 7 was implemented, consisting of a three-phase three-wire inverter topology with an SPWM with a switching frequency of 20 kHz.

**Figure 7.** System representation with the output filter topologies used.

Equations (12)–(15) show the transfer function that relates the current grid (*igrid*) with the converter voltage (*uinv*) of the four topologies, used to validate the proposed methodology.

$$H(\mathbf{s}) = \frac{i\_{\rm grid}}{u\_{\rm inv}} \bigg|\_{\substack{u\_{\rm grid} = 0 \\ z\_{\rm grid} = 0}} = \frac{R\_d \mathbf{C} \mathbf{s} + 1}{\mathbf{s}^3 L\_1 L\_2 \mathbf{C} + \mathbf{s}^2 R\_d \mathbf{C} (L\_1 + L\_2) + \mathbf{s} (L\_1 + L\_2)} \tag{12}$$

$$H(\mathbf{s}) = \left. \frac{i\_{grid}}{u\_{inv}} \right|\_{u\_{grid} = 0} = \frac{R\_d \mathbf{C}\_d \mathbf{s} + 1}{s^4 L\_1 L\_2 \mathbf{C} \mathbf{C}\_d \mathbf{R}\_d + s^3 L\_1 L\_2 (\mathbf{C} + \mathbf{C}\_d) + s^2 R\_d \mathbf{C}\_d (L\_1 + L\_2) + s(L\_1 + L\_2)} \tag{13}$$

$$H(s) = \left. \frac{l\_{\rm grid}}{u\_{\rm low}} \right|\_{M\_{\rm grid} = 0} = 0 \qquad \frac{s^2 L\_d R\_d C + s L\_d + R\_d}{s^4 L\_1 L\_2 L\_d C + s^3 R\_d C (L\_1 L\_2 + L\_1 L\_d + L\_2 L\_d) + s^2 (L\_1 L\_d + L\_2 L\_d) + s R\_d (L\_1 + L\_2)}\tag{14}$$

$$H(\mathbf{s}) = \frac{l\_{yd}}{\mu\_{\rm{bw}}} \Big|\_{\mathbf{u}\_{\rm{grid}} = 0} = \frac{s^2 L\_d \mathbf{R}\_d \mathbf{C}\_d + s L\_d + \mathbf{R}\_d}{\mathbf{s}^5 L\_1 L\_2 L\_d \mathbf{C} \mathbf{C}\_d \mathbf{R}\_d + \mathbf{s}^4 L\_1 L\_2 L\_d \mathbf{C} + \mathbf{s}^3 \mathbf{R}\_d (L\_1 L\_2 (\mathbf{C} + \mathbf{C}\_d) + L\_1 L\_d \mathbf{C}\_d + L\_2 L\_d \mathbf{C}\_d) + \dots}}{\mathbf{s}^2 (L\_1 L\_2 L\_d \mathbf{C} + L\_1 L\_d + L\_2 L\_d) + \mathbf{s} \mathbf{R}\_d (L\_1 + L\_2)} \tag{15}$$

The implemented control structure is presented in Figure 8. PR controllers were used in both axes of the stationary frame (α and β) and implemented through Equations (3)–(8). The synchronization with the grid is performed using the second order generalized integrator phase-locked loop (SOGI-PLL) algorithm, characterized by Equations (16) and (17) with a sampling frequency of 20 kHz.

$$H\_d(s) = \frac{\widehat{u\_d}}{u\_{grid}} = \frac{kw\_n s}{s^2 + kw\_n s + w\_n^2} \tag{16}$$

$$H\_q(\mathbf{s}) = \frac{\widehat{u\_q}}{u\_{grid}} = \frac{kw\_n^2}{s^2 + kw\_n s + w\_n^2} \tag{17}$$

**Figure 8.** Implemented control structure. SOGI-PLL, second order generalized integrator phase-locked loop.

This synchronization method has the advantage of selectively rejecting all frequencies, except for a certain bandwidth adjusted by the gain *k* regardless of the resonance frequency *wn*, without any lag.

#### *Proposed Methodology*

The proposed methodology is based on the grey wolf optimization (GWO) algorithm. It is a meta-heuristic algorithm proposed by [41] that mimics the social leadership and hunting behavior of grey wolves (agents). Its social leadership has a rigid and hierarchical structure, divided into four types of agents: the dominant agent is called alpha (α); second in the hierarchy is the beta agent (β); immediately below is the delta agent (δ); and finally, the lowest position in the social hierarchy is occupied by the omega agents (ω). Hunting behavior is divided into four stages: encircling prey, hunting, attacking prey, and searching for prey. The dynamics and harmony of these four stages establish the balance between the mechanisms of diversification and intensification and are coordinated through two control parameters, described by Equations (18) and (19):

$$a = 2 - 2\frac{t}{\text{Max}\_{iter}}\tag{18}$$

$$A\_d = 2ar - a \tag{19}$$

where *r* is a random number between [0, 1], *Maxiter* is the number of maximum allowed iterations, and *t* is the current iteration. The searching for prey stage, which occurs when |*Ad*| > 1, forces agents to diverge from the best solution found so far (*x*α), favouring the search for new solutions in unexplored regions (diversification mechanism). The remaining stages favour the intensification mechanism, forcing the construction of solutions in promising regions already explored. For a multidimensional search space, the new position of each agent is expressed by Equations (20)–(22).

$$D\_{a,d} = \left| \mathbb{C}\_d \mathbf{x}\_{a,d}(t) - \mathbf{x}\_{n\_d,d}(t) \right| \\ D\_{\beta,d} = \left| \mathbb{C}\_d \mathbf{x}\_{\beta,d}(t) - \mathbf{x}\_{n\_d,d}(t) \right| \\ D\_{\delta,d} = \left| \mathbb{C}\_d \mathbf{x}\_{\delta,d}(t) - \mathbf{x}\_{n\_d,d}(t) \right| \tag{20}$$

$$\mathbf{x}\_{1,d} = \mathbf{x}\_{a,d}(t) - A\_d D\_{a,d}, \mathbf{x}\_{2,d} = \mathbf{x}\_{\beta,d}(t) - A\_d D\_{\beta,d}, \mathbf{x}\_{3,d} = \mathbf{x}\_{\delta,d}(t) - A\_d D\_{\delta,d} \tag{21}$$

$$\mathbf{x}\_{n,d}(t+1) = \frac{\mathbf{x}\_{1,d} + \mathbf{x}\_{2,d} + \mathbf{x}\_{3,d}}{3} \tag{22}$$

where *d* represents the dimension of the search-space, *na* is the agent number of the population *np*, *x*α is the position of the alpha agent, *x*<sup>β</sup> is the position of the beta agent, *x*<sup>δ</sup> is the position of the delta agent, and *Cd* is a random number within [0, 2].

Figure 9 presents the flowchart of the proposed method, where, firstly, all variables and all parameters referring to GWO are initialized, such as the dimension of the problem, the control parameters, the lower (*lb*) and upper (*ub*) bounds, the number of agents of the population, and the iterations limit. The parameters for each configuration were confined within the boundaries indicated

in Table 1. These boundaries were chosen in accordance with the literature to include a comprehensive set of solutions.

**Figure 9.** Fluxogram of the proposed method.


**Table 1.** Optimization boundaries for each output filter topology.

In the optimization process, 30 agents were used. After the initialization of the variables and parameters, a random initial positioning of the agents was performed within the search space. The performance of each agent was evaluated through a fitness function (*fobj*), where the problem was formulated as the minimization of Equation (23), subject to the restrictions shown in Table 1.

$$f\_{obj} = \frac{\overbrace{\frac{1}{n}\sum\_{i=1}^{n}\left(i\_{\alpha\beta} - i\_{\alpha\beta}^\*\right)^2}^{\text{first term}}}{\max\left(i\_{\alpha\beta}^\*\right)} + \frac{\overbrace{\sqrt{\sum\_{h=2}^{\text{co}} i\_h}^{\text{co}}}^{\text{second term}}}{i\_1} + \frac{\overbrace{\sqrt{\sum\_{i=1}^{n}P\_{\text{loss}}}}^{\text{third term}}}{0.1P\_{\text{nom}}}\tag{23}$$

The fitness function tries to achieve a complete symbiosis and harmony between three fundamental terms to maximize the efficiency of the system. The first term of Equation (23) quantifies the error between the current reference and the current measured in the stationary frame, through normalized root-mean-square error (NRMSE), allowing the determination of the optimum parameters of the PR current controller. The remaining terms of Equation (23) search a balance between antagonistic and fundamental terms for the correct design of the output filter, as they quantify the damping effect and power loss. Thus, the second term quantifies the total harmonic distortion (THD) present in the output current, allowing to measure the distortion of the current waveform. Finally, the third term quantifies the power loss in the damping resistor.

After the agents' evaluation, the three best in minimizing the *fobj* and their respective position (*x*α, *x*<sup>β</sup> and *x*δ) are determined and used to calculate the movement of the remaining population, as described above by Equations (20)–(22). To prevent agents from traveling outside the search space, during the successive iterations, the random positioning strategy was implemented. In this strategy, if any of the limits (lower or upper bounds) are exceeded, the movement of the agent is modified, ensuring that the new positioning is within the search space. This procedure is expressed by Equation (24).

$$\mathbf{x}\_{n\_d,d}(t+1) = lb\_d + (\mathbf{u}b\_d - lb\_d)r \tag{24}$$

The recursive process ends as soon as the stopping criterion is reached. In particular, the stopping criterion used consists of the maximum number of permitted iterations (*Maxiter* = 200).

#### **4. Simulation and Results**

To validate the performance of the proposed method in determining the optimal parameters of the PR controllers and the optimal design of the output filter, two case studies were performed. The first case study was carried out with an SPD topology commonly found in the literature and the second case study with three different CPD topologies.

The system represented in Figures 7 and 8 was developed in Matlab/Simulink® simulation environment and the computing tasks were implemented on a computer with an Intel® Xeon® processor E5-1620 @ 3.60 GHz CPU, 8 GB RAM, and with Windows 10 Professional 64-bit operating system.

#### *4.1. First Case Study—SPD Topology*

The results obtained in the first case study (topology 1), using the proposed method, are presented in Table 2. The optimization process reached a fitness value of 0.3210, where almost 90% of the fitness value is related to NRMSE, which quantifies the error of the PR current controllers in both axes of the stationary frame. Both PR controllers present a similar performance. However, the PR controller in the α-frame has a slightly higher performance.

**Table 2.** Obtained parameters for topology 1. SPD, series passive damping.


The second term of the fitness function that quantifies the THD value reached a value of 0.0195, which satisfies the constraints established by the IEEE-519 and IEEE-1547 standards. Finally, the third term of the fitness function quantifies the power loss in the damping resistor, and obtained a value of 0.0013, which corresponds to a root mean square (RMS) value of 1.5 W.

Figure 10a illustrates the frequency response of the output filter, optimized by the proposed method. It is possible to observe an attenuation of 60 dB/dec for high frequencies and an attenuation of 20 dB/dec for frequencies between 10 Hz and the resonance frequency (6.85 KHz). A slight amplification around the resonance frequency is visible, resulting from the trade-off between the damping effect and the power loss. In addition, the output filter stability is ensured with a gain margin of 38.11 dB and a phase margin of 113.57 degrees. Figure 10b shows the fast Fourier transform (FFT) of the output current, where a low switching noise around the switching frequency and below the resonance frequency can be noticed.

**Figure 10.** Output filter with topology 1, optimized with the proposed method. (**a**) Bode diagram; (**b**) fast Fourier transform.

To validate and compare the proposed methodology in the SPD topology, an analytical method was implemented for the design of the output filter, proposed by [42]. For this, an attenuation factor *ka* of 20% and a maximum allowed ripple on output current of 10% were considered. As a result, a value of 1.4 mH was obtained for *L1* inductor, 0.2 mH for *L2* inductor, 18.37 μF for capacitor C, and 0.3510 Ω for the damping resistance. Figure 11a shows the frequency response of the calculated filter, where a resonance frequency of 8.2 KHz, an attenuation for high frequencies of 60 dB/dec, a gain margin of 26.71 dB, and a phase margin of 89.99 degrees can be observed.

Additionally, for comparison purposes, in terms of FFT and THD, the same experimental procedure with the same operating conditions was performed. In Figure 11b, it is possible to observe the power spectrum of the output current obtained through the analytic method. When compared with the proposed method in terms of FFT and THD, it presents a similar noise around the switching frequency. However, it is possible to notice a lower attenuation in the harmonic components of the low frequency current. Another indicator of the signal harmonic distortion is the THD value, which in this case is 7.08%.

Figure 12 presents the values of the fitness function terms obtained by both methods. The proposed method achieves a 27% reduction in the fitness value. The most significant reduction occurred in the value of THD and in the current tracking error in the β-frame. In addition, the proposed method presents a lower power loss in the damping resistor, which is contradictory to the expected results. This is because the proposed method addresses both optimization problems (PR controllers and output filter design) as a single process, allowing a symbiosis and a better frequency response of the system.

**Figure 11.** Output filter with topology 1, calculated through the conventional analytic method. (**a**) Bode diagram; (**b**) fast Fourier transform.

**Figure 12.** Fitness values obtained from the proposed method (left bar) and from the analytical method (right bar). NRMSE, normalized root-mean-square error; THD, total harmonic distortion.

#### *4.2. Second Case Study—CPD Topologies*

The results obtained for the CPD topologies using the proposed method are summarized in Table 3. The values of the fitness function show that all topologies obtained a similar performance. However, topology 2 achieved the best performance with a fitness value of 0.317; followed by topology 4 with a fitness value of 0.322; and, finally, topology 3 with a fitness value of 0.323. The NRMSE value obtained by the controllers in the α-frame is similar in all CPD topologies. Despite this, concerning the controllers in the β-frame, it is topology 4 that presents a lower NRMSE value. Regarding the total harmonic distortion, all topologies satisfy the constraints established by the IEEE-519 and IEEE-1547 standards. However, topology 2 stands out with a THD of 2.45%, followed by topology 4 with a THD of 2.73%, and lastly topology 3 with a value of 2.81%. Regarding the power loss in the damping resistor, the best configuration was topology 2 with an RMS value of 0.5 W, followed by topology 3 with an RMS value of 4.33 W, and finally topology 4 with an RMS value of 8.89 W.


**Table 3.** Obtained parameters for filter topologies 2, 3, and 4.

Figure 13 illustrates the frequency responses of the output filters with the CPD topologies, optimized by the proposed method. It is possible to verify that both topologies have a similar behaviour in the attenuation of low frequency components. However, topology 4 presents a slight superiority in attenuating the components in that range. Regarding the attenuation of high frequency components, the behaviour of the three topologies is different. Topology 3 has the worst performance with an attenuation of 40 dB/dec. The remaining topologies (2 and 4) exhibit an attenuation of 60 dB/dec, although topology 4 presents a slightly superior performance in the attenuation of these components. Regarding the gain margin, topology 2 achieved a higher gain of 10.40 dB, followed by topology 4 with a gain of 6.05 dB, and lastly topology 3 with a gain of 5.06 dB. In terms of phase margin, all topologies present a similar value of 113 degrees.

**Figure 13.** Bode diagram of the frequency response from filter with topologies 2, 3, and 4, obtained from the proposed method.

The fast Fourier transforms (FFTs) of the output currents of the three CPD topologies, optimized by the proposed method, are shown in Figure 14. Comparing the three FFTs, it is possible to verify that topology 4 exhibits the greatest attenuation for high frequency components, as shown in Figure 14c. The topology that offers the worst performance in this operating range is topology 3, as illustrated in Figure 14b. This is because topology 3 presents a 40 dB/dec attenuation for the high frequency components, as shown in Figure 13. In relation to THD, topology 2 has the best result with a value of 2.45%. The remaining topologies (3 and 4) present similar THD values with 2.81% and 2.73%, respectively.

**Figure 14.** Fast Fourier transform of the frequency response for the three CPD filter topologies, obtained from the proposed method. (**a**) Topology 2; (**b**) topology 3; (**c**) topology 4.

Lastly, in Figure 15, it is possible to analyze the different terms of the fitness function for the three CPD topologies. All the three topologies reached similar fitness function values. However, topology 2 has the lowest value (0.317); followed by topology 4 with a value of 0.322; and, finally, topology 3 with a value of 0.323. Regarding the current tracking error, the NRMSE of the controllers in the α-frame is similar in all CPD topologies. However, the β-frame topology 4 exhibits a slightly lower NRMSE. The most expressive differences between each topologies are related to the power loss and the THD value. Once again, topology 2 stands out, reaching the lowest values in both power loss and THD.

**Figure 15.** Fitness values obtained from the proposed method with topology 2 (left bar), topology 3 (centre bar), and topology 4 (right bar).

#### **5. Conclusions**

This paper proposed a new method to simultaneously determine the optimal control parameters of PR controllers and optimize the design of the output filter of a grid-tied three-phase inverter. The proposed method, based on the GWO algorithm, addresses both optimization problems as a single process, to achieve a complete symbiosis and a better system frequency response. It optimizes the parameters through an objective function that obtains the best trade-off between some fundamental terms: the harmonic attenuation rate, the power loss through the damping resistor, and the current tracking error. To validate the proposed methodology, two case studies were considered, with different output filter structures. The results obtained were analyzed according to three fundamental terms, in order to maximize the efficiency of the system. The first term quantifies the error between the current reference and the current measured in the stationary frame, through normalized root-mean-square deviation (NRMSE). The remaining terms quantify the total harmonic distortion and the power loss in the damping resistor. The different optimized topologies achieve an excellent performance, presenting a similar behavior. However, the results showed that topology 2 achieved a slightly superior performance, in terms of both THD and power loss in the damping resistor. In view of the above, it is possible to conclude the validity of the proposed methodology in both optimization problems.

**Author Contributions:** All authors contributed equally to this work. All authors have read and agreed to the published version of this manuscript.

**Funding:** This work is funded by FCT/MCTES through national funds and when applicable co-funded EU funds under the project UIDB/EEA/50008/2020.

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

#### **References**


© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
