# Energy Bus-Based Matrix Modeling and Optimal Scheduling for Integrated Energy Systems
## 4 Optimal Scheduling of IES
### Day-ahead Optimization  
In day-ahead scheduling, we expect that the total daily cost can be minimized by optimizing the hourly set points of the devices. The day-ahead optimization interval \(T_{\text{d}}\) is \(1\,\text{h}\). Considering the stochastic fluctuations in the RESs and the users' demands, the objective function is defined as  
\[\text{min}\;COST=E\left[\sum_{t=1}^{24}\mathbf{p}(t)^{\text{T}}\mathbf{e}_{\text{grid}}(t )\right] \tag{31}\]  
where \(t\) (\(t\in[1,24]\)) denotes the \(t\)-th hour of a day, and \(\mathbf{p}(t)\) is the price vector of the energy purchased from the gas and power grids in period \(t\). It is expressed as  
\[\mathbf{p}(t)=\left[p_{\text{G}}(t)\quad p_{\text{E}}(t)\quad 0\quad 0\right]^{ \text{T}} \tag{32}\]  
where \(p_{\text{G}}(t)\) and \(p_{\text{E}}(t)\) are the prices of gas and electricity in period \(t\), respectively.  
The day-ahead optimization must satisfy the balance constraint of the energy flow expressed in (14). Each energy converter or storage unit must run within its capacity; therefore, each decision variable \(\alpha_{i}(t)\) must meet the following constraint:  
\[0\leq\alpha_{i}(t)\leq\alpha_{i,\text{rc}} \tag{33}\]  
Figure 7: The schematic diagram of optimal scheduling for the IES.  
where \(\alpha_{i,\text{rc}}\) is the input of the device \(i\) in the rated condition. The SOC of the energy storage unit should be subject to the following constraints:  
\[\begin{array}{c}0\leq\alpha_{\text{s,soc}}(t+1)=\eta_{\text{soc}}\alpha_{ \text{s,soc}}(t)-\eta_{\text{s}}\alpha_{\text{s}}(t)\leq\alpha_{\text{s,soc, max}},\\ 0\leq\alpha_{\text{s,soc}}(t)\leq\alpha_{\text{s,soc,max}}\end{array} \tag{34}\]  
where \(\alpha_{\text{s,soc,max}}\) is the maximum SOC of the energy storage unit. In addition, to ensure the same flexibility of the energy storage on each scheduling day, the initial and final SOCs should be equal:  
\[\alpha_{\text{s,soc}}(1)=\alpha_{\text{s,soc}}(25) \tag{35}\]  
Finally, the day-ahead optimization model can be summarized as follows:  
\[\begin{array}{c}\text{Objective function: Equation (\ref{eq:eq  
weighting vector of the gas, power, cooling, and heat grids. Regarding the power grid, it is generally expected that the IES can purchase and sell electricity as planned, so \(\gamma\) is  
\[\gamma=\begin{bmatrix}0&1&0&0\end{bmatrix}^{\mathsf{T}} \tag{39}\]  
Similarly, rolling optimization must meet the constraints in (2) and (33)-(35), in which the time interval is 5 min and \(\epsilon_{i,\text{out}}(j)\) is calculated using (21) and (37).  
Finally, the rolling optimization problem can be summarized as follows:  
Objective function: Equation (38)  
Subject to: Equations (2), (21), (33)-(35), (37)  
All decision variables include \(\alpha_{\text{grid,g}}(j)\), \(\alpha_{\text{grid,g}}(j)\), \(\alpha_{\text{pgu}}(j)\), \(\alpha_{\text{gb}}(j)\), \(\alpha_{\text{ac}}(j)\), and \(\alpha_{\text{ec}}(j)\), while the variables \(\alpha_{\text{s,e}}(j)\), \(\alpha_{\text{s,c}}(j)\), and \(\alpha_{\text{s,h}}(j)\) refer to the day-ahead optimization results.