Genetic Algorithm on 2nd Voltage Harmonic Mitigation in Hybrid Microgrids

This work introduces a compensation scheme that uses a genetic algorithm to mitigate the 2nd voltage harmonic component of hybrid microgrids. The foremost advantage of the proposed scheme, is its capability to effectively compensate the 2nd harmonic component regardless of the feeder impedance, the location of the equipment and without any need for real-time communications. A graphical representation of the genetic algorithm parameters is also presented, being a handily tool for designing it for any microgrid application and the mathematical analysis of hybrid microgrids under the prospect of harmonic compensation is given. Simulations and experimental tests verify the effectiveness of the proposed method, indicating that its efficiency is maintained at about 90%, while the efficiency of the other methods falls below 35% when the impedance of the connection line increases at 1+0.16j Ω(@100 Hz). Finally, a comparative analysis is also performed between the proposed method and existing ones.


I. INTRODUCTION
Hybrid microgrids have received increased attention over the past years since they enhance the capacity, the power quality, and the reliability of the existing AC grid [1] - [5]. The division to AC and DC subgrids, as depicted in Fig. 1, allows a flexible organization of AC and DC sources / loads, reducing power conversion stages and improving the overall efficiency of the microgrid. In addition, the interconnection of AC and DC subgrids via multiple interlinking converters, enhances the reliability and reduces the control complexity [1], [5] - [8]. However, hybrid microgrids face technical challenges due to the high penetration of power electronics devices, which impose current and voltage harmonic distortion as well as power ripples in DC subsystems; DC power ripples cause a significant system degradation to DC subgrid [9], [10].
In order to address this issue, relatively large electrolytic capacitors are used in the DC subsystem which act as buffers. However, the large volume, weight, limited life expectancy, and the increased cost of the electrolytic capacitors make them an undesirable solution [2], [9] - [11]. In recent years, Active Power Decoupling (APD) methods have attracted much attention in order to effectively resolve this issue, overcoming the aforementioned disadvantages of passive decoupling methods [9] - [15]. The fundamental idea behind APD is to provide the power ripple by another energy device and effectively reduce DC bus capacitance. Consequently, large electrolytic capacitors are avoided and smaller in volume and weight, with prolonged lifetime, film or ceramic capacitors are used instead [9], [10].
Several papers deal with the classification of APD methods [10], [12], [13]. In [12], APD methods are classified according to their control principle, while in [10], APD methods are classified into independent and dependent ones (the classification is whether the APD method has been integrated to the original converter or not); whereas in [13], APD methods are classified according to their topology (i.e., rectifier, inverter, bidirectional) and the existence of galvanic isolation or not. However, these APD methods require the hardware modification of the host system and the access to several internal terminals (e.g., AC terminal, phase leg switches), the addition of extra hardware such as switches, inductors and capacitors and the utilization of expensive central controllers and/or peer-to-peer communications. These requirements, prevent these APD methods from being applied to hybrid microgrids, as they increase the cost and the complexity, while they compromise the operation of the microgrid. In order for an APD method to be considered suitable for microgrids, it should present some distinct characteristics: 1) integration of the APD method in the existing equipment of the microgrid, 2) the performance of the APD method should not be compromised by the physical location of the compensation circuit, and 3) the APD method should not require additional equipment or extra communication lines. Given these challenges, the realization of distributed power ripple compensation in hybrid microgrids becomes necessary. A distributed power ripple compensation method must be easily integrated as a secondary function in the already installed DC/DC converters (using dedicated ripple mitigators can be costly), and the power ripple compensation should not be compromised from the physical locations of the compensation converters (i.e., connection line impedances). In this direction, some APD methods have been proposed in literature [14] - [18]. In [14], a virtual resistor-based method is introduced that automatically shares the second order ripples between the distributed DC/DC converters, being easily integrated in dc-APF (Active Power Filter) and energy storage units (ESUs); however, the efficiency of this method is reduced in the presence of mismatched feeder impedances and a supervisory controller to address this issue is utilized. The work in [15], introduces a plug and play voltage ripple mitigator. However, this APD method requires extra hardware, whereas it has limited flexibility in terms of installation; as regards the physical location of the device, it should be installed directly at the DC link of each individual converter. In [16], a frequency adaptive virtual oscillator control is proposed. The virtual control enables the power compensation in a decentralize manner; however, this method relies on the existence of APFs in each node, which is neither practical nor cost effective. The researchers in [17] and [18], propose an oscillatory current sharing control strategy in DC microgrids which compensates the power ripples by forming the output impedance of the distributed units; however, in both works the knowledge of the total harmonic current is required, which is not accessible in most cases. Overall, the main drawbacks of the existing APD methods from the perspective of microgrids can be summarized in: a) need for modification of the host system, b) addition of extra hardware, c) utilization of expensive communication infrastructure and central controllers, d) APD methods' efficiency depends on the physical location of the compensating circuit, e) need of knowledge of several microgrid parameters that are not available (e.g., line impedance values, total harmonic current etc.).
As regards meta-heuristic algorithms, such as Genetic Algorithms (GA), they are widely used in microgrids' applications to deal with optimization problems that other classical numerical approaches face difficulties in solving [19] - [24]. In [19] a hybrid ant colony optimization and cuckoo search optimization method is utilized. to deal with the optimization of charging / discharging schedule of electric vehicles in microgrids. In [20], a three-level planning model for optimal sizing of networked microgrids is introduced. The method utilizes the adaptive GA to tackle the normal sizing problem and achieve an optimum tradeoff between cost and resilience. In [21], a tailor-made GA is utilized to tackle the optimal sizing problem in hybrid AC-DC microgrids, while a non-linear solver is deployed to solve the operational cost problem. In [22], the glow-worm swarm optimization algorithm is utilized to deal with the optimal management of a smart power distribution grid, where a direct control scheme over the loads is applicable. In [23], the optimal scheduling of an energy network aiming to minimize CO2 emissions or energy costs over a certain period time is achieved by means of genetic algorithm and tabu search. In [24], a detailed overview of the most recent meta-heuristic approaches for smart microgrids is carried out, while the advantages, disadvantages and the applications of each meta-heuristic approach are extensively discussed.
In this context, this paper proposes an APD method that compensates the 2 nd harmonic component of the DC subgrid by means of a GA, overcoming the significant drawbacks of the previous discussed methods. The proposed method can be implemented in any DC/DC converter without the need of hardware modification. enabling the utilization of the existing DC/DC converters in the power ripple mitigation effort. However, as highlighted in [14], the installation of an APD method in dc-APF and bidirectional Energy Supply Units (ESU), e.g., supercapacitor banks, is more appropriate, without implying that the installation in other types of DC/DC converters is prohibited. It is worth noting that the incorporation of ripple mitigation functions in battery or fuel cell based ESUs is not recommended, since ripple current will affect their lifespan. The proposed method compensates the second-order ripples in the DC bus by a remote converter (i.e., the converter is not directly connected to the DC bus), enabling so the use of the existing DC/DC converters as compensating converters (regardless their location within the DC subgrid), whereas their 2 nd harmonic component compensation performance is independent of the impedances of the connection lines. As regards the communication infrastructures, the proposed method does not require realtime communications nor real-time measurements; however, it requires a (near real time) sparse communication network in order to evaluate the effect of the compensating current to the DC bus voltage, as it will be explained later on. Nonetheless, a sparse communication network is available in most hybrid microgrids anyway, in order to achieve some other distributed functions (such as load sharing, energy management, etc.) [5] - [8], [25], so this requirement it is not considered as a burden. In addition, in order to overcome any undesirable effects caused by the latency of the sparse network, this latency is taken into account in the design of the proposed method.
The rest of the paper is organized as follows: Section II describes the system under study and analyzes it under the prospect of the 2 nd harmonic voltage component, Section III introduces the genetic algorithm, Section IV discusses the parameters of the genetic algorithm, Sections V and VI present the simulation and experimental results, respectively, Section VII presents the comparative analysis between the existing methods and the proposed one, and Section VIII concludes the paper.

