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

Bug when simulating an action leading to a diverging powerflow with LightSim #235

Closed
marota opened this issue Jun 22, 2021 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@marota
Copy link
Contributor

marota commented Jun 22, 2021

Environment

  • Grid2op version: 1.6.0
  • System: osx
  • Additional system information

Bug description

Bug when simulating an action leading to a diverging powerflow with LightSim.

How to reproduce

Code snippet

import grid2op
# Backend class to use
from lightsim2grid.LightSimBackend import LightSimBackend
BACKEND = LightSimBackend
#from grid2op.Backend import PandaPowerBackend
#BACKEND = PandaPowerBackend

env_path='/YourPath/L2RPN_icaps2021/input_data_val'

env = grid2op.make(env_path,backend=BACKEND(),difficulty="competition")

final_dict={'generators_id': [(19, 1)],
 'loads_id': [(30, 2)],
 'lines_or_id': [(58, 1)],
 'lines_ex_id': [(46, 1), (47, 2)]}
action=env.action_space({"set_bus": final_dict})

obs=env.get_obs()
obs.simulate(action,time_step=0)

Current output

File "grid2op/Observation/CompleteObservation.py", line 206, in update
self._shunt_p[:] = sh_p
ValueError: could not broadcast input array from shape (0) into shape (6)

When doing env.step(action) your get the following:

(<grid2op.Space.GridObjects.CompleteObservation_input_data_val at 0x7f815e84aa60>,
-1.0,
True,
{'disc_lines': array([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1,
1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
0, -1, -1, -1, -1, -1, -1, -1], dtype=int32),
'is_illegal': False,
'is_ambiguous': False,
'is_dispatching_illegal': False,
'is_illegal_reco': False,
'reason_alarm_illegal': None,
'opponent_attack_line': None,
'opponent_attack_sub': None,
'opponent_attack_duration': 0,
'exception': [Grid2OpException DivergingPowerFlow DivergingPowerFlow('divergence of powerflow (non connected grid)')],
'rewards': {}})

Or doing the same simulate but with pandapower you get:

(<grid2op.Space.GridObjects.CompleteObservation_input_data_val at 0x7fd3ab019eb0>,
-1.0,
True,
{'disc_lines': array([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1,
1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
0, -1, -1, -1, -1, -1, -1, -1], dtype=int32),
'is_illegal': False,
'is_ambiguous': False,
'is_dispatching_illegal': False,
'is_illegal_reco': False,
'reason_alarm_illegal': None,
'opponent_attack_line': None,
'opponent_attack_sub': None,
'opponent_attack_duration': 0,
'exception': [Grid2OpException DivergingPowerFlow DivergingPowerFlow('powerflow diverged with error :"Power Flow nr did not converge after 10 iterations!"')],
'rewards': {}})

Expected output

Would expect the same kind of output as pandapower
@marota marota added the bug Something isn't working label Jun 22, 2021
BDonnot referenced this issue in BDonnot/Grid2Op Jun 23, 2021
Hotfix issue rte-france#235
BDonnot referenced this issue Jun 23, 2021
Hotfix issue rte-france#235
@BDonnot
Copy link
Collaborator

BDonnot commented Jun 23, 2021

Should be fixed in the latest grid2op release (version 1.6.0.post1)

@BDonnot BDonnot closed this as completed Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants