Hybrid Controller Based on LQR Applied to Interleaved Boost Converter and Microgrids under Power Quality Events

: Renewable energy sources are an environmentally attractive idea, but they require a proper control scheme to guarantee optimal operation. In this work, we tune different controllers for an Interleaved Boost Converter (IBC) powered by a photovoltaic array using three metaheuristics: Genetic Algorithm, Particle Swarm Optimization, and Gray Wolf Optimization. We also develop several controllers for a second simulated scenario where the IBC is plugged into an existing microgrid (MG) as this can provide relevant data for real-life applications. In both cases, we consider hybrid controllers based on a Linear Quadratic Regulator (LQR). However, we hybridize it with an Integral action (I-LQR) in the ﬁrst scenario to compare our data against previously published controllers. In the second one, we add a Proportional-Integral technique (PI-LQR) as we do not have previous data to compare against to provide a more robust controller than I-LQR. To validate our approach, we run extensive simulations with each metaheuristic and compare the resulting data. We focus on two fronts: the performance of the controllers and the computing cost of the solvers when facing practical issues. Our results demonstrate that the approach proposed for tuning controllers is a feasible strategy. The controllers tuned with the metaheuristics outperformed previously proposed strategies, yielding solutions thrice faster with virtually no overshoot and a voltage ripple seven times smaller. Not only this, but our controllers could correct some issues liaised to the IBC when it is plugged into an MG. We are conﬁdent that these insights can help migrate this approach to a more diverse set of MGs with different renewable sources and escalate it to real-life experiments.


Introduction
Recent studies have corroborated that the excessive exploitation of fossil fuels as a primary energy source has caused negative impacts on our environment. Nonetheless, experts recognize energy consumption as a pillar of worldwide economic development. Therefore, environmental organizations have encouraged the exploration of alternative and sustainable energy sources. The chief goal is to update the current electrical system by incorporating renewable energies so that fossil fuel consumption can be gradually decreased to 20% by 2050 [1]. This objective has created several research opportunities in the Distributed Energy Resources (DERs) field. Some examples include the technological furthering of power electronics for energy production, as well as the challenges associated with energy quality, electric power systems reliability, and increasing energy demand. The DERs appear as an innovative solution that benefits customers at a lower energetic cost while preserving a high power quality and energy independence [2]. Moreover, integrating employed an improved version of the Chaotic Whale Optimization Algorithm and sought to preserve PEMFCs within the desired operating range. Even so, they analyzed similar metrics (ripple and overshoot) while comparing their data against previous works. This study demonstrated that Metaheuristics (MHs) are powerful tools for tuning LQR, classical, and hybrid controllers. In fact, hybrid controllers stand as a suitable choice when one wants a fast response with good energy efficiency, i.e., robust and tolerant to perturbations. For example, Kim et al. [18] proposed a controller offering a low operation cost and a reduced error, which they called LQR+PI.
Controlling schemes have also been used for improving MG performance. Savaghebi et al. [19] designed a hierarchical control for improving the voltage quality of sensitive loads connected to the AC bus. The authors proposed a two-level controlling scheme. The former managed DERs while the latter balanced voltage and harmonics. Dasgupta et al. [20] implemented a new current control technique. They considered a three-phase framework for active and reactive power flow management from a renewable energy source.
Moreover, system stability was ensured by including the Lyapunov function. Such a control scheme was focused on reducing the THD generated by typical nonlinear loads. Throughout the same year, Lotfollahzade et al. [21] presented an LQR controller for compensating unbalanced nonlinear loads in grid-tied and island mode. They included a PID controller tuned by PSO, which managed the load from a set of distributed generators. A few years later, Shi et al. [22] enhanced the MG power quality and the inverter performance using a negative-sequence compensation method. Later on, Mousavi et al. [23] adopted a resonant control strategy based on active and reactive power controllers. With this, they compensated power quality problems at the Distributed Generation (DG) terminals or the PCC.
Then, Hadidian et al. [24] tested a control scheme applied to four-leg battery energy storage systems called BESS. Here, the authors considered an MG operating in isolated mode faced with unbalanced and nonlinear loads. This approach exhibited a reduced steady-state error, a fast transient response, and a low THD index. Beus et al. [25] presented a hierarchical control method with three levels for MGs operating in grid-tied mode. The first level minimized the MG operating cost. The second level used a predictive controller and a Kalman filter for controlling the frequency of the MG. Finally, the third level used classical controllers for tracking the set-points coming from the previous levels. Faria et al. [26] proposed a new method for determining the optimal parameters of the proportional resonant controller, as well as the values of the output filter upon a grid-tied three-phase inverter through the Gray Wolf Optimization (GWO). The authors designed the fitness function based on harmonic attenuation rate, power loss, and steady-state error reduction. Additionally, Ebrahim et al. [27] compared three MHs techniques to properly select the resonant proportional controller and its harmonic compensator for three-phase voltage source inverters connected to the electrical grid. They employed a multi-objective function for minimizing the harmonic distortion of the grid output current.
Despite their broad use for MG-related applications, hybrids between LQR and PID controllers are also widespread in other engineering applications. For example, Nagarkar et al. [28] tackled the nonlinear model of a quarter car suspension system, where the controller was driven by a GA. Lindiya et al. [29] followed an equivalent approach, but they applied it to improve the performance of DC-DC converters. Similarly,Şen and Kalyoncu [30] used the GWO for tuning the controller. The authors, however, used this approach for regulating the foot trajectory of a quadruped robot. Moreover, Ibrahim and Abdulla explored the stabilization of a helicopter with three degrees of freedom [31].
It is well-known that the nature of an IBC is highly nonlinear. Even so, most of the control schemes proposed for the IBC dynamic are linear. In this sense, we followed a similar approach. As proposed in [10,17], we linearized the IBC mathematical model considering the duty cycle of inductors and the system equilibrium points. However, bear in mind that even if this facilitates model decoupling, it has the drawback of lowering performance due to the non-minimum phase problem Banerjee et al. [16]. Nonetheless, there are several works dealing with this issue, as was mentioned above. However, the performance of such controllers still has room for improvement. Besides, most previous works either deal with PEMFCs or consider photovoltaic (PV) cells that are directly connected to the MG. Moreover, the earlier approaches consider ideal elements, which obscures performance in real-life applications.
In this work, we propose two approaches. The first one deals with tuning IBC controllers in standalone mode by considering a multi-input single-output control path. We focus on the settling time, overshoot, and steady-state error, as well as on the response when faced with perturbations, and the output voltage ripple. Likewise, we design a hybrid I-LQR controller driven by metaheuristics. Through it, we seek to improve the aforementioned metrics. Moreover, we consider photovoltaic cells as the energy source connected to the IBC.
As for the second approach, we introduce a new methodology for adjusting MG control parameters when handling power quality issues, which is powered by metaheuristics. In this case, we incorporate a PI-LQR controller, which contemplates the same control specifications as in the first approach. Besides, we tackle the specific case of power exchange between IBC and VSI, where energy is supplied by an MG towards the loads connected at the PCC. Note that the IBC is seen as an ideal voltage source within the MG model. Besides, drawbacks related to power quality in the MG are generated by unbalanced linear and nonlinear loads. In this approach, the IBC feeds the MG while the latter works in grid-tied mode and thus conforming the IBC+MG set.
To power our approach, we selected the most popular algorithms in the last few years. We determined them by analyzing previously reported applications. Our exploration revealed approaches where Particle Swarm Optimization (PSO) and Genetic Algorithms (GA) were used to tune IBC controllers [10,16,17]. We also detected reports about the successful application of the Grey Wolf Optimizer (GWO) for adjusting control parameters in microgrids [26,27].
In summary, our work has five significant contributions:

