A GIS-Based Planning Approach for Urban Power and Natural Gas Distribution Grids with Different Heat Pump Scenarios

Next to building insulation, heat pumps driven by electrical compressors (eHPs) or by gas engines (geHPs) can be used to reduce primary energy demand for heating. They come with different investment requirements, operating costs and emissions caused. In addition, they affect both the power and gas grids, which necessitates the assessment of both infrastructures regarding grid expansion planning. To calculate costs and CO2 emissions, 2000 electrical load profiles and 180 different heat demand profiles for single-family homes were simulated and heat pump models were applied. In a case study for a neighborhood energy model, the load profiles were assigned to buildings in an example town using public data on locations, building age and energetic refurbishment variants. In addition, the town’s gas distribution network and low voltage grid were modeled. Power and gas flows were simulated and costs for required grid extensions were calculated for 11% and 16% heat pump penetration. It was found that eHPs have the highest energy costs but will also have the lowest CO2 emissions by 2030 and 2050. For the investigated case, power grid investments of 11,800 euros/year are relatively low compared to gas grid connection costs of 70,400 euros/year. If eHPs and geHPs are combined, a slight reduction of overall costs is possible, but emissions would rise strongly compared to the all-electric case.


Introduction
One important aspect of mitigating climate change is the increase in energy efficiency, particularly in the building sector. The European Union's amended Directive on Energy Efficiency (2018/2002) sets an energy efficiency target for 2030 of at least 32.5% improvement compared to the 2007 business-as-usual scenario [1,2]. The German government has set a goal of an 80% reduction in primary energy consumption by 2050 compared to 2008 for the building sector [3]. The primary energy consumption of the German building sector decreased by 18.8% from 2008 to 2017 while the overall German primary energy consumption sunk by 5.5%. Space heating and domestic hot water provision in private households accounted for 21.9% of the total final energy consumption in Germany in 2017 [4].
The research field of future energy-efficient heat supply is manifold and consists of various sub-research areas that overlap with other energy research questions. There are three main areas of particular relevance for the present paper that are elaborated on later in this section. Firstly, heat pumps the FlexiGIS model and not mentioned in the literature review. The platform was developed for the optimization of generation and demand of flexibilities in urban regions. In the present paper, we go a step further and add detailed modeling of the gas and power grid infrastructure to the neighborhood energy model of an example town.
In the following, we model both topics in great detail so that it is possible to derive the total costs for a future energy infrastructure that is able to supply electricity and heat in a German town for the years 2030 and 2050. On the one hand, the building owners' perspective regarding deciding on insulation and the type of heating system is modeled. On the other hand, the grid operator's perspective toward investing in the power and gas distribution grid to assure a reliable and efficient network infrastructure is modeled as well. The innovation in this paper is to analyze the costs and emissions of heat generation under consideration of different building ages and energetic refurbishment variants in combination with the related costs for grid reinforcement in both the natural gas and the low voltage network of a German town. Using this approach, in contrast to other studies, a more comprehensive assessment of different heating technologies can be conducted, including the cost for heat pump systems and infrastructure costs together. The study shows where a significant number of costs are located and which type of heat pump could be used to minimize the costs but also to reduce CO 2 emissions.
In the context of grid expansion planning, this study presents the following main innovations: • The mutual investigation of power and natural gas distribution infrastructure for a whole town using a pipe and power-flow grid analysis.

•
Deriving open models from a large number and different types of public data only, creating a highly diversified spatial and temporal resolution. • Using a multi-perspective approach that considers electricity and natural gas grid investments, heat pump costs, and CO 2 emissions for three cases.
The structure of the paper is as follows: First, the steps to model the existing building stock in the town and electric and gas grid infrastructure are described in Section 2. Second, fixed numbers of heat pumps are assumed to be added to the infrastructure by 2030 and 2050. Three cases are studied, including (1) only electric heat pump systems being installed, (2) only gas engine heat pump systems being installed, and (3) a mix of electric and gas engine heat pump systems being installed. Heat pump related costs and emissions are presented in Section 3.1 for individual building types with different building ages and three energetic refurbishment variants. In Section 3.2, the costs for all heat pumps that are assumed to be installed in the town are summarized. The costs for grid expansion of the power and gas grid depending on the number of electric and gas engine heat pumps are presented in Section 3.3. In Section 4, the results are discussed for the three cases, and the conclusion on the costs and CO 2 emissions of scenarios with different numbers of heat pump types are drawn.

