Skip to content

Unfortunate set-action behavior while a line is disconnected #693

@mhassouna95

Description

@mhassouna95

Environment.

  • Grid2op version: 1.9.8
  • System: Rocky Linux 9.4

Bug description

I am not sure whether this a bug per se, but it is something that impacts agents performance significantly. When applying (simulate or step) with a set action while a line is disconnected, all substations that are adjacent to the line are rendered useless. This is the case because the substation reconf. actions always set all buses (inlcuding that of the disconnected powerline) which results in an error. This is particularly bad when a line adjacent to a large substation is disconnected, leading to invalidation of almost the whole action space.

How to reproduce

Code snippet

import grid2op
from lightsim2grid import LightSimBackend
backend = LightSimBackend()
env = grid2op.make("l2rpn_wcci_2022", backend=backend)
all_actions = env.action_space.get_all_unitary_topologies_set(env.action_space) # get all set actions 
obs = env.reset()

# disconnect line 0 (adjacent to substation 0)
change_status = env.action_space()
change_status.line_change_status = [0] # disconnect line 0
obs,_,_,_ = env.step(change_status)

#get set action of substation 0 
act_sub0 = all_actions[0] # a substation 0 action

print(env.simulate(act_sub0)) 
# Grid2OpException IllegalAction IllegalAction('Powerline with ids [0] have been modified illegally (cooldown of [3])'


... # Some code 

Current output

(<grid2op.Space.GridObjects.CompleteObservation_l2rpn_wcci_2022 object at 0x7efba377c2e0>, 0.0, False, {'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, -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, -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, -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],
      dtype=int32), 'is_illegal': True, 'is_ambiguous': False, 'is_dispatching_illegal': False, 'is_illegal_reco': False, 'reason_alarm_illegal': None, 'reason_alert_illegal': None, 'opponent_attack_line': None, 'opponent_attack_sub': None, 'opponent_attack_duration': 0, 'exception': [Grid2OpException IllegalAction IllegalAction('Powerline with ids [0] have been modified illegally (cooldown of [3])')], 'time_series_id': None, 'rewards': {}})

Expected output

Ideally, not an IllegalAction exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions