marota / ExpertOp4Grid

Expert System agent to operate a power grid
https://expertop4grid.readthedocs.io/en/latest
Mozilla Public License 2.0
7 stars 2 forks source link

Bug when trying to display overflow_graph on grid different from IEEE14 #16

Closed marota closed 4 years ago

marota commented 4 years ago

Running on l2rpn_neurips_2020_track1_val python -m alphaDeesp.main -l 22 -c 2 -t 0 (chronics of February)

Commented Custom Layout in config.ini

g_pow and g_pow_prime are correctly printed But not g_overflow


Shell print of error


we print the cmd line = neato -n -Tpdf "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/ressources/output/Base graph/g_overflow_print_geo_2020-07-16_12-222.dot" -o "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/ressources/output/Base graph/g_overflow_print_geo_2020-07-16_12-222.pdf" Traceback (most recent call last): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/main.py", line 99, in main() File "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/main.py", line 94, in main ranked_combinations, expert_system_results, action = expert_operator(sim, plot=args.snapshot) File "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/expert_operator.py", line 33, in expert_operator sim.plot_grid_delta() File "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/core/grid2op/Grid2opSimulation.py", line 430, in plot_grid_delta return self.plot_grid(None, name="g_overflow_print") File "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/core/grid2op/Grid2opSimulation.py", line 446, in plot_grid self.printer.display_geo(g_over, self.get_layout(), name=name) File "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/core/printer.py", line 84, in display_geo assert alphadeesp.execute_command(cmd_line)

marota commented 4 years ago

Running the cli neato -n -Tpdf "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/ressources/output/Base graph/g_overflow_print_geo_2020-07-16_12-222.dot" -o "/Users/antoinemarot/dev/ExpertOp4Grid/alphaDeesp/ressources/output/Base graph/g_overflow_print_geo_2020-07-16_12-222.pdf" Error: node 14 in graph %3 has no position as required by the -n flag

marota commented 4 years ago

So apparently it is using the IEEE14 layout, and don't find positions for other nodes with IDs >= 14

NMegel commented 4 years ago

Could not find the network. Can only chose among ['l2rpn_2019', 'l2rpn_case14_sandbox', 'l2rpn_neurips_2020_track1_large', 'l2rpn_neurips_2020_track1_small', 'l2rpn_neurips_2020_track2_large', 'l2rpn_neurips_2020_track2_small', 'l2rpn_wcci_2020', 'rte_case14_realistic', 'rte_case14_redisp', 'wcci_test']

marota commented 4 years ago

I shared l2rpn_neurips_2020_track1_val on Discord

And then you have to load it grid2op.make(gridPath=datasetPth, test=True)

marota commented 4 years ago

@NMegel verifié comment passer le layout du reseau à la méthode qui génère g_overflow

NMegel commented 4 years ago

The desired process was that the layout loaded in the simulator (class Grid2opSimulation) is first the one given in config.ini (if exists).

    def compute_layout(self):
        try:
            layout = self.param_options['CustomLayout']
            # Conversion from string to list
            layout = ast.literal_eval(layout)
        except:
            try:
                # Grid2op Layout if exists
                layout = list(self.obs.grid_layout.values())
            except:
                layout = [(-280, -81), (-100, -270), (366, -270), (366, -54), (-64, -54), (-64, 54), (366, 0),
                          (438, 0), (326, 54), (222, 108), (79, 162), (-152, 270), (-64, 270), (222, 216),
                          (-280, -151), (-100, -340), (366, -340), (390, -110), (-14, -104), (-184, 54), (400, -80),
                          (438, 100), (326, 140), (200, 8), (79, 12), (-152, 170), (-70, 200), (222, 200)]
        return layout

As you can see in the code above, if there is no layout in config.ini, it loads grid2op layout. It should work if you relaunch after commenting the CustomLayout parameter in config.ini

marota commented 4 years ago

Ok. If we don't already have one, can you add a warning print at the beginning of the process to say that the layout will be taken from config.ini or the backend? so that it is more explicit for someone running a computation

NMegel commented 4 years ago

Warning have been added in method Grid2opSimulation.compute_layout() See commit : d84dd09f552434880c465313a57f3a335563c369

marota commented 4 years ago

Ok