e2nIEE / simbench

Electrical Power System Benchmark Dataset directly usable with pandapower (use the project website for other tools)
https://simbench.de/en/
Other
97 stars 28 forks source link

Error using EHVHV grid with run_timeseries #20

Open Svosw opened 2 years ago

Svosw commented 2 years ago

Hi,

Thank you for all the hard work in maintaining this package!

I have stumbled upon an error when trying to use the 1-EHVHV-mixed-all-1-no_sw grid. See the following minimal example to reproduce the error:

import simbench as sb
from pandapower.timeseries.run_time_series import run_timeseries

# The first grid works, the second doesn't
working_grid = "1-EHVHV-mixed-all-0-no_sw"
non_working_grid = "1-EHVHV-mixed-all-1-no_sw"

net_working = sb.get_simbench_net(working_grid)
net_non_working = sb.get_simbench_net(non_working_grid)

profiles_working = sb.get_absolute_values(
    net_working, profiles_instead_of_study_cases=True
)
profiles_non_working = sb.get_absolute_values(
    net_non_working, profiles_instead_of_study_cases=True
)

sb.apply_const_controllers(net_working, profiles_working)
sb.apply_const_controllers(net_non_working, profiles_non_working)

# check that all needed profiles existent
assert not sb.profiles_are_missing(net_working)
assert not sb.profiles_are_missing(net_non_working)

timesteps = range(96)

# This run_timeseries should work
run_timeseries(net_working, timesteps)

# The following run_timeseries results in an error
run_timeseries(net_non_working, timesteps)

Trying to use the run_timeseries function from pandapower with the 1-EHVHV-mixed-all-1-no_sw grid results in the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/timeseries/run_time_series.py", line 346, in run_timeseries
    run_loop(net, ts_variables, **kwargs)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/timeseries/run_time_series.py", line 318, in run_loop
    run_time_step(net, time_step, ts_variables, run_control_fct, output_writer_fct, **kwargs)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/timeseries/run_time_series.py", line 121, in run_time_step
    run_control_fct(net, run_control=False, ctrl_variables=ts_variables, **kwargs)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/control/run_control.py", line 293, in run_control
    control_implementation(net, controller_order, ctrl_variables, max_iter, **kwargs)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/control/run_control.py", line 216, in control_implementation
    ctrl_variables = evaluate_net_fct(net, levelorder, ctrl_variables, **kwargs)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/control/run_control.py", line 180, in _evaluate_net
    run_funct(net, **kwargs)  # run can be runpp, runopf or whatever
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/run.py", line 205, in runpp
    _recycled_powerflow(net, **kwargs)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/powerflow.py", line 121, in _recycled_powerflow
    _build_gen_ppc(net, ppc)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/build_gen.py", line 53, in _build_gen_ppc
    add_element_to_gen(net, ppc, element, f, t)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/build_gen.py", line 82, in add_element_to_gen
    _build_pp_gen(net, ppc, f, t)
  File "[...]/.venv/lib/python3.8/site-packages/pandapower/build_gen.py", line 198, in _build_pp_gen
    gen_buses = bus_lookup[net["gen"]["bus"].values[gen_is]]
IndexError: boolean index did not match indexed array along dimension 0; dimension is 338 but corresponding boolean dimension is 342

The same error also appears with 1-EHVHV-mixed-all-2-no_sw.

Can you have a look at what is going on?

I'm using pandapower 2.7.0 with Simbench 1.3.0.

Thanks!

SteffenMeinecke commented 2 years ago

@Svosw, thank you for the easy-to-reproduce issue! This error was new to me. It is an pandapower issue. So I opened https://github.com/e2nIEE/pandapower/issues/1430. As a quick solution, as long as the bug has been solved, you can use pandapower v2.5.0 if you do not rely on the newer pandapower functions.

Svosw commented 2 years ago

Perfect, thank you! Using v2.5.0 resolves the issue.