Materials and Methods
The approach of evaluating the total costs and CO 2 emissions of planning an urban power and gas grid is based on detailed geographic information system (GIS) data. An overview of the different steps is shown in Figure 1. The data used in this study are all publicly available on the Internet as open-data or derived from assumptions based on studies mentioned in the following paragraphs.  Figure 1. GIS-based approach for evaluating the total costs for an overall future infrastructure plan.
The analysis was performed for the German town "Schutterwald" in the geographical region of "Oberrhein" in southern Germany. The basic model of the studied town was built from GIS data of buildings and streets derived from OpenStreetMap (OSM) [53]. Additional information from public sources [54,55] on building age and energetic refurbishment was connected to the buildings of the town. From this geographical connected information, the load profiles and the grid models were derived. All buildings were treated as residential buildings, since commercial buildings are rather rare in the focus area. Most of the town's commercial and industrial area is located in the northern part of the town, which is not considered in this study. The load profiles cover electrical and thermal profiles. While the electrical load profiles were modeled for each building, thermal profiles were modeled for 12 different building classes with three different renovation standards and five different household types. The electrical load profiles were then geographically connected to the power grid model. The power grid and the gas grid model were also based on GIS data and were modeled based on publicly available information [53][54][55][56][57]. However, assumptions had to be made if the level of detail from the sources was not sufficient. The grids in this study can therefore differ from the actual grid in features such as cable type and exact routing or transformer parameters and location. The thermal profiles served as input for the gas consumption profiles and the future electrical load profiles, which were modeled for the grid planning in 2030 and 2050. The gas and power grid connection point profiles were based on a model of heat pump and storage systems including a rule-based control to apply the thermal energy for space heating and domestic hot water for a household. In future scenarios, additional loads may occur in the grid, e.g., more air conditioning units due to global warming, and electric vehicles. However, these effects are out of the scope of the present study and require further research. From the resulting time-series, the operating costs and CO 2 emissions for the buildings and thermal energy systems on the one hand, and required grid infrastructure investments, on the other hand, were calculated.

GIS-Based Information
The GIS coordinates of the building were taken from OSM data. The buildings were classified in accordance with the TABULA-building topology for Germany [58][59][60]. Twelve different periods were classified according to their year of construction, as shown in Table 1 ("construction year classes"). The state of energetic refurbishment was modeled by three different states: • Variant 1: "standard (no refurbishment)." • Variant 2: "moderate refurbishment." • Variant 3: "advanced refurbishment." Table 1. Different construction year classes for Germany as defined in [59].

Name Years
A 1859 and earlier B 1860-1918 C 1919-1948 D 1949-1957 E 1958-1968 F 1969-1978 G 1979-1983 H 1984-1994 I 1995-2001 J 2002-2009 K 2010-2015 L 2016 and later Variant 1 refers to the requirements according to the applicable energy efficiency guideline for buildings in the respective construction year. Moderate and advanced refurbishments differ in thickness of wall insulation, number of insulated walls and other refurbishment measures. A detailed overview is given in [58,59].
The houses' construction year periods in the example town were derived from the technical report [54]. The result is shown in Figure 2.  The color code describes the construction year class of each building (see legend in the right upper corner and, in the right lower corner, the inset for distribution of the number of houses for each period). Classification of periods based on [54].
The refurbishment variants were randomly assigned to the houses, based on a probabilistic distribution. The distribution of the three variants within each construction year class was based on statistics of German stock of buildings [55] as depicted in Figure 3. Different household types with one to four residents were randomly assigned to the houses, weighted by the census data for the municipality [61]; see   [55]. Class A and B were not differentiated in the reference. As no data for classes K and L were given in the reference, equal distributions to class J were assumed. In total, the model included 1506 houses; twelve construction year classes with three variants of refurbishment, each completed by five household types.
The temperature and solar radiation data were taken from the weather year 2009.

Class-Based Electrical and Thermal Load Profiles
To reduce complexity, all buildings were assumed single-family homes. The electrical load profiles without heat generators were generated using a bottom up load profile generator, which is presented in [62]. The profile generator was based on adding up single household devices, such as a television, coffee machine, and washing machine. The devices' operating times were based on probability functions so that each resulting profile was different from the others. The probability functions were specific for different types of household members, e.g., children use the bathroom lightning earlier in the evening than adults. To account for different usage patterns of electrical appliances and different household sizes, five main household types were implemented representing the statistical distribution of singles (employed/retired) and couples with one, two, or without children in the municipality ( Table 2). In total, 2000 different electrical load profiles for one year with a resolution of 10 minutes have been computed using the load profile generator.
Space heating (SH) demand and domestic hot water (DHW) demand were computed using another load profile generator that was developed in [63], similar to the method in [64]. It uses occupation models for the five different household types for each of the 36 building types. The profiles for space heating depending on the construction year class and the domestic hot water demand with a 10 min resolution were also computed for one year. Based on those profiles, models of heat pumps and thermal storage systems were applied to derive "grid connection point profiles", i.e., electricity and gas load profiles from the heat demand time-series that affect the power grid and natural gas network (see Figure 1).

