Analysis of Dependencies between Gas and Electricity Distribution Grid Planning and Building Energy Retrofit Decisions

Most macroeconomic studies predict a decline in final energy demand and the use of natural gas in the heating sector in Europe. In the course of building retrofitting, gas-based heating systems are predominantly replaced by electricity-based solutions. This influences the business models of electricity and especially gas distribution network operators (DNOs), where grid charges tend to rise. The resulting feedback effect could accelerate the decrease of demand and finally lead to the defection of the gas grid—an effect that has been neglected in energy system analysis so far. We present a multi-agent simulation with a rule-based gas and electricity DNO model and a building retrofit optimization model to analyze these interdependencies during the transformation path, focusing on the role of different technical, economic, and regulatory triggers. Our case studies for a real grid area of a German city shows that an interplay of the gas and electricity DNO’s strategy, as well as the building-, heating system-, grid-, and trigger-configuration, determine the decision on the extension, continuation, or defection of the gas grid infrastructure. Finally, strategies for how to reduce the risk of a gas grid defection, which are relevant for DNOs, policy makers, and creators of macro-economic models, are discussed.


Introduction
More than one third of the final energy consumption of European residential buildings is covered by natural gas [1]. Heat generation accounts for 61% of gas demand on average for all 28 European Union (EU) countries, with 46% being consumed in the residential building sector [2][3][4][5][6]. Scenarios for future gas demand vary widely: Forecasts for China [7,8] or the USA [9][10][11][12] often predict a medium-term increase in gas demand. Studies from Europe predict a stagnation or decline of the final energy demand and use of fossil fuels [2]. Dependent on the predicted technology transformation path, different building retrofit measures, like the reinforcement of the surface insulation or an exchange of the heating system are chosen. On the one hand, British and Irish publications expect measures to increase building efficiency, as well as carbon capture technologies and synthetic gases to decarbonize

•
How do electricity and natural gas grid charges impact the choice of type and size of heating systems as well as the thickness of building surface insulation? • How are the building retrofit decisions, including natural gas and electricity grid costs, influenced by triggers such as carbon dioxide (CO 2 ) pricing and shaped by the building stock? • How strong is the interdependency between the investment strategy of the DNOs and building retrofit decisions in scenarios where gas grid customers leave the grid? • How does a change in the gas DNO strategy influence the choice of building renovation measures, gas grid costs and the strategy's profitability in scenarios with a decreasing demand?
This depicts our main innovation: We measure both the effects of single actors in the energy system and the interdependence between them-on the one side, the influence of building energy retrofit measures on gas and electricity demand, and on the other side, the impact of the DNO's investment strategy on grid charges. We show that a combination of different triggers leads to a significant decrease in gas demand and reduces the gas DNO's revenues and grid length. This finally leads to gas grid defection in the case of an unfavorable combination of the gas DNO's strategy with the building and heating system configurations.
We have organized the paper in four sections: First, we conduct a literature review to analyze factors that influence building owners' retrofit decisions (Section 2.1), and justify our assumptions for the DNO model (Section 2.2) and the multi-agent simulation (Section 2.3). Second, we introduce our methodology and data in Section 3: The research approach (Section 3.1), grid and building and DNO data (Section 3.2), the building model (Section 3.3), the DNO model (Section 3.4), and the multi-agent simulation (Section 3.5). Furthermore, we validate our model (Section 3.6), describe the concept of the case studies (Section 3.7), and analyze their limits and transferability (Section 3.8). After the analysis of sensitivities of building retrofit decisions on energy price fluctuations with the single-level building model (Section 4.1), we provide three main case studies for a real grid area of the German city of Bamberg, varying the building heating and system stock for each of them: An analysis of the role of different triggers on the transformation path (Section 4.2); a measurement of the interdependencies between grid costs and building retrofit decisions (Section 4.3); the determination of the impact of different DNO strategic patterns (Section 4.4). Afterwards, conclusions, options, and risks for the different stakeholders are discussed to motivate further research (Section 5). For a list of the acronyms used, see Table A1 in the Appendix.

Retrofit Decisions of Building Owners
There is a trend in the literature predicting gas-based space heating and domestic hot water generation systems to be substituted by electrical heat pumps [17,19,32]. With that the question arises: What are the influencing factors in building retrofit decisions that trigger such a scenario?
The literature lists various optimization goals of building retrofit models, ranked by the number of works found: Energy consumption, investment expenditures, life-cycle costs, operational expenditures, comfort, total costs, and CO 2 emissions. They focus on the following parts of the building, listed according to their importance: Building envelope, building form and heating, and ventilation and air conditioning systems [33]. Depending on the level of detail and the temporal granularity, simplified analytical models, detailed building models or building performance surrogate models are used [34,35]. Thereby, different approaches like scenario, operation, and planning models have to be distinguished [36]. Most models are mathematical optimizations or artificial intelligence approaches [33,35]. In the case of the building retrofit decisions, the initial building equipment option significantly influences the associated building-specific measure costs for changing the heating system (options like heating circuit, chimney, domestic hot water storage tank, oil or pellet storage or a gas grid connection) [37]. Although this aspect is essential for the assessment in practice, there is a lack in the literature.
We focus on the mapping of a building's individual technical and economic factors within the optimization procedure. Therefore, we use a simplified thermal model based on annual time steps for the energetic calculation and implement an analytical optimization model based on a mixed integer linear program, which minimizes the total costs for heating.

Business Model of a Distribution Network Operator in the Regulatory Environment
Recent works in the field of natural gas or electricity distribution grid planning deal with cost or CO 2 optimal grid reinforcement and restructuring in face of the integration of renewable energy generation [26,28,[38][39][40][41]. For that reason, target planning [25,39] or consecutive multi-stage planning approaches [26,27] are used. Most often the DNO's cash flow, and especially the regulatory mechanism, is neglected. Our model integrates consecutive grid planning, considering the yearly cash flow under regulatory constraints. In the following, we discuss the basics of our cash flow model with regard to current literature.
In the EU, gas and electricity supply are vertically unbundled. Therefore, the grid infrastructure is subject to a natural monopoly and the DNO's business model is constrained by regulatory mechanisms to guarantee a stable and cost-efficient supply [42]. Most regulatory systems are cost-based: The revenues from grid charges income correspond to the marginal costs of grid operation plus a fixed return on equity. Several basic approaches can be distinguished, such as the "revenue cap" method, in which the revenues are constrained, or the "price cap" method, in which the upper limit of grid charges is limited [43]. Purely cost-based approaches lead either to the build-up of cost inefficiencies or a decline in the supply quality; therefore they are supplemented by incentive regulation systems [44,45].
As the characteristics of the incentive systems differ widely between countries [42], we base our work on the basic approach for reasons of transferability. Thereby yearly costs are summed up and a fixed interest rate on equity capital and tax is added. Finally, the costs are rolled up in form of grid Sustainability 2020, 12, 5315 4 of 44 charges on the grid user. Depending on the DNO strategy, we limit the cost base. This corresponds to a wide range of regulatory regimes from minimum to maximum supply costs and efficiency. Table 1 shows the three modeled strategies, with an interpretation of the influence on the supply quality and efficiency. The DNO tries to keep the grid age on a stable level, which constraints the investment ratio, respectively the RC.
Revenue cap 0 0 Stable grid charges (SGC) The DNO tries to keep the GC on a stable level, which constraints the investment ratio, respectively the RC.
Price cap -+ Notes: +: positive effect; 0: stabilizing effect; -: negative effect on the development of supply quality and efficiency; RC: the DNO's revenue cap; GC: grid charges.
All costs of a DNO are summed up in the cost base, where two different types of expenditures are distinguished: The operational (OPEX) and investment (CAPEX) expenditures [42]. Each of them is divided into several cost components. As they often differ between countries, we apply a basic concept based on [21,46,47] according to Table 2. Notes: OPEX: operational expenditure; CAPEX: investment expenditure; +: linear positive dependence; -: negative linear dependence; *: not modeled in this paper; **: derived from real data of the whole grid area and the corresponding DNO's cost-base (Bamberg, 2017).
We divide the CAPEX into depreciations, interest on borrowed and equity capital, and tax, calculated based on the rest book value of fixed assets. The assets are financed with an equity to debt ratio of 40-60% [21]. The imputed depreciation period is determined according to Germany [47] and the historical acquisition costs are used to adapt the simulation to the real grid area.
OPEX is divided into the following components: The operating costs include all non-capitalized assets and costs for personnel, maintenance, and others, modeled linearly depending on the line length. Loss costs, upstream grid charges, and concession fees [48] are modeled linearly dependent on energy supplied [21]. For the sake of simplicity, the dependence of operating costs on the asset age and the energy supplied is not modeled.

Combined Planning and Operation of Building and Multi-Utility Grid Infrastructure
There are multi-energy-planning approaches focusing on operation or planning issues on the transmission network level [26][27][28]38,39]. Others address the planning of distribution networks, with a focus on energy conversion between the power and gas sectors [41,49] or planning under uncertainty [40]. Some studies evaluate and plan multi-energy systems combining building and grid infrastructure on the micro-grid or city-district level [50][51][52]. Moreover, authors cover planning issues of interconnected heating, power, and gas grids [36,53,54]. Some of them consider the interface between grid and building infrastructure [53]. Almost without exception, the approaches are concerned with the construction, expansion, and restructuring of existing network structures or the integration of renewable sources. Most often they use mathematical programs to find the optimal configuration for the overall system or the one of a single actor [36,55,56]. There is a lack in literature when it comes to the analysis of the impact of feedback effects and interdependencies between DNOs and building retrofit decisions, and the role of possible political and regulatory triggers and tipping points within the transformation path that could cause gas grid defection.
There are different suitable methodological approaches for the coupling of different energy carriers or actors: Some integrate the subsystems into an overall optimization model [53], while others apply bi-level optimization approaches [26] or a multi-agent simulation (MAS), which we use. With regard to the theory of business dynamics [57], this method enables the evaluation of the structure and dynamics within the complex system of balancing or reinforcing cause-effect relationships between the interdependent actors. In a MAS, there is no overall system goal. The system behavior is only determined by the decisions of the individual autonomous and independent agents [58][59][60]. In this way, it is possible to investigate the behavior of each single actor and their interaction.

