Giter Site home page Giter Site logo

Comments (3)

BDonnot avatar BDonnot commented on August 13, 2024

Hello @Medha710 i am not witnessing any unusual behaviour in the grid2op 0.5.2 version on my machine.
The outcome of your script, for the load_v part look like this to me:
load_voltage_scneario2

We notice everything is fine, until there is a game over (at time step around 90-100).
This change of behaviour (sending a game over when a load is disconnected) has been added in version 0.5.0 I believe.
Can you confirm you get the same results as me on this exact script please (this is a copy paste of your program that sets the scenario tested to the bugy scenario) ?

import numpy as np
import pandas as pd
import grid2op
import matplotlib.pyplot as plt

def obs_to_df(obs, reward):
    """ Extract relevant information from observation and put it into dataframe. """
    # create dataframe from observations
    num_load=obs.n_load
    num_line=obs.n_line
    data = [[pd.Timestamp(obs.year, obs.month, obs.day, obs.hour_of_day, obs.minute_of_hour),reward]]
    df = pd.DataFrame(data, columns = ['Date','reward'])
    load_v=pd.DataFrame([obs.load_v[2]], columns=["Load 3(V)"])
    df=pd.concat([df,load_v],axis=1)
    # Adding line related data
    for i in range(0, num_line):
        str_line_or=("Line Origin %d" % (i+1))
        or_v=pd.DataFrame([obs.v_or[i]], columns=[(str_line_or+"(V)")])
        str_line_ex=("Line Extremity %d" % (i+1))
        ex_v=pd.DataFrame([obs.v_ex[i]], columns=[(str_line_ex+"(V)")])
        df=pd.concat([df,or_v,ex_v],axis=1)
    return df
# RUN THE AGENT:
env = grid2op.make("case5_example") # create environment: power grid, injections, reward function, observation space, action space
env.chronics_handler.tell_id(0) # force the environement to use scenario 1 (set it to scenario 0, but calling env.reset will make it go to scenario 01)
total_reward = 0.0 # initialize reward accumulator
total_steps = int(0) # initialize the counter of steps
obs = env.reset() # obtain first observation
print("Chronics used: {}".format(env.chronics_handler.get_id()))
df_obs = obs_to_df(obs, 0.0) # put relevant observations into dataframe
do_nothing_action = env.helper_action_player({}) # specify the "do-nothing action"
load_v=[]
while True:
        obs, reward, done, info = env.step(do_nothing_action) # run the power grid with the do-nothing action
        df_obs = df_obs.append(obs_to_df(obs, reward), ignore_index=True) # append relevant observations to dataframe
        total_reward += reward
        total_steps += 1
        if np.any(~np.isfinite(obs.load_v)):
            print("I found a nan in load voltages")
        if done:
            break
print("Episode done in %d steps, total reward %.2f" % (total_steps, total_reward))  
#Issue here: Load 3 becomes NaN after some timestamps
plt.plot(df_obs.index, df_obs['Load 3(V)'],label="Load 3(V)")
plt.show()

Also, note that version of pandapower 2.2.0 make the environment really really slow (10 fold increase in the computation of a time step). The pandapower team was made aware of this issue and they fixed it in version 2.2.1. I would recommend using either pandapower 2.1.0 or pandapower 2.2.1 for grid2op related computation, but not 2.2.0.

from grid2op.

medhasubramanian avatar medhasubramanian commented on August 13, 2024

Hello @BDonnot
Yes, you are correct. I had not checked if the game over signal was true or false. As in the previous version, the game would not be over even though the load was disconnected.
Yes, I confirm that I get the same response.
Thank you for the clarification!
Also, thank you for your comment about the pandapower version; will take it into account.

from grid2op.

BDonnot avatar BDonnot commented on August 13, 2024

Hello Medha,

I am closing this issue as the problem seems to have been solved. Don't hesitate to reach out if this issue arises again.

Benjamin

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.