From 85b87599d586bb43a79ec7b309abc23f1eb9cc84 Mon Sep 17 00:00:00 2001 From: "martha.mf" Date: Mon, 17 Jul 2023 21:37:23 +0200 Subject: [PATCH 01/12] solve_network: add res_share constraint --- scripts/solve_network.py | 87 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index e8f54a00f..b2ef09771 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -347,6 +347,89 @@ def add_battery_constraints(n): define_constraints(n, lhs, "=", 0, "Link", "charger_ratio") +def add_RES_constraints(n, res_share): + lgrouper = n.loads.bus.map(n.buses.country) + ggrouper = n.generators.bus.map(n.buses.country) + sgrouper = n.storage_units.bus.map(n.buses.country) + cgrouper = n.links.bus0.map(n.buses.country) + + load = ( + n.snapshot_weightings.generators + @ n.loads_t.p_set.groupby(lgrouper, axis=1).sum() + ) + + rhs = res_share * load + + res_techs = ["solar", "onwind", "offwind-dc", "offwind-ac", "battery", "hydro", "ror"] + charger = ["H2 electrolysis", "battery charger"] + discharger=["H2 fuel cell", "battery discharger"] + + gens_i = n.generators.query("carrier in @res_techs").index + stores_i = n.storage_units.query("carrier in @res_techs").index + charger_i = n.links.query("carrier in @charger").index + discharger_i = n.links.query("carrier in @discharger").index + + + # Generators + lhs_gen = ( + linexpr( + (n.snapshot_weightings.generators, get_var(n, "Generator", "p")[gens_i].T) + ) + .T.groupby(ggrouper, axis=1) + .apply(join_exprs) + ) + + # StorageUnits + lhs_dispatch = ( + linexpr( + ( + n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_dispatch")[stores_i].T, + ) + ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) + ).reindex(lhs_gen.index).fillna("") + lhs_store = ( + linexpr( + ( + n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_store")[stores_i].T, + ) + ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) + ).reindex(lhs_gen.index).fillna("") + + # Stores (or their resp. Link components) + # Note that the variables "p0" and "p1" currently do not exist. + # Thus, p0 and p1 must be derived from "p" (which exists), taking into account the link efficiency. + lhs_charge = ( + linexpr( + ( + n.links.loc[charger_i].efficiency, + get_var(n, "Link", "p")[charger_i], + ) + ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) + ).reindex(lhs_gen.index).fillna("") + lhs_discharge = ( + linexpr( + ( + n.links.loc[discharger_i].efficiency, + get_var(n, "Link", "p")[discharger_i], + ) + ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) + ).reindex(lhs_gen.index).fillna("") + + lhs = lhs_gen + lhs_dispatch - lhs_store #- lhs_charge + lhs_discharge + + define_constraints(n, lhs, "=", rhs, "RES share") + + def extra_functionality(n, snapshots): """ Collects supplementary constraints which will be passed to @@ -366,6 +449,10 @@ def extra_functionality(n, snapshots): reserve = config["electricity"].get("operational_reserve", {}) if reserve.get("activate"): add_operational_reserve_margin(n, snapshots, config) + for o in opts: + if "RES" in o: + res_share = float(re.findall("[0-9]*\.?[0-9]+$", o)[0]) + add_RES_constraints(n, res_share) for o in opts: if "EQ" in o: add_EQ_constraints(n, o) From 5bd58254636d78de27ec7cec554ac62976247818 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 19:40:59 +0000 Subject: [PATCH 02/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/solve_network.py | 87 +++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index b2ef09771..2f056beec 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -360,16 +360,23 @@ def add_RES_constraints(n, res_share): rhs = res_share * load - res_techs = ["solar", "onwind", "offwind-dc", "offwind-ac", "battery", "hydro", "ror"] + res_techs = [ + "solar", + "onwind", + "offwind-dc", + "offwind-ac", + "battery", + "hydro", + "ror", + ] charger = ["H2 electrolysis", "battery charger"] - discharger=["H2 fuel cell", "battery discharger"] + discharger = ["H2 fuel cell", "battery discharger"] gens_i = n.generators.query("carrier in @res_techs").index stores_i = n.storage_units.query("carrier in @res_techs").index charger_i = n.links.query("carrier in @charger").index discharger_i = n.links.query("carrier in @discharger").index - # Generators lhs_gen = ( linexpr( @@ -381,51 +388,67 @@ def add_RES_constraints(n, res_share): # StorageUnits lhs_dispatch = ( - linexpr( - ( - n.snapshot_weightings.stores, - get_var(n, "StorageUnit", "p_dispatch")[stores_i].T, + ( + linexpr( + ( + n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_dispatch")[stores_i].T, + ) ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) ) - .T.groupby(sgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + .reindex(lhs_gen.index) + .fillna("") + ) lhs_store = ( - linexpr( - ( - n.snapshot_weightings.stores, - get_var(n, "StorageUnit", "p_store")[stores_i].T, + ( + linexpr( + ( + n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_store")[stores_i].T, + ) ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) ) - .T.groupby(sgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + .reindex(lhs_gen.index) + .fillna("") + ) # Stores (or their resp. Link components) # Note that the variables "p0" and "p1" currently do not exist. # Thus, p0 and p1 must be derived from "p" (which exists), taking into account the link efficiency. lhs_charge = ( - linexpr( - ( - n.links.loc[charger_i].efficiency, - get_var(n, "Link", "p")[charger_i], + ( + linexpr( + ( + n.links.loc[charger_i].efficiency, + get_var(n, "Link", "p")[charger_i], + ) ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) ) - .groupby(cgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + .reindex(lhs_gen.index) + .fillna("") + ) lhs_discharge = ( - linexpr( - ( - n.links.loc[discharger_i].efficiency, - get_var(n, "Link", "p")[discharger_i], + ( + linexpr( + ( + n.links.loc[discharger_i].efficiency, + get_var(n, "Link", "p")[discharger_i], + ) ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) ) - .groupby(cgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + .reindex(lhs_gen.index) + .fillna("") + ) - lhs = lhs_gen + lhs_dispatch - lhs_store #- lhs_charge + lhs_discharge + lhs = lhs_gen + lhs_dispatch - lhs_store # - lhs_charge + lhs_discharge define_constraints(n, lhs, "=", rhs, "RES share") From 77678a3f6c452e68c0f3c4e10cd65a2d6acaf719 Mon Sep 17 00:00:00 2001 From: "martha.mf" Date: Thu, 20 Jul 2023 14:15:36 +0200 Subject: [PATCH 03/12] solve_network: include storage units and stores (links) to RES share --- scripts/solve_network.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index b2ef09771..590570fff 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -382,20 +382,17 @@ def add_RES_constraints(n, res_share): # StorageUnits lhs_dispatch = ( linexpr( - ( - n.snapshot_weightings.stores, - get_var(n, "StorageUnit", "p_dispatch")[stores_i].T, - ) + (n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_dispatch")[stores_i].T) ) .T.groupby(sgrouper, axis=1) .apply(join_exprs) ).reindex(lhs_gen.index).fillna("") + lhs_store = ( linexpr( - ( - n.snapshot_weightings.stores, - get_var(n, "StorageUnit", "p_store")[stores_i].T, - ) + (-n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_store")[stores_i].T) ) .T.groupby(sgrouper, axis=1) .apply(join_exprs) @@ -407,7 +404,7 @@ def add_RES_constraints(n, res_share): lhs_charge = ( linexpr( ( - n.links.loc[charger_i].efficiency, + -n.links.loc[charger_i].efficiency, get_var(n, "Link", "p")[charger_i], ) ) @@ -425,7 +422,9 @@ def add_RES_constraints(n, res_share): .apply(join_exprs) ).reindex(lhs_gen.index).fillna("") - lhs = lhs_gen + lhs_dispatch - lhs_store #- lhs_charge + lhs_discharge + # signs of resp. terms are coded in the linexpr. + # todo: for links (lhs_charge and lhs_discharge), account for snapshot weightings + lhs = lhs_gen + lhs_dispatch + lhs_store + lhs_charge + lhs_discharge define_constraints(n, lhs, "=", rhs, "RES share") From f26cbf310a4c42d36956a029fbacc2ee48067c9d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 20 Jul 2023 12:21:14 +0000 Subject: [PATCH 04/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/solve_network.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index a4a38d507..9fd60bb37 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -388,18 +388,26 @@ def add_RES_constraints(n, res_share): # StorageUnits lhs_dispatch = ( - linexpr( - (n.snapshot_weightings.stores, - get_var(n, "StorageUnit", "p_dispatch")[stores_i].T) + ( + linexpr( + ( + n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_dispatch")[stores_i].T, + ) + ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) ) - .T.groupby(sgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + .reindex(lhs_gen.index) + .fillna("") + ) lhs_store = ( linexpr( - (-n.snapshot_weightings.stores, - get_var(n, "StorageUnit", "p_store")[stores_i].T) + ( + -n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_store")[stores_i].T, + ) ) .reindex(lhs_gen.index) .fillna("") From a9a13a3b24b8b2303aa859f0c470af8ce4320149 Mon Sep 17 00:00:00 2001 From: "martha.mf" Date: Fri, 21 Jul 2023 21:16:05 +0200 Subject: [PATCH 05/12] solve_network: fix constraint typo --- scripts/solve_network.py | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index a4a38d507..9931c5428 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -400,10 +400,9 @@ def add_RES_constraints(n, res_share): linexpr( (-n.snapshot_weightings.stores, get_var(n, "StorageUnit", "p_store")[stores_i].T) - ) - .reindex(lhs_gen.index) - .fillna("") - ) + ).T.groupby(sgrouper, axis=1) + .apply(join_exprs) + ).reindex(lhs_gen.index).fillna("") # Stores (or their resp. Link components) # Note that the variables "p0" and "p1" currently do not exist. @@ -414,26 +413,21 @@ def add_RES_constraints(n, res_share): -n.links.loc[charger_i].efficiency, get_var(n, "Link", "p")[charger_i], ) - .groupby(cgrouper, axis=1) - .apply(join_exprs) ) - .reindex(lhs_gen.index) - .fillna("") - ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) + ).reindex(lhs_gen.index).fillna("") + lhs_discharge = ( - ( - linexpr( - ( - n.links.loc[discharger_i].efficiency, - get_var(n, "Link", "p")[discharger_i], - ) + linexpr( + ( + n.links.loc[discharger_i].efficiency, + get_var(n, "Link", "p")[discharger_i], ) - .groupby(cgrouper, axis=1) - .apply(join_exprs) ) - .reindex(lhs_gen.index) - .fillna("") - ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) + ).reindex(lhs_gen.index).fillna("") # signs of resp. terms are coded in the linexpr. # todo: for links (lhs_charge and lhs_discharge), account for snapshot weightings From b7c93922c13f9d34748d26a380c7992861f946ec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Jul 2023 19:58:08 +0000 Subject: [PATCH 06/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/solve_network.py | 55 +++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 5e98bdd8d..9f720ed93 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -403,37 +403,52 @@ def add_RES_constraints(n, res_share): ) lhs_store = ( - linexpr( - (-n.snapshot_weightings.stores, - get_var(n, "StorageUnit", "p_store")[stores_i].T) - ).T.groupby(sgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + ( + linexpr( + ( + -n.snapshot_weightings.stores, + get_var(n, "StorageUnit", "p_store")[stores_i].T, + ) + ) + .T.groupby(sgrouper, axis=1) + .apply(join_exprs) + ) + .reindex(lhs_gen.index) + .fillna("") + ) # Stores (or their resp. Link components) # Note that the variables "p0" and "p1" currently do not exist. # Thus, p0 and p1 must be derived from "p" (which exists), taking into account the link efficiency. lhs_charge = ( - linexpr( - ( - -n.links.loc[charger_i].efficiency, - get_var(n, "Link", "p")[charger_i], + ( + linexpr( + ( + -n.links.loc[charger_i].efficiency, + get_var(n, "Link", "p")[charger_i], + ) ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) ) - .groupby(cgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + .reindex(lhs_gen.index) + .fillna("") + ) lhs_discharge = ( - linexpr( - ( - n.links.loc[discharger_i].efficiency, - get_var(n, "Link", "p")[discharger_i], + ( + linexpr( + ( + n.links.loc[discharger_i].efficiency, + get_var(n, "Link", "p")[discharger_i], + ) ) + .groupby(cgrouper, axis=1) + .apply(join_exprs) ) - .groupby(cgrouper, axis=1) - .apply(join_exprs) - ).reindex(lhs_gen.index).fillna("") + .reindex(lhs_gen.index) + .fillna("") + ) # signs of resp. terms are coded in the linexpr. # todo: for links (lhs_charge and lhs_discharge), account for snapshot weightings From 3248b255de7615f8dc4001077bb8bb2e3ccdabb0 Mon Sep 17 00:00:00 2001 From: "martha.mf" Date: Sat, 29 Jul 2023 18:12:54 +0200 Subject: [PATCH 07/12] solve_network: fix efficiencies for stores --- scripts/solve_network.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 9290d6db3..72abd7c29 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -423,11 +423,11 @@ def add_RES_constraints(n, res_share): ( linexpr( ( - -n.links.loc[charger_i].efficiency, - get_var(n, "Link", "p")[charger_i], + -n.snapshot_weightings.stores, + get_var(n, "Link", "p")[charger_i].T, ) ) - .groupby(cgrouper, axis=1) + .T.groupby(cgrouper, axis=1) .apply(join_exprs) ) .reindex(lhs_gen.index) From edee7e66dcc5664a4d14f42edaba91c2bf417bf8 Mon Sep 17 00:00:00 2001 From: "martha.mf" Date: Sat, 29 Jul 2023 18:31:22 +0200 Subject: [PATCH 08/12] solve_network: include work in progress warning for RES share constraint --- scripts/solve_network.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 72abd7c29..320483648 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -351,6 +351,13 @@ def add_RES_constraints(n, res_share): ggrouper = n.generators.bus.map(n.buses.country) sgrouper = n.storage_units.bus.map(n.buses.country) cgrouper = n.links.bus0.map(n.buses.country) + + logger.warning( + "The add_RES_constraints functionality is still work in progress. " + "Unexpected results might be incurred, particularly if " + "temporal clustering is applied or if an unexpected change of technologies " + "is subject to the obtimisation." + ) load = ( n.snapshot_weightings.generators From 793fbca17f77750992078ba7f4ffe2db306aa2c4 Mon Sep 17 00:00:00 2001 From: "martha.mf" Date: Sat, 29 Jul 2023 18:32:37 +0200 Subject: [PATCH 09/12] update doc/ for initial res_share functionality --- doc/configtables/opts.csv | 25 +++++++++++++------------ doc/release_notes.rst | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/doc/configtables/opts.csv b/doc/configtables/opts.csv index b468be6ef..876c79cf7 100644 --- a/doc/configtables/opts.csv +++ b/doc/configtables/opts.csv @@ -1,12 +1,13 @@ -Trigger, Description, Definition, Status -``nH``; i.e. ``2H``-``6H``, Resample the time-resolution by averaging over every ``n`` snapshots, ``prepare_network``: `average_every_nhours() `_ and its `caller `__), In active use -``nSEG``; e.g. ``4380SEG``, "Apply time series segmentation with `tsam `_ package to ``n`` adjacent snapshots of varying lengths based on capacity factors of varying renewables, hydro inflow and load.", ``prepare_network``: apply_time_segmentation(), In active use -``Co2L``, Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit``. If a float is appended an overall emission limit relative to the emission level given in ``electricity: co2base`` is added (e.g. ``Co2L0.05`` limits emissisions to 5% of what is given in ``electricity: co2base``), ``prepare_network``: `add_co2limit() `_ and its `caller `__, In active use -``Ep``, Add cost for a carbon-dioxide price configured in ``costs: emission_prices: co2`` to ``marginal_cost`` of generators (other emission types listed in ``network.carriers`` possible as well), ``prepare_network``: `add_emission_prices() `_ and its `caller `__, In active use -``CCL``, Add minimum and maximum levels of generator nominal capacity per carrier for individual countries. These can be specified in the file linked at ``electricity: agg_p_nom_limits`` in the configuration. File defaults to ``data/agg_p_nom_minmax.csv``., ``solve_network``, In active use -``EQ``, "Require each country or node to on average produce a minimal share of its total consumption itself. Example: ``EQ0.5c`` demands each country to produce on average at least 50% of its consumption; ``EQ0.5`` demands each node to produce on average at least 50% of its consumption.", ``solve_network``, In active use -``ATK``, "Require each node to be autarkic. Example: ``ATK`` removes all lines and links. ``ATKc`` removes all cross-border lines and links.", ``prepare_network``, In active use -``BAU``, Add a per-``carrier`` minimal overall capacity; i.e. at least ``40GW`` of ``OCGT`` in Europe; configured in ``electricity: BAU_mincapacities``, ``solve_network``: `add_opts_constraints() `__, Untested -``SAFE``, Add a capacity reserve margin of a certain fraction above the peak demand to which renewable generators and storage do *not* contribute. Ignores network., ``solve_network`` `add_opts_constraints() `__, Untested -``carrier+{c|p|m}factor``,"Alter the capital cost (``c``), installable potential (``p``) or marginal costs (``m``) of a carrier by a factor. Example: ``solar+c0.5`` reduces the capital cost of solar to 50\% of original values.", ``prepare_network``, In active use -``CH4L``,"Add an overall absolute gas limit. If configured in ``electricity: gaslimit`` it is given in MWh thermal, if a float is appended, the overall gaslimit is assumed to be given in TWh thermal (e.g. ``CH4L200`` limits gas dispatch to 200 TWh termal)", ``prepare_network``: ``add_gaslimit()``, In active use +Trigger, Description, Definition, Status,, +``nH``, i.e. ``2H``-``6H``, Resample the time-resolution by averaging over every ``n`` snapshots, ``prepare_network``: `average_every_nhours() `_ and its `caller `__), In active use, +``nSEG``, e.g. ``4380SEG``,"Apply time series segmentation with `tsam `_ package to ``n`` adjacent snapshots of varying lengths based on capacity factors of varying renewables, hydro inflow and load.", ``prepare_network``: apply_time_segmentation(), In active use, +``Co2L``, Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit``. If a float is appended an overall emission limit relative to the emission level given in ``electricity: co2base`` is added (e.g. ``Co2L0.05`` limits emissisions to 5% of what is given in ``electricity: co2base``), ``prepare_network``: `add_co2limit() `_ and its `caller `__, In active use,, +``Ep``, Add cost for a carbon-dioxide price configured in ``costs: emission_prices: co2`` to ``marginal_cost`` of generators (other emission types listed in ``network.carriers`` possible as well), ``prepare_network``: `add_emission_prices() `_ and its `caller `__, In active use,, +``CCL``, Add minimum and maximum levels of generator nominal capacity per carrier for individual countries. These can be specified in the file linked at ``electricity: agg_p_nom_limits`` in the configuration. File defaults to ``data/agg_p_nom_minmax.csv``., ``solve_network``, In active use,, +``EQ``,Require each country or node to on average produce a minimal share of its total consumption itself. Example: ``EQ0.5c`` demands each country to produce on average at least 50% of its consumption; ``EQ0.5`` demands each node to produce on average at least 50% of its consumption., ``solve_network``, In active use,, +``ATK``,Require each node to be autarkic. Example: ``ATK`` removes all lines and links. ``ATKc`` removes all cross-border lines and links., ``prepare_network``, In active use,, +``BAU``, Add a per-``carrier`` minimal overall capacity, i.e. at least ``40GW`` of ``OCGT`` in Europe, configured in ``electricity: BAU_mincapacities``, ``solve_network``: `add_opts_constraints() `__, Untested +``SAFE``, Add a capacity reserve margin of a certain fraction above the peak demand to which renewable generators and storage do *not* contribute. Ignores network., ``solve_network`` `add_opts_constraints() `__, Untested,, +``carrier+{c|p|m}factor``,"Alter the capital cost (``c``), installable potential (``p``) or marginal costs (``m``) of a carrier by a factor. Example: ``solar+c0.5`` reduces the capital cost of solar to 50\% of original values.", ``prepare_network``, In active use,, +``CH4L``,"Add an overall absolute gas limit. If configured in ``electricity: gaslimit`` it is given in MWh thermal, if a float is appended, the overall gaslimit is assumed to be given in TWh thermal (e.g. ``CH4L200`` limits gas dispatch to 200 TWh termal)", ``prepare_network``: ``add_gaslimit()``, In active use,, +``RES``, Add an overall relative share of renewable generation to total load (e.g. ``RES0.5`` enforces renewables to fulfil a 50% share of total load ).,,,, diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 08b2d41e9..f19943a43 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -22,6 +22,8 @@ E.g. if a new rule becomes available describe how to use it `snakemake -j1 run_t * Drop code-dependency from vresutil `PR #803 `__ +* Support renewables or renewable expansion to meet a desired share of total load. `PR #793 `__ + PyPSA-Earth 0.2.2 ================= From 6cfd54422e0cf10e3e8c8a99b4382f4430726a30 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 29 Jul 2023 16:34:49 +0000 Subject: [PATCH 10/12] [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 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 42e886104..1a6cdcde5 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -24,7 +24,7 @@ E.g. if a new rule becomes available describe how to use it `snakemake -j1 run_t * Add a check to ensure match between a cutout and a modelled area `PR #805 `__ -* Support renewables or renewable expansion to meet a desired share of total load. `PR #793 `__ +* Support renewables or renewable expansion to meet a desired share of total load. `PR #793 `__ PyPSA-Earth 0.2.2 ================= diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 320483648..7442584ad 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -351,7 +351,7 @@ def add_RES_constraints(n, res_share): ggrouper = n.generators.bus.map(n.buses.country) sgrouper = n.storage_units.bus.map(n.buses.country) cgrouper = n.links.bus0.map(n.buses.country) - + logger.warning( "The add_RES_constraints functionality is still work in progress. " "Unexpected results might be incurred, particularly if " From e842ae09d881847c0025e32e081c152b0974e735 Mon Sep 17 00:00:00 2001 From: "martha.mf" Date: Sat, 29 Jul 2023 20:07:07 +0200 Subject: [PATCH 11/12] solve_network: snapshot weightings to link constraint --- scripts/solve_network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 7442584ad..3b546c22b 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -445,7 +445,7 @@ def add_RES_constraints(n, res_share): ( linexpr( ( - n.links.loc[discharger_i].efficiency, + n.snapshot_weightings.stores.apply(lambda r: r * n.links.loc[discharger_i].efficiency), get_var(n, "Link", "p")[discharger_i], ) ) From ac48bf0eb88171fcace67eb776e9a6058fb61f0b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 29 Jul 2023 18:07:32 +0000 Subject: [PATCH 12/12] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/solve_network.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/solve_network.py b/scripts/solve_network.py index 3b546c22b..4dd372940 100755 --- a/scripts/solve_network.py +++ b/scripts/solve_network.py @@ -445,7 +445,9 @@ def add_RES_constraints(n, res_share): ( linexpr( ( - n.snapshot_weightings.stores.apply(lambda r: r * n.links.loc[discharger_i].efficiency), + n.snapshot_weightings.stores.apply( + lambda r: r * n.links.loc[discharger_i].efficiency + ), get_var(n, "Link", "p")[discharger_i], ) )