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

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.


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 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][30][31][32][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.

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]. 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.

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. The ideal transfer function of PR controllers is expressed by Equation (1), where w n is the resonant frequency of the controller and the parameters k p and k r are the proportional and resonant gains, respectively.
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 k r -a small value creates a very narrow band, while a large value of k p will cause a larger band around the resonance frequency. 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 w c w n is assumed, where w c is the bandwidth around the resonance frequency w n .
Using Tustin's approximation with pre-warped frequency [39] to discretize the system expressed by Equation (2), that is, considering s = w n tan w n T s 2 k t z−1 z+1 , we get the following: 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.

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. The output filters L, where Z 1 is finite, Z 2 is infinite, and Z 3 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).
The output filters (LC), where Z 1 is finite, Z 2 is finite, and Z 3 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).
The LCL filters, considering Z 1 , Z 2 , and Z 3 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). 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 R d 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.

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,R d , k r , k p . 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,C d , R d , k r , k p . For topologies 3 and 4, the optimization problem consists in determining the seventh and eighth unknown parameters τ = L 1 , L 2 , C,L d , R d , k r , k p and τ = L 1 , L 2 , C,C d , L d , R d , k r , k p , 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.
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)  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 w n , 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): where r is a random number between [0, 1], Max iter is the number of maximum allowed iterations, and t is the current iteration. The searching for prey stage, which occurs when |A d | > 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).
x n a ,d (t where d represents the dimension of the search-space, n a is the agent number of the population n p , x α is the position of the alpha agent, x β is the position of the beta agent, x δ is the position of the delta agent, and C d 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.  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 ( f obj ), where the problem was formulated as the minimization of Equation (23), subject to the restrictions shown in Table 1.
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 f obj and their respective position (x α , x β 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).
x n a ,d (t + 1) = lb d + (ub d − lb d )r (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 (Max iter = 200).

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.

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. 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. 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 L 1 inductor, 0.2 mH for L 2 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.

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.  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. 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. 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.

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.