II. SYSTEM DESCRIPTION & ANALYSIS UNDER THE PRESENCE OF 2 ND ORDER HARMONIC COMPONENTS
The structure of the system under study is illustrated in Fig.  1. Overall, it consists of a DC subgrid and an AC subgrid, coupled via a number of AC/DC converters, being so a hybrid microgrid. This work proposes a DC ripple mitigation scheme, so the analysis will focus on the DC subgrid. The equivalent electrical circuitry of the DC subgrid is depicted in Fig. 2. It consists of DC/DC converters that act as voltage sources and regulate the DC bus voltage (denoted as voltage regulating converters), DC/DC or AC/DC converters that act as current sources and provide or absorb energy from the DC bus (denoted as power converters); Cbus and Rload. Are the total capacitance (capacity bank) and DC load that are connected directly to the DC bus; in this regard, DC voltage regulation is a complex process that depends on the presence of grid, energy storage reserve, energy sources capacity and loads. Various energy management schemes that regulate the DC bus voltage have been proposed in literature [26] - [28], however, DC bus voltage regulation is not within the scope of this work; thus, it is assumed that some converters are selected to provide the proper voltage regulation of the microgrid.
Voltage regulating converters are modeled as DC voltage sources Vdc,2N in series with their output impedances Zf,2N and power converters are modeled as current sources in Fig. 2, providing or absorbing power from the regulated DC bus. DC/DC power converters interface DC loads, energy sources, and ESUs. AC/DC power converters interface AC loads, AC power sources and interlink DC, and AC subgrids. DC/DC power converters are modeled as DC current sources, Idc,1N, paralleled with their respective output impedances, Zf,1N, as depicted in the top right of Fig. 2, while the AC/DC power converters are modeled as DC current sources, Idc,N, with imposed current ripple harmonics [29], [30], as perceived from the perspective of the DC subgrid; the equivalent model is illustrated in the bottom right of Fig.  3, where multiple higher harmonic-order current sources, in,N, are connected in parallel with the DC current source and the respective output impedances Zf,N of the AC/DC converters.
In DC subgrids the harmonics that are present in normal operation (due to single phase inverters and unbalanced three phase loads) are the even ones (i.e., 2 nd , 4 th , 6 th , 8 th etc.), considering the grid frequency as the fundamental one. The only way for odd harmonics to appear in a DC subgrid is that either the grid has background sub/inter harmonics or an equipment failure exists somewhere in its structure. Therefore, since odd harmonics are uncommon in DC subgrids, the ones of most interest are the even ones, especially the 2 nd order harmonic -since it is the lowest and the hardest to deal with [14].
In this context, the system under study is analyzed in the 2 nd harmonic order, as it is depicted in Fig. 3; the voltage regulating and power DC/DC converters are replaced with their respective output impedances at the 2 nd harmonic order, Zf,XN, in series with their line impedances, Zline,XN, which connects each DC/DC converter to the DC bus. At this point, it should be noted that line impedances in DC subgrids are mostly resistive; however, as the connection lines to the DC bus and the power of the DC subgrid increase, the inductive part of the connection lines becomes comparable with the resistive one. Thus, it cannot be omitted from this analysis. AC/DC power converters are replaced with the sum of all 2 nd order harmonic current sources i2,inj, since the analysis focuses on the DC side and, as it is well known, the sum of sinusoids at the same frequency (even under different phases and amplitudes) can always be expressed as a single sinusoid at that frequency, with some resultant phase and amplitude. The line impedances of these inverters are omitted, since the analysis focuses on the 2 nd harmonic component of the DC bus voltage, V2bus, and the ones that appear at the DC/DC converters terminals, V2zf,XN. On the top left of Fig. 3, the 2 nd harmonic current source i2,c represents the compensation current that aims to mitigate V2bus, injected either from DC/DC converters that already exist in the DC subgrid, or from dedicated equipment that is installed especially for this purpose, such as APFs or Dynamic Voltage Restorers (DVRs) [10], [12] - [15] etc., while Zf,c is the output impedance of the compensating circuit at the 2 nd harmonic order and Zline,c is the line impedance which connects the compensating circuit to the DC bus. From the circuit analysis of Fig. 3, the following equations are derived: , where i2zb is the 2 nd order harmonic current that flows through the DC bus capacitor and causes the V2bus voltage ripples; this is the ripple that should be mitigated. i2zf,Xn is the harmonic current that is drawn from each DC/DC converter and causes the 2 nd order voltage ripple V2zf,Xn. That harmonic causes numerous of problems, such as overheating of batteries, fuel cells' lifetime limitation etc. [9], [10]. i2zf,c is the harmonic current that flows through the output impedance of the compensating circuit and causes the 2 nd order harmonic voltage, V2zf,c. Moreover, In order to demonstrate the voltage mitigation procedure (i.e. V2zf,c) of the compensating circuit, we solve (1) Based on equations (1)  When the compensation circuit is not directly connected to the DC bus it aims to compensate the 2 nd order harmonic component of the voltage at its output terminals, V2zf,c. However, according to (8), this does not lead to the full compensation of V2bus -Eq. (4), (8). To further investigate this issue, Fig. 4 depicts the absolute value of the remaining 2 nd order harmonic component of the DC bus |V2bus| for various values of α = Rline,c/Xline,c, connection line distances (in km), and Zf,c; 100% |V2bus| is the absolute value of the V2bus without any compensation and it equals to |i2,inj‧Zeq|; Rline,c is the resistive part of the connection line that connects the compensation source to the DC bus; Xline,c is the reactance of the connection line at 2 nd harmonic order; Zf,c is the output impedance of the compensating converter at 2 nd harmonic order. The assumptions that were made to derive Fig. 4 are that the compensation converter has an inner current control loop at its inductor current and that Zf,c is purely capacitive. From Fig. 4 is observed that as the output impedance decreases and the compensation source distance from the DC bus increases, the remaining |V2bus| increases even for low a-values. In this context, methods that compensate the 2 nd voltage harmonic at their outputs do not ensure the compensation of V2bus. A secondary controller can be employed to resolve this issue. However, the extra cost and the expensive communication infrastructures that are needed make them not an appealing solution. In view of these challenges, this work proposes an innovative distributed APD method that compensates V2bus, regardless of the Zline,c values, without the need of real-time communications, which is easily employed in the existing DC/DC converters.

