An Improved Hybrid PSO-TS Algorithm for Solving Nonlinear Equations of SHEPWM in Multilevel Inverters

Selective Harmonic Elimination Pulse Width Modulation (SHEWM) can eliminate selected low order harmonics by solving nonlinear transcendental equations to obtain the switching angles in advance and achieve precise harmonics control. However, when solving nonlinear equations, the convergence rate and solution accuracy of the existing intelligent algorithms for multilevel inverter SHEPWM will decrease with the increase of the number of switching angles. In this paper, an improved hybrid PSO-TS algorithm (IPSO-TS) is proposed for switching angle selection in PWM inverter. In the proposed IPSO-TS algorithm, both the PSO algorithm and TS algorithm are improved respectively to enhance their convergence when calculating multiple switching angles. Also, these two improved algorithms are combined to obtain the hybrid algorithm IPSO-TS, in which PSO is used to provide global search capabilities, and TS is used to increases the accuracy of solutions. Simulations are carried out using MATLAB/SIMULINK environment to demonstrate the better convergence of the proposed algorithm compared with the other existing methods. Moreover, the simulation results are further verified by experimental results.


I. INTRODUCTION
With the rapid development of power electronics technology in recent years, multilevel inverters have been paid more attention in the field of high voltage and large capacity [1]. As the first choice of high power supply, multilevel inverter has the advantages of high output voltage, high energy conversion efficiency, low THD, low switching stress, and strong ability to resist electromagnetic interference [2][3][4]. Therefore, it is widely used in many aspects, such as FACTS devices, HVDC lines, electrical drives, battery energy storage systems, uninterruptible power supply systems, renewable energy and distributed generation systems [5][6][7][8][9].
Appropriate modulation strategy can optimize the output performance of multilevel inverters, and hence modulation strategy is an important part of multilevel inverter research. Selective Harmonic Elimination Pulse Width Modulation (SHEPWM) is used in many applications in order to eliminate low order harmonics without complex filtering systems. SHEPWM can suppress the generation of low-order harmonics at power source [10].
The research of SHEPWM focuses on the establishment and solution of the harmonic elimination nonlinear transcendental equations. At present, there are two approaches to solve the equations, one is based on traditional numerical methods, the other is using intelligent algorithms. In the numerical methods, Newton iterative method was mostly used to solve the SHEPWM nonlinear equations [11]. The principle of Newton iterative method is simple, the calculation process is direct, and the solving accuracy is satisfactory. However, this method depends greatly on the initial value, which is required to be in the region near the optimal solution after many attempts according to experience. In reference [12], Walsh function was adopted to transform the nonlinear equation into a series of linear algebraic equations, which can be calculated online conveniently and can provide a variety of solution sets. However, the conversion between Walsh domain and Fourier domain can lead to additional heavy calculations, which makes it difficult to solve the equations with multiple variables. In reference [13], the homotopy algorithm was used to solve the nonlinear equation, which can converge quickly and can be extended to high-level inverters without any additional analysis and calculation, but the obtained solution is not accurate enough and can only be used as an initial value of Newton iterative method. Some research publications used algebraic methods to convert nonlinear transcendental equations into polynomial equations to solve switching angles without initial values [14,15], . However, these methods require complex calculations, thus they are only applicable to low level inverters.
Due to the complex calculations and poor global search ability of the traditional numerical methods, intelligent algorithms with strong abilities of searching global optimal solution and solving complex optimization problems were gradually applied to the solution of nonlinear equations of SHEPWM in multilevel inverter. Reference [16,17] adopted Genetic Algorithm (GA), which is relatively simple and does not need to derive additional analytical expressions when applied to multilevel inverters, but is prone to premature phenomenon and low precision. Reference [18][19][20] introduced Particle Swarm Optimization (PSO) algorithm, which stores the individual optimal position of each particle and the global optimal position of all particles to guide particles to the optimal solution. Therefore, it is better than genetic algorithm in terms of accuracy and convergence, but the problem of premature phenomenon remains, especially when the number of switching angle is more than 6. As mentioned in reference [21,22], the Imperial Competition Algorithm (ICA) has advantages in terms of convergence and computing time. However, as the level of multilevel inverter increases, the convergence and accuracy of the solution become worse. Reference [23,24] applied Artificial Neural Network (ANN) algorithm to multilevel inverter to achieve online SHEPWM solution, but the algorithm needs to obtain enough data in advance. At the same time, the learning process of ANN cannot be observed, and its output results are difficult to interpret, which will affect the credibility and acceptability of the results.
In some cases, for example, in order to eliminate the high order harmonics caused by wide-bandwidth oscillation when new energy grid-connected converters are connected to a weak grid, multiple switching angles need to be calculated. However, it can be seen from the above paragraph that the existing algorithms for SHEPWM has the problems of prematurity and low accuracy when calculating multiple switching angles. Aiming to overcome these problems, an improved hybrid PSO-TS algorithm (IPSO-TS) is proposed to solve the nonlinear transcendental equations of SHEPWM. Firstly, tabu intelligence is introduced into PSO to help the algorithm jump out of local optimum: when PSO falls into local convergence, the global optimal solution will be tabooed to avoid local convergence and improve the convergence rate. Next, the search domain of TS is gridded to avoid repeated tabu, and the neighborhood size and tabu length are dynamically adjusted during the algorithm process to increase convergence rate. Finally, the two improved algorithms are combined together: PSO searches in the global scope and finds a solution with low accuracy, and TS is used to improve the accuracy of the solution. The hybrid algorithm obtained by these steps can realize the improvement of convergence rate, calculation accuracy and convergence speed when calculating multiple switching angles.
The rest of this paper is organized as follows. In Section II, the working principle of the cascaded multilevel inverter and SHEPWM technique are introduced. In Section III, the proposed hybrid PSO-TS algorithm is introduced. In Section IV, the algorithm is simulated and experimented respectively to verify the effectiveness of the improved hybrid algorithm in SHEPWM. Conclusions are drawn in Section V.