GIS-Based Grid Connection Point Profiles
A heating system was modeled by a heat generator unit and two insulated hot water tanks, one for space heating and one for domestic hot water. The distribution of the heat within the house, including radiators, in-house pipes, and ventilation systems, was not modeled explicitly in this study. Distribution losses were taken into account by a loss factor. Three heat generator options were considered to cover the heat demand
η Pn = (A + B · log 10 (P n ))/100 (1) η Ppart = (C + D · log 10 (P n ))/100 with rated power P n ; efficiency at rated and partial power η Pn and η Ppart ; standby heat loss q P0 ; electric auxiliary power P aux ; and factors A-H and K according to standard DIN V 18599:5. The coefficient of performance (COP) for electric heat pumps eHP was calculated from the ideal COP and a system efficiency factor η HP = 0.36 using Equation (5).
with temperatures at the condenser T c and evaporator T e in Kelvin. Like the electric heat pumps, gas engine heat pumps use a refrigerant cycle too. The compressor is driven by a gas engine and the heat from the engine cooling cycle and exhaust gas is utilized by additional heat exchangers. Thus, the overall efficiency was estimated according to Equation (6) with relative exhaust heat loss q ex,loss = 0.25 [21], heat pump system efficiency η HP = 0.36 and gas engine efficiency η engine = 0.307 (assumption: full load, 1400 rpm) [65]. Currently, commercial gas engine heat pumps are only available for rated power of 25 kW upwards but market availability of small-scale geHPs could be reached within a few years [66].
The temperatures of the condensers in houses with regular, advanced, and ambitious energetic standards are assumed to be 55 • C, 45 • C, and 35 • C, respectively. Ambient air temperature records of a nearby weather station were used as evaporator temperature [67]. Since the lowest air temperature in 2007-2014 was recorded for 2009 (−15.2 • C), the weather year 2009 was used for the simulations in this study. Extreme winters may also occur in the future due to changes in atmospheric circulation caused by climate change [68]. Thus, the risk of over-sizing the heating systems appears to be limited but cannot be negated.
The losses of the hot water tanks are calculated with Equation (7) (according to DIN V 18599:5) and the stored heat energy is a function of the tank's volume and temperature, see Equation (8).
Q loss,d = 0.4 kWh day + 0.14 kWh 0.001 m 3 day · V stor (7) with daily heat loss Q loss,d , storage volume V stor in liters, thermal storage capacity Q stor and difference between the maximum and minimum storage temperature ∆T The investments for heat generators and hot water tanks were estimated according to Equation (9). All price parameters were assumed to stay constant for all investigated scenario years.
where a and b are factors shown in Table 3 and X is rated thermal power in kilowatts or storage volume in liters [69]. Initial costs were converted to annuities, using an interest rate of i hh = 2.7 % for households (average of [70][71][72]) and i DSO = 4.27 % for distribution system operators (see Table A9).
The energy carrier rates given in Table 4 were applied to calculate the heating systems' fuel or electricity costs. Emissions were calculated based on the emission factors given in Table 5 [73,74]. It has to be noted that only scope 1 and 2 emissions were taken into account; no scope 3 emissions (production and mining). Possible emission changes for gas that may come from changing gas mix were neglected.

GIS-Based Grid Models
Based on the existing building stock model, the town's low voltage grid and gas distribution network were modeled.

