*2.2. SHE-PWM*

In the great number of cases of SHE-PWM application, it is used in electric drives to eliminate low order harmonics, while amplitudes of high order harmonics are reduced by input filters. SHE equations are based on the Fourier series expansion of the inverter output voltage waveform:

$$V(\alpha t) = a\_0 + \sum\_{n=1}^{\infty} \left[ a\_n \sin(n\omega t) + b\_n \cos(n\omega t) \right] \tag{1}$$

where ω is an angular frequency of fundamental component, *n* is a harmonic order, and an, bn are Fourier coefficients. For quarter-wave symmetry, only coefficient an for the odd *n* coefficient represents the non-zero value:

$$a\_n = \begin{cases} \frac{4L\_{DC}}{n\pi} \left[ -1 - 2\sum\_{i=1}^{N} (-1)^i \cos(n \cdot a\_i) \right] & \text{; for odd } n\\ 0 & \text{; for even } n \end{cases} \tag{2}$$

$$b\_n = \begin{cases} \begin{array}{c} 0 \\ 0 \end{array}; \text{ for odd } n \\ \begin{array}{c} 0 \\ \end{array}; \text{ for even } n \end{array} \tag{3}$$

where *UDC* is DC-link voltage and *n* is the number of switching angles per a quarter-period. In this paper, fluctuation and ripplers of DC-link voltage were not of concern.

Assuming the odd quarter-wave symmetry of inverter output voltage, triple harmonics are canceled. The symmetry of the system brings cancelation of even harmonics as well. For *n* = 5 switching angles in quarter-period, 5 non-linear equations can be formulated (4) to satisfy fundamental component (*V1*) and eliminate 5th, 7th, 11th, and 13th harmonics:

$$\begin{cases} \frac{4}{\pi}[-1+2\cos(\alpha\_1)-2\cos(\alpha\_2)+2\cos(\alpha\_3)-\dots \\ \dots 2\cos(\alpha\_4)+2\cos(\alpha\_5)] = M1 \\ \frac{4}{5\pi}[-1+2\cos(5\alpha\_1)-2\cos(5\alpha\_2)+2\cos(5\alpha\_3)-\dots \\ \dots 2\cos(5\alpha\_4)+2\cos(5\alpha\_5)] = 0 \\ \frac{4}{7\pi}[-1+2\cos(7\alpha\_1)-2\cos(7\alpha\_2)+2\cos(7\alpha\_3)-\dots \\ \dots 2\cos(7\alpha\_4)+2\cos(7\alpha\_5)) = 0 \\ \frac{4}{11\pi}[-1+2\cos(11\alpha\_1)-2\cos(11\alpha\_2)+2\cos(11\alpha\_3)-\dots \\ \dots 2\cos(11\alpha\_4)+2\cos(11\alpha\_5)] = 0 \\ \frac{4}{13\pi}[-1+2\cos(13\alpha\_1)-2\cos(13\alpha\_2)+2\cos(13\alpha\_3)-\dots \\ \dots 2\cos(13\alpha\_4)+2\cos(13\alpha\_5)] = 0 \end{cases} (4)$$

where *M*1 is for modulation index:

$$V\_1 = M1 \, \frac{\text{UL}\_{DC}}{2} ; \quad \text{for } M1 \langle 0, \, \frac{4}{\pi} \rangle \tag{5}$$

In this case the fundamental voltage component (*V1*) is defined as the amplitude of phase voltage of the motor in the star connection of the windings. The main goal of this paper is to adopt GOA for solving Equation (4) to determine switching angles for SHE-PWM end examine its convergence.

#### **3. Formulation of The Optimization Problem**

To solve SHE Equation (4) using an optimization algorithm, the fitness function must be formulated. For *n* = 5 switching angles and four harmonics eliminated the fitness function is described by following equation with constraints:

$$\begin{aligned} \text{Minimize: } & f\_{\text{fil}}(\alpha\_1, \alpha\_2, \alpha\_3, \alpha\_4, \alpha\_5) \\ &= \sigma\_1 \cdot \left( V\_1 - V\_1^\* \right)^2 + \sigma\_5 \cdot \left( V\_5 \right)^2 + \sigma\_7 \cdot \left( V\_7 \right)^2 + \sigma\_{11} \cdot \left( V\_{11} \right)^2 + \sigma\_{13} \cdot \left( V\_{13} \right)^2 \\ &\text{subject to: } \ 0 < \alpha\_1 < \alpha\_2 < \alpha\_3 < \alpha\_4 < \alpha\_5 < \frac{\pi}{2} \end{aligned} \tag{6}$$

where: *V*1, *V*5, *V*7, *V*11, *V*<sup>13</sup> are fundamental component and 5th, 7th, 11th and 13th voltage harmonics (p.u.) respectively, σ*<sup>x</sup>* are penalty weights for the optimization process.

Thus, the aim is to apply an optimization algorithm to minimize fitness function (6) to achieve declared fundamental component (*V*∗ <sup>1</sup>) and harmonics elimination. The fundamental component is minimized with the highest weigh (penalty value) that equals σ<sup>1</sup> = 100. Thus, every 1% of difference between an actual value and the desired one will increase fitness function by 100. Harmonics are minimized with penalty weight σ<sup>5</sup> = σ<sup>7</sup> = σ<sup>11</sup> = σ<sup>12</sup> = 10 One of the essential assumptions of every optimization algorithm is the STOP criterion based on the maximum number of iterations and the minimum value of the fitness function. In this paper, the minimum value of the fitness function assumed to be the success is ffit\_STOP = 0.0001. Regarding the necessity of implementation of dead-times in industrial applications (in this paper dt <sup>=</sup> <sup>5</sup> <sup>×</sup> <sup>10</sup>−<sup>6</sup> s), a lower value of the fitness function will not be recognized as higher quality performance. To prove this statement, sample results obtained by GOA with tolerance 1 <sup>×</sup> 10−<sup>3</sup> (Figure 3a) were compared with the results obtained with tolerance <sup>1</sup> <sup>×</sup> <sup>10</sup>−<sup>10</sup> (Figure 3b). Figure 3 shows that decreasing the parameter of tolerance does not guarantee better efficiency of eliminated harmonics, only significantly increases computation time. Thus, tolerance <sup>1</sup> <sup>×</sup> <sup>10</sup>−<sup>3</sup> was assumed to be sufficient. More results will be presented in Section 5.

**Figure 3.** Simulated output voltage spectrum for SHE-SPWM carried out using Grasshopper Optimization Algorithm (GOA) for different tolerance: (**a**) tolerance < 1 <sup>×</sup> 10<sup>−</sup>4; M1 = 1.0; <sup>x</sup> <sup>=</sup> (0.1234; 0.4242; 0.5199; 1.2197; 1.2791); (**b**) tolerance <sup>&</sup>lt; <sup>1</sup> <sup>×</sup> <sup>10</sup><sup>−</sup>10; M1 <sup>=</sup> 1.0; x <sup>=</sup> (0.1225; 0.4259; 0.5206; 1.2186; 1.2783)

#### **4. Grasshopper Optimization Algorithm (GOA)**

GOA was developed and introduced by Saremi, Mirjalili, and Lewis in [20]. The first proposed application was for structural optimization to find the optimal shape of a three-bar truss, a 52-bar truss, and a Cantilever beam. In this paper, the authors present the application of GOA to solve SHE equations. The proposed algorithm mathematically models the behavior of grasshopper swarm foraging for food to survive. Their individual behavior and social interactions lead the swarm to the optimal solution. The mathematical model of grasshopper behavior is based on a formula for the position of each grasshopper described by the following equation:

$$X\_{\bar{l}} = \ S\_{\bar{l}} + \ G\_{\bar{l}} + A\_{\bar{l}} \tag{7}$$

where *Xi* is the position of the i-th grasshopper, *Si* is the social interaction between agents in the swarm, *Gi* is the gravity force acting on the i-th grasshopper, and *Ai* models the wind effect. However, due to specifics of the problems analyzed in this work effect of gravity and wind were omitted. Thus, only social interactions were taken into account.

