Skip to content

Commit

Permalink
Fix calculation of solar rooftop potentials for "m" clusters
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nworbmot committed Sep 25, 2020
1 parent 6b96486 commit de52711
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ rule build_clustered_population_layouts:
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:
input:
pop_layout_total="resources/pop_layout_total.nc",
Expand Down Expand Up @@ -235,6 +247,7 @@ rule prepare_sector_network:
profile_offwind_dc=pypsaeur("resources/profile_offwind-dc.nc"),
clustermaps=pypsaeur('resources/clustermaps_{network}_s{simpl}_{clusters}.h5'),
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",
heat_demand_urban="resources/heat_demand_urban_{network}_s{simpl}_{clusters}.nc",
heat_demand_rural="resources/heat_demand_rural_{network}_s{simpl}_{clusters}.nc",
Expand Down
12 changes: 10 additions & 2 deletions scripts/prepare_sector_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,14 @@ def insert_electricity_distribution_grid(network):
solar = network.generators.index[network.generators.carrier == "solar"]
network.generators.loc[solar, "capital_cost"] = costs.at['solar-utility',
'fixed']
# add max solar rooftop potential assuming 1kW/person
potential = pop_layout.total.rename(index = lambda x: x + " solar")
if snakemake.wildcards.clusters[-1:] == "m":
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",
solar,
Expand Down Expand Up @@ -1778,6 +1784,8 @@ def remove_h2_network(n):
pop_layout["ct_total"] = pop_layout["ct"].map(ct_total.get)
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,
snakemake.config['costs']['USD2013_to_EUR2013'],
snakemake.config['costs']['discountrate'],
Expand Down

0 comments on commit de52711

Please sign in to comment.