1.
It proposes a hybrid controller ensuring voltage equilibrium at the PCC, according to the regulations overseeing MGs, while reducing harmonic content from nonlinear loads connected to the PCC.

2.
It provides a comparison between three MHs for finding the best controller configuration in terms of the IBC and MG dynamics.

3.
It describes controller performance for an IBC connected to VSI while the MG is working in grid-tied mode.

4.
It delivers different controller proposals that outperform recent developments from relevant literature while using photovoltaic cells as an energy source.

5.
It introduces a testing scenario closer to reality, which includes non-ideal elements such as voltage sources.

Interleaved Boost Converter Model
An Interleaved Boost Converter (IBC) is a device used to increase the input voltage. They are quite useful for applications such as electric vehicles and voltage regulators in PEMFCs [17]. This kind of device preserves the working principle of a Boost Converter (BC). Furthermore, IBCs have remarkable advantages compared to BCs. Some of them include low ripple and harmonic content at the input and output current signals [16]. Such advantages match the power quality interest mentioned in this article. For this reason, we selected IBCs for this work. However, IBCs incorporate two inductance currents into their structure [10]. A feasible approach to construct an IBC is to connect two BC in parallel, resulting in a two-phase interleaved converter ( Figure 1). In this case, it is paramount that the drive signals be shifted by 180 • [32]. Based on Figure 1, the mathematical model of an IBC depends on the activation of switches Q 1 and Q 2 and on the polarization of diodes D 1 and D 2 . Bear in mind that R represents the load connected to the IBC. Accordingly, the IBC dynamic can be described in the state-space framework as where s k , ∀ k = {1, . . . , 4}, are variables defined by the four possible operating modes shown in Table 1. Table 1. IBC activation modes that render different variants of (1).

Inputs Outputs
Therefore, it is possible to obtain a weighted model of the IBC by adding a new input linked to the duty cycle of inductors (U 1 and U 2 ). However, this scheme leads to the following nonlinear mathematical model, After averaging the IBC model one can infer that it is similar to the classical boost converter expression. However, bear in mind that the mathematical representation includes two inductor currents, as aforementioned. Therefore, the model expressed in (2) exhibits two commonplace scenarios for activation modes of the duty cycle: lower or higher than 50%. However, the duty cycle should be 50%, the IBC benefits from ripple reduction, either in the input current or in the capacitor voltage. Nonetheless, our approach does not restrict the values of these duty cycles.
As the proposed hybrid controller is based on a linear control technique, the nonlinear system must be linearized. This process can be done through the Jacobian obtained from the states x and inputs u, which derives into (4) and (5), into the linearized model given by (4) and (5), yielding and Notice that matrices A and B , as well as vector C, come from the general representation of the linearized model. These parameters are employed and detailed in Section 3.