Low Voltage Power Grid Model
As the real low voltage grid of the town is unknown, a new grid model was created. According to the classification presented in [79], three categories are applicable: • Synthetic, because it is not based on a real DSO grid model; • Example, because the main purpose is to illustrate different scenarios; • Benchmark, because it is used to compare different scenarios by derived grid expansion costs.
The grid model was derived from an open-source 10 kV medium voltage (MV) grid model called "MV Oberrhein" that is provided as a synthetic grid in the Python package pandapower [32,80]. The low voltage grids for each of the 14 transformers have been modeled using a semi-automated method that includes the following steps: 1. The street lines downloaded from OpenStreetMap are segmented into sets of points with 1 m distance and an individual ID, called grid-points, using the QGIS-plugin QChainage [81]. It is assumed that cables are routed along the streets and each house is assigned to its nearest grid-point using the extension NNJoin [82]. All grid-points that have no house assigned are deleted. 2. The remaining grid-points are connected to their assigned houses by cables of type NAYY 4x50.
To derive a preliminary grid structure, grid-points are connected to their nearest neighbor in the same street with less than 40 m distance by cables of the type NAYY 4x150. The parameters and locations of the MV/LV transformer stations are taken from the pandapower grid "MV Oberrhein". All information is imported to PSS R Sincal to proceed with a graphical interface. 3. The imported information is validated and existing errors due to the automated approach of grid generation are corrected manually. For each transformer, a supply area is chosen and the respective branches are connected by cables of type NAYY 4x150 to the LV-busbar of the transformer. Crossing points of many cables are equipped with switch cabinets. A radial topology without any galvanic connections between transformers is ensured by appropriate switch configuration. The result is shown in Figure 4. 4. For each house, a peak load of P = 2 kW and Q = 0.1 kVar is assumed, which represents a cos(φ) of 0.96. With these values, a load flow calculation is performed to make sure that the grid model is valid and the voltage and current of each cable, bus, and transformer stay within given limits. Limits are chosen to be 0.9-1.1 p.u. for bus voltages, 60% capacity for cables, and 130% for transformers (oil insulated) [83]. 5. If violations of given voltage and capacity limits are found at this stage, switch measure, direct connection to bus bars; or new, parallel cables are added until all restrictions are met. 6. The Sincal-grid model is imported to pandapower and by using the integrated converter of pandapower-pro. 7. The loads in pandapower are connected with the house data (construction year classes, the status of energetic refurbishment, household type) from This electrical distribution grid is the benchmark grid for today and was used for the applications of the different scenarios. All transformer tap positions were set to the second-lowest position (−1).
The power flow was calculated using the open-source Python package pandapower [32,80]. A version of the synthetic low voltage grid can be found in the Supplementary Materials as a pandapowerNet-file.  Each color represents a galvanically connected low voltage grid (grid group) that belongs to one transformer/external grid connection (squares). Due to the status of the switches, the different grid groups are not galvanically connected on the low voltage side.

Natural Gas Grid Model
The gas distribution grid was modeled in STANET R [84] by applying the following steps: 1. The raw network topology was derived from a map presented in [54]. 2. Detailed information such as pipe diameters and types was derived from the gas network operator's online planning information platform [57] and was set in STANET R accordingly. The backbone of the gas system is made of pipes of the type 180 PE 100; all other pipes are of type 125 PE 100. 3. The location of the city gate station (pressure regulator station) was taken from the route depicted in the land utilization plan [56] and assumed to provide a constant pressure of 1 bar. It was implemented as a constant pressure node in STANET R . 4. The buildings and their types that were set in the electrical distribution grid model were imported to the gas distribution grid model. 5. Linear connection pipes from houses to the nearest natural gas pipeline were created by using the STANET R function "Create house connection pipes". 6. The STANET R grid model was exported as a CSV-file and imported into pandapipes, an open-source Python package for pipe flow and network simulation [85], for further analysis, e.g., on different lengths of house connection pipes. 7. Gas network capacity tests were conducted to find potential violations of the operation limits (flow velocity and nodal pressure). For these tests, it was assumed that all houses in the model were heated by gas boilers, except for those with an assigned heat pump. Then, time-series simulations were conducted in pandapipes. The highest gas flow velocity and the lowest nodal pressure per time step were logged.
The resulting gas distribution grid is shown in Figure 5 and can be found in the Supplementary Materials in the STANET R -CSV and pandapipesNet-file format.   Figure 5. Assumed connection costs for houses based on their linear distance to the natural gas grid and the specific costs given in Table 6.

GIS-Based Grid Expansion Planning
Based on a scenario data of the INTEEVER project [77] scaled by the number of residents, the numbers of heat pumps in the years 2030 and 2050 were set to 164 and 247, respectively. These heat pumps can be realized as eHPs or geHPs. In the following, three cases are studied and compared for calculating the costs for grid expansion planning of electrical and gas distribution systems.

•
Case 1 "electric": All heat pumps are realized as eHPs. • Case 2 "natural gas": All heat pumps are realized as geHPs. • Case 3 "mixed": It is assumed that heat pumps are driven by gas engines for houses that are close to the gas grid (less than 67 m linear distance). Heat pumps in other houses are implemented as eHPs.

