In this paper, a student psychology-based optimization algorithm (SPBOA)-based proportional-integral-derivative (PID) controller is implemented for load frequency control (LFC) of an isolated hybrid power system (IHPS) and a grid-connected HPS (GHPS) models. In the designed models, a combined-cycle gas turbine, a diesel engine generator, a wind turbine generator and a solar photovoltaic generating unit are used as the main power generating units. A superconducting magnetic energy storage is used with IHPS model to improve the dynamic stability of the studied system. A single area power system is connected with IHPS model through a tie-line to form a GHPS. In the GHPS, a thyristor-controlled series controller and a unified power flow controller are associated with the tie-line power flow control. In this work, electric vehicle is also connected as a load to both the IHPS and GHPS models. The output profile of the proposed SPBOA-based PID controller of both models is compared with whale optimization algorithm (WOA) and quasi-oppositional-based WOA (QOWOA). The performance of IHPS and GHPS models are studied under the different load perturbations. The robustness analysis and frequency domain analysis in terms of Bode plot are also shown in favor of the SPBOA method.