## 3 Energy Management Framework
\[F_{3} = \max\left\{1-\frac{F}{W/\eta_{\text{G}}^{\text{E}}+Q/\eta_{\text{G}}^ {\text{E}}+R/\left(\eta_{\text{G}}^{\text{E}}\cdot COP^{\text{F}\text{P}}\right)}\right\}\] \[F = \sum\limits_{i\in\Omega_{\text{G}}}\eta_{F}\cdot\left(a_{i}+b_{i} \cdot P_{\text{G},i}+c_{i}\cdot P_{\text{G},i}^{2}\right)+\sum\limits_{m\in \Omega_{\text{M}E}}F_{\text{CCHP},\text{m}}\] \[W = \sum\limits_{i\in\Omega_{\text{G}}}P_{\text{G},i}+\sum\limits_{j \in\Omega_{\text{H}DRO}}|I|\cdot\left[\frac{(I-1)}{2}\cdot P_{\text{G}\text{P},j}-\frac{(I+1)}{2}\cdot P_{\text{P}\text{2H},j}\right]+\] \[\qquad\qquad\qquad+\sum\limits_{k\in\Omega_{\text{R}}}P_{k,k}+ \sum\limits_{m\in\Omega_{\text{CCHP}}}W_{\text{CCHP},\text{m}}\] \[Q = \sum\limits_{m\in\Omega_{\text{CCHP}}}Q_{\text{CCHP},\text{m}}\,\ R= \sum\limits_{m\in\Omega_{\text{CCHP}}}R_{\text{CCHP},\text{m}}\]  
The constraints part are composed of electrical network constraints and ME applications constraints. \[P_{Gi}-P_{Li}-U_{i}\sum\limits_{j=1}^{n}U_{j}\left(G_{ij}\cos \theta_{ij}+B_{ij}\sin\theta_{ij}\right)=0\quad(i,j\in\Omega_{\text{B}})\] \[Q_{Gi}-Q_{Li}-U_{i}\sum\limits_{j=1}^{n}U_{j}\left(G_{ij}\sin \theta_{ij}-B_{ij}\cos\theta_{ij}\right)=0\quad(i,j\in\Omega_{\text{B}}) \tag{25}\] \[\frac{P_{Gi}}{P_{Gi}}\leq P_{Gi}\,\ \underline{Q_{Gi}}\leq Q_{Gi} \leq\overline{Q_{Gi}}\quad(i\in\Omega_{\text{G}})\] (26) \[\left|S_{ij}\right|\leq\overline{S_{ij}}\quad(i,j\in\Omega_{ \text{B}})\] \[F_{3} = \max\left\{1-\frac{F}{W/\eta_{\text{G}}^{\text{E}}+Q/\eta_{\text{G}}^ {\text{E}}+R/\left(\eta_{\text{G}}^{\text{E}}\cdot COP^{\text{F}\text{P}}\right)}\right\}\]0  
Equations (25)-(27) are electrical network constraints. Equation (25) represents the active and reactive power balance for each bus. Equation (26) represents the output limits of generators. Equation (27) represents the operational limits on the apparent power and the steady-state voltage magnitude. \(P_{Gi}\) and \(Q_{Gi}\) denote the active and reactive power outputs, \(P_{Li}\) and \(Q_{Li}\) denote the active and reactive power loads, \(U_{i}\) denotes the voltage magnitude of Bus \(i\) and \(\theta_{ij}\) denotes the voltage angle gap between Bus \(i\) and Bus \(j\), \(G_{ij}\), and \(B_{ij}\) denote the real and imaginary parts of the \(i\)th row the \(j\)th column element in the nodal admittance matrix. \(S_{ij}\) denotes the apparent power between bus \(i\) and bus \(j\). \[F_{3} = \max\left\{1-\frac{F}{W/\eta_{\text{G}}^{\text{E}}+Q/\eta_{\text{G}}^ {\text{E}}+R/\left(\eta_{\text{G}}^{\text{E}}\cdot COP^{\text{F}\text{P}}\right)}\right\}\]1 \[F_{3} = \max\left\{1-\frac{F}{W/\eta_{\text{G}}^{\text{E}}+Q/\eta_{\text{G}}^ {\text{E}}+R/\left(\eta_{\text{G}}^{\text{E}}\cdot COP^{\text{F}\text{P}}\right)}\right\}\]2 (29) \[F_{3} = \max\left\{1-\frac{F}{W/\eta_{\text{G}}^{\text{E}}+Q/\eta_{\text{G}}^ {\text{E}}+R/\left(\eta_{\text{G}}^{\text{E}}\cdot COP^{\text{F}\text{P}}\right)}\right\}\]3  
Equations (28)-(30) are the CCHP plants constraints. In (28) and (29), \(\overline{E_{i,x}}\) and \(\underline{E_{i,x}}\) are the maximum input and minimum input of ME device \(x\) in the CCHP plant \(m\), \(\overline{E_{0,x}}\) and \(\underline{E_{0,x}}\) its maximum output and minimum output. In (30), \(E_{1}^{m}\) and \(E_{\text{D}}^{m}\) are the ME input of the CCHP plant \(m\) and local ME demands, \(E_{\text{Ex}}^{m}\) is the ME exchange between the CCHP plant \(m\) and the external energy distribution networks. The constraints of P2H/H2P plants are defined in Section 2.2 as in (4)-(10). \[F_{3} = \max\left\{1-\frac{F}{W/\eta_{\text{G}}^{\text{E}}+Q/\eta_{\text{G}}^ {\text{E}}+R/\left(\eta_{\text{G}}^{\text{E}}\cdot COP^{\text{F}\text{P}}\right)}\right\}\]4 \[F_{3} = \max\left\{1-\frac{F}{W/\eta_{\text{G}}^{\text{E}}+Q/\eta_{\text{G}}^ {\text{E}}+R/\left(\eta_{\text{G}}^{\text{E}}\cdot COP^{\text{F}\text{P}}\right)}\right\}\]5  
Equations (31) and (32) are the EV charging constraints. In (31), \(\underline{\rho_{\text{TOU}}}\) and \(\overline{\rho_{\text{TOU}}}\) are the minimum and maximum price of the EV charging price.