## 3 Robust Co-Optimization Considering N-1 Constraints and Active Set Method
### N-1 Contingency Constraints for Generators  
Once a failure occurs on the pre-defined \(n\)-th generator, its output as well as the regulating reserve and spinning reserve will be forced to zero. It leads to  
\[P_{n}=0,A_{n}^{+}=0,A_{n}^{-}=0,R_{n}=0 \tag{20}\]  
Meanwhile, the requirements of the minimum system regulating and spinning reserve must be satisfied, and it yields  
\[\sum_{a=1,a\
eq n}^{N_{g}}A_{a}^{+}\geq D_{A} \tag{21}\]  
\[\sum_{a=1,a\
eq n}^{N_{g}}A_{a}^{-}\geq D_{A} \tag{22}\]  
\[\sum_{i=1,j\
eq n}^{N_{g}}R_{i}\geq D_{R} \tag{23}\]  
If one contingency occurs on the \(n\)-th generator, the cleared spinning reserves of the other normal online generators should be dispatched upwards and the active power output should be increased to compensate the power mismatch. \[\sum_{i=1,j\
eq n}^{N_{g}}R_{i}^{n}=P_{n} \tag{24}\]  
where \(R_{i}^{n}\) represents the spinning reserve that the \(i\)-th generator should actually use to re-dispatch the power generation after the \(n\)-th pre-defined generator outage occurs. However, the reserve should not be larger than the cleared spinning reserve of the \(i\)-th generator. \[0\leq R_{i}^{n}\leq R_{i} \tag{25}\]  
After dispatching the spinning reserve upwards, the constraints of transmission lines must still be satisfied:  
\[-P_{l_{k}\max}\leq P_{l_{k}}^{n}\leq P_{l_{k}\max} \tag{26}\]  
\[P_{l_{k}}^{n}=\sum_{i=1,j\in\Omega_{k}}^{N_{g}}H_{ki}(P_{i}+R_{i}^{n})-\sum_{j =1,j\in\Omega_{k}}^{N_{g}}H_{kj}D_{j}+\sum_{m=-1,m\in\Omega_{m}}^{N_{m}}H_{km} W_{m}^{f}+\sum_{a=1,a\in\Omega_{k}}^{N_{g}}\sum_{m=1,m\in\Omega_{m}}^{N_{m}}(H_{ka} \beta_{a}+H_{km})E_{m} \tag{27}\]  
where \(P_{l_{k}}^{n}\) represents the power flow in the \(k\)-th transmission line in the grid after the outage of the \(n\)-th pre-defined generator. Furthermore, the contingency constraints of both transmission lines and generators are added into the joint robust co-optimization model. However, if all the N-1 contingencies of the generators and transmission lines are added into the optimization model, there will be a large number of variables and constraints in the model and the computational speed will be significantly affected in real-time electricity market. To improve the computational performance, an active set method is employed to add only some vital N-1 contingencies of generators and transmission lines into the model; the other constraints are simply checked any other violated constraints are added into the model. The renewed co-optimization model is then solved and the new dispatch schedule is obtained. Then, a recursive process is conducted until all the constraints are satisfied, which can be found in Figure 1.  
1. The participation factors are introduced to determine the regulating reserve cleared in the AGC units to balance the predicted errors of wind power generation outputs;
2. Through a great deal of power system stability and reliability offline simulation analysis, together with the forecasted wind generation outputs, the market wide requirement and each zonal requirement for regulating reserves and spinning reserves are determined;3. Along with the basic constraints of the traditional economic dispatch model, the energy and zonal reserve joint dispatch model, considering wind power generation uncertainties to minimize the total energy and reserve costs, is established. In addition, the market wide requirement and each zonal requirement for reserves are taken into account in the constraints;
4. In the optimization model, contingencies on both generators and transmission lines are modeled explicitly. Since the N-1 contingencies on transmission lines and generators have different impacts on the re-distribution of the power flow, the modeling of the two elements is done separately. 5. To alleviate the computational burden, the contingency constraints are added into the model sequentially, and then all of contingencies will be examined whether all the N-1 feasibility criteria are satisfied.