From 1ea31f0e57efa0ebb0079c1ee6ea170297e5c962 Mon Sep 17 00:00:00 2001 From: Tom Brown Date: Tue, 1 Dec 2020 14:41:11 +0100 Subject: [PATCH] Redo investment-year-dependent exogenous retrofitting parameter Specify as dictionary, use get_parameter to get correct value. Also remove old parameter "space_heating_fraction" since this is superceded by the new exogenous retro code. --- Snakefile | 31 +++++++++++++++---------------- config.default.yaml | 23 +++++++++++++---------- scripts/prepare_sector_network.py | 27 +++++---------------------- 3 files changed, 33 insertions(+), 48 deletions(-) diff --git a/Snakefile b/Snakefile index 7647b795..ee0fb8cf 100644 --- a/Snakefile +++ b/Snakefile @@ -278,22 +278,21 @@ rule build_industrial_demand: resources: mem_mb=1000 script: 'scripts/build_industrial_demand.py' -if config['sector']['retrofitting'].get('retro_endogen', True): - rule build_retro_cost: - input: - building_stock="data/retro/data_building_stock.csv", - u_values_PL="data/retro/u_values_poland.csv", - tax_w="data/retro/electricity_taxes_eu.csv", - construction_index="data/retro/comparative_level_investment.csv", - average_surface="data/retro/average_surface_components.csv", - floor_area_missing="data/retro/floor_area_missing.csv", - clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", - cost_germany="data/retro/retro_cost_germany.csv", - window_assumptions="data/retro/window_assumptions.csv" - output: - retro_cost="resources/retro_cost_{network}_s{simpl}_{clusters}.csv", - floor_area="resources/floor_area_{network}_s{simpl}_{clusters}.csv" - script: "scripts/build_retro_cost.py" +rule build_retro_cost: + input: + building_stock="data/retro/data_building_stock.csv", + u_values_PL="data/retro/u_values_poland.csv", + tax_w="data/retro/electricity_taxes_eu.csv", + construction_index="data/retro/comparative_level_investment.csv", + average_surface="data/retro/average_surface_components.csv", + floor_area_missing="data/retro/floor_area_missing.csv", + clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", + cost_germany="data/retro/retro_cost_germany.csv", + window_assumptions="data/retro/window_assumptions.csv" + output: + retro_cost="resources/retro_cost_{network}_s{simpl}_{clusters}.csv", + floor_area="resources/floor_area_{network}_s{simpl}_{clusters}.csv" + script: "scripts/build_retro_cost.py" rule prepare_sector_network: diff --git a/config.default.yaml b/config.default.yaml index 1f486bc7..54470178 100644 --- a/config.default.yaml +++ b/config.default.yaml @@ -100,17 +100,20 @@ sector: 'transport_internal_combustion_efficiency': 0.3 'shipping_average_efficiency' : 0.4 #For conversion of fuel oil to propulsion in 2011 'time_dep_hp_cop' : True - 'space_heating_fraction' : 1.0 #fraction of space heating active 'retrofitting' : - 'retro_exogen': False # space heat demand savings exogenously - 'dE': 0.4 # reduction of space heat demand (applied before losses in DH) - 'retro_endogen': True # co-optimise space heat savings - 'cost_factor' : 1.0 - 'interest_rate': 0.04 # for investment in building components - 'annualise_cost': True # annualise the investment costs - 'tax_weighting': False # weight costs depending on taxes in countries - 'construction_index': True # weight costs depending on labour/material costs per ct - 'l_strength': ["0.076", "0.197"] # additional insulation thickness[m], determines number of retro steps(=generators per bus) and maximum possible savings + 'retro_exogen': True # space heat demand savings exogenously + 'dE': # reduction of space heat demand (applied before losses in DH) + 2020 : 0. + 2030 : 0.15 + 2040 : 0.3 + 2050 : 0.4 + 'retro_endogen': False # co-optimise space heat savings + 'cost_factor' : 1.0 + 'interest_rate': 0.04 # for investment in building components + 'annualise_cost': True # annualise the investment costs + 'tax_weighting': False # weight costs depending on taxes in countries + 'construction_index': True # weight costs depending on labour/material costs per ct + 'l_strength': ["0.076", "0.197"] # additional insulation thickness[m], determines number of retro steps(=generators per bus) and maximum possible savings 'tes' : True 'tes_tau' : 3. 'boilers' : True diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 201510af..9e3c8872 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -114,13 +114,6 @@ def update_wind_solar_costs(n,costs): n.generators.loc[n.generators.carrier==tech,'capital_cost'] = capital_cost.rename(index=lambda node: node + ' ' + tech) -def retro_exogen(demand, dE): - """ - reduces space heat demand exogenously - demand: current space heat demand - dE: energy savings - """ - return demand * (1-dE) def add_carrier_buses(n, carriers): """ Add buses to connect e.g. coal, nuclear and oil plants @@ -436,12 +429,10 @@ def prepare_data(network): if use == "space": heat_demand_shape = daily_space_heat_demand*intraday_year_profile - factor = options['space_heating_fraction'] else: heat_demand_shape = intraday_year_profile - factor = 1. - heat_demand["{} {}".format(sector,use)] = factor*(heat_demand_shape/heat_demand_shape.sum()).multiply(nodal_energy_totals["total {} {}".format(sector,use)])*1e6 + heat_demand["{} {}".format(sector,use)] = (heat_demand_shape/heat_demand_shape.sum()).multiply(nodal_energy_totals["total {} {}".format(sector,use)])*1e6 electric_heat_supply["{} {}".format(sector,use)] = (heat_demand_shape/heat_demand_shape.sum()).multiply(nodal_energy_totals["electricity {} {}".format(sector,use)])*1e6 heat_demand = pd.concat(heat_demand,axis=1) @@ -458,7 +449,7 @@ def prepare_data(network): ## Get overall demand curve for all vehicles - traffic = pd.read_csv(snakemake.input.traffic_data + "KFZ__count", + traffic = pd.read_csv(os.path.join(snakemake.input.traffic_data,"KFZ__count"), skiprows=2)["count"] #Generate profiles @@ -513,7 +504,7 @@ def prepare_data(network): ## derive plugged-in availability for PKW's (cars) - traffic = pd.read_csv(snakemake.input.traffic_data + "Pkw__count", + traffic = pd.read_csv(os.path.join(snakemake.input.traffic_data,"Pkw__count"), skiprows=2)["count"] avail_max = 0.95 @@ -1087,14 +1078,11 @@ def add_heat(network): # building retrofitting, exogenously reduce space heat demand if options["retrofitting"]["retro_exogen"]: - dE = options["retrofitting"]["dE"] - if snakemake.config["foresight"]=='myopic': - year = int(snakemake.wildcards.planning_horizons[-4:]) - dE = dE[snakemake.config["scenario"]["planning_horizons"].index(year)] + dE = get_parameter(options["retrofitting"]["dE"]) print("retrofitting exogenously, assumed space heat reduction of ", dE) for sector in sectors: - heat_demand[sector + " space"] = heat_demand[sector + " space"].apply(lambda x: retro_exogen(x, dE)) + heat_demand[sector + " space"] = (1-dE)*heat_demand[sector + " space"] heat_systems = ["residential rural", "services rural", "residential urban decentral","services urban decentral", @@ -1934,11 +1922,6 @@ if __name__ == "__main__": add_storage(n) for o in opts: - if "space" in o: - limit = o[o.find("space")+5:] - limit = float(limit.replace("p",".").replace("m","-")) - print(o,limit) - options['space_heating_fraction'] = limit if o[:4] == "wave": wave_cost_factor = float(o[4:].replace("p",".").replace("m","-")) print("Including wave generators with cost factor of", wave_cost_factor)