## Inner Layer Modeling and Optimization
### Inner Layer Optimization Model
#### 2.2.2 Equipment Capacity and Climbing Rate Constraints  
Firstly, the actual wind power consumed by EH cannot exceed the maximum output of the wind farm at time \(t\) under the optimized operation mode:  
\[P_{act}^{t}\leq P_{wind}^{t} \tag{10}\]  
where \(P_{act}^{t}\) represents actual wind power consumed by EH at time \(t\). In addition, the battery storage energy level should be within a given range and meet the constraint (SOC), which is described as:  
\[W_{bat}^{min}\leq W_{bat}(t)\leq W_{bat}^{max} \tag{11}\]  
where \(W_{bat}^{min}\) and \(W_{bat}^{max}\) are the minimum and maximum limits of the battery storage energy level \(W_{bat}(t)\) at time \(t\), respectively. The ramp rate constraints of charging/discharging the battery are given by:  
\[\left\{ \begin{array}{l}0=P_{cha}^{down}\Delta t\leq P_{bat}^{cha}(t+1)-P_{ bat}^{cha}(t)\leq P_{cha}^{up}\Delta t=W_{bat}^{cap}\tau_{bat}^{cha}\Delta t\\ 0=P_{dis}^{down}\Delta t\leq P_{bat}^{dis}(t-1)-P_{bat}^{dis}(t)\leq P_{dis}^{ up}\Delta t=W_{bat}^{cap}\tau_{bat}^{dis}\Delta t\end{array} \right. \tag{12}\]  
where \(\gamma_{bat}^{cha}\) and \(\gamma_{bat}^{dis}\) are ratios determining maximum and minimum levels of battery energy storage, respectively; \(W_{bat}^{cap}\) denotes battery capacity; \(W_{bat}^{min}\) and \(W_{bat}^{max}\) represent the lower and upper bounds of \(W_{bat}(t)\), respectively. Furthermore, generally speaking, when the natural gas fuel of the _CHP_ generation system is given, the heat power output is a definite value, and the power generation output of the gas turbine is determined by the heat power output. The heat power output and the amount of natural gas are limited as:  
\[H_{CHP}^{c_{m},min}\leq H_{CHP}^{c_{m}}\leq H_{CHP}^{c_{m},max} \tag{13}\]  
\[H_{CHP}^{c_{2},min}\leq H_{CHP}^{c_{2}}\leq H_{CHP}^{c_{2},max} \tag{14}\]  
where \(H_{CHP}^{c_{m},min}\) and \(H_{CHP}^{c_{m},max}\) denote the minimum and maximum of the heat power output from _CHP_ unit whose heat-to-power ratio is a constant; \(H_{CHP}^{c_{2},min}\) and \(H_{CHP}^{c_{2},max}\) are the upper and lower limits of the heat power output from alterable heat-to-power ratio _CHP_ unit, respectively. As _P2G_ uses electricity and produces gas, it will have an interactive impact on both the electrical and gas networks that it is connected to. _P2H_ and _P2G_ have similar working principles. The operation constraints of _P2G_/_P2H_ can be expressed as:  
\[P_{P2H}^{min}\leq P_{P2H}\leq P_{P2H}^{max} \tag{15}\]  
\[P_{P2G}^{min}\leq P_{P2G}\leq P_{P2G}^{max} \tag{16}\]  
where \(P_{P2H}^{min}\) and \(P_{P2H}^{max}\) denote the minimum and maximum of _P2H_ consumed electricity, respectively; \(P_{P2G}^{min}\) and \(P_{P2G}^{max}\) stand for the upper and lower limits of _P2G_ consumed electricity, respectively. It is to be noted that in the above model the interaction between electric power and heat energy is based on the operation of the _P2H_ unit (which is a ground source heat pump) and the _CHP_ unit, while the interaction between the electric power and gas is coupled through both _P2G_ and _CHP_ units, and that gas and heat interact together via furnace/boiler and _CHP_ units in an EH. The coordinated optimal operation of electricity, heat, and gas is fully taken into account in order to meet the practical engineering application scenario. **Remark 1**. : _It is worth pointing out that if the proposed day-ahead steady state operating cost of EH is minimized by Equation (8), then the natural gas power, thermal power, and electrical power delivered from the natural gas system, district heating system, and electricity transmission system are set as EH's inputs. A variety of energy demands for different terminal users can be satisfied at the same time with the minimum cost by inner layer optimization model, so as to maximize the benefits of all types of energy users. Through the inner layer optimization, the optimized multi-energy flow data (i.e., EH's inputs) are obtained based on the day-ahead forecast for all kinds of energy demands.