THE PRINCIPLE OF CASCADED H-BRIDGE INVERTER
Cascaded multilevel inverters have advantages such as higher output waveform quality and lower voltage stress of power switches, making them a very attractive topology [25]. Therefore, cascaded multilevel inverters are considered to be the control objective of SHEPWM in this paper. The cascaded H-bridge multilevel inverter is composed of multiple independent H-bridge units connected in series, and the H-bridge units are powered by independent DC power supply [16] . It has fewer components and is easy to adjust the number of output voltage levels. Switching devices are switched on and off only once per cycle, and hence they can effectively reduce switching power loss [26]. The number of output phase voltage level of the cascaded multilevel inverter is 2S+1, where S is the number of DC sources. Figure 1 shows the topology of a 9-level cascaded H-bridge inverter, in which each phase has four cascaded cells connected in series (i.e. S=4). Each H-bridge can generate three different voltage outputs: +Vdc, 0 and −Vdc.
Combining the outputs of these full-bridges can produce a step wave as shown in Figure 2 which shows the voltage waveform of a nine-level cascaded multilevel inverter at high modulation index, with a number of switching angles of 4 and a phase voltage amplitude of 4Vdc.
The output voltage waveform of a cascaded 9-level inverter with 4 switching angles.

BASIC PRINCIPLE FOR SOLVING THE SHEPWM
As shown in Figure 2, each quarter wave of the waveform contains switching angles that are symmetric with π/2 for half a period, conforming to the so-called quarter-wave symmetry technique, which can simplify the nonlinear equation and reduce the computation [27].
Fourier series expansion of the output phase voltage is written as follows: where，n=1,2,3…，An、Bn represent the amplitude of each order harmonic，and ω is the angular frequency ； According to the 1/4 symmetry of the output phase voltage waveform, the expressions of An and Bn of each harmonic amplitude are listed in equation (2) where Udc is S times Vdc; N is the number of switching angles; αk is the kth switching angle; pk is the coefficient of the cosine function which varies with αk: when αk is rising edge, pk is equal to 1, and when αk is falling edge, pk is equal to -1. Since all the triple harmonics in the three-phase symmetric system are eliminated in the line voltage, the elimination of thirdorder harmonics is not considered, and only 6k±1 harmonics is left to be eliminated. The nonlinear transcendence equations for solving the switching angles can be listed as shown in Equation (3): where L is the number of output levels; m is the modulation index, which is the ratio of the sinusoidal reference signal peak value to Udc. For the convenience of solving switch angles, equation (3) is transformed into: The solution must consider the following condition: where f1 to fN are error functions; Q is the highest number of harmonics to be eliminated. The fitness function F is established based on the nonlinear transcendental equations as shown in (6) [28]. In the case of SHEPWM, it aims to find the solution with the smallest fitness value, which means that all error functions are small enough to be ignored. .. .

