# Optimal Design and Control of MMC STATCOM for Improving Power Quality Indicators
## 6 Proposed Optimization Methods
### Harris Hawk's Optimization (HHO)  
The HHO algorithm was developed in 2019, which in its operation mimics the behavior of the hunting of the Harris hawks, a group of intelligent birds that live in the USA [32; 33]. The hunting manner of these intelligent birds depends on surprise. A group of hawks appear to their prey (rabbits) from different sides at the same time to surprise it, at which point the best-fit hawk of the group (the leader) surrounds it. Mathematically, the technique of catching the prey of the hawks can be divided into three stages: (i) the exploration stage, (ii) the stage of transition from exploration to exploitation and finally (iii) the exploitation stage. The first phase of the attack is the most important as it determines the way that the hawks will act. Firstly, all hawks sit randomly in a high place to give them a good chance of observing the environment and wait for their chase. When the prey appears in the surrounding area, the hawks may attack it in several possible manners, and only the leader will decide the way of attack. All hawks might cooperate and surround the prey, or the leader will give the opportunity to one of them, and it will depend on the behavior of the prey to escape. For each of the two possible tactics, the hawks may take their places depending on the location of the neighboring hawk as expressed in (31) or be distributed randomly as described in (32):  
\[X(t+1)=\left(X_{best}(t)-X_{avg}(t)\right)-\psi(LB+\tau(UB-LB))\ \alpha<0.5 \tag{31}\]  
\[X(t+1)=X_{nnd}(t)-\beta\big{|}X_{nnd}(t)-2\varphi X(t)\big{|}\ \ \alpha\geq 0.5 \tag{32}\]  
where \(X(t)\) is the position of the hawks at the present iteration \(t\); \(X(t+1)\) is a vector of the new positions of the hawks in the next iteration; \(X_{best}(t)\) is the position of the chase (rabbits); and \(\alpha\), \(\beta\), \(\psi\), \(\varphi\) and \(\tau\) are randomly distributed numbers in the range from 0 to 1. \(UB\) and \(LB\) denote the upper and lower limits of the position variables. \(X_{nnd}(t)\) denotes a hawk, which is randomly selected from the present population, and \(X_{avg}(t)\) denotes the mean position of the hawks. The average position of the hawks is determined as follows:  
\[X_{avg}(t)=\frac{1}{N}\sum_{i=1}^{N}X_{i}(t) \tag{33}\]  
where \(X_{i}(t)\) denotes the position of each hawk in iteration \(t\) and \(N\) indicates the number of hawks. Depending on the energy of the prey during the escaping process, HHO can make a transition from exploration to exploitation. The energy of the prey (rabbit) is determined as follows:  
\[E=2\times E_{0}\Big{(}1-\frac{t}{T}\Big{)} \tag{34}\]  
where, \(E_{0}\) denotes the initial energy in each iteration, which is randomly taken from [-1, 1], and \(T\) presents the maximum iterations. As the hawks have detected the prey as explained in the previous stages, they have to make a sudden attack, which depends on the probability of escape. In the mathematical modelling, the probability of escape \(r\) will be \(<\)0.5 for a successful escape and \(r\geq\) 0.5 if the prey unsuccessfully gets away. Depending on the way that the prey will take during escape, the hawks will carry out a soft or hard siege. Regardless of the energy of escape, a hard or soft siege will occur. When \(|E|\geq\) 0.5 and \(r\geq\) 0.5, the prey has enough energy to make random jumps but fails to escape. During these misraattempts, the hawks surround the prey until it is exhausted by its force and then suddenly attack it. Thus, the soft siege is described as:  
\[X(t+1)=\Delta X(t)-E\big{|}(J\times X_{best}(t))-X(t)\big{|} \tag{35}\]  
where \(\Delta X(t)\) denotes the difference between the prey's position and the position of the hawks in the present iteration. \(J\) is the strength of the prey's random escape. When \(|E|<0.5\) and \(r\geq 0.5\), as the prey has no energy to escape, a hard siege will be performed. Accordingly, the hawks hardly circle the prey to execute a surprise attack.