From 165dd2d440818fabd6a18fe1f20dfeea964366f4 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Fri, 10 Jul 2020 16:41:44 +0200 Subject: [PATCH] uncertain costs: facilitate parameter sweep (#167) * add opts for cost parameter sweep * add pr link to release note --- doc/configtables/opts.csv | 1 + doc/release_notes.rst | 2 +- scripts/prepare_network.py | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/configtables/opts.csv b/doc/configtables/opts.csv index 5753fb37..4d699034 100644 --- a/doc/configtables/opts.csv +++ b/doc/configtables/opts.csv @@ -5,3 +5,4 @@ Trigger, Description, Definition, Status ``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 ``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+factor``, "Alter the capital cost of a carrier by a factor. Example: ``solar+0.5`` reduces the capital cost of solar to 50\% of original values.", ``prepare_network``, In active use \ No newline at end of file diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 06f41116..3e8ed2f7 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -11,7 +11,7 @@ Release Notes Upcoming Release ================ -* ... +* Added an option to alter the capital cost of carriers by a factor via ``carrier+factor`` in the ``{opts}`` wildcard. This can be useful for exploring uncertain cost parameters. Example: ``solar+0.5`` reduces the capital cost of solar to 50% of original values (`#167 `_). PyPSA-Eur 0.2.0 (8th June 2020) diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index 10939172..994b9d6b 100755 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -215,6 +215,19 @@ if __name__ == "__main__": else: add_co2limit(n, Nyears) + for o in opts: + oo = o.split("+") + if oo[0].startswith(tuple(n.carriers.index)): + carrier = oo[0] + cost_factor = float(oo[1]) + if carrier == "AC": # lines do not have carrier + n.lines.capital_cost *= cost_factor + else: + comps = {"Generator", "Link", "StorageUnit"} + for c in n.iterate_components(comps): + sel = c.df.carrier.str.contains(carrier) + c.df.loc[sel,"capital_cost"] *= cost_factor + if 'Ep' in opts: add_emission_prices(n)