# Flexibility Based Day-Ahead Generation-Reserve Bilevel Decision Model
## 3 Flexibility Based Reserve Decision Method
### Flexibility Based Reserve Capacity Calculation  
The system ramping, which refers to the power fluctuation between adjacent time, is the algebraic sum of load change, conventional unit ramping caused by forced outage and wind power ramping so the UGF model for system ramping is:  
\[\begin{array}{ll}u_{\rm R}(z,t)&=u_{\rm D}(z,t)\otimes_{-}u_{\rm G}(z,t) \otimes_{-}u_{\rm W}(z,t)\\ &=\sum\limits_{k=1}^{S_{\rm D}}p_{k}^{\rm dr}\cdot z^{R_{k}^{\rm G}}\otimes_{- }\sum\limits_{j=1}^{S_{\rm W}}p_{j}^{\rm W}\cdot z^{R_{j}^{\rm W}}\otimes_{- }\sum\limits_{i=1}^{S_{\rm G}}p_{i}^{\rm G}\cdot z^{R_{i}^{\rm G}}\\ &=\sum\limits_{k=1}^{S_{\rm eq}}p_{k}^{\rm eq}(t)\cdot z^{\rm R_{k}^{\rm eq}(t) }\end{array} \tag{27}\]  
where \(S_{\rm eq}\) is the total number of ramping states of the equivalent system, \(R_{k}^{\rm eq}(t)\) is the system ramping power at state \(k\), and \(p_{k}^{\rm eq}(t)\) is the corresponding probability. In this way, the probability distribution function \(F_{t}^{\rm eq}(\cdot)\) of the system ramping at time \(t\) is obtained.  
Loss of flexibility probability means the probability that the system ramp more than the operating reserve. It is an intuitive index of system flexibility. The up and down operating reserves are \(R^{\rm U}(t)\) and \(R^{\rm D}(t)\), respectively. For ramping state \(k\), if \(R_{k}^{\rm eq}(t)>R^{\rm U}(t)\), the system cannot provide sufficient generation power in transition from time \(t\) to \(t+1\), causing loss of load; if \(R_{k}^{\rm eq}(t)<-R^{\rm D}(t)\), it cannot lower output in transition from time \(t\) to \(t+1\), resulting in wind power curtailment. Therefore, the system LOFP can be defined as:  
\[LOFP(t)=\sum\limits_{R_{i}^{\rm eq}(t)>R^{\rm U}(t)}p_{i}^{\rm eq}(t)+\sum \limits_{R_{j}^{\rm eq}(t)<-R^{\rm D}(t)}p_{j}^{\rm eq}(t) \tag{28}\]  
The relationship between LOFP and operating reserve is shown in Figure 1.  
The quantified relationship between the system operating reserve and LOFP is established in definition (28) but this definition cannot be calculated directly. The explicit form of \(f_{\rm R}(\alpha,t)\) still needs  
Figure 1: The relationship between the loss of flexibility probability (LOFP) and operating reserve.  
further derivation. As the probability distribution function \(F_{t}^{\text{eq}}(\cdot)\) of the system ramping at time \(t\) obtained in \(u\)-function (27), \(R^{\text{U}}(t)\) and \(R^{\text{D}}(t)\) can be calculated by the inverse function of \(F_{t}^{\text{eq}}(\cdot)\). When the LOFP is set as \(\alpha\), the \(f_{R}(\alpha,t)\) can be expressed as:  
\[R^{\text{U}}(t)=G_{t}^{\text{eq}}(1-\alpha/2) \tag{29a}\] \[R^{\text{D}}(t)=G_{t}^{\text{eq}}(\alpha/2) \tag{29b}\]  
where \(G_{t}^{\text{eq}}(\cdot)\) refers to the inverse function of \(F_{t}^{\text{eq}}(\cdot)\).  
Just like reliability, the power system needs to keep the LOFP lower than a certain value. According to this flexibility requirement, the total system operating reserve can be calculated through the formula (29). If the reserve obtained in the lower level is greater than the maximal reserve capacity that can be provided by the UC scheme, then the solution of the upper level is not feasible. Therefore, the feedback mechanism between the upper and lower levels is necessary. If the obtained reserve is greater than the reserve capacity that can be provided by the UC scheme, then the flexibility constraint (12) in the UC model of upper level is to be modified, then re-solve the whole model; or otherwise, output the results.  
Meanwhile, it has to be noted that there is no coupling relationship among the time period in the reserve decision models so this model can conduct parallel calculation over a different time period. Moreover, the calculation of the universal generating function features recursiveness, so it significantly improves the efficiency and is extremely applicable to large-scale computer analysis.  
The flowchart of proposed model is as shown in Figure 2.  
Figure 2: Flowchart of flexibility based day-ahead generation–reserve bilevel decision model.