Example #1
0
 def test_case14_test_override_action(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_test")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path,
                                     action_class=VoltageOnlyAction) as env:
             assert issubclass(env._actionClass, VoltageOnlyAction)
Example #2
0
 def test_case5_some_missing(self):
     dataset_path = os.path.join(PATH_DATA_TEST,
                                 "5bus_example_some_missing")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path) as env:
             assert env.parameters.NB_TIMESTEP_COOLDOWN_SUB == 19
Example #3
0
 def test_case5_changedifficulty_raiseerror(self):
     dataset_path = os.path.join(PATH_DATA_TEST, "5bus_example_with_params")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with self.assertRaises(EnvError):
             with make_from_dataset_path(dataset_path, difficulty="3") as env:
                 assert False, "this should have raised an exception"
Example #4
0
 def test_case5_runs(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case5_example")
     with make_from_dataset_path(dataset_path) as env:
         assert env.redispatching_unit_commitment_availble == True
         obs = env.reset()
         sim_obs, reward, done, info = obs.simulate(env.action_space())
         assert sim_obs != obs
Example #5
0
 def test_l2rpn19_override_action(self):
     self.skipTest("l2rpn has been removed")
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "l2rpn_2019")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path, action_class=VoltageOnlyAction) as env:
             assert issubclass(env._actionClass, VoltageOnlyAction)
Example #6
0
 def test_l2rpn19_override_chronics(self):
     self.skipTest("l2rpn has been removed")
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "l2rpn_2019")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path, chronics_class=ChangeNothing) as env:
             assert isinstance(env.chronics_handler.real_data, ChangeNothing)
Example #7
0
 def test_l2rpn19_override_reward(self):
     self.skipTest("l2rpn has been removed")
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "l2rpn_2019")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path, reward_class=FlatReward) as env:
             assert env._rewardClass == FlatReward
Example #8
0
 def test_case14_test_override_reward(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_test")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path,
                                     reward_class=FlatReward) as env:
             assert env._rewardClass == FlatReward
Example #9
0
 def test_case14_redisp_runs(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_redisp")
     with make_from_dataset_path(dataset_path) as env:
         assert env.redispatching_unit_commitment_availble == True
         obs = env.reset()
         sim_obs, reward, done, info = obs.simulate(env.action_space())
         assert sim_obs != obs
         assert np.all(env._thermal_limit_a == case14_redisp_TH_LIM)
Example #10
0
 def test_case14_test_override_chronics(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_test")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path,
                                     chronics_class=ChangeNothing) as env:
             assert isinstance(env.chronics_handler.real_data,
                               ChangeNothing)
Example #11
0
 def test_case5_changedparameters(self):
     param = Parameters()
     param.NB_TIMESTEP_RECONNECTION = 128
     dataset_path = os.path.join(PATH_DATA_TEST, "5bus_example_with_params")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path, param=param) as env:
             assert env.parameters.NB_TIMESTEP_RECONNECTION == 128
Example #12
0
 def test_case14_test_override_feed_kwargs(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_test")
     chronics_path = os.path.join(dataset_path, "chronics", "0")
     dfk = {
         "chronicsClass": ChangeNothing,
         "path": chronics_path,
         "gridvalueClass": GridStateFromFile
     }
     with make_from_dataset_path(dataset_path, data_feeding_kwargs=dfk) as env:
         assert isinstance(env.chronics_handler.real_data, ChangeNothing)
Example #13
0
 def test_l2rpn19_override_feed_kwargs(self):
     self.skipTest("l2rpn has been removed")
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "l2rpn_2019")
     chronics_path = os.path.join(dataset_path, "chronics", "0000")
     dfk = {
         "chronicsClass": ChangeNothing,
         "path": chronics_path,
         "gridvalueClass": GridStateFromFile
     }
     with make_from_dataset_path(dataset_path, data_feeding_kwargs=dfk) as env:
         assert isinstance(env.chronics_handler.real_data, ChangeNothing)
