# A Novel Cascaded Modular Photovoltaic Energy Storage System for Partial Shading Conditions
## 2 Topology, Operation Principle and Optimization Strategy of Proposed PV/ES System
### Energy Optimization Strategy
#### 2.3.2 Energy Optimization Strategy Based on PSO Algorithm  
As one of the most common optimization algorithms, the PSO algorithm has the advantages of easy implementation, fast convergence, and ideal robustness, and it has been successfully applied to the cooperative planning of renewable power sources and energy storage systems [35].  
In terms of the above energy optimization model, an energy optimization strategy based on the PSO algorithm is proposed in order to optimize the current of the DC bus in the cascaded modular PV/ES system. The implementation steps of the proposed algorithm are shown in Figure 5.  
1. Definitions: The current of the DC bus is defined as the particle position, i.e., \(x=i_{\text{bus}}\), and the target function (6) is selected as the fitness value evaluation function.
2. Initialization: Set the number of particles \(N\), number of iterations \(M\), the penalty factor \(b\), the weight coefficients \(w\), \(c1\), and \(c2\). Randomly initialize the position and velocity of each particle in a range, which is given as (7). Set the initial iterative algebra as \(m=1\).  
Figure 5: Implementation flowchart of the proposed energy optimization strategy.  
3. Fitness value calculation: considering the position, measured real-time currents, voltages of all PV modules, and voltages and SOC of all ES modules, the fitness value of each particle is calculated using Equations (3), (5) and (6). 4. The best fitness values and positions updating: the latest fitness value of the \(n\)-th particle (\(n=1,2,\ldots,\) N) is compared with its individual best fitness value, and the smaller one and its corresponding position will be recorded as the new individual best fitness value and best position, which are denoted as \(F_{n\text{Best}}\) and \(p_{n\text{Best}}\), respectively. Then, all of the new individual best fitness values are compared with the previous global best fitness value, and the minimum fitness value and its corresponding position will be selected to update the global best fitness value and global best position, which are denoted as \(F_{g\text{Best}}\) and \(p_{g\text{Best}}\), respectively. 5. Particles updating: The velocities and positions of all of the particles are updated using the following [36]: \[\left\{\begin{array}{l}v_{n}^{m+1}=\text{w}v_{n}^{m}+\text{c}_{1}r_{1}(p_{n \text{Best}}-x_{n}^{m})+\text{c}_{2}r_{2}(p_{g\text{Best}}-x_{n}^{m})\\ x_{n}^{m+1}=x_{n}^{m}+v_{n}^{m+1}\\ n=1,2,\cdots,\text{N}\end{array}\right.\] (8) where \(n\) and \(m\) represent the \(n\)-th particle and \(m\)-th iteration, respectively; \(v\) and \(x\) represent the velocity and position of particles, respectively; \(w\), \(c_{1}\), and \(c_{2}\) are weight coefficients; and \(r_{1}\) and \(r_{2}\) are randomly generated in \([0,1]\). 6. Constraint judgment: if the particle position exceeds the range given in (7), it should be replaced by the following: \[\left\{\begin{array}{l}i_{n\text{bus}}^{m+1}=0,\qquad\quad i_{n\text{bus}}^{ m+1}<0\\ i_{n\text{bus}}^{m+1}=i_{n\text{bus}}^{m+1},\qquad 0\leq i_{n\text{bus}}^{m+1}\leq I_{ \text{rated}}\\ i_{n\text{bus}}^{m+1}=I_{\text{rated}},\qquad i_{n\text{bus}}^{m+1}>I_{ \text{rated}}\\ n=1,2,\cdots,\text{N}\end{array}\right.\] (9) 7. End of the iteration: If the iterative algebra \(m\) is smaller than \(M\), set \(m=m+1\) and return to step 3. If \(m\) is equal to \(M\), the iteration will be stopped, and the optimal current of the DC bus is achieved according to the global best position, as follows: \[i_{\text{opt}}=p_{g\text{Best}}\] (10) Finally, the reference value of the active power from the PV/ES system to the grid is calculated as follows: \[P_{\text{g}}^{*}=\sum_{j=1}^{\text{J}}u_{\text{pv}}\,j_{\text{opt}}\] (11)