SHORTCOMINGS WHEN PSO AND TS ARE USED TO SOLVE SHEPWM EQUATIONS
Solving the nonlinear transcendental equation set based on trigonometric functions in (6) is the core of SHEPWM. PSO and TS algorithms can solve SHEPWM equation set, but both of them have their own disadvantages.

1) THE SHORTCOMINGS OF PSO
PSO algorithm is easy to fall into local convergence when solving multi-dimensional complex nonlinear problems [29]. (7) and (8) are the updating equations of velocity and position of particles: In (7) and (8), represents the th particle; t is the number of iteration, r1 and r2 are random numbers between [0,1], c1 and c2 represent acceleration constants; and go are the ith individual optimal and the global optimal positions; represents inertial weight which is determined by (9): where 1 and 2 are the upper and lower limits of inertia weights; 1 is the maximum number of iterations; 1 is the number of iterations. As shown in (7), the velocity updating formula consists of two parts: genetic term ( ) and evolutionary term 1 1 ( ( ) − ( )) + 2 2 ( ( ) − ( )) . As the algorithm progresses, a particle's positon will gradually approach the individual optimal position io and the global optimal position go, which leads to the evolutionary term of its velocity approaching 0 (as shown in Figure 3, the evolutionary term of particle velocity approaching 0 at the individual and global optimal positions). Partical best solution (Pb) Individual optimal solution (io) At the same time, as the inertia weight gradually decreases with the progress of the algorithm, the genetic term of the particle's velocity will decrease as well. Therefore, the particle's velocity will slow down and eventually approach zero with the algorithm progressing, which will cause the algorithm to fall into the local optimal solution if particles stop near the local optimal solution. To sum up, the degradation of particle velocity in the later stage of PSO leads to the premature phenomenon of the algorithm.

2) THE SHORTCOMINGS OF TS
TS algorithm has strong local search ability and is suitable for discrete search domain [30][31][32]. However, when it is used to search for a continuous domain (such as the solution of the SHEPWM nonlinear equations), the algorithm will fall into local convergence or even non-convergence. The reasons are as follows:


On the one hand, when search domain changes from discrete to continuous, the number of solutions in the search domain will change from finite to infinite, and the drastic increase in the number of solutions will greatly reduce the search efficiency.


On the other hand, the significance of tabu lies in temporary taboo of better solutions to avoid falling into local optimal. But continuous search domain will lead to a large number of extremely similar solutions being tabooed (as shown in Figure 4), which will render tabu meaningless. As a result, the current solutions obtained each time are very similar, and the neighborhood searched in each iteration is similar as well. The algorithm loses the ability to jump out of the local optimal solution and thus falls into local convergence.

III. THE PROPOSED HYBRID PSO-TS METHOD FOR MULTILEVEL SHEPWM
In this paper, a SHEPWM solution based on improved hybrid PSO-TS algorithm is proposed. Firstly, the PSO algorithm is improved with tabu intelligence to quickly provide initial values for TS. And then the improved TS, which improves the convergence and computing speed by dynamically adjusting parameters, is used to search further to obtain a higher precision value. Figure 5 represents the flow chart of the proposed PSO-TS algorithm.

TABU IMPROVED PSO ALGORITHM:
The steps of the improved PSO are as follows: 1) Randomly generates a group of initial solutions and these solutions are set as initial individual optimal solutions io. Then calculate the fitness values of all solutions, and set the solution with the least fitness value as the initial global optimal solution go and the particle swarm optimal solution Pb; 2) Updated the position and velocity of each solution according to (7) and (8); 3) Calculate the fitness value of each particle according to equation (5), and update the individual optimal solution ( + 1) by (10) , where xi(t+1) is the solution obtained in a new iteration.

Start
Initialize the particles, set initial individual optimal position (io), global optimal position (go), and PSO best value (Pb) T=T+1, update the particles, io and go