Research Approach
We postulate an interdependence between building owners' and the electricity and gas network operators' investments. Due to different triggers, gas-based heating systems are substituted, which leads to a decrease in demand and thus an increase in gas grid charges. The increase in electric heat pumps has a reducing effect on electricity grid charges, which further accelerates this development. A self-reinforcing mechanism starts, which can lead to a complete defection of the gas network. We address this issue with a multi-agent simulation (MAS), where the distributed autonomous and independent acting residential building agents interact with the natural gas and electricity grid, each of which is operated by a DNO agent (Figure 1).
The buildings, and respectively their owners (BOs), are represented by a mixed integer linear program (MILP). The BOs' objective is to minimize the life-cycle costs of building retrofit measures focusing on space heating as well as drinking hot water generation and considering investment and operational expenditures. The degrees of freedom are the size and type of the heating system or the solar thermal system and the surface insulation thickness.
The gas and the electricity network operators act independently, represented by a rule-based model: Renewal, reinforcement, and closure measures are chosen considering the investment budget, which is determined by the strategy of each DNO and constrained by the regulatory environment; load and pipe flows simulations are carried out to ensure a supply within technical limits; total yearly grid costs are summed up in a cash flow calculation and passed on to customers in the form of energy-based grid charges. The buildings, and respectively their owners (BOs), are represented by a mixed integer linear program (MILP). The BOs' objective is to minimize the life-cycle costs of building retrofit measures focusing on space heating as well as drinking hot water generation and considering investment and operational expenditures. The degrees of freedom are the size and type of the heating system or the solar thermal system and the surface insulation thickness.
The gas and the electricity network operators act independently, represented by a rule-based model: Renewal, reinforcement, and closure measures are chosen considering the investment budget, which is determined by the strategy of each DNO and constrained by the regulatory environment; load and pipe flows simulations are carried out to ensure a supply within technical limits; total yearly grid costs are summed up in a cash flow calculation and passed on to customers in the form of energybased grid charges.

Grid and Building Data and Software Tools
We base our investigation on real data of a residential area in the southern German city of Bamberg ( Figure 2a). The 129 buildings are supplied via a 2987 meter-long low voltage grid with an average age of 29.3 years, and a 2432 meter-long low-pressure grid with an average age of 29.5 years ( Figure 2c). Both grids are connected to the upstream medium voltage, i.e., the pressure grid. The corresponding connection points are the medium to low voltage (MV/LV) transformer and the medium to low (MP/LP) pressure regulator station, which are modeled by a feeder. The buildings are assigned to reference buildings (according to the institute of housing and environment (IWU) in the TABULA project (typology approach for building stock energy assessment)) based on their energy consumption, floor space, and type [61,62]. The average reference area of the buildings is 137 m² and the average specific heating demand is 208 kWh/(m²·a), with 67% gas-bound, 20% electric and 13% oil-bound heating systems (Figure 2b). The heating circuit temperatures and building equipment are mapped to the buildings based on their renovation status and their initial heating system based on Open Street Maps [63] and census data (spatial resolution: 100 × 100 m) [64].

Grid and Building Data and Software Tools
We base our investigation on real data of a residential area in the southern German city of Bamberg ( Figure 2a). The 129 buildings are supplied via a 2987 meter-long low voltage grid with an average age of 29.3 years, and a 2432 meter-long low-pressure grid with an average age of 29.5 years ( Figure 2c). Both grids are connected to the upstream medium voltage, i.e., the pressure grid. The corresponding connection points are the medium to low voltage (MV/LV) transformer and the medium to low (MP/LP) pressure regulator station, which are modeled by a feeder. The buildings are assigned to reference buildings (according to the institute of housing and environment (IWU) in the TABULA project (typology approach for building stock energy assessment)) based on their energy consumption, floor space, and type [61,62]. The average reference area of the buildings is 137 m 2 and the average specific heating demand is 208 kWh/(m 2 ·a), with 67% gas-bound, 20% electric and 13% oil-bound heating systems (Figure 2b). The heating circuit temperatures and building equipment are mapped to the buildings based on their renovation status and their initial heating system based on Open Street Maps [63] and census data (spatial resolution: 100 × 100 m) [64].
The area is supplied by the city's DNO, which is responsible for the electricity as well as the gas supply. The electricity DNO has a revenue cap of approx. 20 M€ and the gas DNO has a revenue cap of approx. 10 M€. Table 2 shows the percentage distribution of the cost components of the revenue caps. Grid data were provided by the DNO: Line and asset data are from the geo-information system and the internal asset database; georeferenced metering information (energy consumption) of individual grid users is from the energy data management system; and the cost components of each revenue cap are from the cost allocation sheet. All data were recorded in 2018 for the financial year 2017. The software-based models were created on a Python basis, using pandapower [65] for the load flow calculations in the low voltage grid, Mesa [66] for the multi-agent simulation, NetWorkX [67] for the graph analysis, and Pyomo [68,69] together with the commercial solvers CLPEX [70] and Gurobi [71] for the optimization. For the pressure loss calculations, we have used the commercial software STANET [72]. The area is supplied by the city's DNO, which is responsible for the electricity as well as the gas supply. The electricity DNO has a revenue cap of approx. 20 M€ and the gas DNO has a revenue cap of approx. 10 M€. Table 2 shows the percentage distribution of the cost components of the revenue caps. Grid data were provided by the DNO: Line and asset data are from the geo-information system and the internal asset database; georeferenced metering information (energy consumption) of individual grid users is from the energy data management system; and the cost components of each revenue cap are from the cost allocation sheet. All data were recorded in 2018 for the financial year 2017. The software-based models were created on a Python basis, using pandapower [65] for the load flow calculations in the low voltage grid, Mesa [66] for the multi-agent simulation, NetWorkX [67] for the graph analysis, and Pyomo [68,69] together with the commercial solvers CLPEX [70] and Gurobi [71] for the optimization. For the pressure loss calculations, we have used the commercial software STANET [72].

Building Retrofit Optimization Model
The objective of the model is to minimize total expenditure c (Equation 1). This includes the capital expenditures for a change of the heating system c , the improvement of the building envelope c , the operational expenditures for maintenance c , and energy procurement c . The expenditures are calculated for the expected technical lifetime of the heating system based on annual time steps t for each building of the area . For a list of the acronyms used, see Table B1 in Appendix B.1.
For this purpose, the optimizer can choose the surface insulation thickness out of the available thicknesses , represented by the decision variable , and the heating system out of the available systems , represented by , . A solar thermal plant out of the available systems can be added, represented by , .

