conventional config section: update to more general attribute assignment scheme

This commit is contained in:
Fabian 2022-06-27 17:35:19 +02:00
parent 8349e85252
commit b56d1f6f4d
6 changed files with 32 additions and 17 deletions

View File

@ -174,7 +174,7 @@ rule build_renewable_profiles:
input: input:
base_network="networks/base.nc", base_network="networks/base.nc",
corine="data/bundle/corine/g250_clc06_V18_5.tif", corine="data/bundle/corine/g250_clc06_V18_5.tif",
natura=lambda w: ("data/Natura2000_end2020.gpkg" natura=lambda w: ("resources/natura.tiff"
if config["renewable"][w.technology]["natura"] if config["renewable"][w.technology]["natura"]
else []), else []),
gebco=lambda w: ("data/bundle/GEBCO_2014_2D.nc" gebco=lambda w: ("data/bundle/GEBCO_2014_2D.nc"
@ -217,7 +217,8 @@ rule add_electricity:
load='resources/load.csv', load='resources/load.csv',
nuts3_shapes='resources/nuts3_shapes.geojson', nuts3_shapes='resources/nuts3_shapes.geojson',
**{f"profile_{tech}": f"resources/profile_{tech}.nc" **{f"profile_{tech}": f"resources/profile_{tech}.nc"
for tech in config['renewable']} for tech in config['renewable']},
**{"conventional_{carrier}_{attrs}": fn for carrier in config.get('conventional', {None: {}}).values() for fn in carrier.values() if str(fn).startswith("data/")},
output: "networks/elec.nc" output: "networks/elec.nc"
log: "logs/add_electricity.log" log: "logs/add_electricity.log"
benchmark: "benchmarks/add_electricity" benchmark: "benchmarks/add_electricity"

View File

@ -187,7 +187,7 @@ renewable:
conventional: conventional:
nuclear: nuclear:
energy_availability_factors: "data/nuclear-eafs.csv" # float of file name p_max_pu: "data/nuclear_p_max_pu.csv" # float of file name
lines: lines:
types: types:

View File

@ -171,7 +171,7 @@ Define and specify the ``atlite.Cutout`` used for calculating renewable potentia
.. literalinclude:: ../config.default.yaml .. literalinclude:: ../config.default.yaml
:language: yaml :language: yaml
:start-at: hydro: :start-at: hydro:
:end-before: lines: :end-before: conventional:
.. csv-table:: .. csv-table::
:header-rows: 1 :header-rows: 1
@ -180,6 +180,17 @@ Define and specify the ``atlite.Cutout`` used for calculating renewable potentia
.. _lines_cf: .. _lines_cf:
``conventional``
=============
Define additional generator attribute for conventional carrier types. If a scalar value is given it is applied to all generators. However if a string starting with "data/" is given, the value is interpreted as a path to a csv file with country specific values. Then, the values are read in and applied to all generators of the given carrier in the given country. Note that the value(s) overwrite the existing values in the corresponding section of the ``generators`` dataframe.
.. literalinclude:: ../config.default.yaml
:language: yaml
:start-at: conventional:
:end-before: lines:
``lines`` ``lines``
============= =============

View File

@ -53,11 +53,11 @@ Upcoming Release
* Add function to add global constraint on use of gas in :mod:`prepare_network`. This can be activated by including the keyword ``CH4L`` in the ``{opts}`` wildcard which enforces the limit set in ``electricity: gaslimit:`` given in MWh thermal. Alternatively, it is possible to append a number in the `{opts}` wildcard, e.g. `CH4L200` which limits the gas use to 200 TWh thermal. * Add function to add global constraint on use of gas in :mod:`prepare_network`. This can be activated by including the keyword ``CH4L`` in the ``{opts}`` wildcard which enforces the limit set in ``electricity: gaslimit:`` given in MWh thermal. Alternatively, it is possible to append a number in the `{opts}` wildcard, e.g. `CH4L200` which limits the gas use to 200 TWh thermal.
* Add configuration option to implement Energy Availability Factors (EAFs) for conventional generation technologies.
* A new section ``conventional`` was added to the config file. This section contains configurations for conventional carriers. * A new section ``conventional`` was added to the config file. This section contains configurations for conventional carriers.
* Implement country-specific EAFs for nuclear power plants based on IAEA 2018-2020 reported country averages. These are specified ``data/nuclear_eafs.csv`` and translate to static ``p_max_pu`` values. * Add configuration option to implement arbitrary generator attributes for conventional generation technologies.
* Implement country-specific Energy Availability Factors (EAFs) for nuclear power plants based on IAEA 2018-2020 reported country averages. These are specified ``data/nuclear_p_max_pu.csv`` and translate to static ``p_max_pu`` values.
* The powerplants that have been shut down before 2021 are filtered out. * The powerplants that have been shut down before 2021 are filtered out.

View File

@ -331,17 +331,20 @@ def attach_conventional_generators(n, costs, ppl, conventional_carriers, extenda
# Generators with technology affected # Generators with technology affected
idx = n.generators.query("carrier == @carrier").index idx = n.generators.query("carrier == @carrier").index
factors = conventional_config[carrier].get("energy_availability_factors")
if isinstance(factors, float): for key in list(set(conventional_carriers[carrier]) & set(n.generators)):
# Single value affecting all generators of technology k indiscriminantely of country
n.generators.loc[idx, "p_max_pu"] = factors values = conventional_config[carrier][key]
elif isinstance(factors, str):
factors = pd.read_csv(factors, index_col=0)['factor'] if isinstance(values, str) and str(values).startswith("data/"):
# Values affecting generators of technology k country-specific # Values affecting generators of technology k country-specific
# First map generator buses to countries; then map countries to p_max_pu # First map generator buses to countries; then map countries to p_max_pu
bus_factors = n.buses.country.map(factors) values = pd.read_csv(values, index_col=0).iloc[:, 0]
n.generators.p_max_pu.update(n.generators.loc[idx].bus.map(bus_factors).dropna()) bus_values = n.buses.country.map(values)
n.generators[key].update(n.generators.loc[idx].bus.map(bus_values).dropna())
else:
# Single value affecting all generators of technology k indiscriminantely of country
n.generators.loc[idx, key] = values