Maximum interation count meet?
Compare Pb and go, and take the one with the smaller fitness value as the initial value of TS current sloution (Tc) and TS optimal solution (To) Whether the algorithm falls into local optimum obtain the candidate solution set, and find the optimal candidate solution (ocs)  4) Define T as tabu constant. Judge whether the algorithm is trapped in local convergence, that is, judge whether the global optimal solution remains unchanged after T iterations. If so, taboo the global optimal solution go, put it into tabu list, update the list, and execute 5); Otherwise, proceed directly to 7). 5) Determine whether aspiration criterion is satisfied, that is, whether equation (12) is satisfied ( ) ( ) F go F Pb  (12) individual optimal solution io, and select the solution with the smallest fitness value among the individual optimal solutions which are not tabooed as the new global optimal solution (go= iomin_notTabu). Otherwise, go to 6); 6) If the aspiration criterion is not satisfied, then judge the tabu attribute of each individual optimal solution io, and set the no-tabooed individual optimal solution with the smallest fitness value as the new global optimal solution (go=iomin_notTabu); 7) Determine whether the maximum number of iterations is reached. If so, terminate the algorithm and output the particle swarm optimal solution Pb; Otherwise, go back to 2) and continue executing the algorithm. In the improved PSO, tabu intelligence is introduced into PSO to avoid premature convergence of the algorithm. When the algorithm falls into premature convergence, the optimal solution will be tabooed and particle swarm will fly in the direction of the suboptimal solution, so that the particle swarm can regain the velocity, expand the search scope, and make the algorithm have the ability to jump out of local convergence.

IMPROVED TS ALGORITHM:
In this paper, the traditional TS algorithm is improved to adapt to the continuous search domain. The steps of the improved TS algorithm are as follows: 1) Initialize the parameters of TS, such as optimal solution , current solution , tabu length, etc., and set tabu list to empty; 2) Search in the neighborhood of current solution and get a candidate solution set Ca( ). Then obtain fitness values of the candidate solutions according to equation ( . When the fitness value is less than the preset value M, end the search operation process and output the optimal solution; Otherwise, return to Step 2 and continue executing the algorithm.
Step 3 is added to traditional TS to improve the algorithm, and the specific contents of it are as follows:

1) INCREASE THE NUMBER OF RESERVED DECIMAL PLACE OF TABU OBJECTS
According to the size of the neighborhood, gradually increase the number of reserved decimal place of tabu objects from 0 (generally increase to 3 digits is enough). The selection rules for the number of reserved decimal place are as follows: ○ 1 The accuracy of tabu object is greater than that of neighborhood length; ○ 2 If the optimal solution does not change after several iterations, increase the number of reserved decimal place of tabu objects. The purpose of controlling the number of reserved decimal place of tabu objects is to grid the search domain, and during the period when a solution is tabooed, other solutions in the same grid with it are no longer tabooed. This way can avoid the tabu of very similar solutions and the concentration of a large number of solutions in a small area. Figure 6 shows the change of the search domain and the position of solutions after 4 iterations before and after improvement. As can be seen from the figure, when search domain is not gridded, the position of current solutions changes slightly after each iteration, so the overlap area of the neighborhood of current solutions is large, the search efficiency is low, and the algorithm can easily fall into local convergence. When the search domain is gridded, the current solution changes greatly, and the trajectories of candidate solutions move quickly to the trajectory of the optimal solution, which improves the search efficiency and makes it easier to find the optimal solution. At the same time, as the VOLUME XX, 2017 1 increase of the number of reserved decimal place, the accuracy of solutions also increases synchronously.

Search area
Optimal solution

2) REDUCE THE SIZE OF NEIGHBORHOOD
As the number of iterations increases, the neighborhood size need to decrease gradually. The relationship between neighborhood size and iteration times is as follow: 1 1 2

Max Generation Nei Nei
Nei Nei Max where Nei is the size of neighborhood; Nei1, Nei2 are the upper and lower limits of the neighborhood size; Max2 is the maximum number of iterations; Generation2 is the number of iterations. The location of the search domain is determined by current optimal solution, that is, the center of the search domain. Figure 7 represents the positions of candidate solutions and optimal solution after 4 iterations before and after neighborhood size adjustment. As can be seen from the trajectory of particles in the figure, narrowing the scope of the neighborhood size with the increase of iteration times can make candidate solutions close to the optimal solution and increase the probability of finding the optimal solution.

Search area
Optimal solution

