Giter Site home page Giter Site logo

Line Status Issue about grid2op HOT 10 CLOSED

rte-france avatar rte-france commented on August 13, 2024
Line Status Issue

from grid2op.

Comments (10)

BDonnot avatar BDonnot commented on August 13, 2024

Hello, thanks for reaching out. Indeed this behavior is pretty weird.
Can you share me the code to reproduce this behavior?
I am especially interested in:

  • How were the powerline disconnected? Was it from the environment because of an overflow, or the result of the action of an Agent?
  • How do you try to reconnect the power line? Have you tried the "reconnect_powerline" method of the action space?
  • Have you made sure you reconnected powerline by specifying both bused to which you reconnect if at both ends (extremity and origin)

Thanks

from grid2op.

djmax008 avatar djmax008 commented on August 13, 2024

Hi,

Thanks for the reply.

The powerline should be disconnected due to an overflow.
My codes are as follows:

          next_state, reward, done, infos = self.env.step(action_transf_dict)

          next_state_dict = next_state.to_dict()
         # print("next state dict", next_state_dict)
          ts_list = next_state_dict["timestep_overflow"]
          lines_status_list_bool = next_state_dict["line_status"]
          lines_status_list = []
          for line_status in lines_status_list_bool:
            if line_status: 
              lines_status_list.append(0)
            else:
              lines_status_list.append(1)
          topo_list = next_state_dict["topo_vect"]
          load_p_list = next_state_dict["loads"]["p"]
          load_q_list = next_state_dict["loads"]["q"]
          load_v_list = next_state_dict["loads"]["v"]
          prods_p_list = next_state_dict["prods"]["p"]
          prods_q_list = next_state_dict["prods"]["q"]
          prods_v_list = next_state_dict["prods"]["v"]
          lines_or_p_list = next_state_dict["lines_or"]["p"]
          lines_or_q_list = next_state_dict["lines_or"]["q"]
          lines_or_v_list = next_state_dict["lines_or"]["v"]
          lines_or_a_list = next_state_dict["lines_or"]["a"]
          lines_ex_p_list = next_state_dict["lines_ex"]["p"]
          lines_ex_q_list = next_state_dict["lines_ex"]["q"]
          lines_ex_v_list = next_state_dict["lines_ex"]["v"]
          lines_ex_a_list = next_state_dict["lines_ex"]["a"]
          lines_rho_list = next_state_dict["rho"]
          maintenance_time_list = next_state_dict["maintenance"]["time_next_maintenance"]
          maintenance_duration_list = next_state_dict["maintenance"]["duration_next_maintenance"]
          cd_line_list = next_state_dict["cooldown"]["line"]
          cd_substation_list = next_state_dict["cooldown"]["substation"]
          time_before_line_reconnect_list = next_state_dict["time_before_line_reconnectable"]
          print(lines_status_list_bool, time_before_line_reconnect_list)

The way I am trying to reconnect the line is using below commend after 10 steps cooling down

action_transf_dict = self.agent_action_space.reconnect_powerline(line_id=i,bus_or=line_map[str(i)][0],bus_ex=line_map[str(i)][-1])

where line_map is defined as
line_map = {'0': [0,1], '1': [0,4], '15': [8,9], '16': [8,13],

                            '17': [9,10], '18': [11,12], '19': [12,13],

                            '2': [1,2], '3': [1,3], '4': [1,4], '5': [2,3],

                            '6': [3,4], '10': [5,10], '11': [5,11],

                            '12': [5,12], '7': [3,6], '8': [3,8], '9': [4,5],

                           '13': [6,7], '14': [6,8]}

Thanks,

from grid2op.

BDonnot avatar BDonnot commented on August 13, 2024

I think there is a misconception of what buses means here.
In each substations you have 2 busbars. This function requires you to enter a number 1 or 2 saying at which busbar you want to reconnect the power line.

The code, notebooks and documentation are probably not explicit enough about this. I will try to improve it.
I will also add a method of action that test if it's ambiguous or not in the next version. The way I understand it is that your action is not valid because ambiguous and that's why it has no effect on the grid.

from grid2op.

djmax008 avatar djmax008 commented on August 13, 2024

Thanks, you are right. Now I have figured it out and the line can be connected.
One more question is that if I want to change the line status, do I need to specify the busbar id?
It seems this line does not work:
the_same_act = action_space({"change_line_status": [0,1,2]})

from grid2op.

BDonnot avatar BDonnot commented on August 13, 2024

There are 4 ways to reconnect a disconnected powerline:

  • connect origin to busbar 1 and extremity to busbar 1
  • connect origin to busbar 1 and extremity to busbar 2
  • connect origin to busbar 2 and extremity to busbar 1
  • connect origin to busbar 2 and extremity to busbar 2

As for now, you have then to specify the bus bar of both ends of the powerline even if you use "switch". I'm not sure how to do otherwise. Maybe connect it to the previous bused as was suggested on issues #27 or #31

from grid2op.

djmax008 avatar djmax008 commented on August 13, 2024

Got it. Thanks a lot!

from grid2op.

djmax008 avatar djmax008 commented on August 13, 2024

Hi,

I have another quick question. If I want to use the Simulate function in Observation.py, what command should I use in Runner.py file?

Thanks,

from grid2op.

BDonnot avatar BDonnot commented on August 13, 2024

I am not quite sure I get the question correctly.
The runner is basically an helper that standardize the evaluation of an agent in multiple scenarios, possibly in parallel.
It basically executes the "gym" loop

while not done:
    act = agent.act(obs,reward, done) 
    obs, reward, done, info = env.step(act)

For a given agent, a given number of times.
If you want your agent to simulate the effect of an action, you are free to implement it in the definition of the act method.
For example

class MyAgent(Agent):
    def __init__(self, action_space):
         Agent. __init__(self, action_space) 
    def act(obs, reward, done):
         # simulate do nothing action... Why not? 
         sim_obs, sim_reward, sim_done, _ = obs.simulate(self.action_space())
         # return the do nothing action 
         return self.action_space() 

Of course the above agent is just really stupid. It does nothing. But you are free to do smarter thing with this simulate function.

from grid2op.

djmax008 avatar djmax008 commented on August 13, 2024

Thanks for your reply, I think I understand your meaning. BTW, there might be a bug in the current version. In the previous Obseration.py, there is one line "self.backend = tmp_backend" to reset the backend after simulation. But I did not see this line in the current version. Is it alright?

from grid2op.

BDonnot avatar BDonnot commented on August 13, 2024

Hello, it's because i changed the way the code is working. Now, instead of resetting the "simulated" environment to its old value (the one it should be) after performing the simulate, i do i before. This leads to better performances in most cases and avoid copying backend.

from grid2op.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.