III. GENETIC ALGORITHM
GA is a well-known population-based stochastic algorithm that is used in many scientific fields (including microgrids) to solve optimization problems [32] - [38]. The advantages of GA, that make it an appropriate solution for this kind of applications, are: the inherit trait to deal with continuous / discrete problems, constrains are integrated in the genes, search is performed from multiple points, and easy implementation [37], [38]. In this context, GA is selected in this work to mitigate V2bus, since the unknown feeder impedances along with the unknown amplitudes and phases of the injected harmonic currents, that constantly change, demand the use of a metaheuristic algorithm to find the optimum solution.
The design of the proposed GA considers the amplitude and the phase of i2,c as the genes of the chromosomes; whereas parameter |V2zf,XN| serves as the fitness function f, which according to (5) can be rewritten as: The operators that are used in the proposed GA are namely: roulette wheel selection, uniform crossover, and Gaussian mutation [38]. Roulette wheel selection operator ensures the diversity of the new population, as even low fitness chromosomes have the chance to be selected as parents and it is easy to be implemented. Uniform crossover operator further enhances the exploratory behavior of the GA, as it produces chromosomes that are completely different from their parents (if the parents are not the same). Finally, Gaussian mutation ensures the diversity of the new population in a controlled manner, since a maximum / minimum mutation step can be set. These unique characteristics and their ability to be applied to integer and floating type genes, as in our case, are the reasons why these operators are selected. The flowchart of the used GA is presented in the left side of Fig. 5. An initial population of the desired size is initially set with a uniformly random distribution over the search space -later on, the impact of the initial search space to the effectiveness of the GA will be discussed. Afterwards, the fitness of each individual chromosome is computed indirectly as follows: amplitude and phase of i2,c are driven by each chromosome of the initial population and the impact of i2,c to |V2zf,XN| is calculated for each individual. In that way, the fitness value of each chromosome is obtained. The flowchart of the fitness computation algorithm is given in the right side of Fig. 5. Afterwards, the selection, crossover and mutation of the initial population occurs and offspring are produced. The fitness value of each offspring is then computed in the same manner as before. Finally, offspring and previous population are sorted according to their fitness values and the new population emerges, which is subjected to the same process until the fitness value of the best solution is less or equal to the termination value. In that way |V2zf,XN| (being the fitness function) is compensated and, according to equations (7), it leads to the compensation of V2bus. However, since i2,inj can change at any time, it should be checked periodically whether the optimal solution meets the termination criteria. If not, GA is called again and the whole process is repeated.