Allocation of Heat Pumps
Electric heat pumps are connected at the same bus as the household load. For a worst-case scenario, it is assumed that no gas house connections exist or existing house connections are not used. Thus, each geHP is connected to the closest pipe of the gas grid by a linear house connection pipe and pipe investments are required.
The allocation of new heat pumps was not evenly randomly distributed like in other studies but was based on the construction year class. It should also be possible to allocate new heat pumps for a large range of numbers automatically. It should be based on given GIS information and include a sufficient degree of variety to create sets of different samples for the same given number of heat pumps. To achieve this, it was assumed that the likelihood of a house to be equipped with a heat pump depended mainly on the age and degree of refurbishment. For the given stock of buildings, likelihood points were assigned. As heat pumps are especially efficient with modern heating systems that require low-temperature heat, houses with the energetic refurbishment variants "standard", "moderate" and "advanced", received 1, 5, and 10 points, respectively. In a second step, today's shares of heat pumps in each construction year class in Germany were applied and the respective number of houses received 100 points, starting from advanced refurbished houses. For example, 599,201 residential buildings were completed in Germany between 2010 and 2015 (construction year class K), and for 184,110 (30.7%) of those houses, heat pumps were the main heat generator [86]. In the investigated area, around 50 houses got the construction year class K assigned. Thus, 15 of these houses (≈30.7%) received 100 points for the heat pump allocation. The remaining 35 houses stayed at their initial 1, 5, or 10 points. Twenty random allocations were computed for the year 2030 and the remaining heat pumps for 2050 were added subsequently. For replicability, the heuristic's random number generator was initialized with different seeds (0-19) for each allocation. In each case, the same 20 allocations of heat pumps are analyzed and either electric motors or gas engines were assumed.

Grid Analysis
For each sample grid, power flow and pipe flow calculations were conducted in pandapower and pandapipes/STANET R , respectively. To limit the calculation time, the time-series was reduced to time steps with a cumulative load of 90% or more of the annual peak load. From these time steps, the one with the highest voltage band violation (i.e., lowest bus voltage) was used for the following grid extension study.

Grid Reinforcement
Prior to the low voltage grid reinforcement study, switch measures were applied (i.e., opening and closing of switches) by a hill-climbing heuristic for 5 min to balance line loadings and bus voltages among the network. For this sectioning point optimization (SPO) heuristic, the weighted sum of voltage violations and line overloadings was considered. The weighting factor for voltage band violations was set to 15 and line loading violations were weighted by a factor of 1.5. Then, grid reinforcement and extension measures were applied using hill-climbing and iterated local search algorithms from [33]. The allowed voltage band was 0.9 p.u. ≤ u bus ≤ 1.1 p.u. and the maximum line loading was 60%. The following measures were allowed:

•
Replacing overloaded cables or cables that were upstream of voltage band violations by cables with increased diameter (NAYY 4x240).
Subsets of those measures were evaluated by the heuristic optimizer to find a feasible solution and improve it further towards a cost minimum. However, the solutions might not represent the global minima due to a limited computation time of 30 min. Extension costs for the low voltage grid were estimated based on Table 6. In the gas grid, the operational limits are specified as minimum node pressure of p min = 20 mbar and maximum gas velocity v gas,max = 18 m/s [90]. If these boundaries are violated, additional pipes have to be considered.

Results
In the following, the results for different stages of the bottom-up approach are explained. First, the results for the costs and emissions of single buildings are shown. As the effect of different household types is relatively small compared to the influence of building age and energetic refurbishment, only average values for all five household types are presented. Second, the costs and emissions that were specified for each house type are summarized according to the assumed distribution of buildings with heat pumps. Third, heat maps of bus voltages for worst-case time steps are shown and the calculated required grid investments are given. Finally, the combined costs of heat pumps and grid investments are compared for different cases.

Costs and CO 2 Emissions for Single Buildings and New Heating Systems
The calculated annual demands for space heating, hot water, and electricity (for household devices, not for eHP) are summarized by household type in the Appendix A, Table A1. The electricity consumption increases with increasing household size. In turn, the space heating demands decrease slightly, due to the waste heat provided by the electrical appliances. The DHW demand is almost proportional to the number of household members. The simulated annual heat production and efficiency values for eHPs and geHPs are listed for each construction year class and energetic refurbishment variant in Tables A2 and A3. Figure 6 displays specific costs of heat generation for different combinations of heating technologies and years of construction as well as their state of refurbishment. Namely, electric heat pumps with an auxiliary heating coil, gas engine heat pumps, and gas boilers are compared for the construction year classes E (1958-1968) and L (2016 and later). For all heat generator options and years of construction, the required rated heat generator power-and thus the investments-decrease with further energetic refurbishment. Gas boilers have the lowest overall costs of generated heat, as they require the least investments. Required investments for geHPs are 3.18-3.34 times higher than for gas boilers. For eHP, 1.95-3.72 times the investments for respective gas boilers are necessary. Regarding energy costs, geHP are the most cost-efficient, particularly for well-insulated buildings and buildings according to the latest energy efficiency guidelines. Total annual costs (depreciation, energy consumption, maintenance, and interest) and CO 2 emissions of different heat generators are shown in Figure 7 for the construction year classes E (1958-1968) and L (2016 and later). In all cases, gas boilers cause the highest annual emissions. The replacement of gas boilers by geHPs reduces emissions by 27-30%, 35-37% and 46-49% (for variants 1, 2 and 3, respectively). For eHPs, the assumed electricity mix is essential. Using the electricity mix of 2017, an eHP in a house constructed between 1958 and 1968 would eliminate between 6% (variant 1) and 40% (variant 3) of CO 2 emissions. Assuming a further decline of fossil-fired power plants (see Table 5), the savings rise to 62-76% in 2030 and 89-93% in 2050.  Tables A4 and A5. For electric heat pumps (eHPs), the emissions are given for different years (i.e., decreasing carbon intensity of electricity generation; see Table 5). Costs for energy and heating systems were assumed to stay constant for all years. Possible emission changes for gas that may come from changing gas mix are neglected.