Microgrid Model
A microgrid (MG) is a scheme used for generating, distributing, and regulating power flow into an electrical grid. Such a scheme can operate in two configurations: grid-tied and isolated mode. These lead to a characterization of MGs as autonomous or decentralized systems, respectively. In the first case, unbalanced voltages and currents are generated by unbalanced loads and issues within the utility grid, degrading the energy quality index [33]. Note that any anomaly in the electrical grid directly affects the MG performance. For the isolated mode, the MG is disconnected from the utility grid and operates as an autonomous system. Thence, the disequilibrium in voltages and currents is caused by unbalanced loads.
An MG allows users to integrate renewable energy sources; so, representing a sustainable, efficient, and safe alternative for supplying energy. Even though there can be different kinds of MGs, for this work, we consider the one depicted in Figure 2. In electrical terms, the MG contains a Renewable Energy Source (RES), a three-phase converter, a filter (in this case, made up to a capacitor and an inductor), and a Static Disconnect Switch (SDS). This set of elements feed linear and nonlinear loads connected at the PCC between the MG and the utility grid. The latter is constituted by a three-phase voltage source and the respective coupling impedance.
Mathematically speaking, the RES-Converter duo can be modeled as an ideal voltage source. The reason is that the IBC extracts energy directly from photovoltaic cells. Thus, there are no mechanical components generating inertia, as is the case with wind turbines and microturbines, among others [34]. Similarly, we assume a 99% efficiency for the three-phase converter [35]. Bear in mind that in the MG model, the IBC is interpreted as a RES.
The Park transform (PT) is a strategy that can be used for simplifying the electrical three-phase model into the Direct-Quadrature-Zero (dq0) domain. In this way, the MG model is decoupled, facilitating the description of its behavior [36]. The mapping process of the PT begins by considering that passive elements within the LC filter have the same value for each phase. Therefore, their three-phase framework representation is given by where I 3 is the identity matrix of order 3, and l k and c k are the scalar values for the inductor and capacitor bank by phase, respectively. Afterward, the reference system is changed from abc to dq, sans the homopolar component, for (8) using the following current-tension relations: Then, the concept behind the PT is applied to (9), resulting in v L αk where T p (θ) is the PT operator, which is a function of the axes angular-speed θ; that in turn, is defined such as θ = ωt. The dq representation of passive elements is achieved via the chain rule when plugging in (10) and (11), which yields In this sense, the PT can be applied to the Thevenin equivalent of the MG structure using trivial circuit analysis theory [37]. Moreover, the MG dynamic in state-space is represented by Taking advantage of the PT properties [38], the system shown in (16) can be decoupled into the dq reference frame such as where u d [V] and u q [V] represent the dq components of the voltage delivered by the IBC. Moreover, g(x) and h(x) represent the system response to perturbations modeled with (19) and (20), respectively.
Bear in mind that throughout these equations,

related the voltages and currents of inductors (L αk [H]) and capacitors
as the signals coming from the electrical grid in the dq reference frame.

Metaheuristics
Metaheuristics (MHs) are procedures that may range from quite simple approaches to sophisticated ones. They have been used to assess the solution of a wide array of problems. Their use is customary nowadays because of their proven success, flexibility, and simplicity. Besides, they usually are more direct than traditional approaches that require derivatives and other rigid conditions. The current literature is prolific, with examples linked to MHs. Some of the earliest ones have been used for over 30 years and are still reasonably common [39]; for example, Genetic Algorithms [40]. Throughout these years, others have been appearing, showing interesting performances and becoming popular, e.g., Particle Swarm Optimization and Gray Wolf Optimizer. Note that natural processes commonly inspire metaheuristics, so it is customary to accompany them with a corresponding metaphor [41,42]. However, metaphors say nothing about their real procedures, as Sörensen [43] criticized. It is proper to mention the research proposed by Cruz-Duarte et al. [44], which settles the foundations for studying and somehow classifying MHs by focusing on the mathematical procedure representing such metaheuristics.
Before describing the MHs that we implement for this work, we consider it crucial to review two common concepts. The first one is the population employed by many metaheuristics in the literature [41,44]. A population X(τ) is defined as a set of N candidate solutions at iteration τ for an optimization problem given by a feasible domain X and an objective function f : X → R, which is modified in an iterative procedure, i.e., X(τ) = { x 1 (τ), . . . , x N (τ)}. Then, x n (τ) ∈ X(τ) denotes the position of the nth individual (or agent). In this work, we consider a continuous problem domain, so X ⊆ R D , where D stands for the number of dimensions. Plus, for the sake of simplicity, we regard a parallelepipedical feasible region given by as x l and x u are the lower and upper limits, respectively. The second concept, always present in all metaheuristics, is the best position x * . To define it, we may consider an arbitrary set of candidate positions Z, which can be designated as, e.g., the entire population Z = X, the nth neighborhood Z = Y n , and the historical evolution of the nth candidate Z = { x n (0), . . . , x n (τ)}, since τ is the current iteration. Therefore, the best position from Z(t) corresponds to x * ∈ Z, i.e., x * = arginf{ f (Z)} for a minimization problem. Bearing this in mind, we now comment on the methods used for this work.

