## 4 Controller Tuning Methodology  
Based on the above-mentioned proposed control loops of inertial and proportional control for VSWTs, a Student-Psychology-Based Algorithm (SPBA) is proposed here, as presented in [30]. The main advantage of this SPBA is that it provides the best optimum combination of gains for PI controllers. However, different nature-inspired algorithms like the bat algorithm [92], partial swarm optimization algorithm [93; 94], GA-PSO [95; 96], and GA fuzzy [97] are discussed in the literature. However, the SPBA approach is very effective towards this aim [30]. Figure 14: Simulink of proposed VSWT inertial and proportional control for FR. The proposed SPBA used objective functions to calculate the best optimum gain combination to provide FR during transients. The objective function includes the integral absolute error (IAE), integral square error (ISE), and minimum FD. The proposed SPBA helps the I&P control in providing earlier frequency support by releasing a fraction of the K.E stored in rotational masses and taking advantage of the rapid response capability associated with power electronics-based controlled converters. The mathematical representations of the IAE and ISE are given in Equations (12) and (13), respectively. Based on these objective functions, a control quality index, Z, was introduced that estimates the controller's effective performance. Equation (14) shows the controller quality index Z. Here, NADIR represents the underfrequency, and c represents the number of transient peaks (both +ive and -ive) in the speed derivative during contingency. With the help of the control quality index, distinctive combinations of controller gains are calculated. The benefit of using the SPBA is to provide a combined optimum solution if one or more controllers are tuned simultaneously. Figure 15 presents a flow chart of the SPBA for one controller with two gain parameters (K\({}_{\text{dn}}\) and K\({}_{\text{pn}}\)). However, with the increased number of controllers, the number of possible gain parameter combinations increased. In the current scenario, for a controller of two gain parameters, there are eight possible conditions to find the best suitable behavior of the controller. In Section 4.2, the same two parameters based on the SPBA tuning methodology were used to find the optimal values of the inertial and proportional controllers. It is clearly shown in Figure 15 that the algorithm first calculates the base parameters and then compares them with the individual controller quality index, Z, produced by each conditional loop. The decision to repeat the simulation with or without incremental gain parameters depends on Y. Y = [0] indicates repeat simulation by reducing the increment up to the first decimal place. On the contrary, it returns greater Z values because they lead to better controller performance. In addition, comparing it with the previous controller quality index, if the result is positive, the objective function values of Z\({}_{\text{prev}}\) are replaced with the new values associated with Z\({}_{\text{new}}\). The significance of this replacement is that the new gain parameter values are closer to the optimal unique solution. Every time Z\({}_{\text{new}}\) > Z\({}_{\text{prev}}\), the system performance is enhanced by shifting closer to the stability point. The simulation will be stopped when two conditions are satisfied: The first is when incremental conditions are met. It is 0.01 in the current scenario, beyond which there is no significant improvement in NADIR and Z. The second is when Z\({}_{\text{new}}\) \(\
ot>\) Z\({}_{\text{prev}}\). After satisfying these conditions, the final Z reflects the optimum solution with the combined effect of lower fluctuations in the IAE and ISE. The main benefit of this approach is that researchers can find a unique optimum solution with a fast frequency response for PFC. Another significance of the importance of this algorithm is that the system becomes more stable than in the previous condition during each simulation.