Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Before running any analysis with scenarios, the rule `build_scenarios` must be e

snakemake -call build_scenarios -f
or in case of using the public database

snakemake -call build_scenarios --configfile=config/config.public.yaml -f

Note that the hierarchy of scenario files is the following: `scenarios.automated.yaml` > (any `explicitly specified --configfiles`) > `config.yaml `> `config.default.yaml `Changes in the file `scenarios.manual.yaml `are only taken into account if the rule `build_scenarios` is executed.
Expand Down
2 changes: 1 addition & 1 deletion config/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ solving:
skip_iterations: true
rolling_horizon: false
seed: 123
custom_extra_functionality: "../data/custom_extra_functionality.py"
custom_extra_functionality: "../scripts/pypsa-de/additional_functionality.py"
# io_api: "direct" # Increases performance but only supported for the highs and gurobi solvers
# options that go into the optimize function
track_iterations: false
Expand Down
3 changes: 0 additions & 3 deletions rules/solve_myopic.smk
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ rule solve_sector_network_myopic:
"sector", "co2_sequestration_potential", default=200
),
custom_extra_functionality=input_custom_extra_functionality,
# custom_extra_functionality=os.path.join(
# os.path.dirname(workflow.snakefile), "scripts/pypsa-de/additional_functionality.py"
# ),
energy_year=config_provider("energy", "energy_totals_year"),
input:
network=RESULTS
Expand Down
14 changes: 7 additions & 7 deletions scripts/pypsa-de/additional_functionality.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

import logging
import sys

import pandas as pd
from xarray import DataArray
Expand Down Expand Up @@ -51,7 +51,7 @@ def add_capacity_limits(n, investment_year, limits_capacity, sense="maximum"):

lhs = nom.sum()

cname = f"capacity_{sense}-{ct}-{c.name}-{carrier.replace(' ','-')}"
cname = f"capacity_{sense}-{ct}-{c.name}-{carrier.replace(' ', '-')}"

if cname in n.global_constraints.index:
logger.warning(
Expand Down Expand Up @@ -163,7 +163,7 @@ def h2_import_limits(n, investment_year, limits_volume_max):
for ct in limits_volume_max["h2_import"]:
limit = limits_volume_max["h2_import"][ct][investment_year] * 1e6

logger.info(f"limiting H2 imports in {ct} to {limit/1e6} TWh/a")
logger.info(f"limiting H2 imports in {ct} to {limit / 1e6} TWh/a")
pipeline_carrier = [
"H2 pipeline",
"H2 pipeline (Kernnetz)",
Expand Down Expand Up @@ -222,7 +222,7 @@ def h2_production_limits(n, investment_year, limits_volume_min, limits_volume_ma
limit_upper = limits_volume_max["electrolysis"][ct][investment_year] * 1e6

logger.info(
f"limiting H2 electrolysis in DE between {limit_lower/1e6} and {limit_upper/1e6} TWh/a"
f"limiting H2 electrolysis in DE between {limit_lower / 1e6} and {limit_upper / 1e6} TWh/a"
)

production = n.links[
Expand Down Expand Up @@ -271,7 +271,7 @@ def electricity_import_limits(n, investment_year, limits_volume_max):
for ct in limits_volume_max["electricity_import"]:
limit = limits_volume_max["electricity_import"][ct][investment_year] * 1e6

logger.info(f"limiting electricity imports in {ct} to {limit/1e6} TWh/a")
logger.info(f"limiting electricity imports in {ct} to {limit / 1e6} TWh/a")

incoming_line = n.lines.index[
(n.lines.carrier == "AC")
Expand Down Expand Up @@ -374,7 +374,7 @@ def add_co2limit_country(n, limit_countries, snakemake, debug=False):
]

logger.info(
f"For {ct} adding following link carriers to port {port} CO2 constraint: {n.links.loc[links,'carrier'].unique()}"
f"For {ct} adding following link carriers to port {port} CO2 constraint: {n.links.loc[links, 'carrier'].unique()}"
)

if port == "0":
Expand Down Expand Up @@ -602,7 +602,7 @@ def add_h2_derivate_limit(n, investment_year, limits_volume_max):
for ct in limits_volume_max["h2_derivate_import"]:
limit = limits_volume_max["h2_derivate_import"][ct][investment_year] * 1e6

logger.info(f"limiting H2 derivate imports in {ct} to {limit/1e6} TWh/a")
logger.info(f"limiting H2 derivate imports in {ct} to {limit / 1e6} TWh/a")

incoming = n.links.loc[
[
Expand Down
Loading