grid2viz
grid2viz copied to clipboard
Problem with obs_colored.prod_p in grid2viz manager.py
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)
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
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
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
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)