Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] KeyError: 'bus_dc' #2413

Closed
3 of 7 tasks
quant12345 opened this issue Oct 6, 2024 · 8 comments · Fixed by #2455
Closed
3 of 7 tasks

[feature] KeyError: 'bus_dc' #2413

quant12345 opened this issue Oct 6, 2024 · 8 comments · Fixed by #2455

Comments

@quant12345
Copy link
Contributor

quant12345 commented Oct 6, 2024

Feature Checklist

Feature Type

  • Adding new functionality to pandapower

  • Changing existing functionality in pandapower

  • Removing existing functionality in pandapower

Problem Description

In the julia build (3.9, 2) I see three tests with an error: KeyError: 'bus_dc'.
I assume this is because a non-existent key is being accessed.
results.py -> _get_aranged_lookup - row 83

this line:
if len(net[bus_table]) == 0:

Running the test: pytest pandapower/test/opf/test_pandamodels_runpm.py::test_runpm_multi_vstab

I tried adding setdefault before the line that causes the error:

net.setdefault(bus_table, np.array([], dtype=np.int64))# creates a dictionary key if it doesn't exist

but another error occurs:

FAILED pandapower/test/opf/test_pandamodels_runpm.py::test_runpm_multi_vstab - AttributeError: 'numpy.ndarray' object has no attribute 'index'

I haven't been able to figure out how the 'bus_dc' data is formed yet. Or is it in development and not ready yet?

Feature Description

Additional Context

No response

Label

  • Relevant labels are selected
@quant12345 quant12345 reopened this Oct 7, 2024
@yasirroni
Copy link
Contributor

Hi @quant12345, can you test this on matpowercaseframes to? PowerModels accept arbitrary data as far as I know and matpowercaseframes not implemented that yet.

@quant12345
Copy link
Contributor Author

Hi @yasirroni, my modest knowledge in this area is not enough. I have not yet figured out how the data is formed. I can assume that a dataframe should be created in the 'bus_dc' table, but it is not clear where it is formed. The error clearly says that there is no such key in the dictionary.
You created a topic today, I saw that it concerns julia. In Actions I saw

the following failure:
FAILED pandapower/test/opf/test_TNEP.py::test_pm_tnep_cigre_dc - julia.core.JuliaError: Exception 'LoadError: ArgumentError: Package PandaModels does not have PowerModels in its dependencies:
- You may have a partially installed environment. Try `Pkg.instantiate()`
  to ensure all packages in the environment are installed.
- Or, if you have PandaModels checked out for development and have
  added PowerModels as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with PandaModels
in expression starting at /home/runner/.julia/packages/PandaModels/H0sdB/src/PandaModels.jl:1' occurred while calling julia code:
using PandaModels
FAILED pandapower/test/opf/test_TNEP.py::test_pm_tnep_cigre_ac_S - julia.core.JuliaError: Exception 'UndefVarError: `run_powermodels_tnep` not defined' occurred while calling julia code:
run_powermodels_tnep(buffer_file)
FAILED pandapower/test/opf/test_pandamodels_runpm.py::test_compare_pwl_and_poly - pandapower.auxiliary.OPFNotConverged: PowerModels.jl OPF not converged
FAILED pandapower/test/opf/test_pandamodels_runpm.py::test_without_ext_grid - pandapower.auxiliary.OPFNotConverged: PowerModels.jl OPF not converged
FAILED pandapower/test/opf/test_pandamodels_runpm.py::test_storage_opt - KeyError: 'bus_dc'
FAILED pandapower/test/opf/test_pandamodels_runpm.py::test_runpm_multi_vstab - KeyError: 'bus_dc'
FAILED pandapower/test/opf/test_pandamodels_runpm.py::test_runpm_qflex_and_multi_qflex - KeyError: 'bus_dc'

I have the same thing locally in tests, except for the lines with FAILED pandapower/test/opf/test_TNEP.py.

@yasirroni
Copy link
Contributor

Hi @quant12345, I finally success installing PandaModels. Now, I'm also stuck with this same issue, that is bus_dc.

@SimonUlm
Copy link

I think this is caused by the commit fcf7bd7. This also makes the SimBench plugin unusable.

@yasirroni
Copy link
Contributor

Change to stable branch on master, test passed. Thanks @SimonUlm.

@vogt31337
Copy link
Contributor

@quant12345 is this stil relevant?

@quant12345
Copy link
Contributor Author

quant12345 commented Nov 22, 2024

@vogt31337 I saw that in PR #2455 tests for julia (3.9, 2) pass. Need to ask @mfranz13 if there will be any more fixes in the code?

@mfranz13 mfranz13 linked a pull request Nov 22, 2024 that will close this issue
@mfranz13
Copy link
Contributor

There was some unnecessary key dropping from the net object in the result extraction from PandaModels. Thanks for mentioning this issue to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants