add heat buses clustering to myopic

This commit is contained in:
lisazeyen 2022-08-01 18:15:35 +02:00
parent 973074de21
commit cbab86c4bc
2 changed files with 9 additions and 2 deletions

View File

@ -12,7 +12,7 @@ import xarray as xr
import pypsa
import yaml
from prepare_sector_network import prepare_costs, define_spatial
from prepare_sector_network import prepare_costs, define_spatial, cluster_heat_buses
from helper import override_component_attrs, update_config_with_sector_opts
from types import SimpleNamespace
@ -495,4 +495,7 @@ if __name__ == "__main__":
default_lifetime = snakemake.config['costs']['lifetime']
add_heating_capacities_installed_before_baseyear(n, baseyear, grouping_years, ashp_cop, gshp_cop, time_dep_hp_cop, costs, default_lifetime)
if options["cluster_heat_buses"]:
cluster_heat_buses(n)
n.export_to_netcdf(snakemake.output[0])

View File

@ -2564,6 +2564,10 @@ if __name__ == "__main__":
if options['electricity_grid_connection']:
add_electricity_grid_connection(n, costs)
if options["cluster_heat_buses"]:
first_year_myopic = ((snakemake.config["foresight"] == 'myopic') and
(snakemake.config["scenario"]["planning_horizons"][0]==investment_year))
if options["cluster_heat_buses"] and not first_year_myopic:
cluster_heat_buses(n)
n.export_to_netcdf(snakemake.output[0])