$$S\_i = \sum\_{\substack{j=1 \\ j \neq i}}^{Np} s(d\_{ij}^\*) \overrightarrow{d\_{ij}} \tag{8}$$

where *d*∗ *ij* is the normalized distance between the i-th and j-th grasshopper, *s*(*d*<sup>∗</sup> *ij*) is the function of social forces and <sup>→</sup>

*dij* is an unitary vector from i-th to j-th grasshopper.

If absolute value of the distance between the i-th and j-th agent is formulated as:

$$d\_{ij} = \left| \mathbf{x}\_i - \mathbf{x}\_j \right| \tag{9}$$

thus, the normalized value is defined as

$$d\_{ij}^\* = 2 + rem\left(d\_{ij'}2\right) \tag{10}$$

where *rem dij*, 2 is the remainder after division of *dij* by 2. Distance normalization allows for the value of the distance to be kept close to the value of 2 what gives the best effect with the *s-function*. Unitary vector <sup>→</sup> *dij* is defined with the following correlation:

$$\begin{cases} \stackrel{\rightarrow}{d\_{ij}} = 1; \ for \, \mathbf{x}\_i - \mathbf{x}\_j > 0\\ \stackrel{\rightarrow}{d\_{ij}} = -1; \ for \, \mathbf{x}\_i - \mathbf{x}\_j \le 0 \end{cases} \tag{11}$$

Thus, <sup>→</sup> *dij* can be defined by the following formula:

$$
\overrightarrow{d\_{ij}} = \frac{\mathbf{x}\_i - \mathbf{x}\_j}{\left| \mathbf{x}\_i - \mathbf{x}\_j \right|} \tag{12}
$$

A characteristic feature of GOA is a comfort zone shrinking with the iteration number. The Comfort zone is the circle around the best agent. Inside the comfort zone, other agents are being repulsed from the leader and outside the comfort zone, they are being attracted to it. This behavior keeps a balance between exploration and exploitation. The decreasing coefficient *c* models variation of the comfort zone by changing value typically from 1 to some small number. Regarding the above considerations, Equation (7) for the d-dimensional problem can be expanded as follows:

$$X\_i^d = c \left( \sum\_{\substack{j=1 \\ j=1 \\ j \neq i}}^{Np} c \cdot \frac{ub^d - lb^d}{2} s (d\_{ij}^d) \frac{\mathbf{x}\_i^d - \mathbf{x}\_j^d}{\left| \mathbf{x}\_i^d - \mathbf{x}\_j^d \right|} \right) + Gbest^d \tag{13}$$

where *ub<sup>d</sup>* is for upper bound of the *d-th* dimension, *lbd* is for lower bound of the *d-th* dimension, *Gbestd* is for the global best result in the *d-th* dimension, *s* is for *s—Function* which describes the strength of the interaction between agents and is formulated with the following formula:

$$s\left(d\_{ij}^{d\*}\right) = F \cdot e^{\left(-\frac{d\_{ij}^\*}{L}\right)} - e^{\left(-d\_{ij}^\*\right)} \tag{14}$$

where *F* and *L* are coefficients with suggested values 0.5 and 1.5 respectively. Variation of these coefficients will be analyzed in further sections, regarding its influence on the probability of convergence of the algorithm.

Equation (13) reveals the most significant rule of GOA. The position of agents in every iteration is determined with respect to the position of all other agents in the swarm. For instance, in the PSO algorithm position of agents is determined regarding only two vectors: personal best and global best position. That is the reason why GOA requires a lower population to keep the same computational effort. Moreover, an increment of the swarm population may result in lower convergence.

To apply the GOA algorithm for solving SHE Equation (4) the *X<sup>d</sup> <sup>i</sup>* must be correlated with the *i-th* vector of switching angles [α<sup>1</sup> α<sup>2</sup> α<sup>3</sup> α<sup>4</sup> α5]*<sup>i</sup>* Thus, in this case, the problem is 5 dimensional. In the following subsections, the modifications of GOA are proposed and tested in section V.

#### *4.1. GOA with GWO Module*

Grey Wolf Optimizer is a meta-heuristic algorithm inspired by the behavior of grey wolves and mathematically described by Mirjalili et al. in [41]. The GWO is well studied and can be treated as an independent algorithm. However, its main feature can be implemented in other algorithms. The specifics of the GWO is based on the determination of the three best global solutions called alpha, beta, and gamma. Positions of all particles in the swarm will be updated with respect to the position of

the three best global *Ta*, *Tb*, *Tc*. Thus, to combine GOA and GWO, formula (13) will be modified to the following form [24]:

$$X\_i^d = c \left( \sum\_{\substack{j=1 \\ j \neq i}}^{Np} c \cdot \frac{\iota l^d - ll^d}{2} s (d\_{ij}^d) \frac{\mathbf{x}\_i^d - \mathbf{x}\_j^d}{\left| \mathbf{x}\_i^d - \mathbf{x}\_j^d \right|} \right) + \frac{T\_A^d + T\_B^d + T\_C^d}{3} \tag{15}$$

#### *4.2. GOA with NS Module*

The theory of Natural Selection is based on the random elimination of agents from the swarm with a certain probability P with respect to their fitness value. The better result has a higher chance to survive. Thus, NS requires a classification of the agents then the algorithm calculates P for each agent. To adopt NS for the SHE problem the following formula for P for the i-th agent was developed:

$$P\_i = P\_{\min} + \left[ (P\_{\max} - P\_{\min}) \cdot \left( \frac{f\_{fit\\_i}}{f\_{fit\\_swap}} \right) \right] \tag{16}$$

where *Pmin* is the minimum assumed probability of survival assigned for the weakest agent; *Pmax* is the maximum assumed probability of survival assigned for the best agent; *ffit*\_*<sup>i</sup>* is the fitness of the *i-th* agent; *ffit*\_*swarm* is the mean value of fitness functions of all agents in the swarm.

The roulette is performed for every single agent regarding its probability of survival. The eliminated agents are replaced by new random solutions.

## *4.3. Adaptive GOA*

Adaptive Grasshopper Optimization Algorithm (AGOA) is based on a dynamic adaptation of the *c* coefficient regarding the Evolutionary Rate (ER) of the swarm of grasshoppers. ER is defined as the ratio between the number of agents whose fitness was improved in the previous iteration to the total number of agents in the swarm *Np*. Thus, *c* for AGOA is defined by the following formula:

$$\mathcal{L}\left(ite\right) = \left(\mathcal{c}\_{\text{max}} - ite \, \frac{\mathcal{c}\_{\text{max}} - \mathcal{c}\_{\text{max}}}{t\_{\text{max}}}\right) F\_{\text{ER}}\left(ite\right) \tag{17}$$

where *FER* (*ite*) is the dynamic adjustment function defined by the following correlation:

$$F\_{ER}\left(ite+1\right) = \begin{cases} \frac{F\_{ER}\left(ite\right)}{F\_0}; for\,ER<15\%\\\ F\_{ER}\left(ite\right); for\,ER\in\{15\%;30\%\}\\\ F\_{ER}\left(ite\right); for\,ER>30\%\end{cases} \tag{18}$$

where *F*<sup>0</sup> is a constant larger than 1. Thus, AGOA presents a dynamic change of comfort zone with a decreasing trend.

#### *4.4. GOA with OBL Module*

Opposite Based Learning is a technique of swarm algorithms modification based on the statement that the opposite solution to the developed one might bring better result. Thus, every solution (agent) should be reversed and its fitness should be evaluated. If the fitness of the reversed solution is better than the original, the agent will be replaced. Opposite value ... *Xd <sup>i</sup>* can be calculated as follows:

$$
\ddot{\mathbf{X}}\_i^d = \ \mathbf{u}b^d + l\mathbf{b}^d - \mathbf{X}\_i^d; \tag{19}
$$

for \ i = 1, 2, \dots, Np; d = 1, 2, \dots, N

However, the application of this technique to SHE brings issues regarding the feasibility of calculated solutions. As switching angles are restricted to be sorted according to their feasibility, Equation (19) will reverse their order and make them not feasible. To implement OBL to solve the SHE problem opposite solution ... *Xd <sup>i</sup>* must be reordered to respect restriction: 0 < α<sup>1</sup> < α<sup>2</sup> < α<sup>3</sup> < α<sup>4</sup> < α<sup>5</sup> <sup>&</sup>lt; <sup>π</sup> 2 .

#### **5. Simulation Tests and Comparative Study**

In this section, a simulation analysis of GOA algorithm performance is presented. Moreover, a comparative study between GOA and modified GOA (NS, AGOA, GWO, and OBL) is carried out. The optimization process has been carried out with the following assumptions:


Figure 4 shows the flow chart of the developed GOA algorithm for SHE with marked modification modules. However, as was mentioned above, only one module is active at the time.

**Figure 4.** The trajectory of particles in the swarm searching for optimal switching angle α<sup>1</sup> with (**a**) GOA (**b**) Particle Swarm Optimization (PSO).

#### *5.1. Comparison between GOA and PSO*

The comparative study between GOA and PSO was carried out for *n* = 5 switching angles in a quarter-period, modulation index *M1* = 0.9, and fundamental frequency *ff* = 50 Hz what gives 550 Hz switching frequency. In this work 5th, 7th, 11th, and 13th harmonics are eliminated permanently. Figure 5 presents the trajectories of particles during the optimization process with GOA and PSO algorithms, respectively. The GOA algorithm is characterized by a short time of exploration and a long period of exploitation while the PSO algorithm provides a very high intensity of exploration. Figure 6 shows that PSO needs a higher number of iterations to converge comparing with GOA and its modifications.

**Figure 5.** Flow chart of the GOA algorithm with proposed modification.

**Figure 6.** Comparison between PSO and GOA convergence for different values of coefficients.

In the following part of this section, the convergence of GOA and PSO has been compared. The various combinations of parameters were tested. For every set of both GOA and PSO, 100 runs were calculated. For each series of runs, the number of runs that reaches ffit below 1 <sup>×</sup> 10−<sup>4</sup> was recorded as the success. The variation of the following parameters was studied: maximum number of iterations (*max\_ite*), size of the population (*Np*), PSO parameters C1 and C2, and GOA parameters used in s-function (L and F). Thus, all results have been presented in Figure 6 where the probability of convergence is compared. The value of population size for PSO and GOA was adjusted to keep similar computation times for both.

The best performance of GOA was recorded for settings: *Np* = 40 *max\_ite* = 300, *L* = 1.5 and *F* = 0.5. For the aforementioned setting, GOA achieved 27% convergence (time of computation 101 s). The PSO

achieved the best performance for: *Np* = 250, *max\_ite* = 300, *C1* = 1 and *C2* = 0.5. Thus, GOA presents better performance than PSO regarding higher convergence for lower population size. Results presented in Figure 6 proves that for the SHE problem the GOA presents a significantly higher probability of convergence than the PSO algorithm. The most interesting result was achieved by using the GOA algorithm for population 40 and 300 iterations (the second-highest for this algorithm) where the probability of convergence was 28%. This result proves that the GOA algorithm can be very efficient for low population set up which reduces its computational effort. The highest recorded probability of convergence of PSO during the experiment was 15% (time of computation 260 s). The GOA algorithm gives a better result faster. The computation effort is extremely significant during the application of the optimization task for the task. In this paper, coefficients of the compared algorithm were selected in such a way to keep comparable computation time. The parameters which are affecting computation time are population size *Np* and the maximum number of iteration *max\_ite.* Results presented in Figure 6 can be divided into 9 *SETS* regarding *Np* and *max\_ite*. Table 2 presents computation time for the PSO and GOA performed on a computer with processor *Intel Core i7-8557U*. Results from Table 2 are presented in Figure 7. The parameters *Np* and *max\_ite* were selected to keep similar computation time for GOA and PSO for one SET. The GOA in every iteration calculates the position of every agent (grasshopper) related to every agent in the swarm, PSO calculates the only position of the agent related to the position of the pest particle. That is why GOA needs higher computational effort than PSO for the same *Np*. Thus, to make it comparable the *Np* for GOA was reduced in every SET.


**Table 2.** Sets of coefficients with computation time (100 runs).

**Figure 7.** Computation time for different sets of coefficients.

Figure 8 shows the switching angles calculated by PSO and not modified GOA as the function of modulation index M1.

**Figure 8.** Switching angles as the function of modulation index M1 for SHE-PWM calculated using PSO and GOA.

*5.2. Comparative Study between PSO, GOA, and Modified GOA*

In this subsection, the convergence of GOA with modifications and PSO algorithms has been carried out. Assumptions from section *V A* and Table 3 are valid in this section. However, the comparison has been conducted for a wider range of modulation index *M1* = 0.4 ÷ 1.1.


**Table 3.** Parameters for all analysis.

The comparative study reveals that the most efficient with the highest probability of convergence is the GOA algorithm modified by adding the OBL module (Figure 9). The convergence of the studied algorithm was decreasing with an increase of *M1* because higher modulation index requires smaller spaces between switching angles and reduce the feasibility of developed solutions. For *M1* in the range from 0.7 to 0.8 modification based on NS presented very good performance as well. Figure 10 presents the examination of fitness value (*ffit*) as the function of the iteration number. The conclusion is that GOA-based algorithms present significantly faster convergence than PSO.

**Figure 9.** Comparison of the probability of convergence between PSO, GOA, and modified GOA algorithms.

**Figure 10.** Fitness value versus iteration number for examined algorithms.

#### **6. Experimental Results**

The applied GOA algorithm has been experimentally verified. Switching angles calculated by the GOA algorithm were implemented into the laboratory stand (Figure 11) developed according to Figure 1. Parameters of the induction motor applied in the laboratory stand are presented in Table 1. The inverter control by switching angles input was provided by DSpace card 1104. Switching angles were applied as the look-up table for off-line control. Verification was conducted for two operating points with the same fundamental frequency *ff* = 50 Hz, and different *M1* = 0.9 and 1.0, respectively.

**Figure 11.** Laboratory stands for experimental tests.

In Figures 12 and 13 it can be noticed that amplitudes of 5th, 7th, 11th, and 13th harmonics in the output voltage have been eliminated and the GOA algorithm has successfully minimized the goal function.

**Figure 12.** Experimental results for inverter's phase to phase output voltage for M1 = 0.9 (**a**) waveform oscillogram (**b**) spectrum.

**Figure 13.** Experimental results for inverter's output phase to phase voltage for M1 = 1.0 (**a**) waveform oscillogram (**b**) spectrum.

#### **7. Conclusions**

In this paper, the authors investigated a novel application of a recently developed GOA algorithm, for the calculation of switching angles in SHE-PWM inverter modulation. The main goal of this paper was to examine the probability of convergence introduced by GOA applied for solving the SHE problem. Modifications of the GOA algorithm have been implemented and compared with the PSO algorithm. The GOA algorithm is based on the behavior of a swarm of grasshoppers and the most characteristic feature is that the movement of agents depends not only on the position related to the position of the best agent (best global solution) but it depends on the position related to the other agents as well. Thus, the results prove that the GOA algorithm requires a lower population size to converge with computation effort similar to PSO. The most interesting outcome of this study is that the GOA algorithm with OBL elements proves its superiority over the PSO algorithm regarding the probability of convergence for similar computational effort (lower population of particles). The second most efficient combination was the GOA algorithm with NS modification. GOA presents the highest advantage over PSO in the range of modulation index from 0.5 to 1.0. In this range, the convergence of PSO was dramatically reduced (below 5% in the worst case), and meanwhile, the probability of convergence of GOA was between 20 and 80%. The performed measurement experiments proved that the SHE-PWM waveform optimized by the GOA algorithm provided elimination of the chosen harmonics in the inverter's output voltage. In the nearest future, authors will focus their attention on the application of the GOA algorithm for optimization of waveforms generated by multilevel inverters and its applicability in traction drive solutions.

**Author Contributions:** M.S.: Concept and methodology of the research, development of software and application of algorithms. Formulation of conclusions. W.J.: Laboratory measurements and presentation of results. A.S.: Research supervision and text formatting. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**


**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
