## 2 Distribution Network Flexibility Resources and Flexibility Evaluation Indicators
### Two-Layer Planning Model of SOP and ESS
#### 3.2.2 Lower Layer Planning Model  
The lower-layer model is employed to identify the optimal operational strategy for ADN under the specified scenario. The objective is to achieve the highest daily average flexibility level, with the objective function \(F_{down}\) set as the optimal sum of the daily average flexibility of the distribution system after the assignment, where the flexibility is reflected by the DG volatility and DG consumption rate. The assignment is based on the coefficient of variation, which ensures objectivity.  
In accordance with two ADN flexibility evaluation indices introduced in Section 2.3, it can be posited that a higher value of DG consumption rate is indicative of a stronger regulation ability of flexibility resources, a stronger ability to cope with uncertain changes in flexibility demand, and a superior overall flexibility of ADN. Conversely, a lower value of DG volatility is indicative of a superior ability to adapt to uncertainty in flexibility demand. The two indicators are mutually influential, mutually coupled, and mutually acting, and thus the system's flexibility is determined jointly by the two indicators.  
\[F_{down}=w_{xn}H_{xn}-w_{bd}H_{bd} \tag{28}\]  
where \(w_{xn}\) and \(w_{bd}\) are the weights of DG consumption rate and DG volatility.  
In addition, the lower layer needs to satisfy the DG operation constraints, the system trend constraints, and the operation safety constraints besides the operation constraints of SOP and ESS.  
1. DG operating constraints \[0\leq P_{s,t,i}^{NDG}\leq P_{s,t,i}^{NDG,pre}\] (29) \[Q_{i}^{NDG,\min}\leq Q_{s,t,i}^{NDG}\leq Q_{i}^{NDG,\max}\] (30) \[\sqrt{\left(P_{s,t,i}^{NDG}\right)^{2}+\left(Q_{s,t,i}^{NDG} \right)^{2}}\leq S_{i}^{NDG}\] (31)  
where \(P_{s,t,i}^{NDG}\), \(P_{s,t,i}^{NDG,pre}\), and \(Q_{s,t,i}^{NDG}\), \(Q_{i}^{NDG,\max}\), and \(Q_{i}^{NDG,\min}\) are the active power and its predicted value and the reactive power and its maximum and minimum value of DG; \(S_{i}^{NDG}\) is the capacity of DG.
2. System tidal current constraints \[\sum_{ik\in\Omega_{\rm b}}P_{s,t,ik}=\sum_{ji\in\Omega_{\rm b}}\left(P_{s,t,ii} -r_{ji}I_{s,t,ji}^{2}\right)+P_{s,t,i}\] (32) \[\sum_{ik\in\Omega_{\rm b}}Q_{s,t,ik}=\sum_{ji\in\Omega_{\rm b}} \left(Q_{s,t,ji}-x_{ji}I_{s,t,ji}^{2}\right)+Q_{s,t,i}\] (33) \[P_{s,t,i}=P_{s,t,i}^{NDG}+P_{s,t,i}^{SOP}+P_{s,t,i}^{ESS}-P_{s, t,i}^{LOAD}\] (34) \[Q_{s,t,i}=Q_{s,t,i}^{NDG}+Q_{s,t,i}^{SOP}+Q_{s,t,i}^{ESS}-Q_{s, t,i}^{LOAD}\] (35) \[U_{s,t,j}^{2}=U_{s,t,i}^{2}-2\left(r_{ij}P_{s,t,ij}+x_{ij}Q_{s,t, ij}\right)+\left(r_{ij}^{2}+x_{ij}^{2}\right)I_{s,t,ij}^{2}\] (36) \[P_{s,t,ij}^{2}+Q_{s,t,ij}^{2}=U_{s,t,i}^{2}I_{s,t,ij}^{2}\] (37)  
where \(P_{s,t,ji}\) and \(Q_{s,t,ji}\) are the active and reactive power transmitted by branch _ii_; \(P_{s,t,i}\) and \(Q_{s,t,i}\) are the active and reactive power of node; \(P_{s,t,i}^{LOAD}\) and \(Q_{s,t,i}^{LOAD}\) are the active and reactive power consumed by the load; \(U_{s,t,i}\) is the voltage of node \(i\); \(I_{s,t,ji}\) is the current flowing in branch _ij_.  
(3) Operational safety constraints  
\[P_{s,t,ij}^{2}+Q_{s,t,ij}^{2}=U_{s,t,i}^{2}I_{s,t,ij}^{2} \tag{38}\]  
\[P_{s,t,ij}^{2}+Q_{s,t,ij}^{2}=U_{s,t,i}^{2}I_{s,t,ij}^{2} \tag{39}\]  
where \(U_{i}^{\text{min}}\) and \(U_{i}^{\text{max}}\) are the lower and upper limits values of node voltage; \(I_{ij}^{\text{max}}\) is the maximum value of line current.