IV. DISCUSSION ON GA PARAMETERS
In the proposed scheme, the fitness value of each individual chromosome is calculated by evaluating the impact of i2,c in |V2zf,XN|. As depicted in Fig. 6 GA consists of multiple parameters that affect the time needed to find the optimal solution. For this reason, the effect of various variables in GA termination time interval will be discussed and graphically presented in following paragraphs. The results are extracted for each individual operating point out of 1000 runs. The time span to reach the optimal solution has been calculated as the product of the population with tcomp = tcalc= T2h and the necessary number of iterations so as GA meets the termination criteria. It should be noted that the processing time (time needed for a processor to compute the GA) is omitted, since it is insignificant compared to tcomp and the termination time interval. In addition, the values of tcomp = tcalc= T2h and tcomu = 0 were selected, so the following graphs can be easily expanded to include various tcomp values by just multiplying the termination time with the number of T2h cycles that i2,c is injected. In Fig. 7, the box charts of median (light blue in the middle of red boxes), quartiles 25%, 75% (bottom and top of red boxes), minimum (grey plane below red box) and maximum (grey plane above red box) values of GA termination time intervals under various mutation indices (mu) and populations (pop) out of 1000 runs are depicted. mu represents the probability of a chromosome to undergo mutation and pop represents the available chromosomes in each iteration. According to Fig. 7, high mu > 0.7 exhibit increased and highly dispersed termination time intervals, as expected, since GA becomes random and loses its exploitation feature. For mu ≤ 0.7 according to Fig. 7, various combinations of pop and mu values can be selected to exhibit the desired termination time interval. A general rule seems to be that as pop increases, the disperse of the termination time interval decreases. In addition, from Fig. 7 it is observed that lower values of pop need higher values of mu in order to keep the exploration feature of GA and satisfactory termination time intervals. In this context, mu and pop should be carefully chosen so as GA presents short termination time intervals with low divergence. From the aforementioned observations, the most suitable values for mu are 0.2 ≤ mu ≤ 0.7. However, these limits are generic. A detailed value derivation is provided in Fig. 7. (e.g., for pop = 8 and mu = 0.2, GA median termination time interval is high and exhibits high divergence; proper values of mu for pop = 8 are between 0.4 and 0.7).
Search space is considered as the set of values that chromosomes can get, representing feasible solutions. In our application, chromosomes have two genes; one for the amplitude and one for the phase of i2,c. Values of phase genes are restricted between 0 o and 360 o . However, values of amplitude genes can be any positive real number. In this frame, the initial search space may or may not include the final solution. It should be noted that the percentage of the initial search space (x-axis in Fig. 8) is set as the initial maximum amplitude value that genes can get, divided by the amplitude of the optimum solution. On the other hand, phase genes do not affect the expansion of search space since their boundaries are well defined; thus, they are not considered in the initial search space. The effect of initial search space to GA median (light blue), quartiles 25%, 75% (bottom and top of red boxes), minimum (grey plane below red box) and maximum (grey plane above red box) termination time intervals is illustrated in Fig. 8, for various mu values and pop = 16. According to these results it is concluded that the GA termination time interval is reduced if the initial search space includes the final solution, whereas it remains under 6 s for all search space and mu values, even in worst case scenarios. It should be noted that the smaller the initial search space is, the better the transient response of V2bus becomes, since injection current i2,c (which is controlled by GA chromosomes) will be limited in lower values to begin with. On the other hand, if the final solution is not included in the initial search space, then it will be found through the mutation process which allows the expansion of the search space. In this light, the initial search space should be carefully chosen in order to keep GA termination time interval at desirable levels, without compromising the safe operation of the microgrid. GA termination time intervals for different pop values are not depicted for the sake of paper length, however they present the same characteristics as those in Fig. 8. Fig. 9 depicts the effect of various mu and sigma values to GA median (light blue), quartiles 25% ,75% (bottom and top of red boxes), minimum (grey plane below red box) and maximum (grey plane above red box) termination time intervals. sigma is a parameter of mutation operator which dictates the maximum step that a mutated offspring can make in their genes, i.e. amplitude and phase of i2,c. This parameter is of major importance, since it can affect GA termination time interval. In Fig. 9, sigma is presented as a percentage of the initial search space, which is considered to be 150%. In other words, the initial amplitude values that genes can get are between 0 -150% of the final solution amplitude, whereas sigma is set as a percentage of the maximum value of the initial amplitude that genes can get, i.e. 0.1 -0.7 × 150% of the final solution amplitude. As depicted in Fig. 9, high values of sigma lead to more disperse results and as mu grows, termination time interval tends to become longer. The best choices, according to Fig. 9, seems to be sigma = 0.  Fig. 9; however, for the sake of paper length they are omitted too. Finally, Fig. 10 illustrates the standard deviation of GA termination time interval out of 1000 runs for different termination criteria and pop = 16, mu = 0.5, sigma = 0.1 and search space = 150%. termination criteria parameter is defined as the maximum allowable value of the objective function |V2zf,XN| that GA should reach in order to be terminated. As expected, higher termination criteria values lead to smaller termination times. However, higher termination criteria could lead to higher remaining |V2zf,XN| and -consequently -V2bus; so, a compromise between termination time and remaining V2bus must be made. It is noted that different combinations of pop, mu, sigma and search space values would result to same observations, whereas termination criteria is set to ≤ 2 in previous graphs.
Considering the previous graphs, a guideline to design GA for any kind of microgrid application is given here: a) A pair of mu and pop values that exhibit satisfactory termination time and low variance are selected from Fig. 7. b) If the maximum amplitude of the current to be compensated is given, the initial search space and sigma values are found from Fig. 8 and Fig. 9 respectively. Otherwise, the sigma value is selected from Fig. 9 whereas the designer defines the maximum allowable step an offspring can take in its amplitude genes (considering transient phenomena and converter's stress), which results in the calculation of the initial search space. E.g., if the chosen mu is 0.5 the best choice (derived from Fig. 9) for sigma is 0.1. If the maximum allowable step is defined at 2 A, then the initial search space is set as 0 -20 A. c) Termination criteria value is selected, considering Fig.  10 and the microgrid's tolerance as regards the remaining V2bus.
d) tcomp is selected, considering the maximum delay on microgrid's sparse communication network.
All in all, in this section the effects of mu, pop, search space, sigma and termination criteria to the GA performance have been discussed and graphically presented. In addition, the process of fitness evaluation has been thoroughly described and the appropriate selection of the injection time, tcomp, in order to eliminate the need of real-time communication has been discussed, while a guideline to design GA for any kind of microgrid application has been derived. In the following sections, the simulation results and the experimental validation of the proposed scheme are presented and extensively discussed.

