## 3 Controller Design
### Fuzzy PID Controller
Similarly, in [47], a metaheuristic-based fuzzy PID method for AVR control also utilized triangular membership functions. The performance of the proposed method was evaluated based on two different objective functions, namely the Integral of Absolute Error (IAE) and the Integral of Time-weighted Absolute Error (ITAE), and it was found to be superior to the other compared methods. In [48; 49; 50; 51; 52; 53; 54], fuzzy logic controllers utilizing triangular and trapezoidal membership functions were preferred for controlling various systems due to their simplicity, robustness, and effectiveness in producing reliable results. In this study, triangular and trapezoidal membership functions were selected primarily due to computational efficiency and compatibility with industrial PLC-based implementations [55; 56]. PLCs often have limited processing power and memory, making it impractical to use computationally complex functions such as generalized bell and Gaussian membership functions. Triangular and trapezoidal membership functions provide a good balance between accuracy and efficiency, ensuring real-time performance without excessive computational burden. Furthermore, systematic analyses [57; 58] have proven triangular membership functions provide optimal performance for fuzzy control systems, particularly in induction motor drives and similar applications. Their simplicity and efficiency make them well-suited for applications requiring fast and adaptive response under limited computational resources. The fuzzy logic controller operates with 49 rule bases, derived from a detailed analysis of the dynamic behavior of SG and requirements for PID parameter adjustment, as described in Table 2. Although some previous studies have utilized fewer rules [59; 60], decreasing the number of rules in this study would compromise the adaptability and accuracy of the controller, which are essential for frequency regulation in highly dynamic power systems. By prioritizing efficiency and feasibility within industrial applications, this design ensures the Fuzzy-PID controller remains adaptable and effective under practical constraints while maintaining the computational efficiency suitable for PLC-based environments. Experimental results confirm that the chosen membership functions are sufficient in terms of accuracy and robustness without overloading computational complexity. The fuzzy logic controller operates with 49 rule bases derived from a detailed analysis of the dynamic behavior of SG and PID parameter adjustment, as described in Table 2. These rules are essential for ensuring the performance of the controller across a range of operating conditions. The Mamdani-type inference system was used for fuzzification, and the \"Centroid\" method was applied for defuzzification. This design ensures that the FuzzyPID controller adapts effectively to different system conditions. Figure 15 displays the surface viewer of the fuzzy logic system. The implementation of the fuzzy logic system in MATLAB's Fuzzy Logic Toolbox allowed the dynamic adjustment of PID parameters based on the error and error change, making the controller more adaptable to varying conditions. The 49-rule base, composed of seven membership functions per input, ensures a smooth and precise adaptation, maintaining control system stability. Reducing the number of rules could negatively impact the system's adaptability and performance, especially in high-dynamic applications such as frequency control in stand-alone synchronous generators.