Optimizing the active control of the power system and improving the stability of the system in the face of cyber-attacks are necessary to secure the power supply and achieve energy saving and emission reduction. The article proposes an improved granular computing method applied to power system active control, which includes chaotic initialization, dynamic parameter adjustment, and a fast search strategy. And also provides two strategies for defense against FDIA and DDoS attacks. The minimum cost of the IGrC algorithm in 5, 10 and 30 unit systems are 43115.67$, 1017569.51$ and 10170321$, and it has good convergence and robustness. The F1 value of the vertical and horizontal prediction algorithm used is more than 90% in all environments, and the optimal marginal cost of this paper’s algorithm is 44.8357 regardless of whether or not it is facing DDoS attacks. Therefore, the active control optimization method and attack defense strategy proposed in this paper have practical application effects.