## 4 Optimal Operation Model of the RIES System
### Constraint Conditions  
The RIES set up in this paper includes cold energy flow, thermal energy flow, electric energy flow, and gas energy flow, all of which need to meet energy constraints.  
The cold energy flow constraint is shown as,  
\[P_{\text{AC,o}}(t)+P_{\text{EC,o}}(t)=P_{\text{L,t}}^{\text{c0}}+\Delta_{\text{TL, m}}^{t,c}, \tag{27}\]  
where \(P_{\text{L,t}}^{\text{c0}}\) is the cooling load before DR; \(\Delta_{\text{TL,m}}^{t,c}\) is cold load variation between 0 and 220.  
The heat energy flow constraint can be expressed as:  
\[Q_{\text{GB}}(t)+P_{\text{GT,t}}^{h}+Q(t)_{\text{MHB}}+Q(t)_{\text{EB}}+Q_{ \text{HIS,t}}^{h,\text{dis}}-Q_{\text{HIS,t}}^{h,\text{ch}}-P_{\text{AC,in}}=Q_{ \text{L,t}}^{\text{h0}}+\Delta P_{\text{SL,m}}^{t,h}, \tag{28}\]  
where \(Q_{\text{L,t}}^{\text{h0}}\) is the heating load before DR; \(\Delta P_{\text{SL,m}}^{t,h}\) is heat load variation between 0 and 160.  
The electrical energy flow constraint can be given as:  
\[P_{\text{PV,t}}^{\text{e}}+P_{\text{WT,t}}^{\text{e}}+P_{\text{GT,t}}^{\text{ e}}+P_{\text{net,t}}^{\text{e}}+P_{\text{BAT,t}}^{\text{e,dis}}-P_{\text{BAT,t}}^{ \text{e,ch}}-P_{\text{EC,t}}^{\text{e}}-P_{\text{EV,t}}^{\text{e}}-P_{\text{ EB,t}}^{\text{e}}=P_{\text{L,t}}^{\text{e0}}+\Delta P_{\text{SL,m}}^{t,\text{e}}, \tag{29}\]  
where \(P_{\text{L,t}}^{\text{e0}}\) denotes the electrical load before DR; \(\Delta P_{\text{SL,m}}^{t,\text{e}}\) is the electrical load variation between 0 and 150.  
The gas energy flow constraint can be described as:  
\[P_{\text{g,t}}^{\text{net}}-V_{GT}(t)-P_{\text{GB}}^{\text{gas}}=P_{\text{L,t }}^{\text{g0}}+\Delta P_{\text{TL,m}}^{t,\text{g}}, \tag{30}\]  
where \(P_{\text{L,t}}^{\text{g0}}\) represents the air load before DR; \(\Delta P_{\text{TL,m}}^{t,\text{g}}\) is the gas load variation between 0 and 30.  
The constraints of the energy storage device are as follows: the energy storage device includes a battery (BAT) and a heat storage device (HS). The charge level of the energy storage device is related to its operating state [31]. The charge level of the device [32] is shown as:  
\[\left\{\begin{array}{l}SOC_{\text{N,}t+1}=SOC_{\text{n,}t}+\Delta SOC_{ \text{n,}t}\\ \Delta SOC_{\text{n,}t}=(1-\mu_{n,\text{sta}})(\mu_{n,\text{ch}}\eta_{n,\text{ ch}}+\frac{\mu_{n,\text{dis}}}{\eta_{n,\text{dis}}})\frac{P_{n,\text{M}}}{Q_{\text{a}}} \\ \mu_{n,\text{ch}}+\mu_{n,\text{dis}}+\mu_{n,\text{sta}}=1\end{array}\right., \tag{31}\]  
where \(SOC\) represents the charge level; \(P_{n,\text{M}}\) is the power of the energy storage device; \(\mu_{n,\text{sta}}\) denotes the static state variable of the device; \(\mu_{n,\text{ch}}\) and \(\mu_{n,\text{dis}}\) severally stands for the charging and discharging of the equipment.  
The changed electric energy transfer constraint can be illustrated as [33]:  
\[\left\{\begin{array}{l}\Delta q_{\text{P}}+\Delta q_{\text{N}}+\Delta q_{ \text{L}}=0\\ -\Delta D_{\text{P}}\leq\Delta q_{\text{P}}\leq\lambda D_{\text{P}}\\ -\lambda D_{\text{N}}\leq\Delta q_{\text{N}}\leq\lambda D_{\text{N}}\\ -\lambda D_{\text{L}}\leq\Delta q_{\text{L}}\leq\lambda D_{\text{L}}\\ -\beta\leq\Delta q_{t}\leq\beta\end{array}\right., \tag{32}\]  
where \(\lambda\) is 0.2, representing the total power transfer limit; \(\beta\) is the changed electric energy limit in time \(t\), and the value is 150; \(\Delta q_{\text{P}}\), \(\Delta q_{\text{N}}\), \(\Delta q_{\text{L}}\) are the totally changed loads of the original peak period, normal period, and low period, respectively; \(D_{\text{P}}\), \(D_{\text{N}}\), \(D_{\text{L}}\) are the total loads of the original peak period, normal period, and low period, respectively; \(\Delta q_{t}\) is the amount of electrical load changing in the \(t\) period.