Fix calculation of solar rooftop potentials for "m" clusters

I.e. when the generators are clustered to the "simplified" network
resolution, but the grid is clustered further, e.g. by using the
clusters = 37m "m" option.
This commit is contained in:
Tom Brown 2020-09-25 15:25:41 +02:00
parent 6b964865e7
commit de52711700
2 changed files with 23 additions and 2 deletions

View File

@ -62,6 +62,18 @@ rule build_clustered_population_layouts:
script: "scripts/build_clustered_population_layouts.py" script: "scripts/build_clustered_population_layouts.py"
rule build_simplified_population_layouts:
input:
pop_layout_total="resources/pop_layout_total.nc",
pop_layout_urban="resources/pop_layout_urban.nc",
pop_layout_rural="resources/pop_layout_rural.nc",
regions_onshore=pypsaeur('resources/regions_onshore_{network}_s{simpl}.geojson')
output:
clustered_pop_layout="resources/pop_layout_{network}_s{simpl}.csv"
resources: mem_mb=10000
script: "scripts/build_clustered_population_layouts.py"
rule build_heat_demands: rule build_heat_demands:
input: input:
pop_layout_total="resources/pop_layout_total.nc", pop_layout_total="resources/pop_layout_total.nc",
@ -235,6 +247,7 @@ rule prepare_sector_network:
profile_offwind_dc=pypsaeur("resources/profile_offwind-dc.nc"), profile_offwind_dc=pypsaeur("resources/profile_offwind-dc.nc"),
clustermaps=pypsaeur('resources/clustermaps_{network}_s{simpl}_{clusters}.h5'), clustermaps=pypsaeur('resources/clustermaps_{network}_s{simpl}_{clusters}.h5'),
clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv", clustered_pop_layout="resources/pop_layout_{network}_s{simpl}_{clusters}.csv",
simplified_pop_layout="resources/pop_layout_{network}_s{simpl}.csv",
industrial_demand="resources/industrial_demand_{network}_s{simpl}_{clusters}.csv", industrial_demand="resources/industrial_demand_{network}_s{simpl}_{clusters}.csv",
heat_demand_urban="resources/heat_demand_urban_{network}_s{simpl}_{clusters}.nc", heat_demand_urban="resources/heat_demand_urban_{network}_s{simpl}_{clusters}.nc",
heat_demand_rural="resources/heat_demand_rural_{network}_s{simpl}_{clusters}.nc", heat_demand_rural="resources/heat_demand_rural_{network}_s{simpl}_{clusters}.nc",

View File

@ -689,8 +689,14 @@ def insert_electricity_distribution_grid(network):
solar = network.generators.index[network.generators.carrier == "solar"] solar = network.generators.index[network.generators.carrier == "solar"]
network.generators.loc[solar, "capital_cost"] = costs.at['solar-utility', network.generators.loc[solar, "capital_cost"] = costs.at['solar-utility',
'fixed'] 'fixed']
# add max solar rooftop potential assuming 1kW/person if snakemake.wildcards.clusters[-1:] == "m":
potential = pop_layout.total.rename(index = lambda x: x + " solar") pop_solar = simplified_pop_layout.total.rename(index = lambda x: x + " solar")
else:
pop_solar = pop_layout.total.rename(index = lambda x: x + " solar")
# add max solar rooftop potential assuming 0.1 kW/m2 and 10 m2/person,
#i.e. 1 kW/person (population data is in thousands of people) so we get MW
potential = 0.1*10*pop_solar
network.madd("Generator", network.madd("Generator",
solar, solar,
@ -1778,6 +1784,8 @@ if __name__ == "__main__":
pop_layout["ct_total"] = pop_layout["ct"].map(ct_total.get) pop_layout["ct_total"] = pop_layout["ct"].map(ct_total.get)
pop_layout["fraction"] = pop_layout["total"]/pop_layout["ct_total"] pop_layout["fraction"] = pop_layout["total"]/pop_layout["ct_total"]
simplified_pop_layout = pd.read_csv(snakemake.input.simplified_pop_layout,index_col=0)
costs = prepare_costs(snakemake.input.costs, costs = prepare_costs(snakemake.input.costs,
snakemake.config['costs']['USD2013_to_EUR2013'], snakemake.config['costs']['USD2013_to_EUR2013'],
snakemake.config['costs']['discountrate'], snakemake.config['costs']['discountrate'],