## 3 Optimization Procedure by PDG
### Constraint Conditions  
In the pipe network design of the district energy system, the diameters of the pipe are not consistent, and this determines multiple factors, such as volume rate of flow and velocity of flow. These factors follow Equation (13):  
\[Q_{i}\leq\frac{1}{4}\pi d_{i}^{re2}\overline{v}_{i}, \tag{13}\]  
where \(Q_{i}\) represents the design flow of the calculation area; \(d_{i}^{re}\) represents the calculated reference diameter; \(\overline{v}_{i}\) represents the velocity of the thermal media. In practical engineering construction, the pipe diameter of thermal network is not a continuous variable, but rather a discrete variable with a nominal value. According to the relevant engineering estimation indexes, the selection of pipe diameter should be performed with reference to Equation (14):  
\[d_{i}^{st}\leq d_{i}^{re}\leq d_{i}=d_{i}^{st+1}, \tag{14}\]  
where \(d_{i}^{st}\) and \(d_{i}^{st+1}\) represent two adjacent standard pipe diameters in the engineering standard, and \(d_{i}\) is the final selected pipe diameter of the pipe network design. The weight \(w\) (\(u,v\)) of the edge (\(u,v\)) in the connected graph G is the distance between points \(u\) and \(v\). Therefore, the optimization goal of the minimum spanning tree method is the minimum pipe length, Equation (15):  
\[\text{MIN}\sum w(u,\ v)=\text{MIN}\sum l_{i}, \tag{15}\]  
However, in the actual project, the design optimization goal is the minimum cost, Equation (16):  
\[\text{MIN}\ D, \tag{16}\]  
It can be seen from Section 2.2 that \(D\) is not only affected by pipe length \(l_{i}\), but also pipe diameter \(d_{i}\), as per Equation (17):  
\[D=f(l_{i},d_{i})=\left(u_{1}^{P}+u_{2}^{P}+\frac{r(1+r)^{L}}{(1+r)^{L}-1} \right)\times\sum_{i=1}^{n}\text{C}(d_{i})l_{i}+\sum_{i=1}^{n}\frac{4\pi \lambda t_{i}l_{i}T_{i}C_{e}}{ln\frac{d_{i}+2l_{i}+k_{i}}{d_{i}+2l_{i}}\times COP \times 10^{7}}+\sum_{i=1}^{n}1.8\times 10^{-8}\frac{Q_{i}l_{i}T_{i}C_{e}\overline{v}^{2}}{d_ {i}l_{P}}\Big{(}\frac{K}{d_{i}}\Big{)}^{0.25}, \tag{17}\]  
This is not a simple numerical optimization question, because the topology of the pipe network and pipe dimensions must be considered at the same time. The design optimization should be applied in a multidisciplinary manner. Combined with the method in this paper, the minimum spanning tree, the weight \(w(u,v)\) of edge in connected graph G should be determined by distance \(l_{i}\) correction for the cost \(D_{i}\), the optimization goal should be determined by \(\text{MIN}\sum l_{i}\) correction for \(\text{MIN}\sum D_{i}\). To achieve this goal, the pipe DiameterGrading theory (PDG) is proposed. Two fundamental assumptions in the PDG theory are: (A) Network topology diagram is a nonlinear hierarchical tree structure. (B) In this structure, the root node is the location of the energy station, and there is no precursor node. (C) All leaf nodes are load point positions, and are the last terminal, with no subsequent nodes. Each of the remaining nodes can be followed by one or more nodes. The schematic diagram of PDG is shown in Figure 10. The \(D_{i}\) of any pipe segment can be expressed as Equation (18):  
\[D_{i}=\left(\mu_{1}^{P}+\mu_{2}^{P}+\frac{r(1+r)^{L}}{(1+r)^{L}-1}\right) \times C(d_{i})l_{i}+\frac{4\pi\lambda t_{L}l_{T}P_{C}e}{ln\frac{d_{i}+2\beta+i \delta_{il}}{d_{i}+2\lambda_{i}}\times COP\times 10^{7}}+1.8\times 10^{-8}\frac{Q_{i}l_{ i}T_{p}C_{e}\psi^{2}}{d_{i}\eta_{P}}\left(\frac{K}{d_{i}}\right)^{0.25}, \tag{18}\]  
Pipe Diameter Grading means that different pipelines are graded according to their position relative to energy stations and load points.