3) DECREASE THE TABU LENGTH
The selection of tabu length needs to be related to the scope of search domain: if the tabu length is too short, it is easy to cause search cycle and fall into local optimum; excessively long tabu length will prolong calculation time and reduce search efficiency. Since the search scope shrinks as neighborhood solutions approach the optimal solution, the tabu length needs to be reduced synchronously to maintain the appropriate tabu length. The adjustment rule is shown in equation (15) (15) where, TL is tabu length, TL1 is the initial tabu length; Nei and Nei1 are the size and the upper limit of the neighborhood respectively; [] represents taking integers. VOLUME XX, 2017 1

SIMULATION RESULTS
In this section, a 9-level cascaded inverter is taken, whose DC side contains 4 modules, each with a voltage of 50V on the input side and a maximum step-wave amplitude of 200V on the output side, and the fundamental frequency of the output voltage is 50Hz. At the same time, in order to avoid the effect of high-order harmonics caused by widebandwidth oscillation, the maximum number of harmonics to be eliminated is selected as about 1000Hz [33], which means the number of switch angles to be calculated is 8 (the maximum harmonic frequency that can be eliminated is 1150Hz).

1) THE COMPARISON OF CONVERGENCE PERFORMANCE
To make the comparisons, PSO, improved PSO (IPSO), TS and improved TS (ITS) are considered to solve the fitness function. In the proposed hybrid algorithm, PSO is used to provide initial value, so the initial value of PSO is arbitrary, and it is regarded as convergence when the fitness value reaches 0.1. TS is used to improve the accuracy of the solution obtained by PSO, so the initial value of TS is given, and it is regarded as convergence when the fitness value reaches 0.001. Table I is used to compare the convergence rate of the algorithms, select modulation index as 0.5 and 0.8. Where the convergence rate is the ratio of the number of times the algorithm has converged to the total number of runs (10 times). Further, for better convergence, the PSO parameters such as acceleration factors c1 and c2, limits of inertia weight ω1 and ω2, and the tabu constant T are set to 1.49, 1.49, 0.9, 0.4 and 30; TS parameter values such as limits of tabu length TL1 and TL2 and limits of the neighborhood size Nei1 and Nei2 are set to 50, 20, 20, and 0.15, respectively. The number of reserved decimal place of tabu objects R are selected as equation (16)  As can be seen from table I, compared with traditional PSO, the IPSO's convergence rate has increased from 20% to 60%, which raised almost 3 times. The traditional TS basically loses its convergence ability when it is used in the continuous domain, while the convergence rate of the improved TS algorithm is greatly improved, reaching 80%.
To reflect the effect of the Improved PSO-TS Algorithm (IPSO-TS), it is compared with Adaptive Genetic Algorithm (AGA) [15], IPSO and ITS. The initial values of these four algorithms are generated randomly, and the fitness value less than 0.001 is regarded as convergence. When running the algorithms, select m as 0.3, 0.5 0.8 and 1.0, and the number of iterations is 550. Table II shows the fitness value of every algorithm. Figure 8 shows the relationship between the fitness value and the number of iterations.  It can be seen from Table II and Figure 8 that IPSO-TS enhances the convergence ability of IPSO and ITS. Comparing the four algorithms, the solution obtained by IPSO-TS has the highest accuracy, and its accuracy is more than 100 times higher than that of IPSO and ITS. At the same time, the proposed hybrid algorithm also has a faster convergence speed: the other three algorithms fail to converge after 550 iterations, but IPSO-TS can converge within 500 iterations. In summary, IPSO-TS has better performance in terms of convergence accuracy and computing speed than the other three algorithms.

