# Optimization of Heat Pump Systems in Buildings by Minimizing Costs and CO\({}_{2}\) Emissions
## 2 Methodology
\[\sum_{i=1}^{s}x_{i}q_{ij1}\geq pQ_{maxj}, \tag{5}\]  
\[\sum_{i=1}^{s}x_{i}s_{i}\geq S_{hp}, \tag{6}\]  
\[x_{i}\in\mathbb{Z},\ x_{i}\geq 0,0\leq y_{ijk}\leq h_{j},y_{ijk}\in\mathbb{R}^{+}, \ i=1,\ldots,n,\ j=1,\ldots,t,k=1,\ldots,m,\]  
here, \(n\) is the number of analyzed technologies consisting of the number of ground source and air-to-water HPs, the number of hybrid HPs, and the number of EHs; \(t\) is the number of months; and \(m\) is the number of years. The variables \(x_{i}\) of the optimization model represent the number of HPs/EHs of type \(i\) in units, and \(y_{ijk}\) is the number of operating hours of HP/EH of type \(i\) in month \(j\) of year \(k\), which cannot exceed the total number of hours (\(h_{j}\)) in month \(j\). Coefficients \(c_{ijk}\) of the objective function (1) denote the operating costs per hour for technology \(i\) in month \(j\) of year \(k\), which are calculated by multiplying the electricity consumption per hour (kWh) for each technology by the corresponding electricity price \(c_{d_{k}}\) (EUR/kWh) for year \(k\). The electricity consumption of ground source and air-to-water HPs per hour is calculated by dividing the heating capacity (\(q_{ijk}\)) by the coefficient of performance (\(COP_{ijk}\)) of HP \(i\) in month \(j\) of year \(k\) and then multiplying the result by the annually varying electricity price \(\left(c_{el_{k}}\right)\). The operating costs of hybrid HPs per hour consist of the costs for electricity and natural gas when the electricity (kWh) and natural gas (m\({}^{3}\)) consumption values (\(el_{i}\) and \(g_{l}\)) of the hybrid HPs, which are indicated in the specifications of the HPs, are multiplied by the electricity \(\left(c_{el_{k}}\right)\) and natural gas \(\left(c_{gas_{k}}\right)\) tariffs, respectively. The electricity consumption of EHs per hour is calculated by multiplying the values of their heating capacity (\(q_{ijk}\)) and the electricity consumption coefficient (\(t_{ik}\)). Multiplication of the electricity consumption and the electricity tariff \(\left(c_{el_{k}}\right)\) provides the operating costs per hour. The calculation of the coefficients \(c_{ijk}\) of the objective function (1), which depends on the analyzed heating technology, is presented as follows:  
\[c_{ijk}=\left\{ \begin{array}{cc}\frac{q_{ijk}}{COP_{ijk}}c_{el_{k}},&\text{ for geothermal and air-to-water HPs,}\\ g_{i}c_{gas_{k}}+el_{i}c_{el_{k}},&\text{for hybrid HPs,}\\ q_{ijk}t_{ik}c_{el_{k}},&\text{for EHs,}\end{array} \right. \tag{7}\]  
\(i=1,\ldots,l,j=1,\ldots,t,k=1,\ldots,m\). The coefficients \(c_{ijk}\) depend on the changes in heating capacities, efficiency and electricity (gas) utilization coefficients, and electricity and gas tariffs over \(m\) years. The coefficients \(\widetilde{c}_{i}\) in Equation (1) represent the price (EUR) of HP/EH \(i\), and \(\acute{c}_{i}\) denotes the installation costs (EUR). The maintenance costs of HPs/EHs are calculated by multiplying the maintenance costs of HP/EH of type \(i\) per year \((\acute{c}_{i})\) by the number of years (\(m\)). The coefficients \(\overline{c}_{ijk}\) in Equation (2) denote the costs of CO\({}_{2}\) emissions of HP \(i\) in month \(j\) of year \(k\) per hour. These coefficients \(\overline{c}_{ijk}\) are calculated by multiplying the amount of CO\({}_{2}\) emissions \(em_{ijk}\) (t/h) due to gas use of HP \(i\) in month \(j\) of year \(k\) by the price (EUR/t) of CO\({}_{2}\) emissions (\(c_{co_{2_{k}}}\)):  
\[\overline{c}_{ijk}=em_{ijk}c_{co_{2_{k}}}. \tag{8}\]  
Here, CO\({}_{2}\) emissions \(em_{ijk}\) are based on the gas consumption (kWh) of HP \(i\) per hour as given in the technical specifications of the hybrid HPs. The heating system must satisfy the monthly heat demand of the analyzed buildings for each year, i.e., the total amount of heat (kWh) produced by the selected heating system should not be less than the actual heat demand \(Q_{jk}\) (kWh) in month \(j\) of year \(k\). This condition is ensured by the system of inequalities (1).