V. SIMULATION RESULTS
A simulation model has been developed in MATLAB Simulink in order to verify the proposed scheme. The simulation comprises of two (2) synchronous buck converters and an H-bridge inverter along with AC and DC loads; switching models for both the DC/DC converters and the inverter are used in this model. As pertains to the control strategy of the DC/DC converters, the one is used to regulate Vbus and implement the proposed GA while the other injects constant power to the DC bus and calculates / transmits the fitness value |V2zf,2|, which is calculated with the aid of the Goertzel algorithm. On the other hand, the inverter is controlled to regulate AC bus voltage Vac and absorb power from the DC bus. The electrical circuit of the hybrid microgrid along with the respective controls of each unit are depicted in Fig. 11a. The electrical and the GA parameters of the system under study are summarized in Table I, whereas Vs,1, Vs,2 are the DC input voltages of top and bottom converters in Fig. 11a; Vbus.n is the nominal DC bus voltage; Vac.n is the nominal rms AC bus voltage; fac is the fundamental frequency of the grid; Pout,2 is the average power output of bottom converter; Lf,1, Lf,2 are the inductances of top and bottom converters respectively; Cf,1, Cf,2 are the capacitances at the output of top and bottom converters respectively; Li, Ci are the inverter's filter inductance and capacitance; Cbus is the capacitance at DC bus; Rload,ac, Rload,dc are the resistive loads that are directly connected to AC and DC buses; Zline,1, Zline,2 are the connection lines impedances at 100 Hz of top and bottom converters. GA parameters were selected according to the proposed design: a) from Fig. 7, the pair of pop = 8 and mu = 0.5 are selected since they exhibit satisfactory termination time and low variance; b) search space = 150 % and sigma = 0.1 for mu = 0.5 are selected from Fig. 8 and Fig. 9, respectively, since the maximum amplitude of the current to be compensated in our microgrid is given (~9 A); c) termination criteria < 2 is selected, considering Fig. 10 and the accepted remaining V2bus in our system; d) tcomp = 0.02 s is selected, considering the maximum delay on our microgrid's network. This article has been accepted for publication in IEEE Access. This is the author's version which has not been fully edited and content may change prior to final publication. Citation information: DOI 10.1109/ACCESS.2022.3186468 In Fig. 12, the key waveforms of Vbus, Vzf,2, Vzf,1 and iL,1 are depicted before, after and while GA is active. At 0.1 s GA starts and it terminates at 0.8 s. During this time interval, GA searches for a solution that meets the termination criteria. This results into some kind of variation of Vbus, Vzf,2, Vzf,1 and iL,1; however, these variations decline as GA reaches its final solution. Nevertheless, they do not have any serious impact on microgrid operation, since they are not prolonged nor high enough. After GA termination, V2bus is significantly reduced and the effectiveness of the proposed scheme is verified.  For the sake of comparison, the virtual impedance scheme proposed in [39], [40], the virtual resistance scheme proposed in [14], [18] and voltage ripple mitigator proposed in [15] are utilized instead of the proposed GA, under the same test conditions (summarized in Table I), and the results are depicted in Figs. 13 -15. Based on the results that are shown in these figures, we conclude that the activation of the methods under study results to the immediate mitigation of V2zf,1 but this does not lead to the full compensation of V2bus in the presence of line impedances. Specifically, the activation of virtual impedance reduces V2bus by ~59%, as depicted in Fig. 13, the activation of virtual resistance reduces V2bus by ~63%, as depicted in Fig. 14 and the activation of voltage ripple mitigator reduces V2bus by ~65%, as depicted in Fig. 15. On the other hand, for the same operating conditions, the use of the proposed GA achieves ~90% reduction of V2bus, as depicted in Fig. 12. In order to demonstrate that the efficacy of the methods under study will be further degraded by increasing the line impedances, while the performance of the proposed GA method will not be affected, a case study in which we increase the line impedance Zline,1 (i.e., the line connecting the compensating circuit to the DC bus) to 1+0.16j Ω(@100 Hz) is considered. The results are depicted in Figs. 16 -19, where the virtual impedance methods reduce V2bus by ~35% and so their performance is reduced by 24%, as shown in Fig. 16, the virtual resistance methods reduce V2bus by ~33% and their performance is reduced by 30%, as shown in Fig. 17, and the voltage ripple mitigator method reduces V2bus by ~35% and its performance is reduced by 30%, as shown in Fig. 18. On the contrary, GA achieves ~93% reduction of V2bus, as depicted in Fig. 19, and so its performance remains unaffected by the increase of the line impedance. From the above results, the superiority of the proposed scheme is supported further under the presence of considerable line impedances.

