—This work presents an evolutionary-based parametrization for a new discrete-time robust adaptive second-order sliding mode controller. The automatic design procedure is performed using a genetic algorithm. The novel controller is based on robust model reference adaptive control theory and a super-twisting algorithm. The resulting controller is applied to a grid-tied converter with an LCL filter. The proposed design approach, a meta-heuristic algorithm inspired by natural processes, aims to enhance the initial controller’s performance by automating the selection of the controller parameters. Simulation results using PSIM, including converter switching and converter synchronization, are presented to validate the effectiveness of the control strategy, showcasing improved performance in reducing initial transients and enhancing steady-state operation compared to the controller based on designer experience. Index Terms —Adaptive controllers; Grid-tied converters; LCL filter. I. I NTRODUCTION The worldwide investment in the renewable energy sector has been growing fast in the last decade. Due to this, the use of power converters increases [1], as they are the key to interfacing the primary energy source and the electrical grid [2]. However, these devices produce harmonics due to their switching dynamics [3]. Thus, output filters are funda- mental for enhancing the energy quality of renewable energy generation systems. There are many kinds of filters available to accomplish this requirement. Among them, the LCL filter is the most popular [4], because it has high attenuation (-60 dB/dec), while having reduced size, weight, cost, and reactive power consumption [5], [6]. However, the use of LCL filters has a nontrivial control problem, which is the high resonancepeak associated with the pair of capacitors of the filter structure interacting with the grid [7]. The current controller needs to be robust for proper power injection into the grid, because the grid impedance is unknown, and affects straightforwardly the controller’s performance [8]. As weak is the grid, lower is the frequency of the resonance peak, making the closed-loop system susceptible to instability [9]. Therefore, fixed-gain controllers are commonly designed for an operation range considering polytopic models of the plant [10]. Generally, linear matrix inequalities are designed to comply with the gain selection of the controller, such as [11]. However, LMI is not a simple design technique, requiring great experience from controller designers. Different from these techniques, adaptive controllers can update their gains in response to plant variation [12]–[14], requiring only the design of parametric convergence rate parameters, the choice of initial gains, and a reference model [15], [16]. Adaptive control have been successfully applied in a wide range of areas, such as renewable energy systems [17], [18] electric vehicles [19], autonomous vehicles [20], and so on. In power systems, this kind of controller has also gained relevant attention from renewable energy researchers and control engineers because converters with LCL filters have uncertain systems that suffer parametric variations as well as exogenous disturbances from the grid, which vary its impedance [21]–[23]. Aiming to reduce the control structure of adaptive strategies, a model simplification of the LCL filter was presented in [24], only for control design purposes. This methodology allows one to consider the LCL filter model as a first-order transfer function, reducing relevant efforts for adaptive control design and implementation. However, it is2023 15th Seminar on Power Electronics and Control (SEPOC) | 979-8-3503-1289-8/23/$31.00 ©2023 IEEE | DOI: 10.1109/SEPOC58810.2023.10322614 Authorized licensed use limited to: University of Texas at Austin. Downloaded on December 07,2023 at 16:48:44 UTC from IEEE Xplore. Restrictions apply. only valid if the controller is robust enough to deal with all the aforementioned perturbations and the neglected dynamics in the modeling process. Some controllers from literature adopted this strategy successfully, such as [25], [26]. The design methodology of adaptive controllers requires deep knowledge and experience from the designer due to the complexity of the control structure, which often poses chal- lenges in the choice of initial gains and controller parameters. Frequently, this process can be time-consuming, taking hours until the controller algorithm can be executed for the first time in practice. A possible solution for this kind of task is the use of a metaheuristic-based optimization algorithm to perform the controller parametrization. Genetic algorithms (GA) are a class of optimization algorithms inspired by the processes of natural selection and evolution, which can be applied to this task [27]. They have been widely used in different fields of knowledge, such as engineering, computer science, and generalized optimization problems. Differently from [28], the proposed adaptive controller incorporates adaptive gains instead of fixed constants k1andk2, eliminating the need to adjust and optimize these constants and improve transient and steady-state closed-loop system performance. Genetic algorithms operate by simulating the process of evolution, where a population of candidates, depicted as a chromosome K0, undergoes selection, crossover, and mutation to produce new generations of potentially improved solutions. This iterative process allows GAs to explore a large search space and find near-optimal or optimal solutions to complex problems [29], resulting in an optimized chromosome K∗. Numerous studies have demonstrated the effectiveness of GAs in solving parameter tuning optimization problems [30]. The utilization of a genetic algorithm to find initial con- troller gains for a discrete-time robust adaptive second-order sliding mode controller can streamline its parametrization while also improving the initial transient regime, once the con- troller with optimized gains tends to obtain better performance than a designer experience-based controller. Therefore, this work presents a comparison of the GA-based robust adaptive second-order sliding mode controller for current regulation of a grid-tied converter with an LCL filter and the designer experience-based controller. Simulation results are presented to illustrate the benefits of this automatization of the controller design process using PSIM in a reliable scenario, including converter modulation and converter synchronization with the electrical grid. II. G RID-TIED CONVERTER WITH LCL F ILTER Figure 1-a) shows the three-phase grid-tied converter with an LCL filter, where Vis the primary energy source and vd represents the grid. The LCL filter parameters are the grid-side inductance Lg, capacitor C, and grid-side inductance Lg1. The grid inductance is Lg2, and the parasitic resistances are rc, rg1, and rg2. The LCL filter, which is connected to the point of common coupling (PCC), is represented by its Thevenin equivalent. In addition, icandigare the converter-side and grid-side currents, respectively. The control of the three-phasesystem is highly complex because the dynamics are coupled. Therefore, the Clarke Transform is applied to the three-phase coupled model (in abc coordinates) to simplify the control design, obtaining two identical decoupled single-phase models (inαβcoordinates), as illustrated in Figure 1-b), where uis the control action. Axis crgLcL grAxis crgLcL grCcba Lc PCC vdnig ic cr2gr2gL 1gL1gr V+ -Renew able Energy Source Controller SVM PWM Fig. 1. a) Grid-tied converter with LCL filter. b) Equivalent single-phase decoupled models. The decoupled single-phase models, denoted as G(s), are presented in (1), assuming a zero value for vd, G(s) =ig(s) u(s)= 1 LgLcC s3+(rgLc+rcLg) LgLcs2+(Lc+Lg+rgrcC) LgLcCs+rg+rc LgLcC.(1) The control design is performed using a reduced order model for the LCL filter, as discussed in [24], whose sim- plification results in G0(s) =1 Lc+Lg s+rc+rg Lc+Lg, (2) where Lg=Lg1+Lg2andrg=rg1+rg2. III. R OBUST ADAPTIVE SECOND -ORDER SLIDING MODE CONTROLLER This control strategy uses the formalism of RMRAC, θT(k)ω(k) +r(k) = 0 , (3) where ωcontains the dynamics that ponder the gains θ. Moreover, ris the reference signal. Considering the system to be controlled can be represented as a first-order model, and it is subjected to a periodic exogenous disturbance, the auxiliary dynamic vector is ωT(k) = [ u(k), y(k), υ1(k), υ2(k)Vs(k)Vc(k) ],(4) where yis the plant output, υ1(k)andυ2(k)are related to the super-twisting algorithm, while Vs(k)andVc(k)are the phase and quadrature of the exogenous disturbance, respectively. The respective adaptive gains related to these dynamics are Authorized licensed use limited to: University of Texas at Austin. Downloaded on December 07,2023 at 16:48:44 UTC from IEEE Xplore. Restrictions apply. θT(k) = [ θ1(k), θ2(k), θ3(k), θ4(k), θs(k)θc(k) ].(5) The super-twisting terms are given by v1(k) =p |e1(k)|sgm(e1)(k), (6) and v2(k) =v2(k−1) +sgm(e1)(k−1), (7) where sgm(e1)(k)is sgm(e1)(k) =e1(k) |e1(k)|+δsgm. (8) The calculation of the adaptive gains is driven by a modified Gradient algorithm, which is θ(k+ 1) = ( I−σΓTs)θ(k)−TsκΓζ(k)ϵ1(k) ¯m2(k),(9) where Tsis the sampling time. The convergence rate is defined byΓ, which is a positive symmetric matrix gain and κis a positive scalar that accelerate the gains’ convergence. The augmented error ϵ1=e1+θTζ−Wm(θTω), where e1= y−ymis the tracking error. In addition, the regressor vector isζ=WmIωand¯m2is ¯m2(k) =m2(k) +ζT(k)Γζ(k), (10) where the majorant signal m(k)is m(k+ 1) = (1 −Tsδ0)m(k) +Tsδ1(|u(k)|+|y(k)|),(11) which respects the following design constraint m(0)≥ δ1/(1−δ0), where δ0andδ1are positive design parameters. Theσ-modification is used to avoid parameters drifting, σ(k) =  0 if∥θ(k)∥< M 0 σ0(∥θ(k)∥ M0−1) ifM0≤ ∥θ(k)∥<2M0, σ0 if∥θ(k)∥ ≥2M0(12) where σ0is the maximum value of σ(k), while M0is an upper bound of ||θ∗||, and M0>2||θ∗||. Figure 2 shows the block diagram of the robust adaptive second-order sliding mode control strategy. ()uk1()ek ()rk()mykyk ()yk()yk Gz()Control Law [ ] 1q2q3q4qqqsc( )sVk( )cVk()mWz 2(1)( ())()s sTkkk Tkk mkGzq sGqk +=- - I() ()e() Fig. 2. Block diagram of robust adaptive second-order sliding mode controller.IV. G ENETIC ALGORITHM Figure 3 shows the optimization process of the controller gains. The ’ga’ function of Matlab software is employed to perform the controller parameters optimization using the standard GA which includes a parent selection step to generate genes for the offspring chromosomes. [ ] 0K0 k=0 G1q0 2q0 3q0 4q0 sq00 cq [ ] nKn k=n G1qn 2qn 3qn 4qn sqnn cqPopulation SizeChromosomeRandom Choice SelectionSolution Space Lower and Upp er Search LimitG k 1q 2q 3q4qsq cqGens [ ] 1K1 k=1 G1q1 2q1 3q1 4q1 sq11 cq [ ] 2K2 k=2 G1q2 2q2 3q2 4q2 sq22 cqParent 1stParent 2nd Crosso ver Crosso ver [ ] 12K1 k=1 G1q1 2q2 3q2* 4q2 sq22 cqMutation3K4K5KnK1 2 3 4 5......n [ ] *K* k=* G1q* 2q* 3q* 4q* sq** cqGenerations Fig. 3. Overview of optimization process of the controller gains. Considering an initial chromosome given by K0= [ Γ0, κ0, θ0 1, θ0 2, θ0 3, θ0 4, θ0 s, θ0 c], (13) where the subscript zero in each chromosome and gene represents the initial generation. Firstly, the algorithm gen- erates an initial population composed of chromosomes from K0until Knwhere n= 100 is the population size. The size of this population was chosen due to the high rate at which, with smaller populations, the GA algorithm became stucked in a local minimum without being able to reach satisfactory values. Each gene on the chromosome is randomly defined based on the previous set of lower and upper search limits. The set solution space allowed for the routine is Klower = [1 1 −10−10−10−10−10−10] andKupper = [1000 1000 10 10 10 10 10 10] . There is a certain degree of freedom in choosing these values. Typically, higher values are assigned to the first and second parameters of the search vectors, as they are associated with the convergence rate of the gains. The remaining values in the search vector pertain to the actual values of the adaptive gains, which can assume any value. In this genetic algorithm, parent selection is performed using a fitness-based selection strategy among individuals in the population. The ’ga’ function employs a combination of tournament selection and roulette wheel selection to choose parents for reproduction. See [31] for more information about these both strategies. Among these two strategies for selecting Authorized licensed use limited to: University of Texas at Austin. Downloaded on December 07,2023 at 16:48:44 UTC from IEEE Xplore. Restrictions apply. parents, both are related to fitness in the process. Fitness is determined with the aim of finding an optimized K∗that solves the problem, K∗= arg min K∈ψF(K), (14) where ψcan be any value in the solution space, and F(K)is the cost function as follows, which is the integral of absolute error (IAE), F(K) =N2X k=N1|e1(k)|, (15) where N1andN2represent the initial and final samples, respectively, which are determined by the designer based on the execution time of the optimization routine. The gene combination to form the offspring chromosome is carried out by the crossover operator after selecting the parents for reproduction. The adopted crossover operator is a single- point crossover, where a random crossover point is selected from one of the parent chromosomes. Genes before this point are copied to the offspring chromosome, while genes after this point are copied from the second parent chromosome to the offspring chromosome. Following the crossover, mutation operators can be applied to introduce additional variations in the genes of the offspring chromosomes. Mutation is a random process that changes the value of one or more genes on a chromosome. For this optimization, the standard MATLAB mutation of 1% is applied. After this process, chromosomes are checked to ensure system stability during parameter optimization. If a chromo- some has genes that exhibit unstable behavior in different test scenarios, a penalty is applied to the evaluated solution. This penalty is represented by a large number. Thus, when instability conditions are detected, the cost function value is multiplied by this penalty, indicating that the solution is undesirable. The procedure extended for approximately 3 seconds, and load steps were introduced during the simulation to assess solution robustness. Load steps were initiated from 10Ato20Aand subsequently from 20Ato30A. Furthermore, when the system operated under full load conditions ( 30A), an additional grid inductance of 2mH was introduced, simulating a weaker grid environment that necessitated a more robust control structure. For this optimization methodology, to assess if the algorithm is converging to a good solution, the main considerations are made in steady state: •A penalty of 1×1030is applied if the value of the multiplication TsκΓin the adaptation law is greater than 20; •A penalty of 1×1020is applied if the tracking error and augmented error exceeded 1Ain steady state; •A penalty of 1×1020is also applied if the control action exceeded 1000Vin steady state. V. C ONTROLLER DESIGN The optimized controller is applied to the current control of a 5.2 kW three-phase grid-tied converter with an LCL filter.The system parameters are VCC= 500 V ,vdis a sinusoidal signal with an amplitude of 127Vpk,Ts= 1/5000 s,Lc= 1 mH,rc= 50 mΩ,C= 62 µF,Lg1= 0.3mH, and rg1= 50mΩ. Considering the reduced-order system model and the parameters, the LCL filter transfer function (only for controller design purposes) is G0(s) =769.257 s+ 76.9257. (16) The reference model Wm(s)must have the same relative degree as the nominal part of the controlled system, G0(s). Therefore, the following reference model is assumed, Wm(s) =6015 s+ 6015. (17) The reference signal r(k)is a sinusoidal waveform with an amplitude of 15A, a frequency of 60Hz, and a phase angle of0◦. The basic controller parameters for both strategies are chosen as σ0= 0.1,M0= 15 ,¯m2= 4,δ0= 0.7,δ1= 1, and δsgm= 0.5. The controller parameters and the initial gains for the empirical tuning are chosen following the four steps: 1 Empirical selection of κandΓbased on the designer’s experience; 2 Initialization of the gain θ1= -1 to avoid division by zero. Additionally, initialize the other ones with random values or equal to zero; 3 Run the controller. If the gains converge to a good solution, restart the process with the final values of the previous simulation to improve the transient response. In the case of non-convergence, change the values of κand Γempirically once more; 4 After changing the values of κandΓwhile updating the initial controller’s gains exhaustively, the final parameters are now known. A comparison of the efforts to design an adaptive con- troller for the specific case studied in this work is the time spent to empirically design the controller and the automatized parametrization process. The experience-based design takes around 40 hours to obtain a satisfactory response, (naturally, the experience-based design can vary in accordance with the level of expertise of the control designer), while the GA-based method takes 8 hours to run 10 routines, which provide optimal solutions for this problem (that must be evaluated by the control engineer). The best solution obtained by experienced designer has the following parameters: κ= 800 ,Γ = 10 and the initial gains equal to θα(0) = −1.1197622 −0.05269197 −1.1332886 −0.07547035 0.19961174 0.98536551 ,θβ(0) = −1.0100293 −0.2874567 −1.1875230 −0.0002672 0.0716682 0.9227162  Authorized licensed use limited to: University of Texas at Austin. Downloaded on December 07,2023 at 16:48:44 UTC from IEEE Xplore. Restrictions apply. Applying the meta-heuristic algorithm for the controller design, the resulting parameters are κ= 999 .8,Γ = 100 and the following gains: θα(0) = −1.7093520 −1.6041797 0.27786985 0.00189304 0.24973498 1.8691918 ,θβ(0) = −1.7388549 −1.4272192 0.32173488 −0.00233095 0.11628208 1.5403128  VI. S IMULATION RESULTS In this section, simulation results are presented to demon- strate the controller’s performance. A comparison is made between the system responses obtained with empirical tuning and those obtained with the GA methodology for parameter optimization. The simulations were performed using PSIM software, considering converter synchronization with the grid using a Kalman filter and space vector modulation to synthe- size the control action. Figures 4 and 5 depict the performance of the controller with and without parameter optimization. As can be seen, the GA-based controller exhibits smoother transients, resulting in reduced tracking errors if compared to the controller with empirically designed gains. It reflects directly on the energy quality, as can be seen in the tracking error graphics. -20020 -1000100 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4-2002040 Initial transien t resp onse (t=0.05s)Parametric v ariation resp onse (t=0.15s) Amplitude variation resp onse (t=0.25s and 0.35 resp ectively) Grid Sync. Grid inductance and resistance c hange 2 2(:50 100,:0.3 1.3)g grm mLmH mH W®W ®:15pkrA:25pkrA :15pkrA(t=0s) 109.86 V Fig. 4. Simulation results in αcoordinate. Figure 6 shows the comparison of gains for both strategies. The gains of an optimized controller lead to lower parameter variations throughout the simulation because they start close to an optimal solution set. Therefore, it provides fast convergence and improved performance. Moreover, since the optimized solution presented may not have the best parameter set to minimize the transient and steady state performance, and the parameters tuned is only the one with the best fitness among the number of performed routines, if the designer wishes, more -2002040 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4-20020406080Grid Sync. (t=0s) :15pkrA Grid inductance and resistance c hange 2 2(:50 100,:0.3 1.3)g grm mLmH mH W®W ®:25pkrA :15pkrA Initial transien t resp onse (t=0.05s)Parametric v ariation resp onse (t=0.15s) Amplitude variation resp onse (t=0.25s and 0.35 resp ectively) -100010086.83V -109.97 VFig. 5. Simulation results in βcoordinate. Classic T uning Gains -1-0.500.511.5 1q2q3q4qqsqc 0.1 0.2 0.3 0.4-2-1012GA T uning Gains1q2q3q4q qsqc 0.1 0.2 0.3 0.41q2q3q4qqsqc 1q2q3q4qqsqc Fig. 6. Controller gains in αandβcoordinates for both strategies. routines can be run until a better set of solutions is found. This method can consider other chromosome selection strategies, such as linear ranking selection or stochastic tournament selection. Additionally, different crossover techniques may be tested, such as multiple point crossover, uniform crossover, arithmetic crossover, and segment crossover, as well as varying the mutation rates of offspring chromosomes, the population size, the imposed penalties, and the used cost function. Table I provides a comparison of the RMS values of tracking error and the total harmonic distortion (THD) of grid-side currents in steady-state. Additionally, for the THD measurement, the last complete cycle of grid-side currents was considered. VII. C ONCLUSION This work presented the implementation of a genetic algo- rithm for parameter optimization of a robust adaptive second- order sliding mode controller applied to a grid-tied three-phase converter with an LCL filter. The time-consuming part of the Authorized licensed use limited to: University of Texas at Austin. Downloaded on December 07,2023 at 16:48:44 UTC from IEEE Xplore. Restrictions apply. TABLE I PERFORMANCE COMPARISON OF CONTROLLERS . Design MethodologyValue (RMS) e1(α)Value (RMS) e1(β)THD yαTHD yβ Empirically Tuned 0.265 A 0.199 A 3.51% 3 .12% GA Tuned 0.2145 A 0.179 A 3.07% 2 .54% controller design was significantly reduced, and the obtained parametrization provided satisfactory performance, superior to the one obtained with an experience-based designer. The optimized controller achieved smoother transients, reduced tracking errors, and lower parameter variations, indicating improved system performance. The THD of the closed-loop system using a GA-based controller was 2.54% in steady state against 3.12% of the non-optimized controller, reinforcing the benefits of the presented parametrization solution. ACKNOWLEDGMENT The present work was accomplished with the support of the Coordenac ¸ ˜ao de Aperfeic ¸oamento e Pessoal de N ´ıvel Superior - Brasil (CAPES/PROEX) - C ´odigo de Financiamento 001.