## 2 Electricity-Gas-Heat Integrated Energy System Model
### Constraints
#### 3.4.3 Heat System Constraints  
The heat system mainly includes the constraint of heat source, heat network and heat storage device [12].  
(1) Heat source model  
The main heat sources are CHP units and electric boilers. The relevant constraints of CHP units are shown in Equation (6).  
In the electric-gas-heat integrated energy system, the electric boiler is not only the electric load, but also the heat source. Its thermal output is expressed as follows:  
\[H_{\text{EB},t}\ =\ \eta_{\text{EB}}P_{\text{EB},t} \tag{32}\]  
where \(H_{\text{EB},t}\) is the thermal output of the electric boiler at time \(t\), \(\eta_{\text{EB}}\) is the electrothermal conversion efficiency of electric boiler, which is 0.85.  
(2) Heat network model  
The heat subsystem is shown in Figure 3. The heating temperature \(T_{j}^{ps,in}\) is the inlet water temperature of water supply pipeline A, heating temperature \(T_{j}^{ps,out}\) refers to the outlet water temperature of water supply pipeline A, heat return temperature \(T_{j}^{ps,in}\) is the inlet water temperature of return water pipeline A, the heat return temperature is the water temperature at the exit of the return water pipeline A, \(T_{i}^{ms}\) and \(T_{i}^{mr}\) are the mixing temperatures of water supply pipeline and return water pipeline at node \(i\), respectively, \(w_{ij}^{s}\) and \(w_{ij}^{r}\) are the hot water flow in the water supply pipeline and the return water pipeline, respectively.  
In the heat subsystem, the temperature relationship between hot water in multiple pipes before and after mixing with each other at a certain node can be expressed as:  
\[\left\{\begin{array}{l}\sum\limits_{j\in S_{i}^{-}}(T_{j}^{ps,out}w_{ij}^{s })=&T_{j}^{ms}\sum\limits_{j\in S_{i}^{-}}w_{ij}^{s}\\ \sum\limits_{j\in S_{i}^{+}}(T_{j}^{ps,out}w_{ij}^{r})=&T_{i}^{mr}\sum\limits_ {j\in S_{i}^{+}}w_{ij}^{r}\end{array}\right. \tag{33}\]  
where \(j\in S_{i}^{-}\) is a set of pipes with node \(i\) as the end, \(j\in S_{i}^{+}\) is a collection of pipes starting with node \(i\).  
The temperature of hot water flowing out of node \(i\) is equal to the mixing temperature of the node:  
\[\left\{\begin{array}{l}T_{j}^{ps,in}\ =\ T_{i}^{ms},j\in S_{i}^{+}\\ T_{j}^{pr,in}\ =\ T_{i}^{mr},j\in S_{i}^{-}\end{array}\right. \tag{34}\]  
Residential heating load is the most important heat load of heat subsystem. The expression of thermal load power is as follows:  
\[H_{\text{load},i}\ =\ C_{\text{p}}w_{i}(T_{i}^{ms}-T_{i}^{mr}) \tag{35}\]  
Figure 3: Thermodynamic subsystem model.  
where \(H_{\text{load},i}\) is the thermal load power of node \(i\), \(C_{\text{p}}\) is the specific heat capacity of water, \(w_{i}\) injects water into node \(i\) of load node. \(T_{i}^{\text{ms}}\) is the heating temperature of node \(i\) after mixing, \(T_{i}^{\text{mr}}\) is the heat recovery temperature of node \(i\) after mixing.  
In addition, the hot water flow in the thermal pipe should meet the conservation of flow, that is, the sum of the hot water flow out of each node is equal to the sum of the hot water flow in:  
\[\sum_{j\in i}w_{ij}\;=\;0 \tag{36}\]  
(3) Heat storage device model  
\[\left\{\begin{array}{l}H_{\text{save},t}-H_{\text{save},t-1}\leq H_{\text{ im}}^{\text{max}}\\ H_{\text{save},t-1}-H_{\text{save},t}\leq H_{\text{ex}}^{\text{max}}\\ H_{\text{save},t}\leq H_{\text{save}}^{\text{max}}\end{array}\right. \tag{37}\]  
where \(H_{\text{save},t}\) and \(H_{\text{save},t-1}\) are the heat storage capacity of the heat storage device at time \(t\) and time \(t-1\), respectively, \(H_{\text{in}}^{\text{max}}\) is the maximum heat storage power of the heat storage device, \(H_{\text{ex}}^{\text{max}}\) is the maximum heat discharging power of the heat storage device, \(H_{\text{save}}^{\text{max}}\) is the maximum heat storage capacity of heat storage device.  
(4) Thermodynamic equilibrium  
\[H_{\text{CHP},t}+H_{\text{EB},t}+H_{\text{P2G},t}\;=\;H_{\text{load},t}+H_{ \text{save},t}-H_{\text{save},t-1} \tag{38}\]