From 1e87cf0eebd447d98676f361829bd05b898013dc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Sep 2023 06:22:55 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- config/config.default.yaml | 2 +- scripts/solve_network.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config/config.default.yaml b/config/config.default.yaml index 620c04af..76490e6b 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -622,7 +622,7 @@ solving: transmission_losses: 0 linearized_unit_commitment: true horizon: 365 - + constraints: CCL: false EQ: false diff --git a/scripts/solve_network.py b/scripts/solve_network.py index c1c170ce..ca542bba 100644 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -33,7 +33,7 @@ import numpy as np import pandas as pd import pypsa import xarray as xr -from _helpers import configure_logging, update_config_with_sector_opts, get_opt +from _helpers import configure_logging, get_opt, update_config_with_sector_opts logger = logging.getLogger(__name__) pypsa.pf.logger.setLevel(logging.WARNING) @@ -542,7 +542,6 @@ def add_chp_constraints(n): # back-pressure if not electric.empty: lhs = ( - p.loc[:, heat] * (n.links.efficiency[heat] * n.links.c_b[electric].values) - p.loc[:, electric] * n.links.efficiency[electric] ) @@ -582,18 +581,24 @@ def extra_functionality(n, snapshots): opts = n.opts config = n.config constraints = config["solving"].get("constraints", {}) - if ("BAU" in opts or constraints.get("BAU",False)) and n.generators.p_nom_extendable.any(): + if ( + "BAU" in opts or constraints.get("BAU", False) + ) and n.generators.p_nom_extendable.any(): add_BAU_constraints(n, config) - if ("SAFE" in opts or constraints.get("SAFE",False)) and n.generators.p_nom_extendable.any(): + if ( + "SAFE" in opts or constraints.get("SAFE", False) + ) and n.generators.p_nom_extendable.any(): add_SAFE_constraints(n, config) - if ("CCL" in opts or constraints.get("CCL",False)) and n.generators.p_nom_extendable.any(): + if ( + "CCL" in opts or constraints.get("CCL", False) + ) and n.generators.p_nom_extendable.any(): add_CCL_constraints(n, config) reserve = config["electricity"].get("operational_reserve", {}) if reserve.get("activate"): add_operational_reserve_margin(n, snapshots, config) - EQ_config = constraints.get("EQ",False) + EQ_config = constraints.get("EQ", False) EQ_wildcard = get_opt(opts, r"^EQ+[0-9]*\.?[0-9]+(c|)") EQ_o = EQ_wildcard or EQ_config if EQ_o: