From 0bac08934aa701e89887afe8085edf715deda22a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:34:54 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- doc/release_notes.rst | 2 +- scripts/solve_network.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index be6be9fd..52b2ddc2 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -12,7 +12,7 @@ Upcoming Release * New configuration option ``everywhere_powerplants`` to build conventional powerplants everywhere, irrespective of existing powerplants locations, in the network (https://github.com/PyPSA/pypsa-eur/pull/850). -* Remove option for wave energy as technology data is not maintained. +* Remove option for wave energy as technology data is not maintained. PyPSA-Eur 0.9.0 (5th January 2024) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index db842054..0b503644 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -796,8 +796,8 @@ def add_pipe_retrofit_constraint(n): def add_co2_atmosphere_constraint(n, snapshots): - glcs = n.global_constraints[n.global_constraints.type=="co2_atmosphere"] - + glcs = n.global_constraints[n.global_constraints.type == "co2_atmosphere"] + if glcs.empty: return for name, glc in glcs.iterrows(): @@ -812,11 +812,12 @@ def add_co2_atmosphere_constraint(n, snapshots): stores = n.stores.query("carrier in @emissions.index and not e_cyclic") if not stores.empty: last_i = snapshots[-1] - lhs = n.model["Store-e"].loc[last_i, stores.index] + lhs = n.model["Store-e"].loc[last_i, stores.index] rhs = glc.constant - + n.model.add_constraints(lhs <= rhs, name=f"GlobalConstraint-{name}") + def extra_functionality(n, snapshots): """ Collects supplementary constraints which will be passed to