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

Forecast retrieval without calling simulate #131

Closed
Tezirg opened this issue Jul 19, 2020 · 0 comments · Fixed by #139
Closed

Forecast retrieval without calling simulate #131

Tezirg opened this issue Jul 19, 2020 · 0 comments · Fixed by #139
Labels
bug Something isn't working

Comments

@Tezirg
Copy link
Contributor

Tezirg commented Jul 19, 2020

Environment

  • Grid2op version: 1.1.1
  • System: ubuntu20

Bug description

Getting the forecasted prod and load values without calling obs.simulate before raises a KeyError

How to reproduce

Code snippet

import grid2op

print (grid2op.__version__)
env = grid2op.make("l2rpn_wcci_2020")

# Get forecast after a simulate works                                           
obs = env.reset()
obs.simulate(env.action_space({}))
prod_p_f, prod_v_f, load_p_f, load_q_f = obs.get_forecasted_inj()
print (prod_p_f.shape, prod_v_f.shape, load_p_f.shape, load_q_f.shape)

# Get forecast before any simulate doesnt work                                  
obs = env.reset()
prod_p_f, prod_v_f, load_p_f, load_q_f = obs.get_forecasted_inj()
print (prod_p_f.shape, prod_v_f.shape, load_p_f.shape, load_q_f.shape)

Current output

1.1.1
(22,) (22,) (37,) (37,)
Traceback (most recent call last):
  File "./forecast.py", line 13, in <module>
    prod_p_f, prod_v_f, load_p_f, load_q_f = obs.get_forecasted_inj()
  File "XXX/grid2op/Observation/BaseObservation.py", line 666, in get_forecasted_inj
    a = self._forecasted_grid_act[time_step]["inj_action"]
KeyError: 1

Expected output

1.1.1
(22,) (22,) (37,) (37,)
(22,) (22,) (37,) (37,)
@Tezirg Tezirg added the bug Something isn't working label Jul 19, 2020
Tezirg referenced this issue in BDonnot/Grid2Op Jul 22, 2020
Use private attribute _forecasted_inj to get values instead of using the action built from _forecasted_inj in simulate; which removes the need to call simulate
Tezirg referenced this issue in BDonnot/Grid2Op Jul 22, 2020
@BDonnot BDonnot linked a pull request Aug 3, 2020 that will close this issue
BDonnot added a commit that referenced this issue Mar 31, 2021
Final fix before 1.5.0 let's see if tests pass
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

Successfully merging a pull request may close this issue.

1 participant