## 2 Mathematical Modelling of ME Applications
### Modelling of P2H/G2P Facility  
The schematic of a typical P2H/G2P facility is given in Figure 3. In Figure 3, the area surrounded by dotted line represents P2H/G2P plant, which is composed of P2H (electrolyte) unit, G2P (hydrogen turbine) unit and hydrogen storage serving as a buffer.  
Figure 4 gives the diagram of how RES output variation is accommodated with P2H/G2P plants. When there is a surplus of RES generation, P2G is employed to store them into hydrogen by electrolysis in high-pressure hydrogen tanks or caverns. During periods of low RES generation or high power demand, the stored energy can be converted to power through the G2P process. Therefore, three operation modes are considered in the modelling process: P2H mode, G2P mode, and idling mode. In P2H mode, the plant acts as an electric demand, while in G2P mode an electrical generator. In the idling mode, the facility is on standby for either P2H or G2P. In (4), \(I(t)\) is used to indicate the operation mode of the concerned P2H/G2P plant.  
\[I(t)=\begin{cases}1\,,&\text{P2H}\\ -1\,,&\text{G2P}\\ 0\,,&\text{Other}\end{cases} \tag{4}\]  
Then, the output of the P2H/G2P plant \(P_{\text{Hdr}}(t)\) is defined by the linear relationship between the power that charges the hydrogen storage in P2H mode and the power that discharges it in G2P mode, as in (5) and (6). In (5), \(\eta^{\text{G2P}}\), \(\eta^{\text{P2H}}\) are the conversion efficiencies of G2P and P2H processes respectively, \(P_{\text{min}}^{\text{G2P}}\), \(P_{\text{max}}^{\text{G2P}}\) and \(P_{\text{min}}^{\text{P2H}}\), \(P_{\text{max}}^{\text{P2H}}\) are the lower and upper output limits of the corresponding operation modes.  
\[P_{\text{Hdr}}(t)=P^{\text{G2P}}(t)\cdot\eta^{\text{G2P}}-P^{\text{P2H}}(t) /\eta^{\text{G2P}}\quad,\quad\eta^{\text{G2P}},\;\eta^{\text{G2P}}\in[0\,,\,1] \tag{5}\]  
\[\begin{split} P^{\text{G2P}}(t)\in\left[P_{\text{min}}^{\text{G2P}} \cdot I^{\text{G2P}}(t)\,,\;P_{\text{max}}^{\text{G2P}}\cdot I^{\text{G2P}}(t) \right]\\ P^{\text{P2H}}(t)\in\left[P_{\text{min}}^{\text{P2H}}\cdot I^{\text{P2H}}(t )\,,\;P_{\text{max}}^{\text{P2H}}\cdot I^{\text{P2H}}(t)\right]\end{split} \tag{6}\]  
The hydrogen storage level \(H^{\text{sto}}(t)\) is constrained by (7)-(9), where (8) ensures that the storage level is sufficient to provide service, and (9) is to avoid end-of-horizon effects by setting the final hydrogen storage level to be close to its initial value.  
\[H^{\text{sto}}(t+1)=H^{\text{sto}}(t)+P^{\text{P2H}}(t)\cdot\Delta t-P^{\text{G2P} }(t)\cdot\Delta t-H^{\text{oth}}(t)\cdot\Delta t \tag{7}\]  
\[H^{\text{sto}}(t)\in\left[H^{\text{sto}}_{\text{min}}\,\ H^{\text{sto}}_{ \text{max}}\right] \tag{8}\]  
\[H^{\text{sto}}(n\cdot T)\in\left[H^{\text{sto}}_{0}-\Delta H_{\text{sto}}\,\ H^{ \text{sto}}_{0}+\Delta H_{\text{sto}}\right] \tag{9}\]  
\(H^{\text{sto}}_{\text{min}}\) and \(H^{\text{sto}}_{\text{max}}\) are the lower and upper storage limits; \(\Delta t\) represents the given time interval; \(\Delta H^{\text{sto}}\) is a pre-specified small value; \(H^{\text{oth}}\) represents the hydrogen product directly demanded by other energy sectors, which is constrained by (10). In (10) \(H^{\text{oth}}_{\text{max}}\) represents the upper limits of the \(H^{\text{oth}}\).  
\[H^{\text{oth}}(t)\in\left[0\,\ H^{\text{oth}}_{\text{max}}\right] \tag{10}\]