diff --git a/configurations/powergrid/benchmarks/l2rpn_idf_2023.ini b/configurations/powergrid/benchmarks/l2rpn_idf_2023.ini index 7e079ecb..5c1220d0 100644 --- a/configurations/powergrid/benchmarks/l2rpn_idf_2023.ini +++ b/configurations/powergrid/benchmarks/l2rpn_idf_2023.ini @@ -277,6 +277,17 @@ eval_params = { "verify_theta": True} } +[DoNothing] +attr_x = ("prod_p", "prod_v", "load_p", "load_q") +attr_tau = ("line_status", "topo_vect") +attr_y = ("a_or", "a_ex", "p_or", "p_ex", "q_or", "q_ex", "prod_q", "load_v", "v_or", "v_ex", "theta_or", "theta_ex") +attr_physics = ("YBus", "SBus", "PV_nodes", "slack") +dataset_create_params = { + "train": {}, + "test": {}, + "test_ood": {} + } + [Benchmark_competition] attr_x = ("prod_p", "prod_v", "load_p", "load_q") attr_tau = ("line_status", "topo_vect") diff --git a/configurations/powergrid/benchmarks/l2rpn_neurips_2020_track1_small.ini b/configurations/powergrid/benchmarks/l2rpn_neurips_2020_track1_small.ini index a26710b3..8284fae8 100644 --- a/configurations/powergrid/benchmarks/l2rpn_neurips_2020_track1_small.ini +++ b/configurations/powergrid/benchmarks/l2rpn_neurips_2020_track1_small.ini @@ -290,6 +290,17 @@ eval_dict = { eval_params = { "inf_batch_size": 59000} # #pas_de_temps=100 x #ligne=20 x #topo=7 +[DoNothing] +attr_x = ("prod_p", "prod_v", "load_p", "load_q") +attr_tau = ("line_status", "topo_vect") +attr_y = ("a_or", "a_ex", "p_or", "p_ex", "q_or", "q_ex", "prod_q", "load_v", "v_or", "v_ex", "theta_or", "theta_ex") +attr_physics = ("YBus", "SBus", "PV_nodes", "slack") +dataset_create_params = { + "train": {}, + "test": {}, + "test_ood": {} + } + [Benchmark_competition] attr_x = ("prod_p", "prod_v", "load_p", "load_q") attr_tau = ("line_status", "topo_vect") diff --git a/configurations/powergrid/benchmarks/l2rpn_wcci_2022.ini b/configurations/powergrid/benchmarks/l2rpn_wcci_2022.ini index 655bc86f..ae8af637 100644 --- a/configurations/powergrid/benchmarks/l2rpn_wcci_2022.ini +++ b/configurations/powergrid/benchmarks/l2rpn_wcci_2022.ini @@ -276,3 +276,14 @@ eval_params = { "VOLTAGE_EQ": {"tolerance": 1e-4, "verify_theta": True} } + +[DoNothing] +attr_x = ("prod_p", "prod_v", "load_p", "load_q") +attr_tau = ("line_status", "topo_vect") +attr_y = ("a_or", "a_ex", "p_or", "p_ex", "q_or", "q_ex", "prod_q", "load_v", "v_or", "v_ex", "theta_or", "theta_ex") +attr_physics = ("YBus", "SBus", "PV_nodes", "slack") +dataset_create_params = { + "train": {}, + "test": {}, + "test_ood": {} + } diff --git a/lips/dataset/powergridDataSet.py b/lips/dataset/powergridDataSet.py index 932fe129..6c232afb 100644 --- a/lips/dataset/powergridDataSet.py +++ b/lips/dataset/powergridDataSet.py @@ -313,11 +313,13 @@ def _store_physics(self, current_size: int, obs, grid, is_lightSimBackend: bool, pv_nodes = np.zeros(shape=(n_bus_bars), dtype=bool) #get admittance matrix and injection vector values from LightSim2Grid - Sbus = grid.get_Sbus() + if is_dc: YBus = grid.get_dcYbus() + Sbus = grid.get_dcSbus() else: YBus = grid.get_Ybus() + Sbus = grid.get_Sbus() #fill data structures with expected dimensions admittance_matrix[np.ix_(unique_bus, unique_bus)] = YBus.todense() diff --git a/lips/physical_simulator/grid2opSimulator.py b/lips/physical_simulator/grid2opSimulator.py index 583d86b5..737deffa 100644 --- a/lips/physical_simulator/grid2opSimulator.py +++ b/lips/physical_simulator/grid2opSimulator.py @@ -79,6 +79,8 @@ def __init__(self, self._timer_solver = 0 self._timer_preproc = 0 self._timer_postproc = 0 + + self.is_dc = self._simulator.parameters.ENV_DC try: from lightsim2grid import LightSimBackend @@ -249,8 +251,9 @@ def _reset_simulator(self, fast_forward: bool = True): # exclude the already selected time stamps from which the scenario should started remaining_timesteps = set(np.arange(self._max_episode_duration)) - set(self._visited_ts) # randomly skip a given number of steps in the first day (to improve the randomness) - nb_ff = self._simulator.space_prng.choice(list(remaining_timesteps)) - if nb_ff > 0: + if len(remaining_timesteps) > 0: + nb_ff = self._simulator.space_prng.choice(list(remaining_timesteps)) + #if nb_ff > 0: self._simulator.fast_forward_chronics(nb_ff) self._obs = self._simulator.get_obs() self._visited_ts.append(nb_ff) @@ -338,7 +341,12 @@ def __any_isolated_nodes(self, env): """ check = False grid = env.backend._grid - Sbus = grid.get_Sbus() + + if self.is_dc: + Sbus = grid.get_dcSbus() + else: + Sbus = grid.get_Sbus() + if len(Sbus) < env.n_sub: check = True return check