## 2 Modeling for OMEF
### Natural Gas System  
#### 2.2.1 Modeling for Natural Gas System  
(1) Line pack  
Considering the dynamic characteristics of natural gas flow in time and space, natural gas flow has a transmission delay in the pipeline transmission process and the pipeline has a certain buffer capacity. The natural gas inflow at the beginning of the pipeline is different from the outflow at the end. Some natural gas is stored in the pipeline, which is called the \"line pack\", which can be expressed as [16]:  
\[H_{ij,t}=\frac{\pi L_{ij}D^{2}_{ij}}{4 RTZ\rho_{0}}\overline{p}_{ij,t} \tag{24}\]  
\[H_{ij,t}=H_{ij,t-1}+q^{\text{in}}_{ij,t}-q^{\text{out}}_{ij,t} \tag{25}\]  
where \(H_{ij,t}\) is the line pack of pipeline \(ij\); \(L_{ij}\) and \(D_{ij}\) are the pipe length and diameter; \(R\), \(T\), \(Z\) and \(\rho_{0}\) are respectively the gas constant, natural gas temperature, natural gas compression factor, and natural gas density under standard conditions; \(\overline{p}_{ij,t}=\big{(}p_{i,t}+p_{j,t}\big{)}/2\) is the average pressure of pipeline; \(q_{ij,t}^{\text{in}}\) and \(q_{ij,t}^{\text{out}}\) are the gas inflow and outflow of pipeline _ij_. In order to use the line pack reasonably and ensure a certain adjustment margin in the next scheduling cycle, the amount of the total line pack after running one cycle should not be lower than the initial value, as follows:  
\[\sum_{ij}H_{ij,T}\geq\sum_{ij}H_{ij,0} \tag{26}\]  
(2) Natural gas flow equation  
According to the Weymouth equation, the natural gas flow equation can be expressed as:  
\[\overline{q}_{ij,t}|\overline{q}_{ij,t}|=K_{ij}(p_{i,t}^{2}-p_{j,t}^{2}),K_{ij }=\frac{\pi^{2}D_{ij}^{5}}{16L_{ij}F_{ij}RTZ\rho_{0}^{2}} \tag{27}\]  
where \(\overline{q}_{ij,t}=\Big{(}q_{ij,t}^{\text{in}}+q_{ij,t}^{\text{out}}\Big{)}/2\) is the average gas flow of pipeline _ij_; \(K_{ij}\) is the transmission parameter of pipeline _ij_, which is positive; \(F_{ij}\) is the friction coefficient of pipeline _ij_. (3) Node gas flow balance equation  
\[A_{s}q_{s,t}+\mathbf{A}_{\text{P2G}}q_{\text{P2G},t}+A_{\text{R}}(q_{\text{R},t}^ {\text{out}}-q_{\text{R},t}^{\text{in}})+A_{\text{g}}(\overline{q}_{g,t}^{ \text{out}}-\overline{q}_{g,t}^{\text{in}})-q_{\text{D},t}-A_{\text{GT}}q_{ \text{GT},t}=0 \tag{28}\]  
where \(\mathbf{A}_{s}\), \(\mathbf{A}_{\text{P2G}}\), \(\mathbf{A}_{\text{R}}\), \(\mathbf{A}_{\text{g}}\) and \(\mathbf{A}_{\text{GT}}\) are respectively the association matrix of node-natural gas source, node-P2G, node-gas storage tank, node-natural gas pipeline, node-gas turbine; \(q_{s,t}\), \(q_{\text{P2G},t}\), \(q_{\text{R},t}^{\text{out}}\), \(q_{\text{R},t}^{\text{in}}\), \(\overline{q}_{g,t}^{\text{out}}\), \(q_{\text{D},t}\) and \(q_{\text{GT},t}\) are respectively the matrix of gas source output, P2G gas outflow, gas storage tank output, gas storage tank input, pipeline gas outflow, pipeline gas inflow, nodal load, gas turbine gas inflow. (4) Gas sources output limits  
\[q_{s,i,t}^{\text{min}}\leq q_{s,i,t}\leq q_{s,i,t}^{\text{max}} \tag{29}\]  
(5) Gas pressure limits  
\[p_{i,t}^{\text{min}}\leq p_{i,t}\leq p_{i,t}^{\text{max}} \tag{30}\]  
(6) Compressors limits  
In the long-distance transmission of natural gas, a natural gas compressor must be set up at a distance to pressurize the natural gas in the pipeline to offset the pressure consumed along the way. Because the energy consumed by the compressors is less, this article simplifies the compressor model and only considers the pressure-boosting relationship between the inlet and outlet ends of the compressor, as follows:  
\[k_{\text{com}}^{\text{min}}\leq p_{j,t},/p_{i,t}\leq k_{\text{com}}^{\text{ max}} \tag{31}\]  
where \(k_{\text{com}}^{\text{max}}\) and \(k_{\text{com}}^{\text{min}}\) are the upper and lower limits of the gas pressure boost ratio. (7) Gas storage tanks limits  
\[S_{\text{R},i,t}=S_{\text{R},i,t-1}+q_{\text{R},i,t}^{\text{in}}-q_{\text{R}, i,t}^{\text{out}} \tag{32}\]  
where \(S_{\text{R},i,t}\) is the gas storage capacity of the \(i\)th gas storage tank.