From 8a323b726725380e96d385f84c7718b016ea4c13 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Fri, 16 Oct 2020 11:38:26 +0200 Subject: [PATCH] cost: move defaults to config and improve documentation --- config.default.yaml | 13 +++++++++++-- config.tutorial.yaml | 13 +++++++++++-- doc/configtables/costs.csv | 11 ++++++----- doc/configuration.rst | 4 ++-- doc/costs.rst | 17 +++++------------ doc/release_notes.rst | 6 +++++- doc/tutorial.rst | 2 +- scripts/add_electricity.py | 18 ++++++------------ scripts/add_extra_components.py | 4 ++-- scripts/make_summary.py | 5 +++-- scripts/prepare_network.py | 7 ++++--- scripts/simplify_network.py | 7 ++++--- test/config.test1.yaml | 13 +++++++++++-- 13 files changed, 71 insertions(+), 49 deletions(-) diff --git a/config.default.yaml b/config.default.yaml index d0d78730..5635b739 100755 --- a/config.default.yaml +++ b/config.default.yaml @@ -171,8 +171,17 @@ load: costs: year: 2030 - discountrate: 0.07 # From a Lion Hirth paper, also reflects average of Noothout et al 2016 - USD2013_to_EUR2013: 0.7532 # [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html + version: v0.1.0 + rooftop_share: 0.5 + fill_values: + FOM: 0 + VOM: 0 + efficiency: 1 + fuel: 0 + investment: 0 + lifetime: 25 + "CO2 intensity": 0 + "discount rate": 0.07 marginal_cost: solar: 0.01 onwind: 0.015 diff --git a/config.tutorial.yaml b/config.tutorial.yaml index 1aa589ca..272a757b 100755 --- a/config.tutorial.yaml +++ b/config.tutorial.yaml @@ -149,8 +149,17 @@ load: costs: year: 2030 - discountrate: 0.07 # From a Lion Hirth paper, also reflects average of Noothout et al 2016 - USD2013_to_EUR2013: 0.7532 # [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html + version: v0.1.0 + rooftop_share: 0.5 + fill_values: + FOM: 0 + VOM: 0 + efficiency: 1 + fuel: 0 + investment: 0 + lifetime: 25 + "CO2 intensity": 0 + "discount rate": 0.07 marginal_cost: solar: 0.01 onwind: 0.015 diff --git a/doc/configtables/costs.csv b/doc/configtables/costs.csv index 383a6423..11f0f3df 100644 --- a/doc/configtables/costs.csv +++ b/doc/configtables/costs.csv @@ -1,8 +1,9 @@ ,Unit,Values,Description -year,--,"YYYY; e.g. '2030'","Year for which to retrieve cost assumptions of ``data/costs.csv``." -discountrate,--,float,"Default discount rate if not specified for a technology in ``data/costs.csv``." -USD2013_to_EUR2013,--,float,"Exchange rate from USD :math:`_{2013}` to EUR :math:`_{2013}` from `ECB `_" -capital_cost,EUR/MW,"Keys should be in the 'technology' column of ``data/costs.csv``. Values can be any float.","For the given technologies, assumptions about their capital investment costs are set to the corresponding value. Optional; overwrites cost assumptions from ``data/costs.csv``." -marginal_cost,EUR/MWh,"Keys should be in the 'technology' column of ``data/costs.csv``. Values can be any float.","For the given technologies, assumptions about their marginal operating costs are set to the corresponding value. Optional; overwrites cost assumptions from ``data/costs.csv``." +year,--,"YYYY; e.g. '2030'","Year for which to retrieve cost assumptions of ``resources/costs.csv``." +version,--,"vX.X.X; e.g. 'v0.1.0'","Version of ``technology-data`` repository to use." +rooftop_share,--,float,"Share of rooftop PV when calculating capital cost of solar (joint rooftop and utility-scale PV)." +fill_values,--,float,"Default values if not specified for a technology in ``resources/costs.csv``." +capital_cost,EUR/MW,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technologies, assumptions about their capital investment costs are set to the corresponding value. Optional; overwrites cost assumptions from ``resources/costs.csv``." +marginal_cost,EUR/MWh,"Keys should be in the 'technology' column of ``resources/costs.csv``. Values can be any float.","For the given technologies, assumptions about their marginal operating costs are set to the corresponding value. Optional; overwrites cost assumptions from ``resources/costs.csv``." emission_prices,,,"Specify exogenous prices for emission types listed in ``network.carriers`` to marginal costs." -- co2,EUR/t,float,"Exogenous price of carbon-dioxide added to the marginal costs of fossil-fuelled generators according to their carbon intensity. Added through the keyword ``Ep`` in the ``{opts}`` wildcard only in the rule :mod:`prepare_network``." \ No newline at end of file diff --git a/doc/configuration.rst b/doc/configuration.rst index 265943e8..27f6d104 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -240,9 +240,9 @@ Specifies the temporal range to build an energy system model for as arguments to :file: configtables/costs.csv .. note:: - To change cost assumptions in more detail (i.e. other than ``marginal_cost`` and ``capital_cost``), consider modifying cost assumptions directly in ``data/costs.csv`` as this is not yet supported through the config file. + To change cost assumptions in more detail (i.e. other than ``marginal_cost`` and ``capital_cost``), consider modifying cost assumptions directly in ``resources/costs.csv`` as this is not yet supported through the config file. - You can also build multiple different cost databases. Make a renamed copy of ``data/costs.csv`` (e.g. ``data/costs-optimistic.csv``) and set the variable ``COSTS=data/costs-optimistic.csv`` in the ``Snakefile``. + You can also build multiple different cost databases. Make a renamed copy of ``resources/costs.csv`` (e.g. ``data/costs-optimistic.csv``) and set the variable ``COSTS=data/costs-optimistic.csv`` in the ``Snakefile``. .. _solving_cf: diff --git a/doc/costs.rst b/doc/costs.rst index a51acb85..df296341 100644 --- a/doc/costs.rst +++ b/doc/costs.rst @@ -7,7 +7,9 @@ Cost Assumptions ################## -The database of cost assumptions is stored in ``data/costs.csv``. +The database of cost assumptions is retrieved from the repository `PyPSA/technology-data `_ and then saved to``resources/costs.csv``. + +The ``config.yaml` provides options to choose a reference year (``costs: year:``) and use a specific version of the repository ``costs: version:``. It includes cost assumptions for all included technologies for specific years from various sources, namely for @@ -39,15 +41,6 @@ Modifying Cost Assumptions Some cost assumptions (e.g. marginal cost and capital cost) can be directly overwritten in the ``config.yaml`` (cf. Section :ref:`costs_cf` in :ref:`config`). -To change cost assumptions in more detail, modify cost assumptions directly in ``data/costs.csv`` as this is not yet supported through the config file. +To change cost assumptions in more detail, modify cost assumptions directly in ``resources/costs.csv`` as this is not yet supported through the config file. -You can also build multiple different cost databases. Make a renamed copy of ``data/costs.csv`` (e.g. ``data/costs-optimistic.csv``) and set the variable ``COSTS=data/costs-optimistic.csv`` in the ``Snakefile``. - - -Default Cost Assumptions -======================== - -.. csv-table:: - :header-rows: 1 - :widths: 10,3,5,4,6,8 - :file: ../data/costs.csv \ No newline at end of file +You can also build multiple different cost databases. Make a renamed copy of ``resources/costs.csv`` (e.g. ``data/costs-optimistic.csv``) and set the variable ``COSTS=data/costs-optimistic.csv`` in the ``Snakefile``. diff --git a/doc/release_notes.rst b/doc/release_notes.rst index b5855691..9b79ebab 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -21,7 +21,11 @@ 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 `_. +* Corrected setting of exogenous emission price (in ``cost: emission price:``). This was not weighted by the efficiency and effective emission of the generators (`#171 `_). + +* Techno-economic parameters of technologies (e.g. costs and efficiencies) will now be retrieved from a separate repository `PyPSA/technology-data `_ + that collects assumptions from a variety of sources. It is activated by default with ``enable: retrieve_cost_data: true`` and controlled with ``costs: year:`` and ``costs: version:``. + The location of this data changed from ``data/costs.csv`` to ``resources/costs.csv`` (`#184 `_). PyPSA-Eur 0.2.0 (8th June 2020) diff --git a/doc/tutorial.rst b/doc/tutorial.rst index eca7dd05..abc58be8 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -218,7 +218,7 @@ A job (here ``simplify_network``) will display its attributes and normally some [] rule simplify_network: - input: networks/elec.nc, data/costs.csv, resources/regions_onshore.geojson, resources/regions_offshore.geojson + input: networks/elec.nc, resources/costs.csv, resources/regions_onshore.geojson, resources/regions_offshore.geojson output: networks/elec_s.nc, resources/regions_onshore_elec_s.geojson, resources/regions_offshore_elec_s.geojson, resources/clustermaps_elec_s.h5 jobid: 3 benchmark: benchmarks/simplify_network/elec_s diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index 60c1060c..e0e763b4 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -13,7 +13,7 @@ Relevant Settings costs: year: - USD2013_to_EUR2013: + version: dicountrate: emission_prices: @@ -46,7 +46,7 @@ Relevant Settings Inputs ------ -- ``data/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. +- ``resources/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. - ``data/bundle/hydro_capacities.csv``: Hydropower plant store/discharge power capacities, energy storage capacity, and average hourly inflow by country. .. image:: ../img/hydrocapacities.png @@ -145,15 +145,9 @@ def load_costs(Nyears=1., tech_costs=None, config=None, elec_config=None): # correct units to MW costs.loc[costs.unit.str.contains("/kW"),"value"] *= 1e3 + costs.unit = costs.unit.str.replace("/kW", "/MW") - fill_values = {"CO2 intensity" : 0, - "FOM" : 0, - "VOM" : 0, - "discount rate" : config['discountrate'], - "efficiency" : 1, - "fuel" : 0, - "investment" : 0, - "lifetime" : 25} + fill_values = config["fill_values"] costs = costs.value.unstack().fillna(fill_values) costs["capital_cost"] = ((annuity(costs["lifetime"], costs["discount rate"]) + @@ -170,8 +164,8 @@ def load_costs(Nyears=1., tech_costs=None, config=None, elec_config=None): costs.at['OCGT', 'co2_emissions'] = costs.at['gas', 'co2_emissions'] costs.at['CCGT', 'co2_emissions'] = costs.at['gas', 'co2_emissions'] - costs.at['solar', 'capital_cost'] = 0.5*(costs.at['solar-rooftop', 'capital_cost'] + - costs.at['solar-utility', 'capital_cost']) + costs.at['solar', 'capital_cost'] = config["rooftop_share"] * costs.at['solar-rooftop', 'capital_cost'] + \ + (1-config["rooftop_share"]) * costs.at['solar-utility', 'capital_cost'] def costs_for_storage(store, link1, link2=None, max_hours=1.): capital_cost = link1['capital_cost'] + max_hours * store['capital_cost'] diff --git a/scripts/add_extra_components.py b/scripts/add_extra_components.py index 219c082d..13796366 100644 --- a/scripts/add_extra_components.py +++ b/scripts/add_extra_components.py @@ -13,7 +13,7 @@ Relevant Settings costs: year: - USD2013_to_EUR2013: + version: dicountrate: emission_prices: @@ -32,7 +32,7 @@ Relevant Settings Inputs ------ -- ``data/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. +- ``resources/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. Outputs ------- diff --git a/scripts/make_summary.py b/scripts/make_summary.py index db9eff46..74fd0936 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -11,8 +11,9 @@ Relevant Settings .. code:: yaml costs: - USD2013_to_EUR2013: - discountrate: + year: + version: + fill_values: marginal_cost: capital_cost: diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index 67d134f4..60ae0f71 100755 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -19,9 +19,10 @@ Relevant Settings .. code:: yaml costs: + year: + version: + fill_values: emission_prices: - USD2013_to_EUR2013: - discountrate: marginal_cost: capital_cost: @@ -36,7 +37,7 @@ Relevant Settings Inputs ------ -- ``data/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. +- ``resources/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. - ``networks/{network}_s{simpl}_{clusters}.nc``: confer :ref:`cluster` Outputs diff --git a/scripts/simplify_network.py b/scripts/simplify_network.py index 74ba0a7e..26f3f80b 100644 --- a/scripts/simplify_network.py +++ b/scripts/simplify_network.py @@ -14,8 +14,9 @@ Relevant Settings .. code:: yaml costs: - USD2013_to_EUR2013: - discountrate: + year: + version: + fill_values: marginal_cost: capital_cost: @@ -44,7 +45,7 @@ Relevant Settings Inputs ------ -- ``data/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. +- ``resources/costs.csv``: The database of cost assumptions for all included technologies for specific years from various sources; e.g. discount rate, lifetime, investment (CAPEX), fixed operation and maintenance (FOM), variable operation and maintenance (VOM), fuel costs, efficiency, carbon-dioxide intensity. - ``resources/regions_onshore.geojson``: confer :ref:`busregions` - ``resources/regions_offshore.geojson``: confer :ref:`busregions` - ``networks/{network}.nc``: confer :ref:`electricity` diff --git a/test/config.test1.yaml b/test/config.test1.yaml index 536a3d50..8de2c707 100755 --- a/test/config.test1.yaml +++ b/test/config.test1.yaml @@ -149,8 +149,17 @@ load: costs: year: 2030 - discountrate: 0.07 # From a Lion Hirth paper, also reflects average of Noothout et al 2016 - USD2013_to_EUR2013: 0.7532 # [EUR/USD] ECB: https://www.ecb.europa.eu/stats/exchange/eurofxref/html/eurofxref-graph-usd.en.html + version: v0.1.0 + rooftop_share: 0.5 + fill_values: + FOM: 0 + VOM: 0 + efficiency: 1 + fuel: 0 + investment: 0 + lifetime: 25 + "CO2 intensity": 0 + "discount rate": 0.07 marginal_cost: solar: 0.01 onwind: 0.015