VI. EXPERIMENTAL VALIDATION
In order to experimentally verify the effectiveness of the proposed scheme, a test bench of two synchronous buck and one H-bridge inverter was constructed, same as in the simulation model, which are depicted in Fig. 11b. As before, the proposed 2 nd order voltage harmonic component mitigation scheme is utilized from one of the DC/DC converters and the effects of the compensation are calculated/transmitted from the other one; while the Hbridge inverter is utilized to produce the current harmonics to the DC bus. The electric parameters, characteristics and GA parameters, that were selected according to the proposed design (GA parameters remain the same as those of simulations ones, since the experimental setup is a scale down of the simulation setup), are summarized in Table II, while the electrical circuit of the hybrid microgrid along with the control scheme of each unit are illustrated in Fig. 11a. LAUNCHXL-F28379D was used to implement the control loops of the top DC/DC converter (in Fig. 11) and of the Hbridge as well, while MicroLabBox ds1202 was used for data acquisition and the control of the bottom (in Fig. 11) DC/DC converter. and phase angle) while GA searches for a solution that meets the termination criteria. Again, this results into some kind of variation to Vbus and iout,1; however, as in Simulation section, these variations become less significant closer to GA termination, and they are not affecting the microgrid's operation -since they are not prolonged nor high enough. After GA termination (as illustrated on the top of Fig. 21) V2bus is significantly reduced, which further highlights the effectiveness of the proposed scheme. In order to illustrate the adverse effect of line impedances on the compensation of Vbus, GA is used to compensate Vzf,1 instead of Vzf,2 and the results are presented in Fig. 22. As in simulations regarding the virtual impedance methods, the virtual resistance methods and the voltage mitigator method, the compensation of Vzf,1 does not lead to the compensation of Vbus and the results are depicted in the middle of Fig. 22, where Vzf,1 is almost fully compensated while at the bottom of the same figure Vbus is not compensated at all. In this context, the superiority of the proposed scheme is further highlighted under the presence of line impedances and the lack of real-time communication. Finally, in Fig. 23 the key waveforms of Vbus and iout,1, along with the GA activation signal, are depicted as Rload,ac changes from 10 Ω to 20 Ω and back to 10 Ω. Based on the presented results we can conclude that the effectiveness of the GA is retained during AC load changes.

