Grid2Op icon indicating copy to clipboard operation
Grid2Op copied to clipboard

Inconsistent thermal limits in env and obs from env.get_obs()

Open marota opened this issue 2 years ago • 1 comments

Environment

  • Grid2op version: 1.6.5 & 1.7.2
  • System: ubuntu20.04, ...
  • Additional system information

Bug description

When getting an observation through env.get_obs(), thermal_limits don't have a consistent value with the ones from env. Then obs.rho does not have expected value either, which then causes issues when relying on that variable

How to reproduce

Command line

# command line used if any 

Code snippet

from grid2op import make
env=make("l2rpn_case14_sandbox")
obs=env.get_obs()

assert all(obs.rho==obs.a_or/env.get_thermal_limit())
assert all(env.get_thermal_limit()==obs._obs_env.get_thermal_limit())

marota avatar Jul 06 '22 12:07 marota

This "bug" seems only to appear when the env has not been "reset" which is not really supported: always use obs = env.reset() at least once before using an environment.

I tag it as an "improvement" because i'm pretty sure something can be done to fix this particular issue (even when the env is not properly initialized).

The valid code:

from grid2op import make
env=make("l2rpn_case14_sandbox")
obs=env.reset()

assert all(obs.rho==obs.a_or/env.get_thermal_limit())
assert all(env.get_thermal_limit()==obs._obs_env.get_thermal_limit())

works on my machine

BDonnot avatar Jul 06 '22 12:07 BDonnot