Skip to content

Gas clustering in market_optimization not working for eGon2035 #795

@ClaraBuettner

Description

@ClaraBuettner

When setting "market_optimization" to True while running the eGon2035 scenario, there is an error. The gas clustering which is applied to aggregate all gas nodes per country results in the following error:

  File ~/etrago-powerd/eTraGo/etrago/appl.py:709 in run_etrago
    etrago.optimize()

  File ~/etrago-powerd/eTraGo/etrago/execute/__init__.py:431 in optimize
    self.market_optimization()

  File ~/etrago-powerd/eTraGo/etrago/execute/market_optimization.py:60 in market_optimization
    build_market_model(self, unit_commitment)

  File ~/etrago-powerd/eTraGo/etrago/execute/market_optimization.py:729 in build_market_model
    gas_clustering_market_model(self)

  File ~/etrago-powerd/eTraGo/etrago/execute/market_optimization.py:1034 in gas_clustering_market_model
    self.pre_market_model, busmap_new = gas_postprocessing(

  File ~/etrago-powerd/eTraGo/etrago/cluster/gas.py:395 in gas_postprocessing
    busmap = get_h2_clusters(etrago, busmap)

  File ~/etrago-powerd/eTraGo/etrago/cluster/gas.py:322 in get_h2_clusters
    busmap_ch4.loc[etrago.ch4_h2_mapping.index].values,

  File ~/etrago-powerd/venv/lib/python3.10/site-packages/pandas/core/indexing.py:1103 in __getitem__
    return self._getitem_axis(maybe_callable, axis=axis)

  File ~/etrago-powerd/venv/lib/python3.10/site-packages/pandas/core/indexing.py:1332 in _getitem_axis
    return self._getitem_iterable(key, axis=axis)

  File ~/etrago-powerd/venv/lib/python3.10/site-packages/pandas/core/indexing.py:1272 in _getitem_iterable
    keyarr, indexer = self._get_listlike_indexer(key, axis)

  File ~/etrago-powerd/venv/lib/python3.10/site-packages/pandas/core/indexing.py:1462 in _get_listlike_indexer
    keyarr, indexer = ax._get_indexer_strict(key, axis_name)

  File ~/etrago-powerd/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py:5877 in _get_indexer_strict
    self._raise_if_missing(keyarr, indexer, axis_name)

  File ~/etrago-powerd/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py:5938 in _raise_if_missing
    raise KeyError(f"None of [{key}] are in the [{axis_name}]")

KeyError: "None of [Index(['47369', '47372', '47373', '47374', '47375', '47376', '47377', '47378',\n       '47379', '47380',\n       ...\n       '48558', '48562', '48565', '48566', '48567', '48568', '48570', '48596',\n       '48599', '48638'],\n      dtype='object', name='CH4_bus', length=619)] are in the [index]"

I guess the problem is that etrago.ch4_h2_mapping always refers to the H2 and CH4 nodes in the original resolution, so it does not work when it is applied after the first clustering step.

I suggest to update etrago.ch4_h2_mapping after the first clustering step.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions