From 45aa714bdcdee1e08e1cefb514da4d4858afe02a Mon Sep 17 00:00:00 2001 From: Thomas Gilon Date: Fri, 12 Apr 2024 16:10:00 +0200 Subject: [PATCH 1/9] Add calculate_nodal_supply_energy in make summary --- doc/release_notes.rst | 2 ++ rules/postprocess.smk | 1 + scripts/make_summary.py | 71 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index d42b149f..d5532ddb 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -181,6 +181,8 @@ Upcoming Release * Fix custom busmap read in `cluster_network`. +* Add `nodal_supply_energy` to `make_summary`. + PyPSA-Eur 0.10.0 (19th February 2024) ===================================== diff --git a/rules/postprocess.smk b/rules/postprocess.smk index e7df2e66..b2d53253 100644 --- a/rules/postprocess.smk +++ b/rules/postprocess.smk @@ -199,6 +199,7 @@ rule make_summary: energy=RESULTS + "csvs/energy.csv", supply=RESULTS + "csvs/supply.csv", supply_energy=RESULTS + "csvs/supply_energy.csv", + nodal_supply_energy=RESULTS + "csvs/nodal_supply_energy.csv", prices=RESULTS + "csvs/prices.csv", weighted_prices=RESULTS + "csvs/weighted_prices.csv", market_values=RESULTS + "csvs/market_values.csv", diff --git a/scripts/make_summary.py b/scripts/make_summary.py index 8c2a1aea..dc1aaac1 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -413,6 +413,76 @@ def calculate_supply_energy(n, label, supply_energy): return supply_energy +def calculate_nodal_supply_energy(n, label, nodal_supply_energy): + """ + Calculate the total energy supply/consumption of each component at the buses + aggregated by carrier and node. + """ + + bus_carriers = n.buses.carrier.unique() + + for i in bus_carriers: + bus_map = n.buses.carrier == i + bus_map.at[""] = False + + for c in n.iterate_components(n.one_port_components): + items = c.df.index[c.df.bus.map(bus_map).fillna(False)] + + if len(items) == 0: + continue + + s = ( + pd.concat([ + ( + c.pnl.p[items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + .multiply(c.df.loc[items, "sign"]) + ), + c.df.loc[items][["bus", "carrier"]] + ], axis=1) + .groupby(by=["bus", "carrier"]) + .sum()[0] + ) + s = pd.concat([s], keys=[c.list_name]) + s = pd.concat([s], keys=[i]) + + nodal_supply_energy = nodal_supply_energy.reindex(s.index.union(nodal_supply_energy.index)) + nodal_supply_energy.loc[s.index, label] = s + + for c in n.iterate_components(n.branch_components): + for end in [col[3:] for col in c.df.columns if col[:3] == "bus"]: + items = c.df.index[c.df["bus" + str(end)].map(bus_map).fillna(False)] + + if (len(items) == 0) or c.pnl["p" + end].empty: + continue + + s = ( + pd.concat([ + ( + (-1) * c.pnl["p" + end][items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + ), + c.df.loc[items][["bus0", "carrier"]] + ], axis=1) + .groupby(by=["bus0", "carrier"]) + .sum()[0] + ) + + s.index = s.index.map(lambda x: (x[0], x[1] + end)) + s = pd.concat([s], keys=[c.list_name]) + s = pd.concat([s], keys=[i]) + + nodal_supply_energy = nodal_supply_energy.reindex( + s.index.union(nodal_supply_energy.index) + ) + + nodal_supply_energy.loc[s.index, label] = s + + return nodal_supply_energy + + def calculate_metrics(n, label, metrics): metrics_list = [ "line_volume", @@ -637,6 +707,7 @@ def make_summaries(networks_dict): "energy", "supply", "supply_energy", + "nodal_supply_energy", "prices", "weighted_prices", "price_statistics", From 2b0303e913e5c6de86bbab4140ad3c3aba35f4c8 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 12 May 2024 18:06:50 +0200 Subject: [PATCH 2/9] bump powerplantmatching to 0.5.15 --- doc/release_notes.rst | 3 +++ envs/environment.yaml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index b73b56f8..9e9a4fa7 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -9,6 +9,9 @@ Release Notes Upcoming Release ================ + +* Bump minimum ``powerplantmatching`` version to v0.5.15. + * Group existing capacities to the earlier grouping_year for consistency with optimized capacities. * bugfix: installed heating capacities were 5% lower than existing heating capacities diff --git a/envs/environment.yaml b/envs/environment.yaml index cbb1a364..58835603 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -25,7 +25,7 @@ dependencies: - yaml - pytables - lxml -- powerplantmatching>=0.5.13 +- powerplantmatching>=0.5.15 - numpy - pandas>=2.1 - geopandas>=0.11.0 From e023872d44467cfc09ea6727ff6ad9167432035d Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 13 May 2024 10:50:24 +0200 Subject: [PATCH 3/9] stop using wildcard by default --- config/config.default.yaml | 10 ++++------ config/config.entsoe-all.yaml | 2 +- config/test/config.electricity.yaml | 5 ++++- config/test/config.myopic.yaml | 7 ++++++- config/test/config.overnight.yaml | 7 ++++++- config/test/config.perfect.yaml | 7 ++++++- config/test/config.scenarios.yaml | 2 +- doc/configtables/sector-opts.csv | 2 +- doc/introduction.rst | 4 ++-- doc/release_notes.rst | 2 ++ doc/supply_demand.rst | 4 ++-- doc/tutorial.rst | 12 ++++++------ doc/wildcards.rst | 4 ++-- scripts/prepare_sector_network.py | 2 +- 14 files changed, 44 insertions(+), 26 deletions(-) diff --git a/config/config.default.yaml b/config/config.default.yaml index b32031ea..5664f6e9 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -38,17 +38,15 @@ scenario: simpl: - '' ll: - - v1.5 + - vopt clusters: - 37 - 128 - 256 - - 512 - - 1024 opts: - '' sector_opts: - - Co2L0-3H-T-H-B-I-A-dist1 + - '' planning_horizons: # - 2020 # - 2030 @@ -91,8 +89,8 @@ electricity: voltages: [220., 300., 380., 500., 750.] gaslimit_enable: false gaslimit: false - co2limit_enable: false - co2limit: 7.75e+7 + co2limit_enable: true + co2limit: 0. co2base: 1.487e+9 agg_p_nom_limits: data/agg_p_nom_minmax.csv diff --git a/config/config.entsoe-all.yaml b/config/config.entsoe-all.yaml index 85eedb64..b26ea128 100644 --- a/config/config.entsoe-all.yaml +++ b/config/config.entsoe-all.yaml @@ -29,7 +29,7 @@ countries: ['AL', 'AT', 'BA', 'BE', 'BG', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'F electricity: custom_powerplants: true - co2limit: 9.59e+7 + co2limit: 0 co2base: 1.918e+9 lines: diff --git a/config/test/config.electricity.yaml b/config/test/config.electricity.yaml index 979453cc..6fdb018f 100644 --- a/config/test/config.electricity.yaml +++ b/config/test/config.electricity.yaml @@ -15,7 +15,7 @@ scenario: clusters: - 5 opts: - - Co2L-24h + - '' countries: ['BE'] @@ -24,6 +24,7 @@ snapshots: end: "2013-03-08" electricity: + co2limit_enable: true co2limit: 100.e+6 extendable_carriers: @@ -63,6 +64,8 @@ renewable: clustering: exclude_carriers: ["OCGT", "offwind-ac", "coal"] + temporal: + resolution_elec: 24h lines: dynamic_line_rating: diff --git a/config/test/config.myopic.yaml b/config/test/config.myopic.yaml index a9335046..a44757ae 100644 --- a/config/test/config.myopic.yaml +++ b/config/test/config.myopic.yaml @@ -18,7 +18,7 @@ scenario: clusters: - 5 sector_opts: - - 24h-T-H-B-I-A-dist1 + - '' planning_horizons: - 2030 - 2040 @@ -34,6 +34,7 @@ sector: central_heat_vent: true electricity: + co2limit_enable: true co2limit: 100.e+6 extendable_carriers: @@ -69,6 +70,10 @@ renewable: solar: cutout: be-03-2013-era5 +clustering: + temporal: + resolution_sector: 24h + industry: St_primary_fraction: 2030: 0.6 diff --git a/config/test/config.overnight.yaml b/config/test/config.overnight.yaml index b02c0449..4ab03371 100644 --- a/config/test/config.overnight.yaml +++ b/config/test/config.overnight.yaml @@ -17,7 +17,7 @@ scenario: clusters: - 5 sector_opts: - - CO2L0-24h-T-H-B-I-A-dist1 + - '' planning_horizons: - 2030 @@ -28,6 +28,7 @@ snapshots: end: "2013-03-08" electricity: + co2limit_enable: true co2limit: 100.e+6 extendable_carriers: @@ -63,6 +64,10 @@ renewable: solar: cutout: be-03-2013-era5 +clustering: + temporal: + resolution_sector: 24h + sector: gas_network: true H2_retrofit: true diff --git a/config/test/config.perfect.yaml b/config/test/config.perfect.yaml index 7fbfb630..4eacd945 100644 --- a/config/test/config.perfect.yaml +++ b/config/test/config.perfect.yaml @@ -18,7 +18,7 @@ scenario: clusters: - 5 sector_opts: - - 8760h-T-H-B-I-A-dist1 + - '' planning_horizons: - 2030 - 2040 @@ -31,6 +31,7 @@ snapshots: end: "2013-03-08" electricity: + co2limit_enable: true co2limit: 100.e+6 extendable_carriers: @@ -70,6 +71,10 @@ renewable: solar: cutout: be-03-2013-era5 +clustering: + temporal: + resolution_sector: 8760h + industry: St_primary_fraction: 2020: 0.8 diff --git a/config/test/config.scenarios.yaml b/config/test/config.scenarios.yaml index 8ecbb91b..ca2ea439 100644 --- a/config/test/config.scenarios.yaml +++ b/config/test/config.scenarios.yaml @@ -19,7 +19,7 @@ scenario: clusters: - 5 opts: - - Co2L-24H + - '' countries: ['BE'] diff --git a/doc/configtables/sector-opts.csv b/doc/configtables/sector-opts.csv index fc9e8c10..5f5bb250 100644 --- a/doc/configtables/sector-opts.csv +++ b/doc/configtables/sector-opts.csv @@ -1,5 +1,5 @@ Trigger, Description, Definition, Status -``nH``, i.e. ``2H``-``6H``, "Resample the time-resolution by averaging over every ``n`` snapshots, ``prepare_network``: `average_every_nhours() `_ and its `caller `__)", In active use +``nH``, i.e. ``2h``-``6h``, "Resample the time-resolution by averaging over every ``n`` snapshots, ``prepare_network``: `average_every_nhours() `_ and its `caller `__)", In active use ``Co2L``, Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit``. If a float is appended an overall emission limit relative to the emission level given in ``electricity: co2base`` is added (e.g. ``Co2L0.05`` limits emissisions to 5% of what is given in ``electricity: co2base``), ``prepare_network``: `add_co2limit() `_ and its `caller `__, In active use ``carrier+{c|p|m}factor``,"Alter the capital cost (``c``), installable potential (``p``) or marginal costs (``m``) of a carrier by a factor. Example: ``solar+c0.5`` reduces the capital cost of solar to 50\% of original values.", ``prepare_network``, In active use ``T``,Add land transport sector,,In active use diff --git a/doc/introduction.rst b/doc/introduction.rst index 7cfa0e43..d0f7386d 100644 --- a/doc/introduction.rst +++ b/doc/introduction.rst @@ -35,7 +35,7 @@ For instance, an invocation to .. code:: bash - .../pypsa-eur % snakemake -call results/networks/elec_s_128_ec_lvopt_Co2L-3H.nc + .../pypsa-eur % snakemake -call results/networks/elec_s_128_ec_lvopt_.nc follows this dependency graph @@ -50,7 +50,7 @@ preceding rules which another rule takes as input data. .. note:: The dependency graph was generated using - ``snakemake --dag results/networks/elec_s_128_ec_lvopt_Co2L-3H.nc -F | sed -n "/digraph/,/}/p" | dot -Tpng -o doc/img/intro-workflow.png`` + ``snakemake --dag results/networks/elec_s_128_ec_lvopt_.nc -F | sed -n "/digraph/,/}/p" | dot -Tpng -o doc/img/intro-workflow.png`` For the use of ``snakemake``, it makes sense to familiarize yourself quickly with the `basic tutorial diff --git a/doc/release_notes.rst b/doc/release_notes.rst index dbbce365..3ef9d194 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -222,6 +222,8 @@ Upcoming Release * Clarify suffix usage in `add_existing_baseyear`. +* The ``{sector_opts}`` wildcard is now not used by default. All scenario definitions are now done in the ``config.yaml`` file. + PyPSA-Eur 0.10.0 (19th February 2024) ===================================== diff --git a/doc/supply_demand.rst b/doc/supply_demand.rst index ab58368f..bbb0217e 100644 --- a/doc/supply_demand.rst +++ b/doc/supply_demand.rst @@ -211,7 +211,7 @@ Today, most of the :math:`H_2` consumed globally is produced from natural gas by .. math:: - CH_4 + H_2O \xrightarrow{} CO + 3H_2 + CH_4 + H_2O \xrightarrow{} CO + 3h_2 combined with a water-gas shift reaction @@ -453,7 +453,7 @@ The basic chemicals consumption data from the `JRC IDEES `__ for every country. Ammonia can be made from hydrogen and nitrogen using the Haber-Bosch process. .. math:: - N_2 + 3H_2 \xrightarrow{} 2NH_3 + N_2 + 3h_2 \xrightarrow{} 2NH_3 diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 70c4c9e9..bae8e3a3 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -32,7 +32,7 @@ configuration, execute .. code:: bash :class: full-width - snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_Co2L-24H.nc --configfile config/test/config.electricity.yaml + snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_.nc --configfile config/test/config.electricity.yaml This configuration is set to download a reduced cutout via the rule :mod:`retrieve_cutout`. For more information on the data dependencies of PyPSA-Eur, continue reading :ref:`data`. @@ -114,9 +114,9 @@ clustered down to 6 buses and every 24 hours aggregated to one snapshot. The com .. code:: bash - snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_Co2L-24H.nc --configfile config/test/config.electricity.yaml + snakemake -call results/test-elec/networks/elec_s_6_ec_lcopt_.nc --configfile config/test/config.electricity.yaml -orders ``snakemake`` to run the rule :mod:`solve_network` that produces the solved network and stores it in ``results/networks`` with the name ``elec_s_6_ec_lcopt_Co2L-24H.nc``: +orders ``snakemake`` to run the rule :mod:`solve_network` that produces the solved network and stores it in ``results/networks`` with the name ``elec_s_6_ec_lcopt_.nc``: .. literalinclude:: ../rules/solve_electricity.smk :start-at: rule solve_network: @@ -133,7 +133,7 @@ This triggers a workflow of multiple preceding jobs that depend on each rule's i node[shape=box, style=rounded, fontname=sans, fontsize=10, penwidth=2]; edge[penwidth=2, color=grey]; 0[label = "solve_network", color = "0.38 0.6 0.85", style="rounded"]; - 1[label = "prepare_network\nll: copt\nopts: Co2L-24H", color = "0.53 0.6 0.85", style="rounded"]; + 1[label = "prepare_network\nll: copt", color = "0.53 0.6 0.85", style="rounded"]; 2[label = "add_extra_components", color = "0.01 0.6 0.85", style="rounded"]; 3[label = "cluster_network\nclusters: 6", color = "0.03 0.6 0.85", style="rounded"]; 4[label = "simplify_network\nsimpl: ", color = "0.42 0.6 0.85", style="rounded"]; @@ -268,7 +268,7 @@ For example, you can explore the evolution of the PyPSA networks by running #. ``snakemake resources/networks/elec.nc -call --configfile config/test/config.electricity.yaml`` #. ``snakemake resources/networks/elec_s.nc -call --configfile config/test/config.electricity.yaml`` #. ``snakemake resources/networks/elec_s_6.nc -call --configfile config/test/config.electricity.yaml`` -#. ``snakemake resources/networks/elec_s_6_ec_lcopt_Co2L-24H.nc -call --configfile config/test/config.electricity.yaml`` +#. ``snakemake resources/networks/elec_s_6_ec_lcopt_.nc -call --configfile config/test/config.electricity.yaml`` To run all combinations of wildcard values provided in the ``config/config.yaml`` under ``scenario:``, you can use the collection rule ``solve_elec_networks``. @@ -306,6 +306,6 @@ Jupyter Notebooks). import pypsa - n = pypsa.Network("results/networks/elec_s_6_ec_lcopt_Co2L-24H.nc") + n = pypsa.Network("results/networks/elec_s_6_ec_lcopt_.nc") For inspiration, read the `examples section in the PyPSA documentation `__. diff --git a/doc/wildcards.rst b/doc/wildcards.rst index 16681e3d..f8e60e20 100644 --- a/doc/wildcards.rst +++ b/doc/wildcards.rst @@ -101,7 +101,7 @@ The ``{opts}`` wildcard The ``{opts}`` wildcard is used for electricity-only studies. It triggers optional constraints, which are activated in either :mod:`prepare_network` or the :mod:`solve_network` step. It may hold multiple triggers separated by ``-``, -i.e. ``Co2L-3H`` contains the ``Co2L`` trigger and the ``3H`` switch. There are +i.e. ``Co2L-3h`` contains the ``Co2L`` trigger and the ``3h`` switch. There are currently: @@ -121,7 +121,7 @@ The ``{sector_opts}`` wildcard # Co2Lx specifies the CO2 target in x% of the 1990 values; default will give default (5%); # Co2L0p25 will give 25% CO2 emissions; Co2Lm0p05 will give 5% negative emissions - # xH is the temporal resolution; 3H is 3-hourly, i.e. one snapshot every 3 hours + # xH is the temporal resolution; 3h is 3-hourly, i.e. one snapshot every 3 hours # single letters are sectors: T for land transport, H for building heating, # B for biomass supply, I for industry, shipping and aviation, # A for agriculture, forestry and fishing diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 9f53e317..432d9a82 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -3578,7 +3578,7 @@ if __name__ == "__main__": opts="", clusters="37", ll="v1.0", - sector_opts="CO2L0-24H-T-H-B-I-A-dist1", + sector_opts="CO2L0-24h-T-H-B-I-A-dist1", planning_horizons="2030", ) From 85a2e97f1ed542cd855ec01e4e70ef63a7f73fbb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 08:51:19 +0000 Subject: [PATCH 4/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/add_existing_baseyear.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index 13644897..8eac44f6 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -285,7 +285,9 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas i for i in inv_ind if (i + name_suffix_by) in n.generators.index ] - p_max_pu = n.generators_t.p_max_pu[[i + name_suffix_by for i in inv_ind]] + p_max_pu = n.generators_t.p_max_pu[ + [i + name_suffix_by for i in inv_ind] + ] p_max_pu.columns = [i + name_suffix for i in inv_ind] n.madd( From 8706f0411ec17cf16f968bec889a4c15621531bf Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 13 May 2024 14:37:07 +0200 Subject: [PATCH 5/9] revert use of co2limit_enable for sector-coupled networks --- config/config.default.yaml | 4 ++-- config/test/config.electricity.yaml | 2 +- config/test/config.myopic.yaml | 2 +- config/test/config.overnight.yaml | 2 +- config/test/config.perfect.yaml | 2 +- doc/configtables/electricity.csv | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/config.default.yaml b/config/config.default.yaml index 5664f6e9..77732f52 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -89,8 +89,8 @@ electricity: voltages: [220., 300., 380., 500., 750.] gaslimit_enable: false gaslimit: false - co2limit_enable: true - co2limit: 0. + co2limit_enable: false + co2limit: 7.75e+7 co2base: 1.487e+9 agg_p_nom_limits: data/agg_p_nom_minmax.csv diff --git a/config/test/config.electricity.yaml b/config/test/config.electricity.yaml index 6fdb018f..c5303027 100644 --- a/config/test/config.electricity.yaml +++ b/config/test/config.electricity.yaml @@ -24,7 +24,7 @@ snapshots: end: "2013-03-08" electricity: - co2limit_enable: true + co2limit_enable: false co2limit: 100.e+6 extendable_carriers: diff --git a/config/test/config.myopic.yaml b/config/test/config.myopic.yaml index a44757ae..15537520 100644 --- a/config/test/config.myopic.yaml +++ b/config/test/config.myopic.yaml @@ -34,7 +34,7 @@ sector: central_heat_vent: true electricity: - co2limit_enable: true + co2limit_enable: false co2limit: 100.e+6 extendable_carriers: diff --git a/config/test/config.overnight.yaml b/config/test/config.overnight.yaml index 4ab03371..12e27b4d 100644 --- a/config/test/config.overnight.yaml +++ b/config/test/config.overnight.yaml @@ -28,7 +28,7 @@ snapshots: end: "2013-03-08" electricity: - co2limit_enable: true + co2limit_enable: false co2limit: 100.e+6 extendable_carriers: diff --git a/config/test/config.perfect.yaml b/config/test/config.perfect.yaml index 4eacd945..e32ae3c8 100644 --- a/config/test/config.perfect.yaml +++ b/config/test/config.perfect.yaml @@ -31,7 +31,7 @@ snapshots: end: "2013-03-08" electricity: - co2limit_enable: true + co2limit_enable: false co2limit: 100.e+6 extendable_carriers: diff --git a/doc/configtables/electricity.csv b/doc/configtables/electricity.csv index fd160a45..ac2eadea 100644 --- a/doc/configtables/electricity.csv +++ b/doc/configtables/electricity.csv @@ -2,7 +2,7 @@ voltages,kV,"Any subset of {220., 300., 380.}",Voltage levels to consider gaslimit_enable,bool,true or false,Add an overall absolute gas limit configured in ``electricity: gaslimit``. gaslimit,MWhth,float or false,Global gas usage limit -co2limit_enable,bool,true or false,Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit``. +co2limit_enable,bool,true or false,Add an overall absolute carbon-dioxide emissions limit configured in ``electricity: co2limit`` in :mod:`prepare_network`. **Warning:** This option should currently only be used with electricity-only networks, not for sector-coupled networks.. co2limit,:math:`t_{CO_2-eq}/a`,float,Cap on total annual system carbon dioxide emissions co2base,:math:`t_{CO_2-eq}/a`,float,Reference value of total annual system carbon dioxide emissions if relative emission reduction target is specified in ``{opts}`` wildcard. agg_p_nom_limits,file,path,Reference to ``.csv`` file specifying per carrier generator nominal capacity constraints for individual countries if ``'CCL'`` is in ``{opts}`` wildcard. Defaults to ``data/agg_p_nom_minmax.csv``. From 16b189501168ab3eb8ffcca83af49ff94d88f412 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 13 May 2024 14:40:43 +0200 Subject: [PATCH 6/9] revert further unintended changes --- config/config.entsoe-all.yaml | 2 +- config/test/config.electricity.yaml | 2 +- config/test/config.myopic.yaml | 2 -- config/test/config.overnight.yaml | 2 -- config/test/config.perfect.yaml | 2 -- doc/supply_demand.rst | 4 ++-- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/config/config.entsoe-all.yaml b/config/config.entsoe-all.yaml index b26ea128..85eedb64 100644 --- a/config/config.entsoe-all.yaml +++ b/config/config.entsoe-all.yaml @@ -29,7 +29,7 @@ countries: ['AL', 'AT', 'BA', 'BE', 'BG', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'F electricity: custom_powerplants: true - co2limit: 0 + co2limit: 9.59e+7 co2base: 1.918e+9 lines: diff --git a/config/test/config.electricity.yaml b/config/test/config.electricity.yaml index c5303027..6fdb018f 100644 --- a/config/test/config.electricity.yaml +++ b/config/test/config.electricity.yaml @@ -24,7 +24,7 @@ snapshots: end: "2013-03-08" electricity: - co2limit_enable: false + co2limit_enable: true co2limit: 100.e+6 extendable_carriers: diff --git a/config/test/config.myopic.yaml b/config/test/config.myopic.yaml index 15537520..0c3f360e 100644 --- a/config/test/config.myopic.yaml +++ b/config/test/config.myopic.yaml @@ -34,8 +34,6 @@ sector: central_heat_vent: true electricity: - co2limit_enable: false - co2limit: 100.e+6 extendable_carriers: Generator: [OCGT] diff --git a/config/test/config.overnight.yaml b/config/test/config.overnight.yaml index 12e27b4d..09342ae9 100644 --- a/config/test/config.overnight.yaml +++ b/config/test/config.overnight.yaml @@ -28,8 +28,6 @@ snapshots: end: "2013-03-08" electricity: - co2limit_enable: false - co2limit: 100.e+6 extendable_carriers: Generator: [OCGT] diff --git a/config/test/config.perfect.yaml b/config/test/config.perfect.yaml index e32ae3c8..c4dc963f 100644 --- a/config/test/config.perfect.yaml +++ b/config/test/config.perfect.yaml @@ -31,8 +31,6 @@ snapshots: end: "2013-03-08" electricity: - co2limit_enable: false - co2limit: 100.e+6 extendable_carriers: Generator: [OCGT] diff --git a/doc/supply_demand.rst b/doc/supply_demand.rst index bbb0217e..ab58368f 100644 --- a/doc/supply_demand.rst +++ b/doc/supply_demand.rst @@ -211,7 +211,7 @@ Today, most of the :math:`H_2` consumed globally is produced from natural gas by .. math:: - CH_4 + H_2O \xrightarrow{} CO + 3h_2 + CH_4 + H_2O \xrightarrow{} CO + 3H_2 combined with a water-gas shift reaction @@ -453,7 +453,7 @@ The basic chemicals consumption data from the `JRC IDEES `__ for every country. Ammonia can be made from hydrogen and nitrogen using the Haber-Bosch process. .. math:: - N_2 + 3h_2 \xrightarrow{} 2NH_3 + N_2 + 3H_2 \xrightarrow{} 2NH_3 From 27a6f619cd25bb4c206e7a729bc5cc6a2b0b2fab Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 13 May 2024 15:24:33 +0200 Subject: [PATCH 7/9] reduce min_part_load_fischer_tropsch to 50% --- config/config.default.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.default.yaml b/config/config.default.yaml index 77732f52..42fe5e2a 100644 --- a/config/config.default.yaml +++ b/config/config.default.yaml @@ -551,7 +551,7 @@ sector: - nearshore # within 50 km of sea # - offshore ammonia: false - min_part_load_fischer_tropsch: 0.7 + min_part_load_fischer_tropsch: 0.5 min_part_load_methanolisation: 0.3 min_part_load_methanation: 0.3 use_fischer_tropsch_waste_heat: true From da9beaa98f831095d3addbb1972fbafb423f8cef Mon Sep 17 00:00:00 2001 From: lisazeyen <35347358+lisazeyen@users.noreply.github.com> Date: Mon, 13 May 2024 17:33:07 +0200 Subject: [PATCH 8/9] rename Greece iso-code --- scripts/build_energy_totals.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build_energy_totals.py b/scripts/build_energy_totals.py index b56d3294..e32a2193 100644 --- a/scripts/build_energy_totals.py +++ b/scripts/build_energy_totals.py @@ -142,6 +142,7 @@ def build_eurostat(input_eurostat, countries, nprocesses=1, disable_progressbar= "Domestic navigation": "Domestic Navigation", "International maritime bunkers": "Bunkers", "UK": "GB", + "EL": "GR", } columns_rename = {"Total": "Total all products"} df.rename(index=index_rename, columns=columns_rename, inplace=True) From c311f7bdf83b3b8d80c5ba103753da66daf967b0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 15:33:32 +0000 Subject: [PATCH 9/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/make_summary.py | 49 ++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index dc1aaac1..5746697b 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -415,8 +415,8 @@ def calculate_supply_energy(n, label, supply_energy): def calculate_nodal_supply_energy(n, label, nodal_supply_energy): """ - Calculate the total energy supply/consumption of each component at the buses - aggregated by carrier and node. + Calculate the total energy supply/consumption of each component at the + buses aggregated by carrier and node. """ bus_carriers = n.buses.carrier.unique() @@ -432,22 +432,27 @@ def calculate_nodal_supply_energy(n, label, nodal_supply_energy): continue s = ( - pd.concat([ - ( - c.pnl.p[items] - .multiply(n.snapshot_weightings.generators, axis=0) - .sum() - .multiply(c.df.loc[items, "sign"]) - ), - c.df.loc[items][["bus", "carrier"]] - ], axis=1) + pd.concat( + [ + ( + c.pnl.p[items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + .multiply(c.df.loc[items, "sign"]) + ), + c.df.loc[items][["bus", "carrier"]], + ], + axis=1, + ) .groupby(by=["bus", "carrier"]) .sum()[0] ) s = pd.concat([s], keys=[c.list_name]) s = pd.concat([s], keys=[i]) - nodal_supply_energy = nodal_supply_energy.reindex(s.index.union(nodal_supply_energy.index)) + nodal_supply_energy = nodal_supply_energy.reindex( + s.index.union(nodal_supply_energy.index) + ) nodal_supply_energy.loc[s.index, label] = s for c in n.iterate_components(n.branch_components): @@ -458,14 +463,18 @@ def calculate_nodal_supply_energy(n, label, nodal_supply_energy): continue s = ( - pd.concat([ - ( - (-1) * c.pnl["p" + end][items] - .multiply(n.snapshot_weightings.generators, axis=0) - .sum() - ), - c.df.loc[items][["bus0", "carrier"]] - ], axis=1) + pd.concat( + [ + ( + (-1) + * c.pnl["p" + end][items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + ), + c.df.loc[items][["bus0", "carrier"]], + ], + axis=1, + ) .groupby(by=["bus0", "carrier"]) .sum()[0] )