## 2 OPF Problem Formulation
### Constraints  
The OPF optimization problem should satisfy the following constraints:  
_(1) Active and reactive power balances_  
\[\begin{array}{l}P_{Gi}-P_{Di}=\sum\limits_{j=1}^{n}V_{i}V_{j}\big{(}G_{ij} cos\delta_{ij}+B_{ij}sin\delta_{ij}\big{)}\ \ i=1,\ldots,n\\ Q_{Gi}-Q_{Di}=\sum\limits_{j=1}^{n}V_{i}V_{j}\big{(}G_{ij}sin\delta_{ij}-B_{ ij}cos\delta_{ij}\big{)}\ \ i=1,\ldots,n\end{array} \tag{30}\]  
where the number of power system bus is represented by \(n\). \(P_{Gi}\), \(Q_{Gi}\), and \(P_{Di}\), \(Q_{Di}\) are active and reactive power of generators and load, respectively, at the \(i\)th bus.  
_(2) The voltage magnitude of the power plant_  
\[V_{i}^{min}\leq V_{i}\leq V_{i}^{max},\ \ i=1,2,\ldots,n_{G} \tag{31}\]  
where \(V_{i}^{min}\) and \(V_{i}^{max}\) are minimum and maximum limit of \(i\)th bus voltage of power plants \(V_{i}\).  
_(3) Prohibited operating zones_  
There is a risk of machine or accessory failure when a power plant operates outside acceptable ranges, as shown in Equations (32)-(41).  
\[\left\{\begin{array}{l}P_{Gi}^{min}\leq P_{Gi}\leq P_{Gi,1}^{l}\\ P_{Gi,k-1}^{u}\leq P_{Gi}\leq P_{Gi,k}^{l}\\ P_{Gi,z}^{u}\leq P_{Gi}\leq P_{Gi}^{max}\end{array}\right.\ \ k=1,2,\ldots,z \tag{32}\]  
where \(P_{Gi,k}^{l}\) and \(P_{Gi,k}^{u}\) are lower and upper bounds of the \(k\)th POZ of \(i\)th unit. \(P_{Gi}^{min}\) and \(P_{Gi}^{max}\) are active power boundaries of \(i\)th generator.  
_(4) Active and reactive power_  
\[\begin{array}{l}P_{Gi}^{min}\leq P_{Gi}\leq P_{Gi}^{max}\\ Q_{Gi}^{min}\leq Q_{Gi}\leq Q_{Gi}^{max}\end{array}\ \,i=1,2,\ldots,n_{G} \tag{33}\]  
where \(Q_{Gi}^{min}\) and \(Q_{Gi}^{max}\) are boundaries' reactive power of \(i\)th traditional generator.  
_(5) Phase shifter and transformer tap_  
\[PS_{i}^{min}\leq PS_{i}\leq PS_{i}^{max},\ \ i=1,2,\ldots,N_{phase} \tag{34}\]  
\[T_{i}^{min}\leq T_{i}\leq T_{i}^{max},\ i=1,2,\ldots,N_{tap} \tag{35}\]  
\(T_{i}^{min}\) and \(T_{i}^{max}\) are boundaries of \(i\)th tap changer transformer \(T_{i}\), \(PS_{i}^{min}\), and \(PS_{i}^{max}\) are boundaries of \(i\)th phase shifter transformer \(PS_{i}\), and \(N_{tap}\), \(N_{phase}\), are the number of tap changer and installed phase shifter to the network.  
_(6) Shunt compensator_  
\[Q_{c,i}^{min}\leq Q_{c,i}\leq Q_{c,i}^{max}\ \ i=1,2,\ldots,N_{cap} \tag{36}\]  
where \(Q_{c,i}^{min}\) and \(Q_{c,i}^{max}\) are the \(i\)th shunt compensator \(Q_{c,i}\) limits. \(N_{cap}\) represents the number of capacitors linked to the network.  
_(7) Transmission line loading_  
\[|S_{i}|\leq S_{i}^{max}\ \ i=1,2,\ldots,N_{l} \tag{37}\]  
where \(S_{i}^{max}\) is MVA's maximum. \(N_{l}\) is the number of lines.  
_(8) Active power of WE_  
\[0\leq P_{w,i}\leq P_{w,r,i} \tag{38}\]  
Each wind turbine is equipped with a squirrel cage induction generator modeled as PQ buses [44].  
\[P_{w,i}^{2}+Q_{w,i}^{2}+\frac{V_{ww,i}^{2}Q_{w,i}}{X_{i}}=0 \tag{39}\]  
\[\frac{-V_{ww,i}^{2}}{2X_{i}}\leq Q_{w,i}\leq 0 \tag{40}\]  
where \(X_{i}\) is the sum of the leakage reactance of the stator and rotor of the \(i\)th wind turbine. \(V_{ww,i}\) and \(Q_{w,i}\) represents the voltage and the reactive power of the associated bus of the \(i\)th wind generator.  
_(9) Active power of photovoltaic_  
\[0\leq P_{pv,i}\leq P_{pv,r,i} \tag{41}\]