VII. COMPARATIVE ANALYSIS
In this section a comparative analysis of the methods discussed in introduction and shown in simulation results is presented. As shown in Table III, the analysis is focused on the distinct features that makes an APD method suitable for microgrids, as per Section I. From this analysis, the methods presented in [10], [12], [13] are excluded, since these methods compensate the power ripples at converter level by properly modifying the host system or by adding additional hardware. These requirements make them unsuitable for distributed power ripple compensation in microgrids. So, the APD methods that have been considered in this work, are those in [14] - [18], [39], [40], and the method proposed in this paper. A comparison table has been used to facilitate the evaluation of the selected methods. The evaluation is performed upon specific features, based on which it can be concluded that the proposed method combines some unique features that other methods do not have, as reflected in Table  III. In detail, the proposed method can be integrated into existing hardware, like most of the APD methods under consideration. However, the most distinct characteristic of the proposed method is that it maintains its performance regardless of the connection line impedances; most of the other methods depend on the line impedance value, either because they do have to measure it, or because the efficacy of the method depends on the given value of the line impedance. A concern of the proposed method is that it needs some sparse communication network in order to achieve the power ripple compensation. However, this is of low importance because the communication required is not in real-time and such a sparse network is already available in microgrids. Therefore, this is not considered as a drawback. On the other hand, the method proposed in [14] needs realtime communication infrastructure to deal with the remaining 2 nd order harmonic voltage, which is considered as a drawback (since it is not available in most cases and it further increases the operational cost of the microgrid). Finally, none of the APD methods under consideration needs the modification of the host system. However, the method proposed in [15] calls for the addition of extra hardware, which highly increases the microgrid cost.
Under this light, the superiority of the proposed method is highlighted when the compensation circuit is not directly connected to the DC bus (which is the most likely scenario) and the operational cost of the microgrid must be kept low. If the compensation circuit is directly connected to the DC bus or the extra cost is not a burden, then the methods proposed in [14], [15], [16], [39], [40] are more suitable for power compensation since they have better response times. However, these requirements are rarely met, so the proposed method is more appropriate in most scenarios.

VIII. CONCLUSION
This work introduces an optimum compensation scheme that enables the utilization of the already installed equipment for the mitigation of the 2 nd voltage harmonic component at hybrid microgrids, regardless of the feeder impedances and the physical location of the compensation equipment, and without the need for real-time communications. In this context, this scheme ensures the safe operation and the power quality of the microgrid. Moreover, this work presents an analytical discussion on GA parameters and their effects on GA performance, from which, the key design guidelines for any microgrid application have been extracted. In addition, the mathematical analysis of hybrid microgrids under the prospect of harmonic compensation is given, being a useful tool for the design of any compensation method in microgrids. Experimental and simulations results, validate that the proposed method is an excellent solution for 2 nd order voltage harmonic mitigation in hybrid microgrids, where there is no real-time communication available or dedicated equipment is installed to the DC bus. Finally, a comparative analysis is given in this work that highlights the superiority of the proposed method.