Cost and Emissions for Investigated Buildings in Schutterwald
The GIS information of the buildings in Schutterwald and the method to allocate new heat pump systems made it possible to calculate the costs and CO 2 emissions for all analyzed buildings in Schutterwald together.
In the investigated cases, 164 and 247 heat pumps were allocated among the 1506 houses of the town. Due to the partially randomized allocation heuristic, the distributions vary among the construction year classes, energetic insulation standards, and household types. The distributions are shown in Figure 8. Figure 8a shows the share of each construction year class and energy refurbishment variant for one exemplary seed. Figure 8b,c present the distributions of heat pumps for 2030 and 2050 respectively.
The average total annual costs for 164 heat pumps are 494,000 and 416,000 euros in case 1-electric and case 2-natural gas. For 247 heat pumps, these numbers rise to 736,000 and 624,000 euros. In case 3-mixed, on average 67% of the heat pumps are implemented as geHPs and 33% as eHPs. This is reflected proportionally in the heat pump investments and energy costs of 443,000 and 662,000 euros for 164 and 247 heat pumps in case 3. In Figure 9, the cost sensitivity to varied energy prices and investment costs is depicted. In case 1, an electricity price increase of 20% leads to raised overall costs of +11%. If the electricity price is lowered by 20%, case 1 has lower heat pump costs than case 3 with default parameters (−2.2%). If required heat pump investments change by 20%, the overall annuities change by 9%, 12%, and 14% in cases 1, 2, and 3, respectively.
The heat pumps' cost difference is relatively small compared to the difference in annual CO 2 emissions. In the 2030 scenario, the heat pumps emit on average 505 t CO2-eq /a if they are implemented as geHPs. In contrast, the same number of eHPs in 2030 causes on average 66% less CO 2 . With decreasing carbon intensity of the electricity mix, this difference rises to 84% less CO 2 from eHPs than from geHPs in 2050. The emissions in case 3 scale proportionally to the respective eHP/geHP ratio.

Required Grid Investments in the Gas and Power Grids
For each allocation of heat pumps, sectioning point optimizations were conducted in the electric and mixed cases. If voltage band violations or line loading violations occurred, grid reinforcement measures were added.

Case 1-Electric (eHPs)
From the sample allocation of 247 heat pumps shown in Figure 10, it can be confirmed that the distribution among the town's houses is not equal, due to the weighted random heuristic. Thus, clustering can be observed in areas with younger buildings, in the western and southeastern part of the town. In these areas, the grid load is particularly high. Table 7 gives an overview of lowest bus voltages and maximum line loads for an exemplary allocation (for the seed "15"). Undervoltage occurs at 54% of the busses but can be reduced to 4.  Synthetic low voltage grid of the town with 247 electric heat pumps (case 1-electric, for the seed "15"). Line overloads and bus voltages at time step with lowest bus voltage, prior to sectioning point optimization and grid extension. Table 7. Exemplary simulation results from pandapower (for the seed "15"): load at worst time step (occurrence of lowest bus voltage) and lowest bus voltage and maximum line loading before and after sectioning point optimization (SPO) and after automated grid reinforcement planning (with cost-optimal cable reinforcement and parallel lines applied).

Case 2-Natural Gas (geHP)
In this case, the same heat pump allocations as in case 1 were evaluated, but gas engines were assumed instead of electric motors. The required gas connection pipes differ in length and were not limited in this case. As shown in Figure 5, the majority of the town's houses are closer than 100 m to the natural gas grid. However, some areas are further away and the longest required connection pipe has a length of 332.8 m.
This leads to higher grid investments than in case 1 with on average 1,237,127 euros in 2030 and 1,829,862 euros in 2050. These values are theoretical values and indicate an upper limit, as all pipes are implemented as connection pipes. In a real system, the main distribution system may be expanded to supply new demand areas. Thus, shorter house connection pipes would be necessary.
The capacity test shows maximum gas velocities of 13.5 m/s and nodal pressures between 0.80 bar and 1.00 bar in case 2 with 247 geHPs and gas boilers for the remaining 1259 houses. Thus, no predefined operating limits are violated and no reinforcement or extension of the natural gas network is required apart from house connection pipes.

