From 04f19f214d7c6002e499c27efd6d045930eba2a0 Mon Sep 17 00:00:00 2001 From: FabianHofmann Date: Tue, 25 Aug 2020 12:12:00 +0200 Subject: [PATCH] fix emission prices (#171) * fix emission prices I'm not sure if the previous setup was intentional, but regarding that different generators might have different efficiencies and the emissions are carrier specific only, it makes more sense set net emission price. * small fix * update release_notes and config --- config.default.yaml | 2 +- config.tutorial.yaml | 2 +- doc/release_notes.rst | 2 ++ scripts/prepare_network.py | 8 +++++--- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config.default.yaml b/config.default.yaml index b039c047..375bcda6 100755 --- a/config.default.yaml +++ b/config.default.yaml @@ -179,7 +179,7 @@ costs: hydro: 0. H2: 0. battery: 0. - emission_prices: # only used with the option Ep + emission_prices: # in currency per tonne emission, only used with the option Ep co2: 0. solving: diff --git a/config.tutorial.yaml b/config.tutorial.yaml index f199424d..f77ad2bd 100755 --- a/config.tutorial.yaml +++ b/config.tutorial.yaml @@ -156,7 +156,7 @@ costs: offwind: 0.015 H2: 0. battery: 0. - emission_prices: # only used with the option Ep + emission_prices: # in currency per tonne emission, only used with the option Ep co2: 0. solving: diff --git a/doc/release_notes.rst b/doc/release_notes.rst index a30aa02b..b5855691 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -21,6 +21,8 @@ Upcoming Release * Added Google Cloud Platform tutorial (for Windows users). +* Corrected setting of exogenous emission price (in config -> cost -> emission price). This was not weighted by the efficiency and effective emission of the generators. Fixed in `#171 `_. + PyPSA-Eur 0.2.0 (8th June 2020) ================================== diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index 994b9d6b..67d134f4 100755 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -7,7 +7,7 @@ Prepare PyPSA network for solving according to :ref:`opts` and :ref:`ll`, such as - adding an annual **limit** of carbon-dioxide emissions, -- adding an exogenous **price** of carbon-dioxide emissions (or other kinds), +- adding an exogenous **price** per tonne emissions of carbon-dioxide (or other kinds), - setting an **N-1 security margin** factor for transmission line capacities, - specifying a limit on the **cost** of transmission expansion, - specifying a limit on the **volume** of transmission expansion, and @@ -85,8 +85,10 @@ def add_emission_prices(n, emission_prices=None, exclude_co2=False): if exclude_co2: emission_prices.pop('co2') ep = (pd.Series(emission_prices).rename(lambda x: x+'_emissions') * n.carriers.filter(like='_emissions')).sum(axis=1) - n.generators['marginal_cost'] += n.generators.carrier.map(ep) - n.storage_units['marginal_cost'] += n.storage_units.carrier.map(ep) + gen_ep = n.generators.carrier.map(ep) / n.generators.efficiency + n.generators['marginal_cost'] += gen_ep + su_ep = n.storage_units.carrier.map(ep) / n.storage_units.efficiency_dispatch + n.storage_units['marginal_cost'] += su_ep def set_line_s_max_pu(n): # set n-1 security margin to 0.5 for 37 clusters and to 0.7 from 200 clusters