Genetic Algorithms
Genetic Algorithms (GAs) seek to replicate the natural selection process and so their search agents are given by chromosomes, or genotypes, which can be represented as strings of either binary or real-valued numbers [45]. GA is a population-based methodology that, throughout an iterative process, strives to refine (evolve) such a population. This evolution is achieved by using diverse genetic operators that alter chromosomes, aiming to improve their quality measure [46], usually referred to as fitness. Commonplace genetic operators include crossover, mutation, and selection. The first one combines the information of the current population, while the second introduces genetic diversity by randomly modifying some of the individuals. The final operator (also known as elitism) decides which individuals will have the opportunity to provide genetic material for the next generations. Their relationships and an overview of the whole procedure are illustrated in Figure 3. As this work deals with a continuous problem domain, the crossover and mutation operators are based on the standard versions used for real-valued chromosomes. Then, for crossover, the arithmetic approach is employed, as described below, where x c is the position of a child, and x p,1 and x p,2 are two parent chromosomes from the current population. These parents are chosen via a pairing scheme, for example, random, tournament, and roulette wheel. We utilize a random pairing scheme in this GA implementation. Moreover, r u r k ∼ U (0, 1) is a vector of i.i.d. random numbers with uniform distribution, α c ∈ R + is a controlling factor, and is the Hadamard-Schur's product. Plus, this crossover procedure must be carried out for as many children are required to be considered for the next generation.
For mutation, we allow individuals to change within a range given by x l and x u , cf. (21). Therefore, we implemented as x n is a mutant version of the individual (chromosome) x n , r u is a vector of i.i.d. random numbers such as r u r d ∼ U (x l,d , x u,d ), ∀ d ∈ {1, . . . , D}, and α m ∈ [0, 1] is the percentage of information to mutate for each element in the chromosome. After applying this procedure, GA generally has multiple ways to decide if the originals or mutants are preserved. The most common one is the well-known Greedy criterion, which consists of keeping the best version for each individual according to their fitness value. We employ this approach in this GA implementation. The last genetic operator, the selection, is carried out through a random sampling process with uniform distribution. This decision is based on preliminary empirical evidence on the performance of the GA for this particular problem. Bear in mind that this operator seeks to preserve the population size, then some 'newborns', 'mutants', and 'parents' are neglected for the new generation. Besides, GA relies on elitism to keep some of the best individuals of the population, so their promising genetic material is not compromised.

