Adding focus_weights to pre-clustering (#241)

* Add focus_weights to pre-clustering

Hey guys,
another quick fix since I noticed it wasn't implemented yet: When pre-clustering the network, the focus_weights have not yet been considered. This may distort clustering results when pre-clustering to a low resolution.

* Update release_notes.rst
This commit is contained in:
Chiara Anselmetti 2021-05-21 15:27:34 +02:00 committed by GitHub
parent cf55f00656
commit 11c29ac6cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@ Upcoming Release
* Fix: Value for ``co2base`` in ``config.yaml`` adjusted to 1.487e9 t CO2-eq (from 3.1e9 t CO2-eq). The new value represents emissions related to the electricity sector for EU+UK. The old value was ~2x too high and used when the emissions wildcard in ``{opts}`` was used.
* Add option to include marginal costs of links representing fuel cells, electrolysis, and battery inverters
[`#232 <https://github.com/PyPSA/pypsa-eur/pull/232>`_].
* The ``focus_weights`` are now also considered when pre-clustering in the :mod:`simplify_network` rule [`#241 <https://github.com/PyPSA/pypsa-eur/pull/241>`_].
PyPSA-Eur 0.3.0 (7th December 2020)
==================================

View File

@ -324,6 +324,8 @@ def remove_stubs(n):
def cluster(n, n_clusters):
logger.info(f"Clustering to {n_clusters} buses")
focus_weights = snakemake.config.get('focus_weights', None)
renewable_carriers = pd.Index([tech
for tech in n.generators.carrier.unique()
if tech.split('-', 2)[0] in snakemake.config['renewable']])
@ -337,7 +339,8 @@ def cluster(n, n_clusters):
for tech in renewable_carriers]))
if len(renewable_carriers) > 0 else 'conservative')
clustering = clustering_for_n_clusters(n, n_clusters, custom_busmap=False, potential_mode=potential_mode,
solver_name=snakemake.config['solving']['solver']['name'])
solver_name=snakemake.config['solving']['solver']['name'],
focus_weights=focus_weights)
return clustering.network, clustering.busmap