## 4 Particle Swarm Optimization (PSO) Algorithm  
The PSO is an evolutionary algorithm that gives a better result with every iteration. It is based on bird flock concept where each bird follows the leader. In this case, each particle follows the best possible particle. In conventional PSO, there is a population of particles. The positions of these particles are compared with the local best position and the global best position, and accordingly these particles are moved in search space. The position of a particle is determined by the best particle in a region \(P_{best-i}\) as well as the best solution found by all the particles in the total population \(G_{best-i}\). Movement of particles in the optimization process is shown in Figure 7[8; 20]. The particle position \(x_{i}\) is adjusted using Equation (8)  
\[x_{i}^{k+1}=x_{i}^{k}+\phi_{i}^{k+1} \tag{8}\]  
where the velocity component \(\phi_{i}\) represents the step size. The velocity is calculated by Equation (9)  
\[\phi_{i}^{k+1}=\omega\phi_{i}^{k}+c_{1}r_{1}\Big{\{}P_{besti}-x_{i}^{k}\Big{\}} +c_{2}r_{2}\Big{\{}G_{besti}-x_{i}^{k}\Big{\}} \tag{9}\]  
where \(\omega\) is the inertia weight, the acceleration coefficients are represented as \(c_{1}\) and \(c_{2}\), the random constants \(r_{1}\), \(r_{2}\in\) U(0, 1), \(P_{besti}\) and \(G_{besti}\) is the personal best position of particle \(i\), and is the best position of the particles in the entire population respectively. Since the PSO algorithm is used to find the best duty cycle for switching the MOSFET of the ZSI. The position can be taken as duty cycle, and then Equation (10) can be rewritten as  
\[d_{i}^{k+1}=d_{i}^{k}+\phi_{i}^{k+1} \tag{10}\]  
In the PSO Algorithm, first the population of particles is formed and then the objective function is formed. Since it is implemented for Maximum Power Point Tracking (MPPT), the objective is to maximize the output power. The objective function of PSO is framed as max((\(P(k)\), \(P(k-1)\)). In this work, the PSO Algorithm is implemented as a closed loop system for reducing the steady state oscillations and improving the tracking time to achieve maximum power. While forming the population of particles, it is necessary to bound them to a specific level. If not, the particles will lose their directions leading to the failure of the algorithm. The variation of the duty cycle is shown in Figure 8 with switching frequency of 10 kHz. Figure 9 represents the PSO based MPPT integrated through Z-Source inverter and Figure 10 represents the flowchart of PSO algorithm. According to Equation (14), the duty cycle is restricted to 0 to 0.5. The constraint for duty cycle is 0.1 to 0.4 is considered in the PSO algorithm. Figure 7: Movement of particles in the optimization process. When slow variation in irradiance, changes in duty cycle are small to track the MPP. Due to initialization, the change in duty cycle is large, then the particles will have large search area. So, some energy is wasted during the exploration process. If the above changes occur frequently, then the tracking needs to be fast to follow the change, but does not follow the MPP accurately. To overcome this issue modified PSO is used which is detailed in [20]. In modified PSO algorithm, the \(G_{best}\) value is adjusted instead of varying the PSO parameter \(\omega\), C\({}_{1}\), C\({}_{2}\). The value of C\({}_{1}\) = C\({}_{2}\) = 2F, \(\omega\) = 0.4. In slowly varying irradiance, the duty cycles are initialized in two phases. First, the duty cycle is adjusted by \(k_{1}\), using Equation (11) then perturbation of two extreme duty cycle with a constant value of \(k_{2}\), in both the direction shown in Equation (13). \[d_{new}=d_{old}-\frac{1}{k_{1}}(P_{oldMPP}-P_{MPP}) \tag{11}\]  
\[k_{1}=\frac{\Delta P_{MPP}}{\Delta d}\text{, }k_{1}=\{k_{1}\text{ if }\Delta P>0\] \[=\left\{\frac{k_{1}}{2}\text{ if }\Delta P<0\right. \tag{12}\]  
\[d_{i,new}^{k}=[d_{1}-k_{2},\ d_{2},\ d_{3}+k_{2}]\text{ for }k_{2}\geq 0.05 \tag{13}\]  
Figure 8: Varying duty cycle of Particle Swarm Optimization (PSO) algorithm.