Minimization of total harmonic distortions of cascaded H-bridge multilevel inverter by utilizing bio inspired AI algorithm

Minimizing total harmonic distortion (THD) with less system complexity and computation time is a stringent constraint for many power systems. The multilevel inverter can have low THD when switching angles are selected at the fundamental frequency. For low-order harmonic minimization, selective harmonic elimination (SHE) is the most adopted and proficient technique but it involves the non-linear transcendental equations which are very difficult to solve analytically and numerically. This paper proposes a genetic algorithm (GA)-based optimization technique to minimize the THD of cascaded H-bridge multilevel inverter. The GA is the finest approach for solving such complex equations by obtaining optimized switching angles. The switching angles are calculated by the genetic algorithm by solving the nonlinear transcendental equations. This paper has modeled and simulated a five-level inverter in MATLAB Simulink. The THD comparison is carried out between step modulation method and optimization method. The results reveal that THD has been reduced from 17.88 to 16.74% while third and fifth harmonics have been reduced from 3.24%, 3.7% to 0.84% and 3.3%, respectively. The optimization method along with LC filter significantly improves the power quality providing a complete sinusoidal signal for varying load.


Introduction
Power generation from renewable energy sources (RES) is increasing and being integrated in the conventional grid through an intermediate conversion. The power electronics interfaces such as inverters are used as a conversion tool that integrates the RES in the power grid. An inverter can generate an output of square wave which is of two levels or a quasi-square wave which has three-level or modified form of square wave [1]. For some applications, the two-level or three-level inverter does not meet the demand because of low-quality waveform. To overcome this problem, multilevel inverters (MLI) can be used [2]. MLIs can provide a multistepped output of low frequency or high frequency. The multi-stepped output minimizes the harmonic content and a passive filter helps in attaining a sinusoidal output waveform [3,4]. MLI is one of the best possible options for high power, medium voltage, low energy loss, better power quality, and high efficiency. Furthermore, MLI can be used for selective harmonic filtering, VAR compensation, and drive applications.
By using several DC input sources to the multilevel inverter, staircase voltage waveform is obtained [1]. The efficiency of multilevel inverters is gauged upon the content of harmonic level, i.e., total harmonic distortion (THD). Singh and Garg [5] focused on the output waveforms of different multi-level inverters models designed n Simulink, which analyzed their respective THDs. It was verified that the THD decreases with an increase in the voltage levels of an inverter.
MLI enables direct integration with the medium or high voltage utility grid. The integration with medium or high voltage utility grid is not possible with single semiconductor switches of two-level inverter [6]. Different control schemes are adapted to trigger the switches. The most common strategies are selective harmonic elimination (SHE), pulse width modulation (carrier-based), and space vector modulation [7]. Sinusoidal and space vector pulse width modulation are categorized in highfrequency modulation schemes where switches transited many times per cycle [8]. SHE is a low-switching modulation technique, where the switches commutation occurs one or two in a cycle of the desired output voltage. Some features of SHE makes it more suitable for high voltage applications such as low switching losses, small size of filter, and no harmonic interference [9].
Different switching angle techniques have been proposed, i.e., half height (HH), feed forward (FF), equal phase (EP), and half equal phase (HEP) in [10]. These methods do not provide optimum solution to reduce THD and are timeconsuming methods. To reduce the high order harmonics, a switching angle formulation technique has been proposed in [11] in which low odd-order harmonics are eliminated from a multilevel inverter by using genetic algorithm (GA). The most important and adopted technique for the elimination of any desired harmonics is SHE. It can be solved analytically as well as through optimization methods [12]. The optimization methods are based on biological systems that solve optimization problem by calculating switching angles [12,13]. Selective harmonic elimination pulse width modulation (SHE-PWM) technique was used in [14] to eliminate low order harmonics using a single-phase 3level inverter. The active harmonic elimination method has been proposed with unequal DC sources and switching angles are derived analytically in [15,16]. The selective harmonic elimination method is proposed in [17] on cascaded H-bridge to reduce the THD. Paper [18] calculates switching angles by using particle swarm optimization for the elimination of harmonics. A generalized analytical model for SHE-PWM by finding the optimum solution of cascaded multilevel converters by solving nonlinear equations is proposed for harmonic elimination [19,20]. The nonlinear equations used in the aforementioned literature for solving switching angles are time-consuming. SHE generates nonlinear transcendental equations for calculating switching angles to minimize low order harmonics [12]. Different methods are available for solving these nonlinear equations: numeric method, algebraic method, and bio-inspired intelligent algorithm. Many authors used SHE for harmonic elimination as SHE equations are non-linear and simple [21]. In [17,[22][23][24], the authors proposed iterative numerical techniques for solving non-linear equations. For calculating switching angles, the usual method is iterative methods such as Newton Raphson and other numeric or algebraic methods [13,25]. The only problem with the iterative technique is the divergence problem whenever it is solved analytically by numeric methods or algebraic methods, and it is also likely that for minimum THD the optimum switching angles may not be produced [25]. These methods provide more complex and time-consuming solutions. In addition to this, these methods unable to find a solution to certain modulation indexes. There are optimization methods that are based on continuously generating new ants such as particle swarm optimization (PSO), genetic algorithm (GA), and bee algorithm. which can find the optimum solution of full range of modulation indexes [13]. The dc sources applied to multilevel inverter are varying in time, and the switching angles associated with the variation of dc sources. GA technique is used to determine the switching angles offline that correspond to the real time value of dc sources [26]. GA is a simple technique without any analytical calculations and initial guesses. It is bio-inspired artificial intelligence technique which provides the optimum and quick solutions of the harmonic equations [27,28].
A new multilevel inverter topology has been used in [29]. An adaptive genetic algorithm has been used to reduce harmonic contents. A seven-level case is being considered and modeled for THD minimization. For medium voltage and high power applications, multilevel inverter has been used as it provides high-quality output power. Therefore, low switching frequency strategy is applied as it has low harmonic contents as compared to high switching frequency. The paper [30] is simulated by using a selective harmonic elimination method and a genetic algorithm approach to reduce high harmonic content and produce the high power output.
The significance of the optimization technique also lies in the field of the Internet of Medical Things (IoMT), which uses wireless communication for exchanging healthcare data aiming to reduce healthcare cost and prices for service [31]. To keep the reliability to an acceptable level the uncertainty is an important element in the cloud-based internet of things (IoT). Internet of things (IoT) aims to utilize energy efficiently by using different technologies and make it possible for people to live on a green planet [32]. The uncertainty factor includes transmission/reception energy, network topology, nodal charge, and computation capacity. These uncertainties are recorded and mapped to different nodes with changing capabilities by using artificial intelligencebased (AI) algorithms. The aim is to predict and calculate the price per big data by using AI algorithm [33].
In this paper, a cascaded H-bridge topology is adopted due to several advantages, i.e., for every bridge it uses a separate DC source in order to achieve the output voltage waveform similar to a sinusoidal signal and it has the simplest design with less cost as compared to other topologies. To obtain a smooth and pure sinusoidal signal the number of H-bridges are increased. A 5-level multilevel inverter has been designed in MATLAB/Simulink. Stepped modulation and genetic algorithms are used to obtain the switching angles. Moreover, GA-based SHE is used to reduce the undesired third-and fifth-order harmonics in both offline and online modes by the varying load. The simulation results reveal that the undesired third-and fifthorder harmonics from the output have been significantly reduced for a 5-level inverter. The introduction of filter to the design reduces more THD and improves the voltage and current output waveforms. This paper is organized as follows: Section 2 describes the conventional step modulation technique applied to multilevel inverter and elaborates the limitations of these methods that, why it is not succeeded and gives a room to another approach. Section 3 proposes the methodology which describes the selective harmonic elimination method and the problem associated with solving nonlinear transcendental equations. This section also explains the optimization method for solving nonlinear transcendental equations. Section 4 presents the simulation results. Finally, the conclusion of the study is presented in Section 5.

Multi-level inverter with stepped modulation
There are different modulation schemes for various topologies of multilevel inverter. One of the modulation scheme to control switches is step modulation. An investigation has been carried out for THD of sine wave's stepped waveform that synthesizes switching angles by different computational methods. The half-height (HH) method offers the lowest total harmonic distortion [34]. HH calculates the switching angle at the time at which the reference sine wave becomes equal to the half-height of the source. The ith switching angle θ i can be obtained for balance voltage source as Where, θ i is the ith switching angle for different modulation indexes ms.
A cascaded H-bridge configuration of five-level inverter is designed as shown in Fig. 1. Let "s" is the number of H-bridges. For m level inverter, 2(m+1) switching angles are needed. The output voltage v s can be obtained by relating a constant term k i with a dc voltage V dc . A relationship can be written as k i is fluctuating between three values − 1, 0, 1. For positive value of 1, opposite switches S 1 and S 2 or S 5 and S 6 will be turned ON providing +v and 2v. For negative value of − 1 S 3 and S 4 or S 7 and S 8 will be turned ON and thus providing -v and − 2v, respectively. For 0, switches S 1 and S 3 or S 5 and S 7 will be turned ON. The output voltage v o of cascaded H-bridge is equal to the summation of output voltage v s of s H-bridges connected in series.
The switching angles θ 1 , θ 2 , θ 3 obtained by half-height method to control the ON and OFF of switches are shown below in Table 1. The output voltage of nth odd harmonic is given by Where n is the odd-order harmonic since the amplitude of even harmonic is 0. θ i is the ith switching angle. HH method is a simple geometric method to calculate the switching angles but the problem occurs while considering the modulating index which has a mismatch between input and output. Minimum THD does not occur at m setting but slightly higher than m setting [35].  Specifying the switching angles is essential for the control of multilevel inverter. For getting the desired output waveform switching angles should be selected in such a way to reduce the THD. Different modulation techniques are available for MLI to control the output voltage and current. Modulation techniques are divided into two categories based on switching frequency [3,4,36]. GA-based SHE is used in this paper to eliminate the specified harmonic content and is discussed in the following section.

Selective harmonic elimination
The application of medium and high voltage inverters lies in distributed generations, medium voltage drives, and high voltage ac transmissions. Frequency of PWM is limited by switching losses and electromagnetic interference in these applications [37]. To overcome this issue, SHE exploited to reduce the frequency and THD [4,38]. Selective harmonic elimination method is highly preferred for solving non-linear equations. It minimizes the low order harmonics and hence reduction of total harmonic distortion. This method calculates the switching angles in such a way to reduce the harmonics, which also depends on model design and control. It also controls the output voltage of fundamental waveform. For five-level inverter third and fifth harmonics are eliminated and for higher-level (N-1) odd harmonics are eliminated [39]. The fundamental output waveform depends on switching angles that should be selected in such a way to reduce the THD and the modulation index. The magnitude of all other harmonics like even harmonics get reduced to 0. The output waveform can be expressed by Fourier expansion in selective harmonic elimination pulse width modulation method: Where a o is dc component, E n is amplitude even harmonics and O n represents odd harmonics. Multilevel inverter produces quarter symmetric output in which the dc component and even harmonic component gets 0. Equation (5) becomes The equation of Fourier expansion can be expressed in the form of Eq. (2) which becomes k i is the ratio of dc voltage source of ith voltage and dc source which can be expressed in the form of The only harmonics present in quarter-wave symmetric multi-level inverter are odd which need to be eliminated. The switching angles should be selected in such a way to reduce the total harmonic distortion. In this study third and fifth harmonics are minimized for five levels inverter. The fundamental output voltage, third harmonic component and fifth harmonic component can be expressed in the form of The condition should be applied for calculating the switching angles in quarter-wave symmetric waveform: A solution of nonlinear equations obtained by selective harmonic elimination PWM is a challenging task. Different methods are available to find the solution which includes a numeric method, algebraic method, and bioinspired artificial intelligent algorithms [40].
When an exact solution cannot be determined by other methods, the numeric methods are used to approximate the solution of nonlinear equations. The numeric methods build successive approximations that converge to the exact solution of nonlinear equation. In numeric methods, different methods are available for optimization, the most popular are Newton Raphson, Walsh function, and gradient optimization iterative methods. Except for these methods, we also have numerical methods such as the Runge-Kutta methods that are used for solving initial-value problems for ordinary differential equations. However, these problems only focused on solving nonlinear equations with only one variable, rather than nonlinear equations with several variables [41]. These methods are fast iterative methods which involve initial guesses but these initial guesses may cause divergence problem sometime in large iterations.
The other method is algebraic that involve conversion of nonlinear equations into polynomial equations without any initial guess. The only drawback of this method is that optimization of switching angles is done in a very complex manner and also this method is not useful for high-level inverters. However, it can be used for low-level inverters.
The best method for optimization is bio-inspired artificial intelligent algorithm that is inspired by nature selection. This method is easy to implement and it decreases the processing time for optimization. The best optimum solution can be obtained from this method with fast iteration.

Genetic algorithm
Genetic algorithm (GA) is based on a biological inspired process in which a stronger individual is the final solution among all the individuals in the competition i.e. survival of the fittest [42][43][44][45]. This individual represents the set of solution and is composed of different parameters. These parameters are called genes of a chromosomes and is represented by binary strings [46]. The best possible (the fittest) solution at the end approaches the optimum point through several iterations of the algorithm. The bio-inspired intelligent algorithm is one of the best methods for optimization. The aim of using GA here is to optimize the switching angles to reduce the low order odd harmonics. This can be done by genetic algorithm to minimize the objective function. The overall process of genetic algorithm is shown in flowchart below in Fig. 2. The objective function is the total harmonic distortion. To minimize the function f(x 1 , x 2 , ……, x k ) it is first coded as binary floating values, e.g., The set (x 1 , x 2 , ……, x k ) is called chromosomes and the variables contained in chromosomes are genes. The Cost function used for evaluating the fitness value of each chromosome. The fitness value is equal to By adding all the fitness values, we will get the total fitness. To find the selection probability, each fitness value will be divided by total fitness. Crossover and mutation is the next step for optimization. For this, one number is selected that will be floating between 0 and 1. If the selected number for crossover and mutation is smaller than pre-selected probability, it will lead to crossover and mutation. This will be the new set of chromosome functions. This population is now ready to undergo the next cycle of genetic algorithm. It goes several times to get a minimum cost function. Once we get less cost function, it will be the best optimum solution for getting the switching angles. The objective is to get maximum fitness value with cost function less than 1.
In this paper, five-level inverter is simulated to minimize third and fifth harmonics. The best optimum switching angles are obtained by a genetic algorithm. The population size of 40 is selected. The chromosome functions are 40 in a population f(θ 1 , θ 2 , ⋯, θ n ). Performance and efficiency of GA depend on population size. Large population has slow rate of convergence as it required more evaluation per generation [9]. Optimal values were found out by [47] of different parameters in which a population size of 40 is selected. The genes in chromosomes are variables which are switching angles θ n in five-level inverter. There are two variables in fivelevel quarter symmetric multilevel inverter, i.e., f(θ 1 , θ 2 ). The constraints for the genetic algorithm must be satisfied to reduce the third and fifth harmonics that are given below: The objective is to evaluate fitness function for each chromosome. The objective function is harmonic contents which need to be reduced. The cost function or fitness function obtained is GA runs for several iterations minimum of 100 until it reaches the best optimum solution with the cost function less than one. The fitness values determine the new setpoint after the first iteration and it will undergo the whole process of crossover and mutation to produce a new population of chromosomes. This process continues again the same cycle starts from the fitness function. The best fitness function or fitness value obtained is shown in Fig. 6. For five-level inverter, two variables are specified representing the switching angles (θ 1 , θ 2 ) with the aim to get the best optimum switching angles. Optimization technique is applied to get the switching angles best for inverter having low harmonic distortion, the two best variables that are achieved after optimization. Designed parameters of five-level inverter are listed below in Table 1.

Filter with load
Filter with load-multilevel inverters are widely used for grid integration, industrial applications, smart grid technologies, and renewable energy systems. For grid integration, power quality is the main concern, it needs pure sinusoidal voltage and current waveforms. Fundamental output waveform has a lot of harmonics, we can eliminate lower odd-order harmonics by algorithms and different switching techniques, while higher order harmonics with filters. Mostly LC filter is used in multilevel inverter to reduce high-order harmonics. An L-C filter makes waveform pure and free from harmonics. LC filter is used to connect the inverter with machine loads and enable to interface with grid. In this paper, a Butterworth method has been implemented for designing a lumped element based filter. Figure 3 shows four elements of LC filter designed by Butterworth methods. Output impedance should be minimized in case of nonlinear loads to minimize the distortion. If the cutoff frequency is specified the capacitance should be maximized and inductance should be minimized [26]. The most important step in LC filter design is selecting a passive elements L and C for a filter. The designed filter characteristic can be represented by frequency response, i.e., Return loss R L by keeping in view the specifications of filter [48]. Return loss is given by (16).
V R is the input voltage to the filter and V in is reflected voltage, i.e., V dc . The following parameters are needed in the design of a filter: Inverter input dc voltage, Line-line RMS voltage, rated power, frequency and cutoff frequency. Resonant frequency given in (17) should be lower than switching frequency to limit the harmonics [48].
The specification of a design-filter contains a 3 dB cutoff frequency f c and attenuation or the order of the filter. The order of filter n means the number of poles in a transfer function [26]. The order of filter is not necessary in case of harmonics elimination as it is necessary only if the cost and weight of inverter are the concerns. The real values of capacitance and inductance can be determined by (18), Where A k is the attenuation factor used to determine the values of lumped elements. Attenuation factor can be calculated from ( Where, k = 1, 2, 3,⋯, n and n represents the number of elements in a filter. In this paper, four elements LC filter is designed for a five-level inverter to minimize the total harmonic distortion and to connect the inverter to the load. The parameters of LC filter are given in Table  2.
For a design of LC filter, the specifications are given in Table 3 for a load. A 1 kW load is considered in this case with an input of dc voltage 300 V. The switching is carried out with a fundamental frequency.  To validate the algorithm for calculating switching angles, simulation is carried out in MATLAB/Simulink for five-level cascaded H-bridge multilevel inverter. Simulation is carried out for both conventional and genetic algorithm based selective harmonic elimination technique. Different applications have different optimization aims such as minimization of total harmonic distortion of inverter output voltage for PV system, minimization of low odd order harmonics such as third, fifth, and seventh, for different applications [49]. The aim of this research is to reduce the THD of output voltage and to reduce the low odd order harmonics such as third and fifth with both offline and load connected equipped with appropriate filter. Different methods are available for the calculation of switching angle. For our purpose, the best definition of total harmonic distortion is the sum of all harmonic components of rms voltage to the fundamental component of voltage rms.
Results obtained through stepped modulation technique and GA-based SHE are discussed in detailed in the following sections.

Stepped modulation technique
Switching angles are calculated by methods like stepped modulation half height method and in stepped modulation technique, one cannot eliminate or reduce the low-order odd harmonic in the output voltage but total harmonic distortion can be reduced to some extent. The simulation result of a five level inverter in which switching angles are calculated by step modulation technique is shown in Fig. 4. The THD in this case is 17.88%. The output waveform of voltage is shown in Fig. 4a and the order of harmonics is shown in Fig. 4b.

GA-based SHE
The genetic algorithm method can eliminate or minimizes the third order and fifth order harmonics. In addition, there is minimization of total harmonic distortion in proposed method. To minimize total harmonic distortion in cascaded multilevel inverter with "s" H-bridges by considering more than (s-1) harmonics, those harmonics will not be eliminated because of more variables than equation sets [50]. The simulation result of  proposed optimizing method of an inverter is shown in Fig. 5.
The THD result in this case is 16.74%. Output voltage waveform is shown in Fig.5a and Fourier transform analysis is shown in Fig. 5b. It can be observed from Figs. 4b and 5b that the low-order odd harmonics can be minimized to an acceptable range by using optimization technique, i.e., genetic algorithm. The best fitness value is shown in Fig. 6, while the best optimum variables after optimization is shown in Fig. 7.
The optimization method uses best variables, i.e., switching angles to reduce the THD. The output waveform is also similar to sinusoidal signal. The THD reduces to acceptable range. The best and optimum fitness function is obtained through algorithm. The main purpose is the minimization of objective function through algorithm.
The comparison of switching angles, total harmonic distortion, and phase delays are listed in Table 4. It can be seen that total harmonic distortion along with low order odd harmonics, i.e., third and fifth harmonics reduces when optimization method is applied. The table shows that both methods have different switching angles. The optimization aim is to get best switching angles to minimize the total harmonic distortion.
In the Table 4, the comparison has been done between conventional method, i.e., stepped modulation and proposed optimization technique, i.e., genetic algorithm. The comparison is carried out in terms of switching angles, THD, phase delay, and low-odd order harmonics. It is clear from the results that the switching angles, THD, phase delay, and low-odd order harmonics has been reduced in optimization technique. The two variables, i.e., θ 1 and θ 2 which we have taken in optimization technique is reduced from 14.47°, 48.59°to 12.89°, and 42.76°. Therefore, the same reduction has been observed in total harmonic distortion from 17.88 to 16.74% and low-odd order harmonics from 3.24%, 3.7% to 0.84%, and 3.3%.

Filter with load
To minimize the total harmonic distortion of output voltage below 5% and to make the output current and voltage waveform smooth the L-C filter is used [26]. The L-C filter is used in multi-level inverter connected to load. The THD comparison is carried out by varying load. The output voltage waveform is shown in Fig. 8. It can be seen from the comparison  table that by increasing the load without changing any parameter the THD slightly increases. A minute increase of THD has seen by increasing the load to a large extent. The variation of voltage THD with load is shown in Fig. 9 and Table 5. The above Fig. 9 depicts the THD variation with respect to the load. The graph shows that the THD variation is directly proportional to the load increase. As the load increases the THD also increases. Therefore, we need optimization approach to reduce this inclination of THD versus load. If the optimization technique is not applied to the multilevel inverter, these THD variations will shoot out with respect to load and become uncontrollable. We used genetic algorithm approach to reduce the variation of THD with respect to load as the increase of THD is very less.

Conclusion
The genetic algorithm-based approach is proposed to solve the nonlinear transcendental equations of selective harmonic elimination of cascaded H-bridge multilevel inverter. The total harmonic distortion (THD) comparison is carried out between step modulation method and optimization method. The optimization method finds the switching angles in such a way to minimize the THD and low order odd harmonics. Cascaded H-bridge configuration is more practical than diode clamped and flying capacitor multilevel inverter because of less number of components and complexity. Magnitude of  fundamental component is not controllable and is constant throughout the cycle while the magnitude of harmonic component depends on order of harmonics inversely. The simulation is done in MATLAB/Simulink and the optimum solution is provided subsequently due to its fast iterative method. The results reveals that THD has been reduced from 17.88 to 16.74% while third and fifth harmonics has been reduced from 3.24%, 3.7% to 0.84% and 3.3%, respectively. The optimization method is tested with LC filter which results in a complete sinusoidal signal with the significant improvement of THD. The result is verified by varying the load. It also shows the importance of filter to the integration of grid, industrial, and smart grid applications.