Particle Swarm Optimization
Particle Swarm Optimization (PSO) is inspired by the collective behavior of birds and fish [47]. Therefore, as with the previous approach, it considers a collection of search agents. In this case, each agent is called a particle, and their collection is said to form "a swarm". Moreover, each agent has a position x n and a velocity v n , where the former provides candidate solutions to a given problem.
During the iterative process of PSO, the particles are constantly moving and exploring the search space via a simple kinematic dynamic. It leads to some elements worthy of highlighting. For starters, the best position p n that a particle n has found must be preserved and updated accordingly; this is known as the personal best. Consequently, one of these positions also represents the best position found by the whole swarm, g; this is known as the global best. Furthermore, in a given iteration τ, the current position of the particle may differ from its personal best, as they are always moving. Therefore, the movement of a particle is determined by several factors [48], including the current parameters and the best solutions. These elements are liaised through and v n (τ + 1) = w v n (τ) + α 1 r 1 ( p n − x n (τ)) + α 2 r 2 ( g − x n (τ)).
Equation (24) represents the actual movement of the n th particle and requires the current position and velocity of the particle, x n (τ) and v n (τ), respectively, whereas (25) updates the velocity of the nth particle. For such a dynamic, it is required the current position of the nth particle; the personal and global best positions, p n and g, respectively; the inertia factor w ∈ [0, 1[; the self-confidence coefficient α 1 ∈ R + ; and the swarm confidence coefficient α 2 ∈ R + . These formulae also employ a couple of vectors with i.i.d. random elements with uniform distribution, r i r i,k ∼ U (0, 1) ∀ i = {1, 2}. Bear in mind that w is included as a control mechanism for avoiding the swarm explosion [49]. In Figure 4, we present an illustrative example of how the PSO procedure is employed for solving a problem.

Gray Wolf Optimizer
Gray Wolf Optimizer (GWO) seeks to mimic the hunting behavior of grey wolves by considering a group of search agents with a strict hierarchy [50], i.e., α individuals sit at the top, followed by β, and γ wolves. The remaining individuals are regarded to be of the ω class. Now, the "hunting process of wolves" gives place to the position update for each individual in the population, mathematically described by with as τ is the current iteration, x n (τ) stands the current position of the nth individual, x i (τ) represents the position of an elite wolf (i.e., α, β, and γ), and r 1,i r 1,i,k ∼ U (−1, 1) and r 2,i r 2,i,k ∼ U (0, 1) are vectors of i.i.d. random elements. Consider that | y| = (|y 1 |, . . . , |y D |) , with y ∈ R D as a dummy vector, is the element-wise version of the absolute value operator for vectors. Moreover, a(τ) is a vector of components linearly decreasing from 2 to 0 w.r.t. iterations. In this work, we use the formula given by Mirjalili et al. [50], such as where τ max is the maximal number of iterations. Figure 5 provides an overview of the GWO approach and details how each search agent moves throughout the search space, depending on the location of the α, β, and δ individuals.

Energy Quality
The energy quality index is a measurement of how ideal an electrical signal is. This index is determined by the voltage supplied and the operating frequency, and it evaluates whether the former is within an established range. Simultaneously, the latter must be a constant, close to a nominal value, and describe a sinusoid. This concept is affected by the phenomena that distort the waveform, such as the magnitude and phase of power signals measured at the Point of Common Coupling (PCC).
For this work, we assume that these unbalanced loads are given by a voltage with a magnitude provided by the ratio between negative and positive sequence percentages. This term is well-known as the Voltage Unbalance Factor (VUF), which is determined as follows: where V sec(−) and V sec(+) are the negative and positive sequence components, respectively. The standard IEEE 1159-2019 recommends that the voltage imbalance (sometimes called unbalance) of a typical three-phase system must remain below 5% [6]. Another element degrading the power quality is the connection of nonlinear devices at the PCC. This is because these devices generate harmonic content that can deteriorate the MG components and the performance of the utility grid. There are some methods to attenuate the levels of this harmonic distortion, but they are often impractical and challenging to implement [51]. Moreover, the harmonic spectrum of voltage signals measured at the PCC is determined through the Total Harmonic Distortion (THD). THD is then defined by the standard IEC 61000-2-2 as the ratio between the root-sum-square of all harmonic magnitudes (excluding the fundamental) and the magnitude of the fundamental frequency [7]. When the THD index is applied to voltage signals, say THD V , it is assessed such as as V 1 [V] is the voltage signal corresponding to the fundamental frequency, and V 2k+1 [V] is the voltage of the harmonic 2k + 1, ∀ k = 1, . . . , N.
At the low-voltage distribution level, the allowed limit for the THD V is also 5%. Thus, the THD V in each phase of the MG is measured following this bound. Conversely, it is worth commenting that the THD index for the current is considered as a known factor for the nonlinear load connected at the PCC.

Our Proposed Approach
In this section, we detail our proposed approach based on the significant concepts reviewed above.

IBC Controller Optimization
An analysis of the state-space models shown in (7) reveals that the Interleaved Boost Converter (IBC) exhibits an oscillatory response to a step input. At the same time, the Microgrid (MG) provides a critically damped response. Therefore, in this work, we use the state-feedback approach [52] shown in Figure 6 when designing the controllers. This state-feedback is expressed as given, where A, B, and C are matrices of the state-space representation model for IBC and MG, as shown in (7), (17), and (18). K is the feedback matrix for the states, which is a design parameter for the LQR algorithm that seeks the best position for the poles of a system. From (31), one can manipulate the characteristic polynomial of the system, improving the IBC slow dynamic caused by the non-minimum phase problem. In this regard, we use the state-feedback approach to make the closed-loop system track step-type inputs while considering metrics such as settling time and overshoot. Furthermore, LQR is an algorithm that belongs to the theory of optimal control, which is concerned with operating a dynamic system at a low cost [53]. Additionally, y(t) is the system desired output, and u(t) and r(t) are the system input and reference, respectively. Therefore, it is somewhat straightforward to notice that the controller can be optimized by solving the following minimization problem: where Q and R ∈ R M×M + are positive semi-definite matrices assigned arbitrarily. Bear in mind that Q represents the penalization matrix for the system states, x(t). Conversely, R relates to the velocity of the controller and u(t) are the system inputs. In this case, Q and R are used to calculate optimal values for K.
From this problem definition, the updated input and state vector can be obtained as shown, as S is achieved by solving the Riccati equation, given by Under some conditions, the LQR algorithm may fall short. For example, when faster and accurate dynamics are required. For this work, we opt to complement the LQR controller as described next. When designing the controller for the IBC, we include an integral action to obtain a controller resilient to perturbations while being robust enough to track the reference, as Figure 7 depicts. Then, the close-loop state-space representation of the IBC becomes and the final state-space system with the hybrid controller, which is a Multi-Input Single-Output (MISO) system, corresponds to In Equation (37), the inputs are given by the duty cycle of inductors (U d 1 and U d 2 ), and the output y(t) corresponds to the capacitor voltage (v C 1 ). Therefore, we design one controller for each input, as shown in Figure 8, where r(t) is the IBC voltage reference and u 1,2 (t) are the new inputs for the IBC states feedback. This scheme is advantageous, as we can tune each controller independently [54].

MG Controller Optimization
In the case of the microgrid (MG), we follow a similar approach. This time, however, we consider a Proportional-Integral (PI) block instead of only an integral component. This is done by striving for an accurate, fast, and robust controller. As with the previous case, the hybridizing process is shown in Figure 9, where u control d,q are the new inputs for the MG states feedback, r d,q (t) is the MG voltage reference for d and q component, y(t) is the MG output voltage and equivalent to the states v C d and v C q . K p and K i are the proportional and integral gains of proposed hybrid controllers, respectively. Keep in mind that for both cases,ė is the controller state added to the corresponding dynamic. Thence, the MG dynamic can be represented by The control strategies described in (37) and (39) guarantee that such dynamic models inherit the properties of the LQR and traditional controllers. Therefore, they can provide a low-cost system operation, robust reference tracking, and steady-state error minimization. In turn, this allows for optimal energy management at the IBC-MG coupling and between the MG and the electrical grid. Notice that Q and R have a remarkable effect on controller performance since these matrices depend on the state number of the system and the actuator effort. Conversely, the LQR algorithm may present a poor performance for some arbitrary parameters, leading to impractical Q, R, and K parameters that compromise controller performance. Such an issue can be addressed by implementing algorithms that render optimal elements for such matrices, e.g., metaheuristics. Additionally, one can calculate the proportional and integral gains and the LQR parameters by fusing the variables of the hybrid controller through a single fitness function that considers the system design criteria.

Fitness Function
Throughout this work, we compare the three metaheuristics presented in Section 2.3 from the perspective of controller performance. Thus, we use the overshoot, settling time, and ripple, yielded by each controller as the comparison parameters. To this end, we require the K, Q, and R matrices, cf. (32). For the IBC, the LQR parameters are computed such as Similarly, the LQR parameters for the MG are given by With this information, one can assess the performance of a given controller through where w 1 and w 2 are values between zero and one, w 1 , w 2 ∈ [0, 1], for prioritizing the overshoot or the settling time, respectively. Regard that MO shoot and MT s are the maximum overshoot and settling time values, respectively, which are fixed by the user. Besides, O shoot and T s are the actual values yielded by the controller, i.e., overshoot and settling time, respectively. It is also crucial to disclose how metaheuristics represent these design variables. In the case of the IBC, there are six unknowns, i.e., three elements of Q, two of R, and the integral action K i . For the MG, the number of variables is one less. The reason is that there are two unknown values for the Q matrix, one for the R variable and two for the PI controller (K i and K p ).

Methodology
To implement and analyze our proposed approach, we followed a two-stage methodology. Each stage focuses on a different scenario. The first one tackles the IBC as a standalone device, whereas the second merges it with an MG. In both cases, we considered the same PV array and IBC. Therefore, we assumed the parameters given in Table 2 for all simulations.
Additionally, we used the parameters given in Table 3 and repeated each experiment 30 times for statistical purposes. Note that we selected a population size of 10 for comparison purposes and following previous reports [10,17]. Moreover, although we selected the PV array with illustrative purposes, our proposal can be easily extended to other configurations. In the following lines, we provide the details about each stage.

IBC Experiments
We begin by analyzing the behavior of the IBC when fed with the irradiance profile shown in Figure 10, with the task of providing the current displayed in Figure 11.  This is done to compare the performance of our proposed approach against previously published data. Therefore, we analyze the same time intervals that other authors have used before [10]. The set-point is defined to a value high enough so that it can be paired with the MG. Thus, we select a value of 300 V.
To compare the performance of the generated controllers, we analyze data for three categories: maximum overshoot, response time, and voltage ripple. We seek controllers with zero overshoot (O shoot ). Nevertheless, their settling time (T s ) are made free, and thus they may vary w.r.t. the data reported in the literature. In this sense, we conduct a comprehensive analysis to determine the best controller configuration. Additionally, we compare the computing requirements and the performance of designing controllers with each one of the proposed metaheuristics. For this endeavor, we gather data about the integral gain of the resulting controller (K i ), the minimal error, the number of iterations (τ max ) required by the algorithm, and the convergence time.

Experiments with the MG
In the second stage of our work, we verified whether our proposed approach could provide a good enough controller for an MG. Therefore, we implemented the experiment shown in Figure 12, where the parameters of the MG are shown in Table 4.  In this experiment, an optimal control strategy must regulate the energy transfer between the IBC and MG so that the voltage at the PCC becomes balanced. We also developed hybrid controllers for this stage, but the fusion between PI and LQR gave them. We tuned these controllers with each one of the metaheuristics (MHs) considered in this work. Therefore, we assessed their performance in terms of the energy cost associated with the resulting controller, their error convergence, and the computational resources their tuning demands. Recall that the energy cost is directly linked to the MG voltage and the proportional gain value (K p ) of the controller. As the former is fixed, controllers with smaller K p lead to a lower energy cost. Thus, we sought controllers with T s = 0.325 ms and O shoot = 5%, which were found by minimizing the cost function shown in (42).
We compared the controllers based on their overshoot, response time, and error convergence as with the previous stage. However, this time around, we also focused on the gains of the resulting controllers (i.e., K p and K i ). Likewise, we compared the performance of metaheuristics via their computing burden.
Our main long-term goal was to validate the MG performance when facing power quality events. Therefore, for this work, we regarded a final approach with a battery of tests based on the following conditions:

1.
The MG is loaded with different unbalanced voltages that come from distribution network failures, including negative sequence.

2.
The MG is faced with balanced nonlinear loads that exhibit harmonic contents.

3.
The MG is simultaneously connected to nonlinear loads and unbalanced voltages generated by the utility grid.
Note that all our experiments were run in Matlab R2021a, using a PC with a 2.60 GHz Intel Core i7-9750H CPU, 8.00 GB RAM, and Windows 10.

Simulation Results and Discussion
We now present the data resulting from our experiments. To make things easier for the reader, we follow the same structure from Section 4. Table 5 presents the best controllers yielded by each one of the considered MHs and their performance, along with the data from two previous works, i.e., Habib et al. [10], Cao et al. [17]. Note that these data correspond to the response of controllers under the schemes shown in Figures 7 and 8. From these results, one can evidence with ease that the controllers achieved are quicker than those from previous works. This effect is due to the values of the integral gains. Moreover, even though these values are higher than in previous works, the designs presented in Table 2 do not exceed the saturation point for the control action. Table 5. Comparative data for the IBC controllers developed with three different metaheuristics and with previous approaches. All controllers were tuned seeking a zero overshoot and calculating the error according to (42)

Approach
Iter. Another feature to highlight is the few iterations required by the MHs for tuning controller parameters with an excellent response (T s = 0.045 s, O shoot = 0%). Keep in mind that Cao et al. [17] found all six values for the controller parameters, but a common approach is to simplify the search by reducing the parameters in half, as shown by Habib et al. [10]. This effect can be achieved by assuming that both controllers from Figure 8 have the same parameters. Therefore, instead of specializing each controller, we design a general one capable of handling both tasks. Figure 13 shows the response of each controller, as well as the working regions, analyzed thoroughly in this experiment. Plus, Figure 14 details each region from Figure 13. Within the first region (Figure 14a), the controllers tuned by PSO (reddish line) and by GA (blueish line) fail to comply with the zero overshoot requirement, but they have a fast response. Conversely, the slowest controller corresponds to the one proposed by Cao et al. [17] (purple line), closely followed by the one proposed by Habib et al. [10]. Nonetheless, our remaining proposal (yellowish line), employing GWO, is the fastest controller and complies with the zero overshoot requirement. Thus, it seems as if the GWO algorithm is a good alternative for designing this kind of controller. There is an interesting pattern in the remaining regions (Figure 14b). For regions B and D, the controllers behave akin to region A. Nevertheless, for regions C and E, the controller proposed by Habib et al. [10] becomes the one with the maximum overshoot value and the slowest response. Once again, the controller tuned by GWO (i.e., GWO I-LQR) performs best, exhibiting virtually no overshoot and providing the fastest corrections when faced with perturbations. To better assess the performance of the available controllers, Table 6 presents three metrics evaluated at each region, along with their average value across all regions. It is noticeable that all controllers fail at preserving the zero overshoot response at regions C and E. This phenomenon is generated mainly because of a perturbation that suddenly increases the irradiance profile at these regions (cf. Figure 10). Even so, the GWO I-LQR controller always exhibited the lowest overshoot, leading to average values about 40% smaller than that of the second-best controller; the one proposed by Cao et al. [17]. In contrast, the PSO I-LQR controller yielded the worst response in terms of overshoot. It rendered the maximum average value that derives from having the poorest behavior for most regions. Such a value is almost thrice the one for the controller proposed by GWO.   In terms of the response time when facing perturbations, GWO remains the approach that provides the best controller. However, from this perspective, the previously proposed control strategies perform poorly, having an average response time of about three or more times higher than the GWO I-LQR controller and even about two or more times higher than our slowest controller (PSO I-LQR). Notwithstanding, note the reduction in the voltage ripple metric. Even if the GWO I-LQR controller achieved the best average value, the PSO I-LQR controller is the one with minimal voltage undulation from regions B to E. The reason is that in region A, the ripple exhibited by the PSO I-LQR controller goes beyond four times the one yielded by the GWO I-LQR controller, which increases its average value. In contrast, the ripple exhibited by the GWO I-LQR controller reveals a pretty stable dynamic across all regions, with a maximum variation of 0.5 mV. Once again, the design proposed by Cao et al. [17] performs the poorest, followed by the design from Habib et al. [10]. The former exhibits a ripple of about eight times higher than the GWO I-LQR alternative, though the latter still renders a four-fold difference. In summary, we corroborate that the controller tuned by the GWO algorithm is the best alternative as it ranks first in all metrics.
We now move on to validate if these insights hold when all runs are observed as a whole (Figure 15). In the case of the integral gain of the controller (K i ), Figure 15a shows that GWO exhibits a high concentration around K i = 70, with some isolated cases between 35 to 70. Data from PSO and GA are more spread out, with median values (white circles) of 62 and 72, respectively. The integral gains are uniformly distributed, but GA obtained the highest K i values. It is interesting to see that GWO generates stable data and provides an intermediate gain value for the controller (median value of 69). This yields high performance in terms of controller velocity since low values lead to slow responses, and high values risk controller saturation. In any case, tuning controllers with GA seems to provide the best error levels (see Figure 15b). Nonetheless, the three metaheuristics rendered controllers with acceptable error margins (below 0.1), although GWO offers a majority of runs within such a range. It is also essential to analyze the computational effort of finding such controllers. Therefore, Figure 15c,d details the number of iterations and the convergence time of these experiments. As can be seen, GWO exhibited the best performance, requiring a median of 6 iterations that were run in about 5 s. This result represents a mean reduction of about 19.62% and 15.58% w.r.t. the requirements of the other MHs.

MG Experiments
We now analyze how the controllers change when plugging the IBC into the selected MG. Table 7 shows the best controller configuration achieved after 30 runs with each metaheuristic. As in the previous stage, the controllers developed by GWO exhibit good performance. In this case, the controllers shown in Table 7 require an MG voltage of 300 V for reaching their operational point. Likewise, the selected controllers present a similar performance in terms of overshoot, settling time, state feedback gains (K), and proportional and integral constants (K p and K i , respectively). Be that as it may, the controller proposed by GA has a K p~2 9% higher and a K i~8 .80% lower. Besides, its tuning required more iterations. Moreover, this pattern holds for all runs (Figure 16a,b). GWO obtains the best features in terms of error, iterations, and convergence time (Figure 16d-f), providing better-suited designs. Let us take a look at all the runs to determine if these patterns hold. Figure 16a shows that the proportional gain reached by PSO for the controllers seems uniformly distributed and covers a wide range. Besides, it includes small values such as those achieved by GWO and GA. On the contrary, data for the controllers tuned by GWO and GA are more stable. Although the K i median value is similar across GWO, PSO, and GA (Figure 16b), the last two have some isolated runs towards opposite extrema. Even so, note that all the implemented methods exhibit a high concentration corresponding to the overshoot information (Figure 16c). However, the designs achieved with GA displayed the highest median error levels (Figure 16d), and they also required a high number of iterations (Figure 16e) that consumed the highest amount of computing time (Figure 16f). In contrast, GWO provides a good balance between a low-cost search and the desired performance, thus representing the best alternative when designing PI-LQR controllers for this IBC-MG system. Bear in mind that the controller parameters found by GWO require an MG voltage of 300 V in its operational point; this concept is associated directly with searching for low-cost dynamics. Therefore, we use the design shown in the third row of Table 7 for the tests that follow.  After analyzing the general scenario, we migrate to the power quality tests. Let us begin by observing what happens when the distribution network demands unbalanced voltages. Figure 17a corresponds to the system working in normal conditions, i.e., our base case. Such conditions include the connection of linear loads and VUF = 0% when the simulation starts. Note that the controller is turned off during the interval 0 s < t < 0.1 s to validate the posterior control response. During this period, the MG consumes power because the energy flows from the electrical network towards the MG. At t = 0.1 s the controller is activated and it reaches the voltage references (V ref d = 120 V and V ref q = 0 V) V rms at t = 0.104 s, which maintains the equilibrium voltage at the PCC. It is easy to notice that the system operates appropriately. Furthermore, note that all data from this point onward assume an activated controller as in this scenario. Figure 17b displays the effect of a grid failure leading to a VUF index of 5% in the MG. When the controller is turned on, VUF is quickly reduced to 1.51%. The proposed controller can also handle higher VUF values. For example, 7% and 9% indices are diminished to 2.15% and 3.25%, respectively, as presented in Figure 17c,d. Our second power quality test focuses on harmonics attenuation. The nonlinear loads considered for the simulations are composed of three single-phase bridges with capacitive filters and resistive loads connected to each phase. For quantifying the Total Harmonic Distortion (THD) index, a Fast Fourier Transform (FFT) analysis was applied to voltage signals v a , v b , and v c at the PCC to measure the harmonic content in each phase. In this order of ideas, Figure 18 shows a simulation that assumes a THD index of 6.18% (for all v a , v b , and v c signals), which may appear when nonlinear loads are connected to the PCC. When the controller is enabled, it almost halves the THD index, lowering it to 3.51%.
Finally, we analyze a critical scenario with a fusion of the prior situations. Therefore, Figure 19 presents the case where the hybrid controller must simultaneously handle harmonic distortion produced by nonlinear loads and voltage disequilibrium generated by a failure within the utility grid. We assume a VUF index of 8% for this simulation, which leads to a THD index for v a , v b , and v c of 6.18%, 5.60%, and 6.74%, respectively. These values are obtained through a spectral analysis with the FTT. Once the controller powers on, these indices are improved and provided a VUF value of 3.38% and a THD value of 2.65%, 3.55%, and 4.11% for v a , v b , and v c , respectively. Table 8 contains the data of the first five harmonics for these last scenarios. For the second study case (Columns 2 and 3 of Table 8), the 3rd and 9th harmonics were fully mitigated for all phases. In the same scenario, the 11th harmonic was attenuated by 10% for all phases. Notwithstanding, the 5th and 7th harmonics increased its harmonic voltage content by 17.21% and 27.31%, respectively. However, in general terms, the proposed controller reduced the THD index by about 43%. As to the third study case (see Columns 4 and 5 of Table 8), the 3rd harmonic was reduced by 73.87% for all phases. Similarly, the 7th harmonic was attenuated for v a and v c phases by 33.35%, while the 9th harmonic was mitigated for v b and v c phases by 54.95%. Similarly, the harmonic content of v a and v b phases for the 11th harmonic were reduced by 34.60%. Although, the harmonic content of some phases increased, especially for the 5th harmonic. In summary, the controller mitigated THD index by 44.40%, thus demonstrating good behavior when handling this kind of perturbation.

Conclusions
This article carried out a comparative study for designing controllers for an Interleaved Boost Converter (IBC) fed by a photovoltaic (PV) array. To this end, we used the three widespread metaheuristics: Genetic Algorithms (GA), Particle Swarm Optimization (PSO), and Gray Wolf Optimizer (GWO). We also contrasted our data against previously published controllers for IBCs in terms of three performance metrics: the maximum overshoot, the response time when faced with perturbations, and the output voltage ripple. Besides, we analyzed these metaheuristics when tuning controllers for a system comprised of the IBC and a microgrid (MG) under different testing conditions.
We found an interesting behavior. For both experiments, i.e., the standalone IBC and the interconnected scenario, GWO provided the best results. In the first case, we achieved an average overshoot reduction of 41.86% compared with the worst performance described by the PSO alternative (PSO I-LQR). Furthermore, the time response when faced with perturbations and the output voltage ripple were reduced in an average of 71.05% and 86.97%, respectively, according to the data achieved with the controller proposed by Cao et al. [17]. For the second scenario, GWO provided the best results while also demanding a low energetic cost that translates into a small-scale deployment of PV arrays. Therefore, the proposed PI-LQR controller driven by GWO guaranteed fulfilling the international standards established for energy quality indices, according to the results shown in Table 8 and Figures 17-19. Although we consider that experimental tests are relevant, we limited our approach to simulation scenarios in this work. The simulated results demonstrated the effectiveness and robustness of the proposed hybrid controllers for each testing scenario, achieving an equilibrium on the parameters established for all study cases. Therefore, using metaheuristics seems like a viable path for tuning this kind of controller. We showed that the resulting devices are even useful when facing power quality issues.
We identified two interesting paths for future works. The first one considers the physical implementation of the proposed experiment in a power hardware-in-the-loop platform. The main idea of this research path is to carry out an experimental validation of the hybrid controllers and to validate the performance of the MG and IBC models in real-time systems. As to the second path, we intend to explore different controller configurations applied to either the IBC or the MG dynamics. This should consider aspects associated with controller performance when faced with a broader set of power quality events and the effects of such events within the electrical grid. For achieving this, one could pursue two approaches. One of them is to use MHs to tune a controller that can withstand the diverse set of power quality perturbations, following a process akin to the one shown in this work. The other one is to create a set of controllers, where each controller specializes in a specific kind of perturbation, and then use a high-level approach (such as a hyper-heuristic or a machine learning algorithm) to learn when to use each controller. The final path contemplates improvements upon the filtering stage of the microgrid. We believe that by using MHs, one may generate a filter topology in agreement with electrical features such as harmonics attenuation, filter size, and power supply.