2) MATLAB/SIMULINK SIMULATION RESULTS OF SHEPWM BASED ON IMPROVED PSO-TS ALGORITHM
In order to verify the correctness of the solution obtained by the proposed algorithm, MATLAB /Simulink was used for simulation and harmonic analysis. According to the flow chart shown in fig. 5, the solutions of the SHEPWM equation set with the modulation index in the range of 0.1-1 are solved, and the step size is 0.01. Figure 9 shows the variation of switching angles in relation to modulation index. Two different solutions at high modulation index and low modulation index are selected to display detailed output voltage waveforms and harmonic distribution. Figure 10 and Figure 11 show the output waveforms and harmonic spectrums with modulation index is 0.5 and 0.8 respectively. When m is 0.5, the output phase voltage waveform is designed as 5-level wave; when m is 0.8, the output phase voltage waveform is designed as 9-level wave. Table III shows the simulation parameters:  As can be seen from Figure 10 and Figure 11, for the phase voltage harmonic spectra, there are only triple harmonics in the lower harmonics, and the selective harmonic components (5 th , 7 th , 11 th , 13 th , 17 th , 19 th and 23 rd harmonics) are effectively eliminated; for the line voltage harmonic spectra, almost all the harmonics whose order below 25 are effectively eliminated. This proves the correctness of the switching angles and the effectiveness of SHEPWM strategy.   Figure 12 shows the comparison of the output voltage harmonic distribution of a nine-level inverter using traditional SPWM and the SHEPWM based on the proposed hybrid algorithm with m is selected as 0.8, 0.9 and 1.0. And the carrier frequency of SPWM is 1kHz, which is 20 times of the output wave frequency. Table 4 is a summary of the information in Figure 12. It can be seen that compared with SPWM, the output line voltage of the SHEPWM output wave has higher fundamental amplitude and lower THD; the output phase voltage also has higher fundamental amplitude, but has higher THD at m=0.8 and m=0.9. The reason is that the waveform of SPWM is obtained by comparing the standard sine wave with the carrier, but the position of switching angles of SHEPWM is calculated by harmonic elimination equations. Thus, in some cases the output waveform of SPWM is closer to the standard sine wave than that of SHEPWM and has lower THD. However, SHEPWM does not cause a large increase in THD. The THD of SHEPWM output wave decreases as m increases, and its phase voltage THD drops below the SPWM phase voltage THD when m=1. All in all, the proposed SHEPWM strategy does not degrade the quality of the output wave. Besides, SHEPWM has a better harmonic distribution than SPWM, which makes its harmonics easier to filter out.

EXPERIMENTAL RESULTS
In order to verify the simulation results, a downscaled three phase cascaded H-bridge inverter experimental prototype is set up to validate the proposed hybrid PSO-TS algorithm. It consists of four H-bridge inverters connected in series, and the DC source voltage of each inverter is selected as 25V. The output frequency is 50 Hz, and the type of load changes from R (30Ω) to RL (40Ω+50mH). The processor is used to generate switching pulses for Insulated Gate Bipolar Transistor (IGBT) switches. The switching angles of different operating points of the inverter are calculated off-VOLUME XX, 2017 1 line, and then stored in the processor. Figure 13 and figure  14 shows the waveforms and spectrum analysis of phase voltage, line voltage and current when the modulation index is selected as 0.5 and 0.8. When m=0.5, the phase voltage is 5-level and the line voltage is 7-level; when m=0.8, the phase voltage is 9-level and the line voltage is 13-level. This is similar to the simulation results shown in figure 10 and figure  11. As seen from Figure 13 and Figure 14, after the load changes, the waveform distortion of the phase voltage increases. But the targeted harmonics (5th, 7th, 11th, 13th, 17th, 19th, and 23rd) in the phase voltage are effectively eliminated and only triple harmonics are left. For line voltage and current, their waveform distortion is greatly reduced and the waveforms are close to standard sine wave after the load changes. At the same time, it can be seen from their harmonic spectrum that the harmonics whose order below 25th are almost completely eliminated. The hardware results confirm that the proposed IPSO-TS method has the ability to successfully remove the selected harmonics.

V. CONCLUSION
In this paper, an improved hybrid PSO-TS algorithm has been proposed to solve the nonlinear transcendence equations of SHEPWM for multilevel inverters. The simulation results have shown that the convergence rate of the improved PSO and improved TS has been greatly increased, nearly 3 times higher; and IPSO-TS also has advantages in convergence accuracy and computing speed. Comparing IPSO-TS with AGA and the two improved algorithms, when the number of switching angles is 8, the accuracy of the solutions obtained by AGA, IPSO and ITS is too low to converge, but the proposed hybrid algorithm can obtain a convergent solution which is about 100 times more accurate than the other three methods' solutions within a reasonable number of iterations. Also, compared to SPWM, the SHEPWM based on IPSO-TS can effectively eliminate low-order harmonics and improve the harmonic distribution without increasing the THD of output waveforms. In addition, hardware experimental results have been used to verify the calculation results. The proposed algorithm has demonstrated better convergence characteristics and higher search accuracy. Hence the improved hybrid PSO-TS algorithm can provide a better solution for the calculation of the SHEPWM for multilevel inverters which needs to calculate multiple switching angles.