/
config.py
134 lines (128 loc) · 3.36 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
from grid2op.Action import PowerlineSetAction
from grid2op.Reward import AlarmReward
from grid2op.Rules import DefaultRules
from grid2op.Chronics import Multifolder
from grid2op.Chronics import GridStateFromFileWithForecasts
from grid2op.Backend import PandaPowerBackend
from grid2op.Opponent import GeometricOpponent, BaseActionBudget
from grid2op.operator_attention import LinearAttentionBudget
try:
from grid2op.l2rpn_utils import ActionICAPS2021, ObservationICAPS2021
except ImportError:
from grid2op.Action import PlayableAction
from grid2op.Observation import CompleteObservation
import warnings
warnings.warn("The grid2op version you are trying to use is too old for this environment. Please upgrade it.")
ActionICAPS2021 = PlayableAction
ObservationICAPS2021 = CompleteObservation
lines_attacked = [
"62_58_180",
"62_63_160",
"48_50_136",
"48_53_141",
"41_48_131",
"39_41_121",
"43_44_125",
"44_45_126",
"34_35_110",
"54_58_154",
]
opponent_attack_cooldown = 12 # 1 hour, 1 hour being 12 time steps
opponent_attack_duration = 96 # 8 hours at maximum
opponent_budget_per_ts = (
0.17 # opponent_attack_duration / opponent_attack_cooldown + epsilon
)
opponent_init_budget = 144.0 # no need to attack straightfully, it can attack starting at midday the first day
config = {
"backend": PandaPowerBackend,
"action_class": ActionICAPS2021,
"observation_class": ObservationICAPS2021,
"reward_class": AlarmReward,
"gamerules_class": DefaultRules,
"chronics_class": Multifolder,
"grid_value_class": GridStateFromFileWithForecasts,
"volagecontroler_class": None,
"names_chronics_to_grid": None,
"thermal_limits": [
60.9,
231.9,
272.6,
212.8,
749.2,
332.4,
348.0,
414.4,
310.1,
371.4,
401.2,
124.3,
298.5,
86.4,
213.9,
160.8,
112.2,
291.4,
489.0,
489.0,
124.6,
196.7,
191.9,
238.4,
174.2,
105.6,
143.7,
293.4,
288.9,
107.7,
415.5,
148.2,
124.2,
154.4,
85.9,
106.5,
142.0,
124.0,
130.2,
86.2,
278.1,
182.0,
592.1,
173.1,
249.8,
441.0,
344.2,
722.8,
494.6,
494.6,
196.7,
151.8,
263.4,
364.1,
327.0,
370.5,
441.0,
300.3,
656.2,
],
"opponent_attack_cooldown": opponent_attack_cooldown,
"opponent_attack_duration": opponent_attack_duration,
"opponent_budget_per_ts": opponent_budget_per_ts,
"opponent_init_budget": opponent_init_budget,
"opponent_action_class": PowerlineSetAction,
"opponent_class": GeometricOpponent,
"opponent_budget_class": BaseActionBudget,
"kwargs_opponent": {
"lines_attacked": lines_attacked,
"attack_every_xxx_hour": 24,
"average_attack_duration_hour": 4,
"minimum_attack_duration_hour": 1,
},
"has_attention_budget": True,
"attention_budget_class": LinearAttentionBudget,
"kwargs_attention_budget": {
"max_budget": 3.0,
"budget_per_ts": 1.0 / (12.0 * 16),
"alarm_cost": 1.0,
"init_budget": 2.0,
},
}