rte-france / grid2viz

This repository is a tool for visualizing an agent RL process from a grid2op format. It was made though a partnership between RTE and Artelys for the different challengers of the L2RPN RL Challenge.
https://github.com/rte-france/Grid2Op
Mozilla Public License 2.0
42 stars 18 forks source link

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

Open fmarten99 opened 3 years ago

fmarten99 commented 3 years ago

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(maxgens.value) (just add underscores in front of load_p and prod_p)

vinault commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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)