## 4 Simulation Results and Discussion
### Scenario 1: A Two-Area Power System (TAPS) Integrating Hydropower Plants (Figure 2)  
A load disturbance of 0.05 per unit (pu) is applied to the system at t = 1 s. The simulation runs for 30 s, providing sufficient time to analyze the frequency response and assess the effectiveness of the control strategy under varying load conditions. To ensure accurate results and optimal system behavior, the simulation scenario was carefully designed with specific conditions and parameter values (Table 1). The simulation was conducted with a swarm of 100 particles and a maximum of 50 iterations to balance computational cost and solution quality. A moderate inertia weight \(w\) of 0.5 was chosen to balance the exploration of new possibilities with the refinement of current solutions, thereby preventing early convergence. The influence of both pBest and gBest solutions was set equally, with acceleration coefficients \(c_{1}\) and \(c_{2}\) both at 1.5, to promote efficient convergence. Randomness, introduced through variables \(r_{1}\) and \(r_{2}\), helped to maintain diversity within the search and made the system less likely to get stuck in local optima. This parameter configuration was selected to allow the PSO algorithm to effectively tune the PID controller and achieve stable frequency regulation. To evaluate the performance of the PID controller designed using the PSO algorithm, this paper compares it with a controller tuned using the traditional Ziegler-Nichols method. The comparison focuses on key performance metrics such as steady-state error and settling time, highlighting the strengths and trade-offs of each approach. The Ziegler-Nichols method provides a systematic approach to tuning the parameters of a PID controller. The following are the steps to implement this method:  
Step 1: Set the controller to Proportional-only (P) mode. Set \(K_{i}\) = 0 and \(K_{d}\) = 0, keeping only \(K_{p}\) in the PID controller. This ensures that the system operates based solely on the proportional gain \(K_{p}\). \begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Unit** & **Value** \\ \hline \(B_{1}\) = \(B_{2}\) & pu.MW/Hz & 0.425 \\ \(R_{1}\) = \(R_{2}\) & Hz/pu.MW & 2.4 \\ \(T_{gh1}\) = \(T_{gh2}\) & s & 0.3 \\ \(T_{n1}\) = \(T_{n2}\) & s & 5 \\ \(T_{m1}\) = \(T_{m2}\) & s & 28.75 \\ \(T_{p1}\) = \(T_{w2}\) & s & 0.3 \\ \(K_{p1}\) = \(K_{p2}\) & Hz/pu.MW & 120 \\ \(T_{p1}\) = \(T_{ps2}\) & s & 20 \\ \(T_{12}\) & pu.MW/Hz & 0.545 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Parameters for scenario 1. Step 2: Determine \(K_{u}\) and \(T_{u}\). Gradually increase \(K_{p}\) in small increments until the system reaches the critical oscillation point, where the system response shows sustained oscillations with constant amplitude. After determining the values of \(K_{u}\) and \(T_{u}\), note that \(K_{u}\) is the value of \(K_{p}\) at the critical oscillation point, and \(T_{u}\) is the period of sustained oscillation. Step 3: Calculate the PID parameters using the Ziegler-Nichols formula. Using the values of \(K_{u}\) and \(T_{u}\) determined in Step 2, the Ziegler-Nichols formulas are applied to calculate the PID controller parameters, as follows:  
\[ \begin{array}{l}K_{p}=0.6K_{u}\\ K_{i}=\frac{2K_{p}}{T_{u}}\\ K_{d}=\frac{K_{p}T_{u}}{8}\end{array}  \tag{11}\]  
The parameters calculated using the Ziegler-Nichols method provide a basic tuning setup for the PID controller. However, this often leads to oscillatory or excessive responses and is not optimal for many complex systems. The simulation results presented below highlight the performance comparison between the PSO-tuned PID controller and the Ziegler-Nichols PID controller (Table 2). This analysis demonstrates the extent to which the PSO algorithm enhances system response compared to the traditional tuning method. The two graphs depict the simulation results of a frequency control for two areas using two control methods, namely traditional PID-ZN and PID-PSO (combined with an optimization algorithm) (Figure 3).