|
25 | 25 |
|
26 | 26 | from grid2op.Runner import Runner |
27 | 27 |
|
| 28 | + |
28 | 29 | class Issue616Tester(unittest.TestCase): |
29 | 30 | def setUp(self): |
30 | 31 | self.env_name = "l2rpn_case14_sandbox" |
31 | 32 | # create first env |
32 | 33 | with warnings.catch_warnings(): |
33 | 34 | warnings.filterwarnings("ignore") |
34 | 35 | env = grid2op.make(self.env_name, |
35 | | - test=True) |
| 36 | + test=True) |
36 | 37 |
|
37 | 38 | # hack for adding maintenance |
38 | 39 | dict_maint = { |
@@ -133,7 +134,7 @@ def setUp(self): |
133 | 134 | with warnings.catch_warnings(): |
134 | 135 | warnings.filterwarnings("ignore") |
135 | 136 | env = grid2op.make(self.env_name, |
136 | | - test=True) |
| 137 | + test=True) |
137 | 138 |
|
138 | 139 | # hack for adding maintenance |
139 | 140 | dict_maint = { |
@@ -165,62 +166,17 @@ def setUp(self): |
165 | 166 | "gen_p_for_handler": NoisyForecastHandler("prod_p_forecasted"), |
166 | 167 | "load_p_for_handler": NoisyForecastHandler("load_p_forecasted"), |
167 | 168 | "load_q_for_handler": NoisyForecastHandler("load_q_forecasted"), |
168 | | - } |
| 169 | + }, |
| 170 | + test=True |
169 | 171 | ) |
170 | 172 | self.env_bug.chronics_handler.reset() |
171 | 173 |
|
172 | 174 | # store the normal maintenance schedule: |
173 | 175 | self.maint_ref = (np.array([ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
174 | 176 | 23, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, |
175 | | - 310, 311, 588, 589, 590, 591, 592, 593, 594, 595, 596, |
176 | | - 597, 598, 599, 876, 877, 878, 879, 880, 881, 882, 883, |
177 | | - 884, 885, 886, 887, 1164, 1165, 1166, 1167, 1168, 1169, 1170, |
178 | | - 1171, 1172, 1173, 1174, 1175, 1452, 1453, 1454, 1455, 1456, 1457, |
179 | | - 1458, 1459, 1460, 1461, 1462, 1463, 1740, 1741, 1742, 1743, 1744, |
180 | | - 1745, 1746, 1747, 1748, 1749, 1750, 1751, 2028, 2029, 2030, 2031, |
181 | | - 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2316, 2317, 2318, |
182 | | - 2319, 2320, 2321, 2322, 2323, 2324, 2325, 2326, 2327, 2604, 2605, |
183 | | - 2606, 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2892, |
184 | | - 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, |
185 | | - 3180, 3181, 3182, 3183, 3184, 3185, 3186, 3187, 3188, 3189, 3190, |
186 | | - 3191, 3468, 3469, 3470, 3471, 3472, 3473, 3474, 3475, 3476, 3477, |
187 | | - 3478, 3479, 3756, 3757, 3758, 3759, 3760, 3761, 3762, 3763, 3764, |
188 | | - 3765, 3766, 3767, 4044, 4045, 4046, 4047, 4048, 4049, 4050, 4051, |
189 | | - 4052, 4053, 4054, 4055, 4332, 4333, 4334, 4335, 4336, 4337, 4338, |
190 | | - 4339, 4340, 4341, 4342, 4343, 4620, 4621, 4622, 4623, 4624, 4625, |
191 | | - 4626, 4627, 4628, 4629, 4630, 4631, 4908, 4909, 4910, 4911, 4912, |
192 | | - 4913, 4914, 4915, 4916, 4917, 4918, 4919, 5196, 5197, 5198, 5199, |
193 | | - 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5484, 5485, 5486, |
194 | | - 5487, 5488, 5489, 5490, 5491, 5492, 5493, 5494, 5495, 5772, 5773, |
195 | | - 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 6060, |
196 | | - 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069, 6070, 6071, |
197 | | - 6348, 6349, 6350, 6351, 6352, 6353, 6354, 6355, 6356, 6357, 6358, |
198 | | - 6359, 6636, 6637, 6638, 6639, 6640, 6641, 6642, 6643, 6644, 6645, |
199 | | - 6646, 6647, 6924, 6925, 6926, 6927, 6928, 6929, 6930, 6931, 6932, |
200 | | - 6933, 6934, 6935, 7212, 7213, 7214, 7215, 7216, 7217, 7218, 7219, |
201 | | - 7220, 7221, 7222, 7223, 7500, 7501, 7502, 7503, 7504, 7505, 7506, |
202 | | - 7507, 7508, 7509, 7510, 7511, 7788, 7789, 7790, 7791, 7792, 7793, |
203 | | - 7794, 7795, 7796, 7797, 7798, 7799]), |
| 177 | + 310, 311]), |
204 | 178 | np.array([12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14, 14, 14, 14, 14, |
205 | | - 14, 14, 14, 14, 14, 14, 14, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, |
206 | | - 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 2, 2, 2, |
207 | | - 2, 2, 2, 2, 2, 2, 2, 2, 2, 14, 14, 14, 14, 14, 14, 14, 14, |
208 | | - 14, 14, 14, 14, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, |
209 | | - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, |
210 | | - 12, 12, 12, 12, 12, 12, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
211 | | - 2, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, 2, |
212 | | - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
213 | | - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 12, 12, |
214 | | - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, 2, 2, 2, 2, |
215 | | - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
216 | | - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 2, 2, 2, 2, 2, |
217 | | - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
218 | | - 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, |
219 | | - 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, |
220 | | - 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, |
221 | | - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 14, 14, 14, 14, 14, 14, |
222 | | - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, |
223 | | - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14])) |
| 179 | + 14, 14, 14, 14, 14, 14, 14])) |
224 | 180 |
|
225 | 181 | self.load_p_ref = np.array([[22. , 87. , 45.79999924, 7. , 12. , |
226 | 182 | 28.20000076, 8.69999981, 3.5 , 5.5 , 12.69999981, |
@@ -266,8 +222,6 @@ def setUp(self): |
266 | 222 | 19.74 , 6.0899997, 2.45 , 3.85 , 8.889999 , |
267 | 223 | 10.36 ], dtype=np.float32) |
268 | 224 |
|
269 | | - |
270 | | - |
271 | 225 | def tearDown(self) -> None: |
272 | 226 | self.env_bug.close() |
273 | 227 | self.tmp_json.close() |
@@ -360,3 +314,7 @@ def test_chronics_handler_twice_reset(self): |
360 | 314 | assert (np.abs(maint_ref - maint_1) <= 1e-6).all() |
361 | 315 | assert (np.abs(load_q_ref - load_q_1) <= 1e-6).all() |
362 | 316 | assert (np.abs(load_p_ref - load_p_1) <= 1e-6).all() |
| 317 | + |
| 318 | + |
| 319 | +if __name__ == "__main__": |
| 320 | + unittest.main() |
0 commit comments