*Article* **P2P Coordinated Control between SPV and STATCOM in a Microgrid for Power Quality Compensation Using LSTM–Genetic Algorithm**

**Durgamadhab Swain 1,2, Meera Viswavandya <sup>3</sup> , Ritesh Dash <sup>4</sup> , Kalvakurthi Jyotheeswara Reddy <sup>4</sup> , Dhanamjayulu Chittathuru 5,\* , Arunkumar Gopal <sup>5</sup> , Baseem Khan 6,\* and Manam Ravindra <sup>7</sup>**

	- <sup>4</sup> School of Electrical and Electronics Engineering, REVA University, Bengaluru 560064, India; rdasheee@gmail.com (R.D.); jyothireddy.kalvakurthi@gmail.com (K.J.R.)
	- <sup>5</sup> School of Electrical Engineering, Vellore Institute of Technology, Vellore 632014, India; g.arunkumar@vit.ac.in
	- <sup>6</sup> Department of Electrical and Computer Engineering, Hawassa University, Hawassa P.O. Box 05, Ethiopia
	- <sup>7</sup> Department of Electrical and Electronics Engineering, Aditya College of Engineering, Surampalem 533437, India; ravieeejntu@gmail.com
	- **\*** Correspondence: dhanamjayulu.c@vit.ac.in (D.C.); baseemkh@hu.edu.et (B.K.)

**Abstract:** The deployment of a static synchronous compensator within a microgrid can facilitate voltage and reactive power regulation, leading to enhanced stability and reliability. Within a microgrid setting, the effectiveness of a STATCOM in balancing the power supply is influenced by several factors, including the system configuration, the operating conditions, and the specific requirements of the power grid. The capacity, response time, and magnitude of system disturbances also play a role in determining the STATCOM's ability to balance the power supply. To ensure the successful integration of a STATCOM within a microgrid, coordinating the control system with other distributed energy resources (DER), especially when multiple control strategies are employed, can be a challenging task. Therefore, a meticulously designed control system is indispensable to guarantee the microgrid's efficient and effective operation. The use of GA in LSTM tuning can accelerate the process of identifying the optimal hyperparameters for a specific task, obviating the need for time-consuming and computationally expensive grid searches or manual tuning. This method can be particularly advantageous when handling large data sets and complex models. In this paper, an attempt has been made to model the STATCOM to communicate with the microgrid, tuned using LSTM–GA, for the effective calculation of real and reactive power support during grid disturbances.

**Keywords:** algorithm; GA; PSO; PSO–LSTM; search space
