## 4 Examples and Analysis
### Upper Level Programming Model and Lower Level Programming Model  
The upper-level programming model considers DG layout and installation capacity planning. The objective function is to minimize the annual life cycle investment cost:  
\[minC_{1}=C_{I}+C_{OM}+C_{P}+C_{AM}+C_{L} \tag{16}\]  
Figure 16: Photovoltaic curve after scene reduction in autumn. Figure 17: Photovoltaic curve after scene reduction in winter. Figure 15: Photovoltaic curve after scene reduction in summer. The specific expressions of each cost are as follows:  
(1) DG Equivalent Investment Annual Cost  
\[C_{I}=(\sum_{i=1}^{N_{bus}}C_{WTG,i}S_{WTG,i}+\sum_{i=1}^{N_{bus}}C_{PVG,i}S_{ PVG,i})\frac{r(1+r)^{y}}{(1+r)^{y}-1} \tag{17}\]  
where \(N_{bus}\) is the number of nodes in the distribution network, \(r\) is the discount rate, \(y\) is the life span of DG for 20 years, \(C_{WTG,i}\) and \(C_{PVG,i}\) are fixed investment costs of unit capacity of wind power and PV installed at the \(i\) node respectively, \(S_{WTG,i}\) and \(S_{PVG,i}\) are the rated capacity of wind power and PV installed at the \(i\) node respectively. (2) DG annual operation and maintenance costs  
\[C_{OM}=\sum_{n=1}^{12}p_{n}\times 365(\sum_{t=1}^{24}(\sum_{i=1}^{N_{bus}}C_{ WTG,i}E_{WTG,in}(t)+\sum_{i=1}^{N_{bus}}C_{PVG,i}E_{PVG,in}(t))) \tag{18}\]  
where \(P_{n}\) is the scenario probability of the \(n\) scenario, \(C_{WTG,i}\) and \(C_{PVG,i}\) are the operation and maintenance costs of the wind power and the photovoltaic unit electricity received by the \(i\) node, \(E_{WTG,in}(t)\) and \(E_{PVG,in}(t)\) are the wind power received by the \(i\) node and the photovoltaic unit electricity generated during the \(t\) period of the \(n\) typical day, respectively. (3) Annual Electricity Purchase Cost  
\[C_{P}=\sum_{n=1}^{12}P_{n}\times 365(\sum_{t=1}^{24}E_{nt}P_{t}) \tag{19}\]  
where \(E_{nt}\) is the \(t\) time of \(n\) typical days to buy electricity from a higher power grid. \(P_{t}\) is the unit cost of operators purchasing electricity from a higher power grid. (4) DG annual active management cost  
\[C_{AM}=\sum_{n=1}^{12}p_{n}\times 365(\sum_{t=1}^{24}(\sum_{i=1}^{N_{bus}}C_{ AWTG,i}E_{WTG,in}(t)+\sum_{i=1}^{N_{bus}}C_{APVG,i}E_{PVG,in}(t))) \tag{20}\]  
where \(C_{AWTG,i}\) and \(C_{APVG,i}\) are the active management costs of the wind power and the photovoltaic at the \(i\) node respectively. (5) Network Loss Cost  
\[C_{L}=\sum_{n=1}^{12}P_{n}\times 365(\sum_{t=1}^{24}Q_{ntL}P_{ntL}) \tag{21}\]  
where \(Q_{ntL}\) is the net loss of the \(n\) typical day \(t\) period, \(P_{ntL}\) is the unit network loss cost. The constraints are:  
(1) DG Installation Capacity Limitation  
\[ \begin{split} 0\leq R_{WTGi}\leq R_{WTTGmax}\\ 0\leq R_{PVG}\leq R_{PVGmax}\end{split}  \tag{22}\]  
where \(R_{WTTGi}\) and \(R_{PVGi}\) are the wind capacity and PV capacity node i respectively. \(R_{WTGmax}\) and \(R_{PVGmax}\) correspond to the maximum access capacity of DG, respectively. (2) Capacity Limitation of DG Total Installation  
\[\sum\limits_{i=1}^{N_{WTG}}R_{WTGi}+\sum\limits_{i=1}^{N_{PVG}}R_{PVG}\leq R_{ DGmax} \tag{23}\]  
where \(R_{DGmax}\) is the maximum installed capacity. The determination of maximum access capacity needs to consider different adjustment strategies. (3) Constraints of Comprehensive Safety Indicators  
\[C_{csi}=\frac{1}{2}(\frac{1}{NTS}\sum\limits_{n=1}^{N}\sum\limits_{t=1}^{T} \sum\limits_{s=1}^{S}C_{n,t,s}+min\{C_{n,t,s}\}) \tag{24}\]  
where \(C_{n,t,s}\) is the index of safe power supply rate of branch \(s\) of the \(n\) scenario at \(t\) period. \[C_{n,t,s}=1-\frac{\sum\
olimits_{t=1}^{t_{T}}\sum\
olimits_{y\in\varphi_{ntf}} \gamma_{y}S_{n,t,y}\Delta T_{n,t,y}}{\sum\
olimits_{t=1}^{t_{T}}\sum\
olimits_ {i\in\varphi_{ntf}}\gamma_{y}S_{n,t,y}\Delta T_{n,t}} \tag{25}\]  
where \(t_{T}\) is the period of system failure elimination. \(\varphi_{ntf}\) is the \(n\) scenario of \(t\) period outage load set. \(\gamma_{y}\) is the grade factor of Class \(y\) load. \(S_{n,t,y}\) is the Capacity of Class \(y\) Load.