**8. Conclusions**

The compensation of harmonics is a major task in the modular multilevel converter (MMC). The Full-Bridge MMC block with 22 modules per phase is presented in this paper. The optimal design of the MMC capacitor and the optimized parameters of the PI controller were determined using HHO and ASO techniques. Moreover, two realistic representative cases of studies were designed and tested: nonlinear and imbalanced loads. The THD of the current before applying the proposed algorithm was 10.97%, where with the optimal values of the capacitor converters, the THD decreased to 0.60% by using the HHO algorithm, whereas THD decreased to 1.21% using the ASO. The results show that with the application of the MMC STATCOM, the voltage and current load are rapidly adjusted in the case of the imbalanced load. Moreover, the voltage DC-link of the converter has a stability value, and this will reduce the value of the current circulation within the converter. In the two cases of nonlinear and imbalanced loads, the voltage in the DC-link has a stabilized value, and this, in turn, improves the performance of the control system and the power quality indicators in the studied network. In addition, the application of the MMC in grid-connected photovoltaic and wind energy systems and micro grids is also an important issue for our future works. In spite of this, the study of this topic is outside of the framework of this paper, and it can be covered in future works. Finally, the authors would like to remark that, due to the lack of laboratory equipment and apparatus with the high voltage rating, the real time implementation of the proposed algorithm was not performed. However, in future work, one of the aspects of our work will be to experimentally implement the presented control system. Additionally, future work will present the application of other control algorithms to achieve an improvement of the overall system performance.

**Author Contributions:** Conceptualization, A.A.Z.D. and R.A.; Data curation, H.M.S. and Z.M.A.; Formal analysis, A.A.Z.D. and H.M.S.; Methodology, T.E., A.A.Z.D. and R.A.; Resources, A.A.Z.D., R.A. and Z.M.A.; Software, H.M.S.; Supervision, A.A.Z.D.; Validation, T.E. and A.A.Z.D.; Visualization, A.A.Z.D., H.M.S. and Z.M.A.; Writing—original draft, T.E., A.A.Z.D., R.A. and H.M.S.; Writing—review & editing, A.A.Z.D., R.A. and Z.M.A. All authors together organized and refined the manuscript in the present form. 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.