Example #14
0
 def test_case14_redisp_config(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_redisp")
     with make_from_dataset_path(dataset_path) as env:
         # Check config is loaded from config.py
         assert env.rewardClass == RedispReward
         assert env.actionClass == TopologyAndDispatchAction
         assert env.observationClass == CompleteObservation
         assert isinstance(env.backend, PandaPowerBackend)
         assert env.legalActClass == DefaultRules
         assert isinstance(env.voltage_controler, ControlVoltageFromFile)
         assert isinstance(env.chronics_handler.real_data, Multifolder)
Example #15
0
 def test_case5_config(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case5_example")
     with make_from_dataset_path(dataset_path) as env:
         # Check config is loaded from config.py
         assert env._rewardClass == L2RPNReward
         assert env._actionClass == TopologyAction
         assert env._observationClass == CompleteObservation
         assert isinstance(env.backend, PandaPowerBackend)
         assert env._legalActClass == DefaultRules
         assert isinstance(env._voltage_controler, ControlVoltageFromFile)
         assert isinstance(env.chronics_handler.real_data, Multifolder)
         assert env.action_space.grid_layout != None
Example #16
0
 def test_l2rpn19_test_config(self):
     self.skipTest("l2rpn has been removed")
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "l2rpn_2019")
     with make_from_dataset_path(dataset_path) as env:
         # Check config is loaded from config.py
         assert env.rewardClass == L2RPNReward
         assert env.actionClass == TopologyAction
         assert env.observationClass == CompleteObservation
         assert isinstance(env.backend, PandaPowerBackend)
         assert env.legalActClass == DefaultRules
         assert isinstance(env.voltage_controler, ControlVoltageFromFile)
         assert isinstance(env.chronics_handler.real_data, Multifolder)
         assert env.action_space.grid_layout != None
Example #17
0
 def test_case14_test_config(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_test")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path) as env:
             # Check config is loaded from config.py
             assert env._rewardClass == RedispReward
             assert issubclass(env._actionClass, TopologyAndDispatchAction)
             assert issubclass(env._observationClass, CompleteObservation)
             assert isinstance(env.backend, PandaPowerBackend)
             assert env._legalActClass == DefaultRules
             assert isinstance(env._voltage_controler, ControlVoltageFromFile)
             assert isinstance(env.chronics_handler.real_data, Multifolder)
             assert env.action_space.grid_layout != None
Example #18
0
 def test_case14_test_override_action(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_test")
     with make_from_dataset_path(dataset_path,
                                 action_class=VoltageOnlyAction) as env:
         assert env.actionClass == VoltageOnlyAction
Example #19
0
 def test_case14_test_override_reward(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case14_test")
     with make_from_dataset_path(dataset_path,
                                 reward_class=FlatReward) as env:
         assert env.rewardClass == FlatReward
Example #20
0
 def test_l2rpn19_override_action(self):
     self.skipTest("l2rpn has been removed")
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "l2rpn_2019")
     with make_from_dataset_path(dataset_path,
                                 action_class=VoltageOnlyAction) as env:
         assert env.actionClass == VoltageOnlyAction
Example #21
0
 def test_case5_changedifficulty(self):
     dataset_path = os.path.join(PATH_DATA_TEST, "5bus_example_with_params")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path, difficulty="2") as env:
             assert env.parameters.NB_TIMESTEP_RECONNECTION == 6
Example #22
0
 def test_case5_override_chronics(self):
     dataset_path = os.path.join(PATH_CHRONICS_Make2, "rte_case5_example")
     with make_from_dataset_path(dataset_path,
                                 chronics_class=ChangeNothing) as env:
         assert isinstance(env.chronics_handler.real_data, ChangeNothing)
Example #23
0
 def test_case5_parameters_loading_competition(self):
     dataset_path = os.path.join(PATH_DATA_TEST, "5bus_example_with_params")
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore")
         with make_from_dataset_path(dataset_path) as env:
             assert env.parameters.NB_TIMESTEP_RECONNECTION == 12