**5. Conclusions**

In this work, a metaheuristic-based vector-decoupled algorithm for hybrid microgrid energy control and managemen<sup>t</sup> is proposed. The algorithm aims to ensure safe and stable power-sharing between the DC and AC parts of the microgrid considering variable renewable energy sources, EV charging structure, as well as severe operational condition such as in the case of forced islanding operation. The metaheuristic algorithm provides the interlinking converter with optimized parameters to manage the microgrid's operation under various load and resources conditions. mechanism enables a smart and rapid. A hardware-in-the-loop implementation verifies and validates the proposed technique and offer stable and robust operation even during islanding situation. Furthermore, stable voltage and frequency levels are achieved and the power sharing between the two parts of the microgrid is accomplished. Specifically, we assumed a reduction at the power level of the DC side due to dense cloud in the time between 0.8s to 1.5s, as shown in Figure 13a. Accordingly, the controller requests more energy discharge from the EVs during this period to compensate for this deficiency, as illustrated in Figure 13b, while it allows for power sharing from the synchronous generator located at the AC side as shown in Figure 15a to assist the deficiency in the DC side. This is pivotal in the balancing of the operation especially in the case of insufficient participation of the EVs to discharge their energy during the scenario of reduced PV output. It is noted from the results that this has been achieved in rapid and robust manner without impacting the load levels. It should be noted that the parameter optimization of the proposed hybrid algorithm allows more participation from the AC side. Since large variations in the generator output may lead to frequency fluctuations, optimization of the parameters is required in this work. This is achieved by optimizing those parameters using the proposed APOPSO algorithm. As can be shown in Figure 14c, the optimized parameters reduced the fluctuations significantly in comparison with case of non-optimized parameters. Fluctuations in the non-optimization scenario may harm the operation of the hybrid microgrids and could trigger false operation of the over/under frequency protection relays. The success of the hybrid algorithm in reducing the fluctuations indicate its robustness and effectiveness in the hybrid microgrid energy managemen<sup>t</sup> and control.

Future work is expected to incorporate algorithms that propose dynamic pricing structure to accurately reflect the real-time energy prices as result of control activities in hybrid microgrids. Soon, huge participation of EVs as well as privately owned small-scale PV systems is expected, and a fair pricing structure will be required to encourage more participation from consumers sides. The authors of this work propose a new pricing scheme that allocates special pricing tari ff on electric vehicles that charge considering stochastic microgrids operation and energy managemen<sup>t</sup> [33]. Furthermore, the authors sugges<sup>t</sup> that this area of research needs further investigation. Additionally, future work is also anticipated in regard with machine learning applications in smart control of power quality problems as a result of large adoption of EVs in hybrid microgrids. In such studies, smart control is integrated to enhance the voltage fluctuations and harmonics as result of stochastic large-scale integration of EVs activities on microgrids.

**Author Contributions:** Conceptualization, T.M.A. and A.F.E.; Methodology, T.M.A. and A.F.E. Software, T.M.A. and A.F.E.; Validation, T.M.A, A.F.E and O.M.; Formal Analysis, T.M.A.; Investigation, T.M.A.; Resources, T.M.A.; Data Curation, T.M.A. and A.F.E.; Writing-Original Draft Preparation, T.M.A.; Writing-Review and Editing, T.M.A, A.F.E and O.M.; Visualization, T.M.A. and A.F.E.; Supervision, O.M.; Project Administration, O.M.; Funding Acquisition, T.M.A. All authors have read and agreed to the published version of the manuscript.

**Funding:** We acknowledge the financial support of Taibah University, Saudi Aribia for author Tawfiq Aljohani. Laboratory funding support by the Energy Systems Research Laboratory, Florida International University, Miami, FL 33174 (email: mohammed@fiu.edu).

**Conflicts of Interest:** The authors declare no conflict of interest.
