Add selection of cutouts for heat to config

This commit is contained in:
Koen van Greevenbroek 2024-03-01 14:37:16 +01:00
parent d2527ed0ad
commit e891305c9d
3 changed files with 33 additions and 15 deletions

View File

@ -359,6 +359,7 @@ solar_thermal:
orientation: orientation:
slope: 45. slope: 45.
azimuth: 180. azimuth: 180.
cutout: default
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#existing-capacities # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#existing-capacities
existing_capacities: existing_capacities:
@ -391,6 +392,7 @@ sector:
2050: 1.0 2050: 1.0
district_heating_loss: 0.15 district_heating_loss: 0.15
cluster_heat_buses: true cluster_heat_buses: true
heat_demand_cutout: default
bev_dsm_restriction_value: 0.75 bev_dsm_restriction_value: 0.75
bev_dsm_restriction_time: 7 bev_dsm_restriction_time: 7
transport_heating_deadband_upper: 20. transport_heating_deadband_upper: 20.

View File

@ -151,6 +151,19 @@ rule cluster_gas_network:
"../scripts/cluster_gas_network.py" "../scripts/cluster_gas_network.py"
def heat_demand_cutout(wildcards):
c = config_provider("sector", "heat_demand_cutout")(wildcards)
if c == "default":
return (
"cutouts/"
+ CDIR
+ config_provider("atlite", "default_cutout")(wildcards)
+ ".nc"
)
else:
return "cutouts/" + CDIR + c + ".nc"
rule build_daily_heat_demand: rule build_daily_heat_demand:
params: params:
snapshots=config_provider("snapshots"), snapshots=config_provider("snapshots"),
@ -160,12 +173,7 @@ rule build_daily_heat_demand:
regions_onshore=resources( regions_onshore=resources(
"regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson" "regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson"
), ),
cutout=( cutout=heat_demand_cutout,
lambda w: "cutouts/"
+ CDIR
+ config_provider("atlite", "default_cutout")(w)
+ ".nc",
),
output: output:
heat_demand=resources( heat_demand=resources(
"daily_heat_demand_{scope}_elec{weather_year}_s{simpl}_{clusters}.nc" "daily_heat_demand_{scope}_elec{weather_year}_s{simpl}_{clusters}.nc"
@ -217,10 +225,7 @@ rule build_temperature_profiles:
regions_onshore=resources( regions_onshore=resources(
"regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson" "regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson"
), ),
cutout=lambda w: "cutouts/" cutout=heat_demand_cutout,
+ CDIR
+ config_provider("atlite", "default_cutout")(w)
+ ".nc",
output: output:
temp_soil=resources( temp_soil=resources(
"temp_soil_{scope}_elec{weather_year}_s{simpl}_{clusters}.nc" "temp_soil_{scope}_elec{weather_year}_s{simpl}_{clusters}.nc"
@ -294,6 +299,19 @@ rule build_cop_profiles:
"../scripts/build_cop_profiles.py" "../scripts/build_cop_profiles.py"
def solar_thermal_cutout(wildcards):
c = config_provider("solar_thermal", "cutout")(wildcards)
if c == "default":
return (
"cutouts/"
+ CDIR
+ config_provider("atlite", "default_cutout")(wildcards)
+ ".nc"
)
else:
return "cutouts/" + CDIR + c + ".nc"
rule build_solar_thermal_profiles: rule build_solar_thermal_profiles:
params: params:
snapshots=config_provider("snapshots"), snapshots=config_provider("snapshots"),
@ -304,10 +322,7 @@ rule build_solar_thermal_profiles:
regions_onshore=resources( regions_onshore=resources(
"regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson" "regions_onshore_elec{weather_year}_s{simpl}_{clusters}.geojson"
), ),
cutout=lambda w: "cutouts/" cutout=solar_thermal_cutout,
+ CDIR
+ config_provider("atlite", "default_cutout")(w)
+ ".nc",
output: output:
solar_thermal=resources( solar_thermal=resources(
"solar_thermal_{scope}_elec{weather_year}_s{simpl}_{clusters}.nc" "solar_thermal_{scope}_elec{weather_year}_s{simpl}_{clusters}.nc"
@ -949,7 +964,7 @@ rule build_existing_heating_distribution:
def input_profile_offwind(w): def input_profile_offwind(w):
return { return {
f"profile_{tech}": resources(f"profile{weather_year}_{tech}.nc") f"profile_{tech}": resources(f"profile{{weather_year}}_{tech}.nc")
for tech in ["offwind-ac", "offwind-dc"] for tech in ["offwind-ac", "offwind-dc"]
if (tech in config_provider("electricity", "renewable_carriers")(w)) if (tech in config_provider("electricity", "renewable_carriers")(w))
} }

View File

@ -31,6 +31,7 @@ if __name__ == "__main__":
client = Client(cluster, asynchronous=True) client = Client(cluster, asynchronous=True)
config = snakemake.params.solar_thermal config = snakemake.params.solar_thermal
config.pop("cutout", None)
cutout_name = snakemake.input.cutout cutout_name = snakemake.input.cutout
year = snakemake.wildcards.weather_year year = snakemake.wildcards.weather_year