Case 3-Mixed (eHPs and geHPs)
In case 3, both electric and gas engine heat pumps should be deployed. As a reasonable indicator to estimate the house owners' preference for one technology or the other, the house's distance to the gas grid and the respective connection costs were used. For young houses (construction year class L-2016 and later, variant 1) the net present value for heat supply over 20 years is −64,706 euros for eHP and −56,819 euros for geHP, not including connection pipelines. The difference, 7887 euros, equals the costs for a natural gas house connection pipe of 67.2 m length. Thus, this distance is considered as a threshold in case 3.
As in cases 1 and 2, the same allocations of heat pumps were used in case 3. It was assumed that all heat pumps that were closer to the gas grid than 67 m were driven by gas engines (geHPs). Those heat pumps that were further than 67 m away from the existing natural gas network were assumed electrically driven (eHPs). Since the electrical load was reduced (compared to case 1), large parts of the power grid were without violations. However, some load clusters remained and required grid reinforcement ( Figure 11). In general, the violations of the admissible voltage range and the maximum admissible line loads were lower than in case 1. In addition, sectioning point optimization can reduce maximum voltage violations more effectively than in case 1 (see Table 7). On average, this leads to reduced low voltage grid investments of 45.4% (2030) and 33.8% (2050) compared to case 1. At the same time, 35.4% (2030) and 37.2% (2050) of the investments in gas grid connection pipes calculated in case 2 are required.

Combined Costs of Heat Supply and Grid Investments
All grid extension and grid connection costs are summarized in Table A7 and shown in Figure 12. The combined costs of required grid investments per case and heat pump investments, maintenance, and operation are shown with the average emissions in 2030/2050 in Figure 13. For comparison, all costs and investments have been converted to annuities, as installed cables and pipes have much longer lifetimes than heat pumps (see Tables 3 and 6). In all three cases, the required grid investments are low compared to the heat pump related costs. In the scenario with 247 heat pumps, the highest shares of grid investments are 2.1%, 10.6%, and 4.7% for cases 1, 2, and 3, respectively. The average grid investments and other cost components for each case are shown in Figure 14.   In case 2, the cost advantage of geHPs (Table A6) caused by lower energy costs is to a large extent compensated by the higher grid investments. On average, the overall annual costs of case 2 (gas) are 7% lower than in case 1 (electric), both in 2030 and 2050. In case 3 (mixed) a decrease in costs of 0.5% occurs, compared to case 2. The CO 2 -emissions of case 2 are by a factor of 2.9 (2030) and 6.3 (2050) higher than in case 1.

Conclusions
Amongst others, three innovation highlights were addressed in this paper:

•
On the basis of a large number and different types of public data only, a low voltage and gas grid model with a highly diversified spatial resolution has been created for an example town and made available in the Supplementary Materials.

•
We did a mutual investigation of power and natural gas distribution infrastructure for a whole town using a pipe and power-flow grid analysis.

•
For all three cases, we investigated grid investments, heat pump costs, and CO 2 emissions for a multi-perspective approach.
A low voltage network for a town with around 1500 houses has been modeled in pandapower. In addition, a simplified but realistic natural gas distribution network model has been developed in STANET R for the same town. A model of the existing building stock of the town has been derived from OpenStreetMap coordinates and has been enriched with realistic data on construction year classes. Furthermore, information on the houses' energetic refurbishment and household types has been estimated based on detailed statistics. For each house type, different heat demand profiles were simulated and electric load profiles for heat pumps as well as natural gas load profiles for gas boilers and gas engine heat pumps have been derived. Overall, the models can be seen as synthetic with realistic assumptions. They have been compared in terms of costs and emissions. For the majority of the investigated buildings, it was found that eHPs caused higher specific CO 2 -emissions than geHP in 2017. In 2030 and 2050 scenarios, however, the eHP emissions were around 50% and more than 80% below the geHP emission levels, respectively. The specific heat generation costs for eHP decrease strongly with the increasing energetic refurbishment of the buildings. For buildings with little to no energetic refurbishment, a cost advantage for geHP was observed.
Based of the load profiles, the effects of heat pump deployment on either energy infrastructure have been analyzed regarding required grid reinforcement and extension measures. In the power grid, a large share of bus voltage violations could be solved by SPO, which switches lines from one branch to another. If around 11% of the buildings are equipped with electric heat pumps, little to no grid reinforcement is required in the investigated model. For gas engine heat pumps, however, significant grid connection costs can occur if the maximum connection length is not limited. If the share of heat pumps rises to 16%, bigger clusters occur, and average required grid investments in the low voltage power grid increase. Nonetheless, the electric heat pump case (case 1) requires just 12% of the grid investments in the gas engine heat pump case (case 2) and causes 84% less CO 2 emissions (in 2050). If heat pump investments and operating costs are considered as well, case 3 comes on average with 0.3% less annual costs and −28% CO 2 emissions in 2050 compared to case 2. If all remaining geHPs in case 3 are replaced by eHPs, overall annual costs increase on average by 8.0% and CO 2 emissions decrease by 78% (see Figure 13). The observed load clusters indicate the importance of a neighborhood's building characteristics (e.g., energetic refurbishment and age) for grid planning and energy system modeling.

