openego / eTraGo

Optimization of flexibility options for transmission grids based on PyPSA
GNU Affero General Public License v3.0
33 stars 13 forks source link

Power flow with foreign DC-lines fails #553

Closed ClaraBuettner closed 1 year ago

ClaraBuettner commented 1 year ago

When all foreign lines are modeled as DC-links (args['foreign_lines'] = 'DC'), there is a problem in th pf_function:


  File "/tmp/ipykernel_32848/2701482053.py", line 1, in <cell line: 1>
    pf_post_lopf(etrago, calc_losses = True)

  File "/tmp/ipykernel_32848/1323864540.py", line 546, in pf_post_lopf
    drop_foreign_components(network)

  File "/tmp/ipykernel_32848/1323864540.py", line 432, in drop_foreign_components
    foreign_series[comp][a] = foreign_series[comp][a][

  File "/home/clara/etrago_pypsa201/venv/lib/python3.8/site-packages/pandas/core/frame.py", line 3810, in __getitem__
    indexer = self.columns._get_indexer_strict(key, "columns")[1]

  File "/home/clara/etrago_pypsa201/venv/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 6111, in _get_indexer_strict
    self._raise_if_missing(keyarr, indexer, axis_name)

  File "/home/clara/etrago_pypsa201/venv/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 6174, in _raise_if_missing
    raise KeyError(f"{not_found} not in index")

KeyError: "['43768 H2_for_industry', '43770 H2_for_industry', '43772 H2_for_industry', '43774 H2_for_industry', '43775 H2_for_industry', '43777 H2_for_industry', '43780 H2_for_industry'] not in index"

I used the current dev-branch.

ClaraBuettner commented 1 year ago

Hi @CarlosEpia I just noticed that I created this issue without assigning someone.... Do you know if it was already fixed?

CarlosEpia commented 1 year ago

Hi @ClaraBuettner. Yes I did the required changes in #567.