Building Retrofit Optimization Model
The objective of the model is to minimize total expenditure c B (Equation (1)). This includes the capital expenditures for a change of the heating system c BES , the improvement of the building envelope c BE , the operational expenditures for maintenance c M , and energy procurement c EN . The expenditures are calculated for the expected technical lifetime of the heating system T based on annual time steps t for each building of the area J. For a list of the acronyms used, see Table A2 in Appendix B.1.
For this purpose, the optimizer can choose the surface insulation thickness out of the available thicknesses D, represented by the decision variable b BE , and the heating system out of the available systems K , represented by b BES , . A solar thermal plant out of the available systems S can be added, represented by b STE , . We model the building surface in a single-zone model, calculate the design-relevant heat load S BE , based on DIN EN 12831 (German and European harmonized standard) [73], evaluate insulation measures following [74], and choose parameters based on [37,[75][76][77][78][79][80][81]; see Supplements A.1, A.2, and A.4. The investment expenditures for the building envelope (BE) c BE depend on the insulation thickness of the building surface area A E and the equivalent insulation thickness D D (Equation (2)). The optimizer decides whether to retrofit the building surface and can choose thicknesses between 0 and 30 cm. The cost parameters C BEvar and C BEfix are calculated individually for every building based on the area ratios of the individual surface parts and costs [75]: roof, facade, windows, floor, and door. with Sustainability 2020, 12, 5315 The investment expenditures c BES for the building energy system (BES) are dependent on the building heat load S BE , , which includes transmission and ventilation losses. S BE , is a function of the building insulation thickness D D as well as the initial building and usage properties. C BESvar represents the variable, C BESfix , is the fixed parts of the expenditures, and C STEvar as well as C STEfix , are the expenditures of the solar thermal plant (STE) S STE , (Equation (3)). The solar thermal plant is modeled based on [62, 82,83] and covers a part of the demand for drinking hot water S DHW , dependent on the choice of the heating system and the type of the solar thermal plant; see Supplement A.3. All cost components are calculated individually for each building in a preprocessing procedure based on the initial building equipment and the possible building equipment options (see Supplement A.5).
The expenditures for energy procurement c EN are a function of the yearly energy demand (Equation (4)). They are calculated based on the heat load S BE , and the domestic hot water demand S DHW , which is reduced by the solar thermal plant S STE , and S S . S S represents parts of the heat load that are not affected by the renovation measures in our model: heat distribution losses, auxiliary energy, radiation losses, and internal wins. The final energy demand is determined in consideration of the yearly usage hours T N and the plant expenditure figure of the heating system E BES . The energy price C EC c, = Invest is calculated based on the year of investment = Invest and discounted with the present-value factor PF. We consider the energy procurement price C Proc c, , tax C Tax c, , and grid charges c GC c, = Invest . The charges represent the dual variable, making the building owner investment decision interrelated to the one of the DNOs for grid-bound systems.
The yearly expenditures for maintenance c M are influenced by the heating system and solar thermal plant type and size, modeled via a fixed yearly rate M BES . It dependent on the investment expenditure of the heating system [76] and is discounted via the present value factor PF (Equation (5)).
To linearize the nonlinear mixed integer program, we use an approach according to [84]. The decision variables are constrained so that one renovation measure of the heating system has to be performed. The construction of a solar thermal plant and the renovation of the building envelope are possible options. For the constraints used, see formulas A1-A7 in Appendix B.2.

Distribution Network Operator Model
Within the multi-agent simulation the gas as well as the electricity DNO agent perform several steps ( Figure 3).
To linearize the nonlinear mixed integer program, we use an approach according to [84]. The decision variables are constrained so that one renovation measure of the heating system has to be performed. The construction of a solar thermal plant and the renovation of the building envelope are possible options. For the constraints used, see formulas A1-A7 in Appendix B.2.

Distribution Network Operator Model
Within the multi-agent simulation the gas as well as the electricity DNO agent perform several steps ( Figure 3). First, the DNO reacts to the building owners' decision by planning the grid closure, reactivation, construction, and reinforcement measures necessary for grid operation within technical boundaries. In the next step, the investment budget for renewal measures will be determined based on a cash flow calculation, considering its strategy and costs structure and the energy supplied, as well as the grid length and age. Individual measures are chosen with regard to an age-based renewal strategy [85]. In the last step, the revenue cap and resulting grid charges are determined ( Figure 3). Load flow [65] or pressure loss calculations [72] are carried out to check technical limit values, whereby voltage drop and load are checked for electricity grid, and pressure and flow velocity for the gas grid.
The revenue cap is split into CAPEX and OPEX and passed on to the grid users in form of grid charges c , (Equation 6). These charges depend on the energy supplied for heating applications in the gas grid e , or electricity grid e , and other demands E , . Both the energy demand and the grid charges are the dual variables of the model [29]. For a list of the acronyms used in the DNO model, see Table C1 in Appendix C.1. ∀ ϵ : α , + α , − c , ⋅ e , + E , = 0; with α , = α , + α , + α , + α , ; α , = α , + α , + α , + α , We show the calculation systematics of the individual cost components of CAPEX based on electricity lines ( = electricity). The approach can be transferred analogously to other grid assets of electricity and gas networks.  First, the DNO reacts to the building owners' decision by planning the grid closure, reactivation, construction, and reinforcement measures necessary for grid operation within technical boundaries. In the next step, the investment budget for renewal measures will be determined based on a cash flow calculation, considering its strategy and costs structure and the energy supplied, as well as the grid length and age. Individual measures are chosen with regard to an age-based renewal strategy [85]. In the last step, the revenue cap and resulting grid charges are determined ( Figure 3). Load flow [65] or pressure loss calculations [72] are carried out to check technical limit values, whereby voltage drop and load are checked for electricity grid, and pressure and flow velocity for the gas grid.
The revenue cap is split into CAPEX and OPEX and passed on to the grid users in form of grid charges c GC c, (Equation (6)). These charges depend on the energy supplied for heating applications in the gas grid e . Both the energy demand and the grid charges are the dual variables of the model [29]. For a list of the acronyms used in the DNO model, see Table A3 in Appendix C.1.
Heating c, We show the calculation systematics of the individual cost components of CAPEX based on electricity lines (c = electricity). The approach can be transferred analogously to other grid assets of electricity and gas networks. For all lines in operation L , the return on equity (Equation (7)), the interests on borrowed capital (Equation (8)), and the trade tax (Equation (9)) are calculated based on the individual rest book value (factor) RBVF , , and the historical acquisition costs C I , as well as the equity Q EC or debt ratio Q BC , the corresponding interest rates R EC or R BC , or the trade tax rate R Tax . For lines in operation within the technical lifetime T TL , depreciations are calculated based on the initial line age T init and considered via C Depr , (Equation (10)). If a line is renewed or shut down before the end of its lifetime, the resulting special depreciation is excluded from the revenue cap [47].
For the determination of OPEX, we proceed as follows (c = electricity): The operating costs are modeled linearly dependent on the grid length based on C LRC (Equation (11)). Loss costs dependent on the loss factor F Loss (Equation (12)), upstream grid costs (Equation (13)), and concession fees (Equation (14)) are modeled based on the corresponding specific costs C LC , C UpGC , and C Conc , directly proportional to the dual variable e Heating and thus to the energy supplied.
The DNO's degree of freedom lies in the determination of grid measures. Thereby, we distinguish between (a) measures necessary for grid operation and (b) measures to maintain the grid value: (a) The grid length and energy supplied are predetermined by the building owners' decisions in each year. As the DNO has to guarantee a non-discriminatory supply to all customers [46], measures have to be applied to fulfill the supply task within technical limits. (b) The DNO has to ensure a reliable and cost efficient supply [46]: We choose an age-related renewal strategy for the low voltage and the low pressure grid.
Once the measures necessary for network operation (a) have been carried out, all lines or pipes are sorted by age and renewed from old to young (b) until the investment budget is reached. The budget depends on the DNO strategy; see Figure A1 in Appendix C.2. The basic idea of all strategies is to keep the respective target on a constant level by reducing or increasing investments according to (b). Measures according to (a) reduce the investment budget, which, in extreme cases, leads to a change in the respective target figure (RC, GC, grid age). To avoid exotic age distributions, the asset age is limited to half and double the individual technical lifetime T TL [22].

Multi-Agent Simulation
All buildings and respectively the owners and all assets of the gas and electricity grid are modeled as own agents. Technical and economic parameters are propagated to the DNO via a predefined hierarchy. Vice versa measures are delegated to the respective asset (see Supplements B.1 and B.2). The agent model determines how the individual grid agents are instantiated and initialized in a given electricity or gas distribution network and regulates the activation sequence of the agents as well as the communication between them. The agency is the total of all agents and includes all created grid agent instances, building agents, and the scheduler modeled with the Python package MESA [66]. Our agency implements the MESA model class and imports the MESA scheduler class. New grid agent objects that implement the MESA agent class are created via the agency class and added to the scheduler. Table 3 shows the implemented agent types according to [86][87][88][89][90]. Each agent has a different level of complexity, which is reflected in their element-specific tasks in consideration of the individual design goals [60,91]. All agents, even the nodes, lines, and pipes of the grid are reactive. They are triggered by stimuli (input) from their environment and generate actions (output) [60]. For example, if a gas pipe does not receive a gas demand from its neighboring node (input), it triggers an event (output), indicating that it can be closed. The main benefit of this modeling approach is the decomposition and modularization of a complex and dynamic system or problem, in our context the interaction between grid assets and buildings [86]. Furthermore, it reduces the effort needed to expand or modify parts of the simulation system, e.g., change the individual agent specific design goals. We have classified the MAS according to [92] and interpret the properties as follows (Table 4): • "Accessibility" describes the ability of an agent to access all other agents of the network; • "Deterministic" describes if the cause-effect relationship of actions of agents is known or not; • "Episodic" describes whether the simulation time steps are interrelated; • "Dynamic" describes the possibility of environmental changes beyond the control of an agent; • "Discrete" describes if there is a predetermined number of perceptions and actions. The gas or electricity network is modeled as a graph in an undirected tree, in which the agents are arranged hierarchically [93]. This corresponds to a radial grid structure. All agents are executed once during a time step starting at the lowest element-the "Building owner"-and ending at the highest element-the "Network operator". Thus, the information is propagated from the bottom up, meaning that the network operator follows the investment decision of the building owner; see Figure 4. The scheduling method follows a breadth first search (BFS) algorithm in the reverse direction [92]. Conventionally, the BFS traverses a graph from the top to the bottom layer after activating all nodes of a layer, where the algorithm expands in width until it terminates when all nodes have been visited. As we turn this mechanism around, our algorithm terminates after activating the DNO (see Supplement B.1).

Validation of the Building Model
We validated our results for different building types-a single family (SFH), a terraced (TH), and a multi-family house (MFH), and age classes from approx. 1900-2009 (A-J) [61,62] within the literature. For the energy calculation we compared with [62] and for the cost calculation with [94]. Figure 5a shows the results of the yearly final energy demand normalized by the reference floor area (gas-based solution): For buildings of the age classes A-H, we underestimated the energy demand by 5% on average; for classes I-J, we overestimated by 6% on average. The differences are induced by internal and drinking hot water generation losses, which we modeled according to [95]. We assume that the energy calculation model and its parameterization is valid for the present study, as the deviations are below the level caused by individual user behavior in terms of room temperature and ventilation [96,97].  The scheduling method follows a breadth first search (BFS) algorithm in the reverse direction [92]. Conventionally, the BFS traverses a graph from the top to the bottom layer after activating all nodes of a layer, where the algorithm expands in width until it terminates when all nodes have been visited. As we turn this mechanism around, our algorithm terminates after activating the DNO (see Supplement B.1).

Validation of the Building Model
We validated our results for different building types-a single family (SFH), a terraced (TH), and a multi-family house (MFH), and age classes from approx. 1900-2009 (A-J) [61,62] within the literature. For the energy calculation we compared with [62] and for the cost calculation with [94]. Figure 5a shows the results of the yearly final energy demand normalized by the reference floor area (gas-based solution): For buildings of the age classes A-H, we underestimated the energy demand by 5% on average; for classes I-J, we overestimated by 6% on average. The differences are induced by internal and drinking hot water generation losses, which we modeled according to [95]. We assume that the energy calculation model and its parameterization is valid for the present study, as the deviations are below the level caused by individual user behavior in terms of room temperature and ventilation [96,97].  The scheduling method follows a breadth first search (BFS) algorithm in the reverse direction [92]. Conventionally, the BFS traverses a graph from the top to the bottom layer after activating all nodes of a layer, where the algorithm expands in width until it terminates when all nodes have been visited. As we turn this mechanism around, our algorithm terminates after activating the DNO (see Supplement B.1).

Validation of the Building Model
We validated our results for different building types-a single family (SFH), a terraced (TH), and a multi-family house (MFH), and age classes from approx. 1900-2009 (A-J) [61,62] within the literature. For the energy calculation we compared with [62] and for the cost calculation with [94]. Figure 5a shows the results of the yearly final energy demand normalized by the reference floor area (gas-based solution): For buildings of the age classes A-H, we underestimated the energy demand by 5% on average; for classes I-J, we overestimated by 6% on average. The differences are induced by internal and drinking hot water generation losses, which we modeled according to [95]. We assume that the energy calculation model and its parameterization is valid for the present study, as the deviations are below the level caused by individual user behavior in terms of room temperature and ventilation [96,97].   While the end energy demand of the six buildings after retrofitting is well matched (mean deviation: 5.8%), the cost calculation shows deviations between −5 and 40%, which is caused by the parameterization of the cost functions. We use parameters considering [75], where the authors analyzed costs of building and heating system retrofit measures for 1117 buildings in Germany and showed that there is a great variance in practice: The standard errors for thermal insulation systems depicts 6.9% for C BEfix and 15% for C BEvar in full costs (facade). Another reason for the deviations results from different assumptions regarding the reference floor and surface area of type buildings and the consideration of the initial building equipment options, rather the costs of retrofitting (e.g., gas grid connection, oil tank or heating circuit temperature). We modeled these equipment options by adjusting the parameters of the cost functions of the individual measures based on the individual initial building equipment options in preprocessing.

Case Study 1: Sensitivities of Building Retrofit Decisions
In this case study, we faced the question of how electricity and natural gas grid charges influence the choice of building and heating retrofitting measures. For that reason, we analyzed the retrofit decisions of 609 different building and heating system configurations for a variation of electricity and gas prices. The results can be used to classify and compare our findings of the case studies (4.2, 4.3, and 4.4) with the literature. We varied energy prices by +23% and −12% for electricity and +25% and +50% for gas from the initial point and combined them in nine price scenarios. The price changes correspond to a change of grid charges in the electricity sector of −50% and +100% and in the gas sector of +100% and +200%. These price change levels were used as the relationship between demand and grid costs is non-linear and the expected development differs between gas and electricity. The investigation was based on the German average prices for electricity-30.85 ct/kWh-and gas-6.34 ct/kWh-for a medium-sized residential building (energy consumption electricity: 3500 kWh/a, gas: 5556-55,554 kWh/a) [79].

Case Study 2: Analysis of Possible Triggers for a Decline in Gas Demand
In this case study, we answer the question of how building retrofit decisions and thus the natural gas and electricity grid costs are influenced by technological and regulatory triggers and are shaped by the individual initial building insulation status and heating type. Therefore, we distinguish eight types of triggers: • Taxation and levy systems: There is a wide spread of different taxation and levies and systems. We focused on CO 2 pricing, as the German government has passed a law in 2019 that sets a CO 2 price of 25 €/t in 2021, rising to 65 €/t by 2026 [98].
• Grid charge models: In Germany, DNOs can reduce the electricity grid charges for interruptible grid users down to 20% of their regular value [99] (25% for the area under investigation). • Regulatory energy efficiency constraints: In Germany, regulatory constraints for new constructions and retrofittings are listed in the energy saving regulation [100], which will be tightened in the future [101]. We set the initial final energy demand and CO 2 emissions as an upper bound in all simulations. Additionally, two scenarios were modeled, where we tightened the limit and set the primary target equal to the useful energy demand, calculated based on [100]: • In simulation 3, 100% of the buildings have to perform a surface insulation measure and change their heating system to obtain the target.

•
For simulations 8-10, we oblige only 66% of buildings to retrofit their envelope and heating system. 34% can freely choose the kind of measure to reach the efficiency target of [100]. This represents a surface renovation ratio of approx. 2%, corresponding to a technical lifetime of the surface of 50 years often used in literature [32].
• State market incentive and subsidy programs: We consider the situation in Germany: For building envelope renovations, there is a state subsidy program, which on average subsidizes about 30% of investment expenditures [102]. For heat pumps, there is a market incentive program with an average subsidy rate of 40% [103]. • Technological development: The efficiency of heat pumps is highly dependent on the coefficient of performance (COP), which is predicted to increase by about 25% in the next decade [104]. • Decentralized energy generation: In recent years, heat pumps have increasingly been combined with photovoltaic plants and battery storage systems. We do not examine PV-battery systems in our analysis, as we focus on the effects on gas grids. • Initial building insulation status, heating type and date of investment: The initial building age class and heating system largely determines the date of investment and the choice of the renovation measure. As the age and the types of heating systems and buildings are heavily weighted in our dataset, we analyze scenarios with a variation (100 seeds) of the date of investment (I), the initial building age class (B), and the initial heating system (H). For that reason, we reconfigure the initial gas and electricity grid when varying the initial heating systems.
First, we analyze the influence of each of these triggers in simulations 1-6 (see Table 5, marked in grey). Second, we combine triggers, generating two sensitive but opposing scenarios with a high probability of occurrence for Germany: Simulation 7 induces a high proportion of gas-based solutions in the future system, while simulation 8 induces increased substitution of gas-based heating by other systems. Third, we evaluate the influence of a variation of initial building age classes (B) and heating system types (H) of the building stock in simulations 9-11 (marked in blue). These results are compared with simulation 8, since the same combination of triggers is in use. We vary the date of investment (I) for each building in 100 seeds in all simulations. Every building performs one retrofit during the planning horizon from 2020 to 2050, which corresponds to a lifetime of the heating systems of about 31 years; see Supplements C.1 and C.2 for the parameterization.
In the case studies in 4.3. and 4.4, we set the triggers corresponding to "Combination 2" (simulation: 8) because of:

•
Objective of the analysis: We focused on the evaluation of building owners' and electricity and gas DNO's strategies in transformation paths with a decreasing gas demand. • Probability of occurrence: In simulation 8, we have chosen each trigger corresponding to the situation in Germany, as there will be CO 2 pricing in the future. There are subsidization programs, reduced electrical grid charges, and energy efficiency constraints. In this analysis, we address the question of how interdependencies between the DNO's investment decisions and building owners' retrofit decisions are shaped in scenarios with a decreasing gas demand. For that reason, we interrupt the communication of grid charges from DNO to the building owners during the multi-agent simulation, so that building owners decide based on the initial grid charges c GC c, = c GC c, =0 . The results are compared with those of the simulation in which the building owners decide based on the grid charges of the year of building renovation c GC c, = c GC c, = Invest ; see Table 6. We focus on the situation in the gas sector, where we consider the two dual variables, analyzing their development during the planning horizon: The grid charges as a measurement of the sensitivity of grid costs to the given supply task during the transformation path, and the yearly gas demand as measurement for the sensitivity of building retrofit decisions to the costs of grid operation. Measuring the feedback effects between the building owners as well as the electricity and gas DNO allows us to answer the question whether grid costs are a trigger element that could accelerate the decline in gas demand and influence the technology transformation path of heating systems. In this study, we answer the question of how a change in the investment strategy of the gas DNO influences the following: The choice of building retrofit measures (measured by gas demand), the gas grid costs (measured by grid charges), and the profitability of the gas grid (measured by the revenue cap, grid length and age) in scenarios with a decrease in gas demand. For that reason, we compare three main strategies, whereby the DNO tries to keep grid charges (SGC), grid value (SGV), or the revenue cap (SRC) on a stable level during the planning horizon (see Table 1 and Appendix C.2).
We focus on the situation in the gas sector and set the triggers according to "Combination 2". In simulations 8gc, 8gv, and 8rc the date of investment (I) of the buildings are varied and compared to simulations 10gc, 10gv, and 10rc, where the initial building age types and heating system types (I, B, H) are varied ( Table 7). The results can be used to determine the effects of differently shaped regulatory systems on the DNO business model and the efficiency and quality of the gas supply.

Limits, Transferability, and Representativity of the Analysis
In order to guarantee transferability of the results, we used IWU-type buildings [61,62] in all case studies. We varied the date of investment (I), the initial building age classes (B), and the heating system (I) probabilistically in 100 seeds, which constitutes a representative sample size for the analysis in case studies 4. The assumptions for the costs within the building investment model represent a medium case compared to the literature [75]. For the following reasons, the DNO model for gas and electricity underestimates the cost base compared to reality:

•
The grid charges for upstream grid levels (α UpGCG ) are assumed to be constant during the planning horizon in both the electricity and gas sectors. In reality, these charges would also change with the demand.

•
The operational costs for the electricity and gas grid are formulated as linearly dependent on the grid length and independent on grid age. As they include components such as personnel costs and rents for buildings, they are in reality stepped fixed costs related to the grid length, which follow a change of the grid length delayed [22].

•
Costs for line closure measures of house connections in the gas grid are currently valued at 0 € per measure, as they can currently be allocated to the customer.

Case Study 1: Sensitivities of Building Retrofit Decisions
The results of the analysis of building retrofit decisions for the 609 type buildings in ten price scenarios are expressed as shares of the total sample (Figure 6b) or mean values of a part of the sample (Figure 6a). Figure 6a shows the specific final energy demand for single and multi-family buildings: When electricity and gas energy procurement expenses are high, insulation measures are increasingly chosen (20% of the buildings for G:9.48/E:38.07; 8.3% for G:6.34/E:27.24), primarily for older buildings (71% are applied in age classes A-C for G:9.48/E:38.07). Since insulation measures are expensive compared to other energy efficiency measures, they are chosen by only a small proportion of buildings when energy prices are high. Therefore, in reality they are mostly applied at the end of the technical life of the respective part of the building envelope [32].
substituted by oil-based systems or supplemented with solar thermal plants. Current regulations inhibit this trend in Germany [105]. Due to their high initial energy efficiency, heat pumps are becoming more attractive for G-H and I-J class buildings, often supported with solar thermal energy when electricity prices are high. The attractiveness of heat pumps depends strongly on the parameterization of the annual COP: We use the specifications of the Federal Office for Export Control for the market incentive program in Germany [106] and adapt them for different heating circuit temperatures [107]. Lowering the heating circuit temperature increases the efficiency of heat pumps, but is associated with costs, so it is not often chosen (e.g., 15% of the buildings for G:6.34/E:27.24). Condensing boilers are increasingly being chosen in buildings of age classes A-C and D-F, where decisions are sensitive to energy price variations (Figure 6b): With a rising gas price they are substituted by oil-based systems or supplemented with solar thermal plants. Current regulations inhibit this trend in Germany [105]. Due to their high initial energy efficiency, heat pumps are becoming more attractive for G-H and I-J class buildings, often supported with solar thermal energy when electricity prices are high. The attractiveness of heat pumps depends strongly on the parameterization of the annual COP: We use the specifications of the Federal Office for Export Control for the market incentive program in Germany [106] and adapt them for different heating circuit temperatures [107]. Lowering the heating circuit temperature increases the efficiency of heat pumps, but is associated with costs, so it is not often chosen (e.g., 15% of the buildings for G:6.34/E:27.24).
The results imply that fluctuations in energy prices influence the investment decision for heating systems and surface renovations depending on the building age: With rising electricity and gas prices, insulation measures and solar thermal systems are increasingly chosen. Gas burners are more sensitive to energy price fluctuations than electric heat pumps because of their lower efficiency and their low investment compared to operational expenses. The attractiveness of electrical heat pumps increases with a rising building energy efficiency and annual COP. Conclusions can be drawn for the building stock of case studies 4.2, 4.3, and 4.4: Gas and oil condensing boilers in combination with solar thermal systems are increasingly being installed (77% of the buildings belong to building age class D-F, 17% to G-H, and 6% are younger, with 80% being terraced houses, 15% single family houses, and 5% multi-family houses).

Case Study 2: Analysis of Possible Triggers for a Decline in Gas Demand
We split the analysis of the eight trigger scenarios and the building type variations into three subsections: The building retrofit decision, the resulting energy demand, and the grid costs.

Investment Decisions of Building Owners
The results regarding the insulation measures (Figure 7b) support the findings from 4.1: The optimizer does not select an insulation measure if the choice of the measure type is not constrained and the energy saving constraints could only be achieved by a switch of the heating system (simulations 1, 2, 4-7). In this case, heat pumps come into play and substitute surface insulation measures (compare simulations 3 and 8). To generate scenarios with a real surface renovation rate, it must be constrained (simulations 3, 8-11).
Sustainability 2020, 12, x FOR PEER REVIEW 18 of 42 sensitive to energy price fluctuations than electric heat pumps because of their lower efficiency and their low investment compared to operational expenses. The attractiveness of electrical heat pumps increases with a rising building energy efficiency and annual COP. Conclusions can be drawn for the building stock of case studies 4.2, 4.3, and 4.4: Gas and oil condensing boilers in combination with solar thermal systems are increasingly being installed (77% of the buildings belong to building age class D-F, 17% to G-H, and 6% are younger, with 80% being terraced houses, 15% single family houses, and 5% multi-family houses).

Case Study 2: Analysis of Possible Triggers for a Decline in Gas Demand
We split the analysis of the eight trigger scenarios and the building type variations into three subsections: The building retrofit decision, the resulting energy demand, and the grid costs.

Investment Decisions of Building Owners
The results regarding the insulation measures (Figure 7b) support the findings from 4.1: The optimizer does not select an insulation measure if the choice of the measure type is not constrained and the energy saving constraints could only be achieved by a switch of the heating system (simulations 1, 2, 4-7). In this case, heat pumps come into play and substitute surface insulation measures (compare simulations 3 and 8). To generate scenarios with a real surface renovation rate, it must be constrained (simulations 3, 8-11).  Figure 7a shows that inefficient electrical direct heating is mostly substituted by gas condensing boilers (simulations 1-7). Due to the high initial connection rate to the gas grid (approx. 85%), the grid charges and with that the operational expenditures of gas-based heating are comparatively low. As gas grid connections are available in many buildings, the investment expenditures are also low for gas burners. With a drop of initially installed gas-based solutions, their usage is significantly reduced in target systems; compare simulation 8 and 10. A reduction of the heating circuit temperature, which is necessary for most buildings in the investigated area when switching to an electrical heat pump, is associated with higher costs compared to the solutions based on burners. The results for "Combination 2" hardly differ with a variation of building age class (simulations 8 and 9).  Figure 7a shows that inefficient electrical direct heating is mostly substituted by gas condensing boilers (simulations 1-7). Due to the high initial connection rate to the gas grid (approx. 85%), the grid charges and with that the operational expenditures of gas-based heating are comparatively low. As gas grid connections are available in many buildings, the investment expenditures are also low for gas burners. With a drop of initially installed gas-based solutions, their usage is significantly reduced in target systems; compare simulation 8 and 10. A reduction of the heating circuit temperature, which is necessary for most buildings in the investigated area when switching to an electrical heat pump, is associated with higher costs compared to the solutions based on burners. The results for "Combination 2" hardly differ with a variation of building age class (simulations 8 and 9). Figure 8 illustrates the transformation path of the natural gas demand for the projected years: 8a for different triggers (1-6) and their combinations (7-8), 8b for the variation of building age and heating types. In this area, gas is only used for heating applications; therefore a substitution of gas burners directly induces an increase (1, 2, 4-7) or decrease (8) in demand. Although in simulation 3 in 2050 approx. 90% of the heating systems are gas-based, we see a drop of about 55% in demand, which is induced only by surface insulation measures and solar thermal plants (Figure 7b). A comparison of simulations 8-10 shows that the initial building age and heating system configuration have a significant influence on the future supply task. A lower initial house connection rate in the gas grid increases the risk of a complete gas grid defection. While in simulation 8, the initial gas grid connection rate is 85%, in simulation 10, it depicts on average 20%. This causes higher initial grid charges and an increase of the specific investment expenditures for gas condensing boilers, which reduces their attractiveness in simulation 10. This effect can also be seen when comparing the "Base-Case" scenarios (simulation 1, 11). With a decreasing gas grid connection rate, the development of gas grid charges is therefore significantly more sensitive to endogenous economic, regulatory, and technical triggers. When looking at the electricity demand, another picture can be drawn, since the heating applications cover only a part of the supply task. For that reason, the substitution of electric direct heating systems causes a decrease of 35-60% from 2020 to 2050; see Figure A2 in Appendix D.1.  Figure 8 illustrates the transformation path of the natural gas demand for the projected years: 8a for different triggers (1-6) and their combinations (7)(8), 8b for the variation of building age and heating types. In this area, gas is only used for heating applications; therefore a substitution of gas burners directly induces an increase (1, 2, 4-7) or decrease (8) in demand. Although in simulation 3 in 2050 approx. 90% of the heating systems are gas-based, we see a drop of about 55% in demand, which is induced only by surface insulation measures and solar thermal plants (Figure 7b). A comparison of simulations 8-10 shows that the initial building age and heating system configuration have a significant influence on the future supply task. A lower initial house connection rate in the gas grid increases the risk of a complete gas grid defection. While in simulation 8, the initial gas grid connection rate is 85%, in simulation 10, it depicts on average 20%. This causes higher initial grid charges and an increase of the specific investment expenditures for gas condensing boilers, which reduces their attractiveness in simulation 10. This effect can also be seen when comparing the "Base-Case" scenarios (simulation 1, 11). With a decreasing gas grid connection rate, the development of gas grid charges is therefore significantly more sensitive to endogenous economic, regulatory, and technical triggers. When looking at the electricity demand, another picture can be drawn, since the heating applications cover only a part of the supply task. For that reason, the substitution of electric direct heating systems causes a decrease of 35-60% from 2020 to 2050; see Figure D1 in Appendix D.1.

Impact on the Gas and Electricity Grid Charges
As the gas demand rises, the grid charges fall (1, 2, 4-7). As the demand falls, the effect reverses (3,8), but is more pronounced (Figure 9a) due to the non-linear relationship between the number of customers and network length [21,22]. The decrease of gas demand over time is slower than the one of the line length, leading to an increase in grid charges: In simulation 8 the initial grid length drops by about 20% from 2020 to 2050 and the demand drops by about 70% (median). In simulation 10 the line length drops by about 52% and the demand drops by about 90%. In both cases an unproportioned long grid has to be operated, leading to a rise in energy-related OPEX, where the length-related CAPEX remains at a stable level in the DNO strategy "stable grid value".

Impact on the Gas and Electricity Grid Charges
As the gas demand rises, the grid charges fall (1, 2, 4-7). As the demand falls, the effect reverses (3,8), but is more pronounced (Figure 9a) due to the non-linear relationship between the number of customers and network length [21,22]. The decrease of gas demand over time is slower than the one of the line length, leading to an increase in grid charges: In simulation 8 the initial grid length drops by about 20% from 2020 to 2050 and the demand drops by about 70% (median). In simulation 10 the line length drops by about 52% and the demand drops by about 90%. In both cases an unproportioned long grid has to be operated, leading to a rise in energy-related OPEX, where the length-related CAPEX remains at a stable level in the DNO strategy "stable grid value". Sustainability 2020, 12, x FOR PEER REVIEW 20 of 42 In the electricity sector, this effect would be even more pronounced, since the line length cannot be reduced as the demand for heating applications decreases. However, the heating demand represents only a part of the supply task in the electricity sector, so that the decline in demand is not as distinct as it is for gas. As a result, the effect on electricity charges is less pronounced; see Figure  D2 in Appendix D.1.
With a lower house connection density, the increase of gas grid charges is more pronounced (Figure 9b), while the trigger combination 2 induces a rise in the median of grid charges of about 227% for the initial building age and heating system configuration until 2050 (8). The rise grows up to a median of 500% when varying the building and heating system configuration (10). The lower the house connection rate in the gas grid, the more sensitive the substitution of gas-bound heating systems is to grid costs and thus to grid charges.

Case Study 3: Interdependencies Between the DNO's Grid Charge Setting and Building Retrofit Decisions in Face of Decreasing Gas Demand
We compared simulations where the gas and electricity grid charges are set to their initial value , = , during the whole planning horizon with those in which they are set to the value of the corresponding year , = , . Hence, building owners decide based on the year of renovation . Figure 10 shows the gas and electricity demand for the initial building and heating system configuration (I) and its variation (I, B, H) in projected years: There is a drop in electricity demand in all scenarios (8, 8c, 10, 10c), which is more pronounced when building owners have to decide based on , (8c, 10c), compared to (8,10), where they decide based on , (Figure 10b). This is counterintuitive, as the electricity grid charges increase over the planning horizon. However, in case of , = , building owners decide based on the initial gas grid charges, thus the total costs of gas-based systems are relatively low, accelerating the substitution of electricity-based solutions by gas-based ones (8c, 10c). This result indicates that gas grid charges are a trigger element even for the electricity-based heating solutions. In the electricity sector, this effect would be even more pronounced, since the line length cannot be reduced as the demand for heating applications decreases. However, the heating demand represents only a part of the supply task in the electricity sector, so that the decline in demand is not as distinct as it is for gas. As a result, the effect on electricity charges is less pronounced; see Figure A3 in Appendix D.1.
With a lower house connection density, the increase of gas grid charges is more pronounced (Figure 9b), while the trigger combination 2 induces a rise in the median of grid charges of about 227% for the initial building age and heating system configuration until 2050 (8). The rise grows up to a median of 500% when varying the building and heating system configuration (10). The lower the house connection rate in the gas grid, the more sensitive the substitution of gas-bound heating systems is to grid costs and thus to grid charges.

Case Study 3: Interdependencies between the DNO's Grid Charge Setting and Building Retrofit Decisions in Face of Decreasing Gas Demand
We compared simulations where the gas and electricity grid charges are set to their initial value c GC c, = c GC c, =0 during the whole planning horizon with those in which they are set to the value of the corresponding year c GC c, = c GC c, = . Hence, building owners decide based on the year of renovation Invest . Figure 10 shows the gas and electricity demand for the initial building and heating system configuration (I) and its variation (I, B, H) in projected years: There is a drop in electricity demand in all scenarios (8, 8c, 10, 10c), which is more pronounced when building owners have to decide based on c GC c, =0 (8c, 10c), compared to (8,10), where they decide based on c GC c, = Invest (Figure 10b). This is counterintuitive, as the electricity grid charges increase over the planning horizon. However, in case of c GC c, = c GC c, =0 building owners decide based on the initial gas grid charges, thus the total costs of gas-based systems are relatively low, accelerating the substitution of electricity-based solutions by gas-based ones (8c, 10c). This result indicates that gas grid charges are a trigger element even for the electricity-based heating solutions. Sustainability 2020, 12, x FOR PEER REVIEW 21 of 42  Figure 10a shows that the gas demand decreases for the initial building and heating system configuration (8, 8c), which is even more pronounced in case of , = , (8). Simulations 10 and 10c represent the results for the variation of the initial building and heating system configuration: Gas demand rises in the case of , = , (10c) and decreases in the case of , = , (10), since the initial gas grid charges are relatively low and the total costs of gas-based solutions are more sensitive to energy price fluctuations than electric heat pumps. This finally depicts the gas grid charges as a tipping element, which triggers the decrease of gas demand during the planning horizon, finally leading to gas grid defection in some seeds in simulation 10. Opposite effects occur in simulation 10c, where gas-based solutions substitute oil-or electricity-based ones, leading to an increasing gas demand for the majority of seeds. The resulting grid charge development for gas ( Figure 11a) and electricity (Figure 11b) underlines the findings of Figure 10: Electricity grid charges rise in every simulation, which is even more pronounced in the case of , = , (Figure 11b). An increase in gas grid charges occurs in simulations 8, 8c, and 10. A decrease can be seen for several seeds in simulation 10c, due to the increase in gas demand in this scenario (Figure 11a).  Figure 10a shows that the gas demand decreases for the initial building and heating system configuration (8, 8c), which is even more pronounced in case of c GC c, = c GC c, Invest (8). Simulations 10 and 10c represent the results for the variation of the initial building and heating system configuration: Gas demand rises in the case of c GC c, = c GC c, =0 (10c) and decreases in the case of c GC c, = c GC c, Invest (10), since the initial gas grid charges are relatively low and the total costs of gas-based solutions are more sensitive to energy price fluctuations than electric heat pumps. This finally depicts the gas grid charges as a tipping element, which triggers the decrease of gas demand during the planning horizon, finally leading to gas grid defection in some seeds in simulation 10. Opposite effects occur in simulation 10c, where gas-based solutions substitute oil-or electricity-based ones, leading to an increasing gas demand for the majority of seeds.
The resulting grid charge development for gas ( Figure 11a) and electricity (Figure 11b) underlines the findings of Figure 10: Electricity grid charges rise in every simulation, which is even more pronounced in the case of c GC c, = c GC c, =0 (Figure 11b). An increase in gas grid charges occurs in simulations 8, 8c, and 10. A decrease can be seen for several seeds in simulation 10c, due to the increase in gas demand in this scenario (Figure 11a).
The results show that gas grid charges are the dominant variable in the system: On the one hand, the supply task in the gas sector reacts more sensitively to the investment decisions of building owners than the supply task in the electricity sector. On the other hand, life-cycle costs of gas-based heating systems react more sensitively to energy price fluctuations than systems based on electric heat pumps. The development of the gas grid charges finally influences both the electricity and the natural gas sector. The results show that gas grid charges are the dominant variable in the system: On the one hand, the supply task in the gas sector reacts more sensitively to the investment decisions of building owners than the supply task in the electricity sector. On the other hand, life-cycle costs of gas-based heating systems react more sensitively to energy price fluctuations than systems based on electric heat pumps. The development of the gas grid charges finally influences both the electricity and the natural gas sector.

Case Study 4: The Influence of DNO Strategy Patterns on Grid Economy in Face of Decreasing Gas Demand
In the comparison of the three DNO strategies, we focus on the situation in gas grids, vary the gas DNO strategy, use the same strategy for the electricity DNO in all simulations and discuss the results for the natural gas sector. The effects on the electricity demand, the corresponding grid charges and the electricity DNO's revenue cap are low; see the corresponding results in Appendix D.3 (electricity demand in Figure D4; grid charges in Figure D5; revenue cap in Figure D6). Figure 12 shows the decrease in gas demand for the initial building and heating system configuration (I) in 12a and its variation (I, B, H) in 12b. The gas grid costs drop slower than the corresponding demand, leading to an increase in grid charges (Figure 12c,d). Thereby, the rate of change of grid charges depends on the DNO's strategy and on the increase from the SGC via the SGV to the SRC strategy. The difference in grid charges finally leads to more investment in gas-based solutions for the SGC compared to the SRC strategy. We see this effect as the drop in gas demand is more pronounced for simulation 8rc compared with 8gc (a difference of the median of approximately 5% in 2050 in Figure 12a,b). For a variation of initial building and heating configuration (10gc, 10gv, 10rc) this can lead to a complete defection of the gas grid ( Figure 12b); whereby the probability of occurrence for this scenario is higher in the long term when the DNO acts according to the SRC or SGV compared to the SGC strategy.

Case Study 4: The Influence of DNO Strategy Patterns on Grid Economy in Face of Decreasing Gas Demand
In the comparison of the three DNO strategies, we focus on the situation in gas grids, vary the gas DNO strategy, use the same strategy for the electricity DNO in all simulations and discuss the results for the natural gas sector. The effects on the electricity demand, the corresponding grid charges and the electricity DNO's revenue cap are low; see the corresponding results in Appendix D.2 (electricity demand in Figure A5; grid charges in Figure A6; revenue cap in Figure A7). Figure 12 shows the decrease in gas demand for the initial building and heating system configuration (I) in 12a and its variation (I, B, H) in 12b. The gas grid costs drop slower than the corresponding demand, leading to an increase in grid charges (Figure 12c,d). Thereby, the rate of change of grid charges depends on the DNO's strategy and on the increase from the SGC via the SGV to the SRC strategy. The difference in grid charges finally leads to more investment in gas-based solutions for the SGC compared to the SRC strategy. We see this effect as the drop in gas demand is more pronounced for simulation 8rc compared with 8gc (a difference of the median of approximately 5% in 2050 in Figure 12a,b). For a variation of initial building and heating configuration (10gc, 10gv, 10rc) this can lead to a complete defection of the gas grid ( Figure 12b); whereby the probability of occurrence for this scenario is higher in the long term when the DNO acts according to the SRC or SGV compared to the SGC strategy. Sustainability 2020, 12, x FOR PEER REVIEW 23 of 42 When comparing the gas grid charges of the initial building and heating configuration (I) in Figure 12c and its variation (I, B, H) in Figure 12d, it becomes clear that an interplay of an unfavorable DNO strategy (SRC) and a low initial house connection density to the gas grid can lead to a sharp increase in grid charges in 2050: We see a factor of 6.19 (median) in simulation 10rc, compared to 2.55 in simulation 8rc. In both cases, a change in strategy has a strong impact on network charges, which in turn can save the DNO's business model in the long run: For the SGC strategy, the median is 2.32 in simulation 10gc and 1.51 in simulation 8gc (2050).
In the following, we discuss the consequences for the DNO's business model based on Figure  13. Induced by the declining customer number, demand and grid length, we see a drop in revenues in all scenarios (Figure 13a), which is more pronounced for the SGC than for the SGV and SRC strategies. The decline goes along with a shift in CAPEX and OPEX caused by an interplay of the gas DNO's and building owners' decisions: The OPEX is a function of the energy supplied ( Figure 12) and the grid length (Figure 13b). It therefore depends mostly on the building owner's investment decision. The CAPEX is a function of the grid length and age. It therefore depends mainly on the When comparing the gas grid charges of the initial building and heating configuration (I) in Figure 12c and its variation (I, B, H) in Figure 12d, it becomes clear that an interplay of an unfavorable DNO strategy (SRC) and a low initial house connection density to the gas grid can lead to a sharp increase in grid charges in 2050: We see a factor of 6.19 (median) in simulation 10rc, compared to 2.55 in simulation 8rc. In both cases, a change in strategy has a strong impact on network charges, which in turn can save the DNO's business model in the long run: For the SGC strategy, the median is 2.32 in simulation 10gc and 1.51 in simulation 8gc (2050).
In the following, we discuss the consequences for the DNO's business model based on Figure 13. Induced by the declining customer number, demand and grid length, we see a drop in revenues in all scenarios (Figure 13a), which is more pronounced for the SGC than for the SGV and SRC strategies. The decline goes along with a shift in CAPEX and OPEX caused by an interplay of the gas DNO's and building owners' decisions: The OPEX is a function of the energy supplied ( Figure 12) and the grid length (Figure 13b). It therefore depends mostly on the building owner's investment decision. The CAPEX is a function of the grid length and age. It therefore depends mainly on the DNO's investment strategy and primarily determines the differences in revenue caps (Figure 13a). For CAPEX and OPEX see Figure A8 in Appendix D.2.
DNO decision is the determination of the renewal ratio, i.e., the choice of individual renewal measures. Lowering this ratio, as in the SGC strategy, leads to an increase of (length-weighted) grid age (Figure 13c). Increasing this ratio as in the SRC strategy induces the opposite effect: The DNO tries to keep its cost base at the starting level, and revenue shortfalls due to the loss of customers are compensated with an increase in the renewal ratio. As a result, the grid charges are relatively high in the SRC strategy and customers are increasingly replacing their gas-fired heating systems. In this way, more and more house connections and supply pipes are being shut down, which reduces the grid length (Figure 13b). Furthermore, the SRC strategy increases the risk of stranded investments, as the high revenue cap values are induced by CAPEX and thus the fixed assets. The relative OPEX of the SRC strategy in 2050 (0.33) is lower than in the SGC strategy (0.53). As the decrease of grid length over time is slower than the decrease of the gas demand, the energy-related OPEX rises independently of the DNO strategy. This finally leads to a rise in grid charges in all strategies ( Figure 12). In the SGC strategy, it is possible to a certain extent to compensate for the disproportionately rising costs in relation to the grid length by lowering the CAPEX, whereas the SRC strategy in particular allows these costs to rise. The results prove the feedback of the DNO strategy to the building owner's decision: • SRC: Due to the rise in grid charges, gas-bound systems are increasingly being substituted, resulting in a risk of a self-reinforcing effect, which in turn leads to an increased decline in the energy demand as well as network length. This could finally trigger the closure of the entire gas network. • SGC: The initial disadvantage concerning the lower cost base for the DNO resulting from a disproportionate decline in the CAPEX becomes less pronounced during the planning horizon, as the grid length and supplied energy and with that the OPEX are higher compared to the SRC strategy. In the long run, this strategy can help secure the business model and reduce the risk of a complete shutdown, as a comparison of network lengths shows. The change of grid length induced by line closure and new house connection measures is determined by the building owners' investment decision. The remaining degree of freedom of the DNO decision is the determination of the renewal ratio, i.e., the choice of individual renewal measures. Lowering this ratio, as in the SGC strategy, leads to an increase of (length-weighted) grid age (Figure 13c). Increasing this ratio as in the SRC strategy induces the opposite effect: The DNO tries to keep its cost base at the starting level, and revenue shortfalls due to the loss of customers are compensated with an increase in the renewal ratio. As a result, the grid charges are relatively high in the SRC strategy and customers are increasingly replacing their gas-fired heating systems. In this way, more and more house connections and supply pipes are being shut down, which reduces the grid length ( Figure 13b). Furthermore, the SRC strategy increases the risk of stranded investments, as the high revenue cap values are induced by CAPEX and thus the fixed assets. The relative OPEX of the SRC strategy in 2050 (0.33) is lower than in the SGC strategy (0.53).

Conclusions
As the decrease of grid length over time is slower than the decrease of the gas demand, the energy-related OPEX rises independently of the DNO strategy. This finally leads to a rise in grid charges in all strategies ( Figure 12). In the SGC strategy, it is possible to a certain extent to compensate for the disproportionately rising costs in relation to the grid length by lowering the CAPEX, whereas the SRC strategy in particular allows these costs to rise. The results prove the feedback of the DNO strategy to the building owner's decision: • SRC: Due to the rise in grid charges, gas-bound systems are increasingly being substituted, resulting in a risk of a self-reinforcing effect, which in turn leads to an increased decline in the energy demand as well as network length. This could finally trigger the closure of the entire gas network. • SGC: The initial disadvantage concerning the lower cost base for the DNO resulting from a disproportionate decline in the CAPEX becomes less pronounced during the planning horizon, as the grid length and supplied energy and with that the OPEX are higher compared to the SRC strategy. In the long run, this strategy can help secure the business model and reduce the risk of a complete shutdown, as a comparison of network lengths shows.

Conclusions
Our simulation provides two main innovations in modeling: We integrate a cash flow calculation and a grid planning model into one DNO model. This enables us to assess the implications of different DNO strategic patterns on grid measures and grid charges.
The results of the case studies with the joint MAS simulation give some new insights into the interrelated system between building owners' and the DNO's investment decisions: Some configurations of endogenous economic, regulatory, and technical triggers induces the substitution of gas-bound heating systems mostly with electric heat pumps. Due to the sensitivity of building owners' investment decisions to gas price fluctuations and the sensitivity of gas grid charges on gas demand, a self-reinforcing feedback loop starts and accelerates the defection of the gas grid ( Figure 14). A change in the gas DNO's strategy can reduce but not stop this feedback. These implications are relevant for DNOs, policy makers, and building owners. Our simulation provides two main innovations in modeling: We integrate a cash flow calculation and a grid planning model into one DNO model. This enables us to assess the implications of different DNO strategic patterns on grid measures and grid charges.
The results of the case studies with the joint MAS simulation give some new insights into the interrelated system between building owners' and the DNO's investment decisions: Some configurations of endogenous economic, regulatory, and technical triggers induces the substitution of gas-bound heating systems mostly with electric heat pumps. Due to the sensitivity of building owners' investment decisions to gas price fluctuations and the sensitivity of gas grid charges on gas demand, a self-reinforcing feedback loop starts and accelerates the defection of the gas grid ( Figure  14). A change in the gas DNO's strategy can reduce but not stop this feedback. These implications are relevant for DNOs, policy makers, and building owners. Figure 14. Found cause-effect relationships: A self-reinforcing feedback loop between the building owners' retrofit decisions with regard to gas-based heating systems and the gas DNO's grid charge setting, which is initially induced by endogenous economic, technical, and regulatory triggers. (R: positive reinforcing loop; link polarities (XY): +: when X increases, Y increases; -: when X increases, Y decreases (and vice versa), see [57].)

Implications for Building Owners
Due to the existing gas network and the building and heating system configuration, gas-fired heating systems are predominantly used in the investigated area, while insulation measures and electric heat pumps appear unattractive. The development is changing when the solution space is limited or steered by triggers: Most single triggers, like CO2 pricing, an increased heat pump efficiency, government subsidies, or a reduction of electricity grid charges have a minor influence on the decision. The application of an energy-efficiency constraint shows large effects. Dependent on the design of the energy-efficiency constraint, electrical heat pumps, solar thermal plants, and surface insulation measures comes into play. Ambitious CO2-efficiency targets are associated with high costs; see Figure D3 in Appendix D.1.
The results indicate gas grid charges as a trigger element for retrofit decisions: For some building and heating configurations, the development of gas grid charges triggers an increase instead of a decrease in gas demand. In the worst case, this could lead to complete grid defection. Under the current political CO2 emission targets and the CO2 footprint of the natural gas supply, a financial risk for building owners arises when choosing a gas-based heating system: Future CO2 prices and grid charges are difficult to predict and the energy-related costs can rise sharply during the life-cycle. Furthermore, it is possible that fossil-fired plants will be banned during their lifetime [105]. Our model does not cover these economic risks, due to from incomplete information. The building owner can reduce the risk by making him or herself less dependent on energy supply through improved R -+ + Figure 14. Found cause-effect relationships: A self-reinforcing feedback loop between the building owners' retrofit decisions with regard to gas-based heating systems and the gas DNO's grid charge setting, which is initially induced by endogenous economic, technical, and regulatory triggers. (R: positive reinforcing loop; link polarities (X→Y): +: when X increases, Y increases; -: when X increases, Y decreases (and vice versa), see [57]).

Implications for Building Owners
Due to the existing gas network and the building and heating system configuration, gas-fired heating systems are predominantly used in the investigated area, while insulation measures and electric heat pumps appear unattractive. The development is changing when the solution space is limited or steered by triggers: Most single triggers, like CO 2 pricing, an increased heat pump efficiency, government subsidies, or a reduction of electricity grid charges have a minor influence on the decision. The application of an energy-efficiency constraint shows large effects. Dependent on the design of the energy-efficiency constraint, electrical heat pumps, solar thermal plants, and surface insulation measures comes into play. Ambitious CO 2 -efficiency targets are associated with high costs; see Figure A4 in Appendix D.1.
The results indicate gas grid charges as a trigger element for retrofit decisions: For some building and heating configurations, the development of gas grid charges triggers an increase instead of a decrease in gas demand. In the worst case, this could lead to complete grid defection. Under the current political CO 2 emission targets and the CO 2 footprint of the natural gas supply, a financial risk for building owners arises when choosing a gas-based heating system: Future CO 2 prices and grid charges are difficult to predict and the energy-related costs can rise sharply during the life-cycle. Furthermore, it is possible that fossil-fired plants will be banned during their lifetime [105]. Our model does not cover these economic risks, due to from incomplete information. The building owner can reduce the risk by making him or herself less dependent on energy supply through improved building insulation measures, self-generating systems or efficient heating systems, such as heat pumps. These desolidarization efforts can already be observed in practice and are part of studies [29] that are so far mostly focused on the situation in the electricity grid.

Implications for Natural Gas and Electricity Distribution Grid Opteraters
The results show that the disordered structure inherent to grid-based infrastructure leads to an increase in length-related grid costs, i.e., grid charges in scenarios with a strong decrease in gas demand. A change of the DNO's strategy can only counteract this effect to a limited extent. The short-term more profitable gas DNO strategy (SRC) increases the risk of a closure of the entire gas network in the long-term due to the feedback effect via grid charges. A strategy (SGC) that is less profitable for the DNO, but more in the public interest, contributes to the long-term maintenance of the gas grid infrastructure. A decision on the future of the gas grid infrastructure taken at macroeconomic level could reduce these economic risks.
We see the postulated feedback loop not only between the gas DNO and the buildings. There is also an interdependency between the gas and electricity DNO's revenue caps, due to the competition between gas burners and electrical heat pumps. In this context, the gas-based heating systems act as a trigger element for the tilting effects on the DNO's cost base. For that reason, the DNO could incentivize building owners to install gas-based systems in the future. In addition to the adaptation of the investment and operation strategy, this could help maintain the gas grids for some areas.

Implications for Policy Makers
We have shown that the use of single triggers, such as regulatory constraints, levy systems or state subsidy programs, mostly favors individual types of measures or systems but contributes little to the overall goal of CO 2 reduction. This effect can be mitigated by designing state measures for technology neutrally, without a pronounced steering effect for specific building envelope measures or heating systems. The formulation of reduction targets for primary energy demand or CO 2 as well as the introduction of levy and subsidy systems, such as CO 2 -pricing, represent technology-neutral alternatives.
In scenarios with a decreasing gas demand, the DNO strategy can contribute to maintaining the gas grid infrastructure. According to the actual incentive regulation system in Germany, DNOs apply the SRC or the SGV strategy with which they increase their business risk through grid defection in the long-term in such scenarios. This poses a risk to society, since gas networks are seen as a flexibility option for volatile electricity production [23]. From a macrosocial point of view, the question arises whether gas networks are necessary in the future energy system. If not, a stepwise shutdown with regulatory support could guarantee a stable supply within the transformation; if so, appropriate business incentives for gas DNOs could reduce the risk of grid defection [21,22].

Further Research
Until now, the role of a change in gas grid costs due to decreasing demand or titling effects has not been sufficiently considered in energy system analyses [16][17][18][19]. The increase of grid charges is mainly induced by the non-linear dependency between grid length and customer number or demand. Models are available to consider this aspect in energy system analysis [22].
If more and more customers leave the gas grid in the future, the risk of stranded investments on the DNO side will increase. Knowledge about the future development of the building stock could help qualify this risk. The investment theory offers numerous methods for the valuation of investments under uncertainty and the quantification of this risk [108]. They could be adapted to gas grids to consider age, importance, and risk when choosing renewal measures.
The results also imply an interdependence between gas DNO and electricity DNO. For society, the question arises whether a joint cost-base for the electricity and gas grids, can help to reduce the long-term risk of gas grid defection. This instrument would provide the basis for a cross-sectoral infrastructure charge, which could help maintain the gas grid as a flexibility option.  Figure S1: Scheme of data prorogation in regard to the energy demand and economic parameters implemented for natural gas and electricity grid, Table S1: Parameters of the available solar thermal plants,

Acknowledgments:
We would like to thank the Stadtwerke Bamberg energy and water supply company, Bamberg, Germany, for providing us the data of loads, grids, and costs components that form the basis for this work.

Appendix B.2 Constraints of the Building Retrofit Model
We constrained the number of measures per category in each simulation, considering A1, A2, and A3. The optimizer can choose a building surface insulation measure: The optimizer has to replace the heating system: The optimizer can choose a solar thermal plant: In each simulation we set the initial yearly CO 2 emissions (A4) and the end energy demand (A5) as upper bounds: In our case-studies in simulations 3, 8-10 we constrained the yearly primary energy demand to the corresponding demand Q P EnEV , calculated based on the energy-efficiency targets of [100] (for the Q P EnEV values see Supplement C, Table S6). The optimizer can freely choose the type of measure.
∀ ∈ J : We also added a restriction to oblige building owners to insulate their building envelope in order to reach the energy-efficiency goals according to [100]. (In simulation 3 this was applied for 100% of the buildings, while in simulations 8-10 it was applied for 66% of the building) ∀ ∈ J :

Appendix C Gas and Electricity Network Operator Model
Appendix C.1 Nomenclature       Figure D4. Relative electricity demand in projected years with a comparison of different gas DNO strategies with (a) a variation of the date of investment (I); (b) a variation of date of investment, building age type, and heating system type (I, B, H). (Electricity DNO strategy in all simulations: "stable grid value"). (Dots: individual seeds; boxes: median and 25%/75% percentiles of the resulting distribution; whiskers: +/-1.5 IQD).