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

Problem with obs_colored.prod_p in grid2viz manager.py #92

Open
fmarten99 opened this issue May 3, 2021 · 4 comments
Open

Problem with obs_colored.prod_p in grid2viz manager.py #92

fmarten99 opened this issue May 3, 2021 · 4 comments

Comments

@fmarten99
Copy link

fmarten99 commented May 3, 2021

When using the most recent grid2op (1.5.1), some observation attributes have become private. This will cause errors in the grid2viz manager.py program when executing:
obs_colored.load_p = np.array(max_loads.value)
obs_colored.prod_p = np.array(max_gens.value)
because load_p and prod_p are now private attributes.
Hence, Python will complain that these attributes cannot be set and grid2viz does not load its main windows when selecting a scenario.

It can easily be fixed by adjusting the manager.py to:
obs_colored._load_p = np.array(max_loads.value)
obs_colored._prod_p = np.array(max_gens.value)
(just add underscores _ in front of load_p and prod_p)

@vinault
Copy link
Collaborator

vinault commented May 4, 2021

Hi Frank,

The prod_p attribute was actually renamed gen_p in Grid2Op 1.5.1.

obs_colored.prod_p = np.array(max_gens.value)

has been replaced by :

obs_colored.gen_p = np.array(max_gens.value)

on branch grid2op-1.5 but has not been merged into the master yet. Thanks for spotting it.

Cheers

@BDonnot
Copy link
Contributor

BDonnot commented May 4, 2021

Just to be clear on that, obs.prod_p is still possible to do in grid2op 1.5.1 without any issue.
If not, then it's a grid2op bug

@BuenoRebecca
Copy link

Hi,

I am getting this error too:
File "/home/rebecca/anaconda3/lib/python3.8/site-packages/grid2viz/src/manager.py", line 235, in make_network_scenario_overview obs_colored.prod_p = np.array(max_gens.value) AttributeError: can't set attribute

@BDonnot
Copy link
Contributor

BDonnot commented May 11, 2021

Thanks for clarifying the issue.
I think i see the problem now.

Attribute of the observation should be immutable. Only the environment can generate an observation, then no one should be able to modify it.

Apparently, grid2viz does that for some attributes (in this case prod_p which should not be possible)

@BDonnot BDonnot changed the title Problem with obs_colored.load_p in grid2viz manager.py Problem with obs_colored.prod_p in grid2viz manager.py May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants