## 3 Mathematical and Problem Formulations
### Objective Function Formulation  
The current study presents a multi-objective optimization model that involves conflicting objectives and does not have a unique solution. The goal is to achieve safe and optimal coordinated control of UPFCs and PSSs while satisfying constraints, which requires determining various pieces of information, such as unit commitment, controllable generation unit capacities, and power exchange with power tie lines for each hour of a day in advance. The ultimate objective is to achieve optimal and safe operation in response to a cyber-attack, considering all technical parameters of the network. To achieve this, this study uses modified mixed-nonlinear programming based on a Harris hawk formulation. The planning problem is formulated with a multi-objective function according to Equation (11). \[\min\{F_{i}(K_{i}^{\text{UPFC}},K_{i},T_{i}^{\text{PSS}})\} \tag{11}\]  
The equation above shows that the objective functions in the problem are represented by F and depend on the independent coefficient factors of controllers in the shunt, series UPFC, and PSSs. This means that the desired objective functions for this problem can be formulated based on following objectives. The main objective of this research is to reduce the power system oscillations that may occur due to disturbances caused by a transient cyber-attack. The oscillation of the system can be observed by analyzing the deviation in the rotor-angle speed of the generators. Therefore, the primary aim of this study can be stated as follows:  
\[F_{1}(\{K_{i}\}_{\text{UPFC}},\{K_{i},T_{i}\}_{\text{PSS}})=\int_{t=0}^{t=t_{ \text{sim}}}\left(\sum_{i}|\Delta\omega_{i}^{L}|+\sum_{i}|\Delta\omega_{i}^{I} |\right)\cdot t\,dt \tag{12}\]  
where \(t_{sim}\) is the simulation time range, \(\triangle\omega_{i}^{L}\) is the local speed deviation of each generator, and \(\triangle\omega_{i}^{I}\) it the interarea speed deviation. The power system is simulated in the time domain for a specific duration, and the objective function is calculated based on the simulation results. The PSS and UPFC controllers are restricted within a specified range. As a result, an optimization problem is formulated using the following design approach. \[\min\{F_{i}(K_{i}^{\text{UPFC}},K_{i},T_{i}^{\text{PSS}})\}\]  
subjected to:  
\[K_{i}^{\min}\leq K_{i}\leq K_{i}^{\max}\]  
\[T_{i}^{\min}\leq T_{i}\leq T_{i}^{\max} \tag{13}\]  
The range of the gain for the controllers (PSS and damping controller) is limited by \(K_{i}^{min}\) and \(K_{i}^{max}\), which represent the lower and upper bounds, respectively. Similarly, \(T_{i}^{min}\) and \(T_{i}^{max}\) represent the lower and upper bounds for the time constants of the controllers (PSS and UPFC). Another crucial technical objective of the overall objective function is to ensure that the voltage remains within the acceptable range when responding to a physical cyber-attack on the power system. As a result, the voltage deviation factor can be computed at each simulation step as an additional objective [33]. Figure 7: Structure diagram of the PSS controller. \[F_{2}(\{K_{i}\}_{\text{UPFC}},\{K_{i},T_{i}\}_{\text{PSS}})=VD=\sqrt{\sum_{i=1}^{N _{b}}\left(\frac{V_{\text{std}}}{V_{\text{Base}}}-\frac{V_{i}}{V_{\text{Base}}} \right)^{2}} \tag{14}\]  
The equation below can also be used to attain the economic objective of the total objective function, which is the total generation cost of the system [33]. \[F_{3}(\{K_{i}\}_{\text{UPFC}},\{K_{i},T_{i}\}_{\text{PSS}})=C_{\text{Gen}}=\sum _{i=1}^{N}C_{\text{Gen},i,t}^{\text{OP}}+\sum_{i=1}^{N}C_{\text{Gen},i,t}^{\text {EMI}} \tag{15}\]  
where \(C_{\text{Gen},i,t}^{\text{OP}}\) represents the generation cost of each power plant unit, and \(C_{\text{Gen},i,t}^{\text{EMI}}\) is the cost associated with the pollution of the units in each time interval (\(t\)) which can be defined as follows:  
\[C_{\text{Gen},i,t}^{\text{OP}}=\left\{ \begin{array}{l}aP_{\text{Gen}}^{2}+bP _{\text{Gen}}+\text{cif}\ 0<P_{\text{Gen}}<P_{\text{Gen}}^{\text{rated}}\\ 0\ \text{if}\ P_{\text{Gen}}=0\end{array}