The process described at the beginning of this chapter is developed for each proposed case study to reduce the voltage THDv percentage by reducing the most prevalent harmonics in each inverter model.
3.3.5. Description of the Optimization Algorithm
The proposed Algorithms 1 and 2 aim to determine the optimal switching angles for a SHE-PWM signal using Particle Swarm Optimization (PSO).
Algorithm 1 SHE-PWM Optimization Using PSO. |
- 1:
Input: , , - 2:
PSO Parameters: N, , w, , , , - 3:
Initialization: - 4:
Set (initial velocity) - 5:
Set - 6:
Set - 7:
Initialize , - 8:
Initial Evaluation: - 9:
for
to
N
do - 10:
- 11:
if then - 12:
- 13:
- 14:
end if - 15:
end for - 16:
Iterations: - 17:
for
to
do - 18:
for to N do - 19:
- 20:
- 21:
Limit to - 22:
- 23:
if then - 24:
- 25:
- 26:
if then - 27:
- 28:
- 29:
end if - 30:
end if - 31:
end for - 32:
- 33:
if then - 34:
- 35:
end if - 36:
end for - 37:
Output: - 38:
Convert to degrees, sort, and print - 39:
optimal solution - 40:
Calculate and print Fourier components:
|
Algorithm 2 Objective Function calcuFitness. |
- 1:
Input: , , , - 2:
Calculate fundamental error: - 3:
Initialize - 4:
for each
h
in
do - 5:
- 6:
- 7:
end for - 8:
Compute the objective function: - 9:
Return:
f - 10:
End
|
The developed objective function verifies the reduction of unwanted harmonics and how close the value of the fundamental component is to the target value defined with the modulation m and the weighting factor . The algorithm is described in the following steps:
Parameter initialization: Input and configuration values for the PSO are defined, such as the number of firing angles (), harmonics to be eliminated (), the value of the fundamental component (), the number of particles (N), the number of iterations (iter), the inertial weight (w), the cognitive and social attraction coefficients ( and ), and the lower and upper bounds for the angles in the search space (lb and ub).
Generation of the initial population: Positions x are randomly initialized within the search space defined by [lb − ub]. The velocities v are initialized to zero. The best individual position (pbst) is set as the initial position, and a seed is selected for the best global position (gbst). The fitness values ( and ) are initialized to infinity.
Initial population evaluation: The objective function for each particle is evaluated using calcuFitness, which considers the fundamental component error and the squared error of the harmonics of interest. The pbst and gbst values are updated based on the best value obtained.
PSO iterations: Each particle is updated in both velocity and position using Equations (
7) and (9), respectively. Positions are limited within the valid angle range [lb ub]. The objective function is re-evaluated, and if the fitness values improve (
and
), they are updated with their corresponding positions (pbst and gbst). A progressive inertial weight-damping strategy is applied to refine solutions close to the optimum.
Obtaining results: At the end of the iterations, the best global solution (gbst) is selected, which represents the optimal set of firing angles. These angles are converted to degrees and sorted in ascending order. Finally, the harmonic components are calculated using the Fourier Series with the optimal angles obtained.
Configuration of PSO parameters: To configure the PSO parameters, a sensitivity analysis is performed to justify the numerical values of the parameters w, , , and . The goal is to ensure that the selected value corresponds to the lowest cost of the objective function, as this represents an efficient and optimal solution. However, a high cost of the objective function indicates a poor or suboptimal solution. This demonstrates the limitations of the algorithm in the face of parameter variation, ensuring replicability for future case studies. Inertia weight (w): Regulates the balance between the exploration and exploitation mechanisms in the search space. It is related to the previous velocity of the particle for the current motion, thus determining the degree of persistence in its trajectory. Typically, a range of values is used between [0.4–0.9]. Eight random values for w are evaluated within the optimal range between [0.4–0.9], with fixed values of 1.5 for and , and is not considered, with the aim of achieving the lowest cost for the objective function.
Values to be evaluated: [0.4, 0.48, 0.56, 0.64, 0.72, 0.80, 0.88, 0.9]
Figure 22 shows how the cost of the objective function gradually decreases as it approaches a value of w equal to 0.65, reaching its minimum at w equal to 0.72, and then increasing its cost again as the value of w rises until it reaches 0.9.
A high value of w promotes broader exploration in the search space but slows convergence, as seen with values such as 0.88 and 0.9. While a low value of w induces more conservative behavior, exploiting promising areas once identified, it can cause premature convergence, as seen in values such as 0.4, 0.48, and 0.56. Therefore, a value of w equal to 0.72 is selected for the algorithm, as it achieves the minimum cost of the objective function and, hence, a balance between exploration and exploitation. This value is reduced by 1% for each iteration until it reaches a value of w equal to 0.48. Progressive damping is applied, favoring exploration in the early iterations and ensuring exploitation when reaching the final iterations, to optimize the particle solution set. Cognitive coefficient (): Regulates the degree of influence exerted by the best individual position achieved by each particle (pbst). It represents the individual learning tendency regarding the future trajectory of each particle. It is typically set within a range of [1–2.5]. Eight random values for are evaluated within the optimal range of [1, 2.5], with a fixed value of 0.72 for w, ignoring and , in an attempt to achieve the lowest cost for the objective function.
Values to be evaluated: [1, 1.21, 1.42, 1.5, 1.84, 2.05, 2.26, 2.5]
Figure 23 illustrates the high initial cost of the objective function, with
initially set to 1. However, the price decreases until it reaches its minimum at
= 1.5. As this value increases until
equals 2.5, an increase in the cost of the objective function is observed, indicating that the function parameters are no longer being met and, therefore, are undesirable values for configuring the algorithm.
High values of , such as 1.84, 2.05, 2.26, and 2.5, make the particle overly dependent on its own experience, preventing it from exploring new solutions. This leads to premature convergence due to stagnation in local minima, increasing the cost of the objective function. Low values of , such as 1, 1.21, and 1.42, limit individual search and reduce the importance of the best individual position. Thus, the appropriate value for setting the parameter is equal to 1.5, as it allows particles to leverage their history of success without compromising the swarm’s diversity, as demonstrated by its low objective function cost. Social coefficient (): Regulates the social learning component, representing a particle’s tendency to follow the collective knowledge of the swarm (gbst). As with , it is usually set within a range of [1–2.5], following established criteria for evaluating parameter sensitivity. Eight random values for are reviewed within the optimal range of [1–2.5], with a fixed value of 0.72 for w, 1.5 for , and ignoring , with the aim of achieving the lowest cost for the objective function.
Values to be evaluated: [1, 1.21, 1.42, 1.63, 1.80, 2.05, 2.26, 2.5]
As shown in
Figure 24, the cost of the objective function is high, starting with a value of
equal to 1, but this decreases as the value of
increases until it reaches a minimum cost of
equal to 1.80. From that point on, the price of the objective function increases again until the maximum value of
is reached.
High values for
, such as 2.05, 2.26, and 2.5, cause a loss of diversity in the swarm, leading to premature stagnation. Low values for
, such as 1, 1.21, 1.42, and 1.63, reduce swarm coordination, resulting in slow and unstable but diverse convergence. Typically, the values of
and
are set equal to ensure symmetry in population exploration and avoid bias toward the nearest global optimum. However, when evaluating the different values of
for the objective function, the value with the lowest cost is a
equal to 1.80, indicating that there is a tendency to prioritize the global optimal solution over individual solutions, maintaining a balance between personal exploration and group collaboration, as its value is not far from
’s value of 1.5. Weighting factor (
): This factor accounts for the error of the fundamental component in the objective function. It ensures a balance by maintaining the importance of eliminating harmonics of interest, without neglecting the magnitude of the essential component. Among the evaluated values (
Figure 25),
resulted in the lowest cost for the objective function, indicating an optimal trade-off between harmonic suppression and preservation of the fundamental component. A lower
overemphasizes harmonic elimination, risking deviation of the fundamental magnitude, while a higher
prioritizes fundamental retention at the expense of residual harmonic content. Therefore,
= 10 ensures that both objectives are balanced effectively.
The appropriate range of values is [1–50] (
Table 6), depending on the priority given to the function’s objectives. For this case, eight random values spanning all working ranges of
will be evaluated to assess the cost of the objective function.
Figure 25 shows how values outside the range [5–20] present a high cost of the objective function, and within this range, the lowest cost of the objective function is found for a value of
equal to 10. Thus, the value used to configure the algorithm will be
equal to 10, as this guarantees a balance between the function objectives, thus achieving a solution consistent to reduce distortion in the CHB-MLI voltage signals.
Search limits for optimal angles: lb (minimum) and lu (maximum) are set between
and
, as the objective is to operate in the first quarter-wave of the voltage signal, which corresponds to a maximum value of
or
. However, to avoid generating conflicts in the algorithm due to divisions by zero, extreme values are avoided for the configuration. Number of particles (N): Represents the number of solutions evaluated simultaneously in each iteration. PSO typically works with a range of [30–50] particles for nonlinear optimization problems, as is the case for SHE-PWM modulation. Therefore, to avoid excessive computational load and maintain adequate search diversity, and considering that the response with the most particles is for the 9-level CHB-MLI, which requires four optimal firing angles, the value of N is considered equal to 40 to configure the parameter. Maximum number of iterations (Iter): Defines how many times the positions and velocities of the particles in the swarm are updated, ensuring that the objective function stabilizes.
Figure 26 shows how, starting at 200 iterations, the cost of the objective function begins to stabilize. After that, increasing the number of iterations does not guarantee significant improvements in the result, but it does increase the computational time of the algorithm, making it slower.
Therefore, a value below 200 iterations does not ensure convergence to stable solutions, and a value above 400 does not improve the results. Therefore, an Iter value of 300 is considered, striking a balance between solution quality and reasonable computational cost. The parameters are set to the values described in
Table 7.
The selection of PSO parameters (e.g., inertia weight
,
,
) is based on sensitivity analysis results illustrated in
Figure 22,
Figure 23 and
Figure 24. These values achieve the lowest objective function cost and ensure a balance between exploration and exploitation in the search space. Similar configurations have also been recommended in the literature for SHE-PWM optimization problems [
12,
13], confirming the robustness and convergence effectiveness of this parameter set.