Discussion and Limitations
In the proposed method, multiple building characteristics (construction year, energetic refurbishment, household type) are taken into account. The grid load analysis indicates that the degree of energetic refurbishment has the strongest effect of grid stress. This is partly related to the assumption of decreasing heating temperatures with higher insulation but also shows the importance of energy efficiency.
In the case study, some simplifications and assumptions were made that may have affected the results. In particular, constant cost parameters due to neglected learning curves may have led to overestimated investment costs for heat pumps. Additionally, the fact that present heat generators and existing gas grid connections were not taken into account also led to higher cost estimations. Instead of adding multiple individual house connection gas pipes, synergies could be used by extending the main natural gas grid to reach new demand clusters. For this, the gas grid could be modeled in pandapipes and an algorithm similar to the automated grid planning in pandapower [33] could be applied.
The buildings' heat demand was likely overestimated as well since the building stock was assumed to stay constant and no refurbishments were taken into account. The distribution of the heat within the house included radiators, in-house pipes, and ventilation systems. These systems were not modeled explicitly in this study, but are important within the context of renovation and usability of thermal systems with different temperature levels. Therefore, it is important to distinguish between old buildings with low refurbishment standards and new buildings with low heat demand. Enabling older buildings to use electrical heat pump systems could create much higher costs than in younger buildings.
This work focuses on single-family homes. However, commercial, non-residential consumers will likely have a strong impact on load in the power and natural gas grids. There are commercial consumers, such as restaurants, cooking with natural gas, who may not be willing to change to electrical systems. Solutions for such individual demands have to be taken into account in real urban systems. As the natural gas composition was assumed to stay constant, the emissions were higher than in a scenario with an increased share of green hydrogen, bio-methane, or synthetic fuel usage. Nevertheless, for a comprehensive assessment of the emissions, supply chain emissions of electricity generation and natural gas supply have to be taken into account as well. This could lead to remarkably higher indirect emissions. Traber and Fell [91] reported a global warming potential (20-year horizon) of the natural gas supply chain of 170-337 g CO2-eq /kWh fuel . Compared to scope 1 emissions of 202 g CO2 /kWh fuel , this implies an increase of emissions by 84-266%.
In addition, the investigated cases did not consider other developments that may increase the need for grid reinforcement. In particular, increasing installations of solar PV, charging points for electric vehicles, and the need for air conditioning units can be considered as potential drivers for additional power grid investments.
The grid extension analysis was conducted for a dedicated town with specific infrastructure and building stock characteristics. Therefore, the applied method will likely lead to different results in other towns and further research is required to derive more general results.

Further Research
The calculations were done for a synthetic German town example and the numbers of new heat pumps were taken from a national energy optimization model. However, the number was rather low, so that 11% and 16% of the buildings were to be equipped with heat pumps in 2030 and 2050, respectively. This leaves questions regarding efficient, renewable heating systems for the rest of the buildings in the town. In Germany, the new installation of decentralized oil heating systems will be forbidden, starting in the year 2025. Currently, more than 60% of the buildings in the example town are equipped with such systems. An evaluation of cost and feasibility needs to be done for future scenarios, including the change of all thermal supply systems in the town to a CO 2 neutral solution.
In this study, a simple control algorithm for heating systems has been used and static blocking time slots set by the DSO were assumed. Advanced algorithms may lead to further variation in load profiles and thus reduce simultaneity. This would lead to lower peak load and reduce required grid extension measures. Furthermore, future research may check the usage of small-scale heat pumps for each building against the possibility of installing district heating grids.
The matching power and gas grid models that were created in this work can be used for future research, in particular in the field of coupled power and gas distribution grids.
For municipalities with increasing numbers of heat pumps being installed, the case study provides an initial impression in which operating costs, capital expenditures for households, and grid operators arise and how they are distributed among the stakeholders. As a next step, the individual stakeholders' investment decisions could be investigated in more detail and policy measures (e.g., regional incentive programs) could be coordinated accordingly. However, the results of the case study cannot be generalized without further research.

Conflicts of Interest:
The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

Abbreviations
The following abbreviations are used in this manuscript:   Table A6. Statistical description of overall annualized heat pump investments and yearly energy costs in 1000 euros/a for each case (20 allocations per case). Q 1 , Q 2 , and Q 3 represent 25%, 50%, and 75% quartiles.