## 3 Outer Layer Modeling and Optimization
### Outer Layer Optimization Model  
Based on the developed steady state model of IES, the outer layer optimization model for optimal operation will be provided. For optimizing economic dispatch, the most important evaluation indices are economic [31; 32; 33; 34]. The total fuel cost over a certain time-period of the IES can be regarded as an essential criterion for economic feasibility. \[ \begin{split} mint\sum_{source}Cost_{source},\,source=GEN,CHP,GAS \end{split}  \tag{24}\]  
Figure 4: Schematic diagram of circulating pump. where \(Cost_{GEN}\), \(Cost_{CHP}\), and \(Cost_{GAS}\) denote total fuel cost of thermal generating unit, \(CHP\) unit, and gas source, respectively. Considering the valve-point effect, the fuel cost function of each thermal generating unit is expressed as the sum of a sinusoidal and quadratic function [28; 31; 32; 33; 34]. The total fuel cost in IES over a certain period of time can be expressed as:  
\[Cost_{GEN}=\sum_{i=1}^{N}\sum_{t=1}^{T}\left[a_{i}+b_{i}P_{it}^{gen}+c_{i}(P_{ it}^{gen})^{2}+\left|d_{i}\sin\left\{e_{i}(P_{imin}^{gen}-P_{it}^{gen}) \right\}\right|\right] \tag{25}\]  
where \(P_{it}^{gen}\) represents the output power of thermal unit \(i\) at time \(t\); \(P_{imin}^{gen}\) stands for the lower generation limits for thermal unit \(i\); \(a_{i}\), \(b_{i}\), \(c_{i}\), \(d_{i}\), and \(e_{i}\) are the cost coefficients of thermal unit \(i\); \(T\) represents dispatching cycle; and \(N\) is the number of generating units. Generally speaking, \(CHP\) is known as cogeneration, and it is defined as the use of a single piece of the plant to simultaneously generate electricity and heat. The operating cost of the \(CHP\) plant is presented as follows:  
\[Cost_{CHP}=\sum_{j=1}^{N}\sum_{t=1}^{T}\left[a_{j}+b_{j}P_{jt}^{chp}+c_{j}(P_{ jt}^{chp})^{2}+d_{j}H_{jt}^{chp}+e_{j}(H_{jt}^{chp})^{2}+f_{j}P_{jt}^{chp}H_{jt}^{ chp}\right] \tag{26}\]  
where \(P_{jt}^{chp}\) represents power generation output of \(CHP\) unit \(j\); \(a_{j}\), \(b_{j}\), \(c_{j}\), \(d_{j}\), \(e_{j}\) and \(f_{j}\) are cost coefficients of \(CHP\) unit \(j\); \(H_{jt}^{chp}\) stands for heat generation output of \(CHP\) unit \(j\). In addition, the fuel cost function of the gas source can be expressed as:  
\[Cost_{GAS}=\sum_{k=1}^{N}\sum_{t=1}^{T}\left(a_{k}+b_{k}P_{kt}^{gas}\right) \tag{27}\]  
where \(a_{k}\) and \(b_{k}\) denote the cost coefficients of the gas source unit \(k\); \(P_{kt}^{gas}\) represents the output power of gas source unit \(k\) at time \(t\). The feasible region of the outer layer optimization problem is defined by a number of constraints including different system in IES, which mainly involves limiting the variables related to network nodes and lines. As for the electricity transmission system in the IES, the equality constraints contain the AC power flow equations, as shown in Equation (17). Inequality constraints are the active power flows through power lines, node voltage amplitudes, and the active and reactive power outputs of generators [3; 25], which are generally well-known and omitted here owing to the space limit. Furthermore, for the natural gas system in the IES, the natural gas transmission process is also subject to several constraints [3; 12; 19], such as pipeline volume flow limit, the compression ratio limit of each compression station, and nodal gas pressure; the constraints are formulated as:  
\[m_{g}^{min}\leq m_{g}\leq m_{g}^{max} \tag{28}\]  
\[K_{com}^{min}\leq K_{com}\leq K_{com}^{max} \tag{29}\]  
\[P_{n}^{min}\leq P_{n}\leq P_{n}^{max} \tag{30}\]  
In addition, there are also several constraints for the district heating system in the IES [3; 12; 25]. The mass flow rate under actual operation within each pipeline is limited and cannot exceed the design values. The heating water outlet temperature \(T_{out,s}\) from the heat source should meet engineering application requirements, and the same is true for the thermal load outlet's temperature constraints.