forked from ugr-sail/sinergym
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
243 lines (225 loc) · 9.55 KB
/
__init__.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
import os
import gymnasium as gym
from gymnasium.envs.registration import register
from sinergym.utils.constants import *
from sinergym.utils.rewards import *
# Set __version__ in module
version_file = os.path.join(os.path.dirname(__file__), "version.txt")
with open(version_file, "r") as file_handler:
__version__ = file_handler.read().strip()
# 0) Demo environment
register(
id='Eplus-demo-v1',
entry_point='sinergym.envs:EplusEnv',
kwargs={
'building_file': '5ZoneAutoDXVAV.epJSON',
'weather_files': 'USA_PA_Pittsburgh-Allegheny.County.AP.725205_TMY3.epw',
'action_space': DEFAULT_5ZONE_ACTION_SPACE_CONTINUOUS,
'time_variables': DEFAULT_TIME_VARIABLES,
'variables': DEFAULT_5ZONE_VARIABLES,
'meters': DEFAULT_5ZONE_METERS,
'actuators': DEFAULT_5ZONE_ACTUATORS,
'reward': LinearReward,
'reward_kwargs': {
'temperature_variables': 'air_temperature',
'energy_variables': 'HVAC_electricity_demand_rate',
'range_comfort_winter': (
20.0,
23.5),
'range_comfort_summer': (
23.0,
26.0)},
'env_name': 'demo-v1'})
id_bases = ['5zone', 'datacenter', 'warehouse', 'office', 'officegrid', 'shop']
id_specifics = [
'hot-discrete',
'mixed-discrete',
'cool-discrete',
'hot-continuous',
'mixed-continuous',
'cool-continuous',
'hot-discrete-stochastic',
'mixed-discrete-stochastic',
'cool-discrete-stochastic',
'hot-continuous-stochastic',
'mixed-continuous-stochastic',
'cool-continuous-stochastic']
variation = (1.0, 0.0, 0.001)
for building in id_bases:
reg_kwargs = {'time_variables': DEFAULT_TIME_VARIABLES}
if building == '5zone':
reg_kwargs['building_file'] = '5ZoneAutoDXVAV.epJSON'
action_space_continuous = DEFAULT_5ZONE_ACTION_SPACE_CONTINUOUS
action_space_discrete = DEFAULT_5ZONE_ACTION_SPACE_DISCRETE
reg_kwargs['action_mapping'] = DEFAULT_5ZONE_ACTION_MAPPING
reg_kwargs['actuators'] = DEFAULT_5ZONE_ACTUATORS
reg_kwargs['variables'] = DEFAULT_5ZONE_VARIABLES
reg_kwargs['meters'] = DEFAULT_5ZONE_METERS
reg_kwargs['reward'] = LinearReward
reg_kwargs['reward_kwargs'] = {
'temperature_variables': 'air_temperature',
'energy_variables': 'HVAC_electricity_demand_rate',
'range_comfort_winter': (
20.0,
23.5),
'range_comfort_summer': (
23.0,
26.0)}
elif building == 'datacenter':
reg_kwargs['building_file'] = '2ZoneDataCenterHVAC_wEconomizer.epJSON'
action_space_continuous = DEFAULT_DATACENTER_ACTION_SPACE_CONTINUOUS
action_space_discrete = DEFAULT_DATACENTER_ACTION_SPACE_DISCRETE
reg_kwargs['action_mapping'] = DEFAULT_DATACENTER_ACTION_MAPPING
reg_kwargs['actuators'] = DEFAULT_DATACENTER_ACTUATORS
reg_kwargs['variables'] = DEFAULT_DATACENTER_VARIABLES
reg_kwargs['meters'] = DEFAULT_DATACENTER_METERS
reg_kwargs['reward'] = LinearReward
reg_kwargs['reward_kwargs'] = {
'temperature_variables': [
'west_zone_temperature',
'east_zone_temperature'],
'energy_variables': 'HVAC_electricity_demand_rate',
'range_comfort_winter': (
18,
27),
'range_comfort_summer': (
18,
27)}
elif building == 'warehouse':
reg_kwargs['building_file'] = 'ASHRAE901_Warehouse_STD2019_Denver.epJSON'
action_space_continuous = DEFAULT_WAREHOUSE_ACTION_SPACE_CONTINUOUS
action_space_discrete = DEFAULT_WAREHOUSE_ACTION_SPACE_DISCRETE
reg_kwargs['action_mapping'] = DEFAULT_WAREHOUSE_ACTION_MAPPING
reg_kwargs['actuators'] = DEFAULT_WAREHOUSE_ACTUATORS
reg_kwargs['variables'] = DEFAULT_WAREHOUSE_VARIABLES
reg_kwargs['meters'] = DEFAULT_WAREHOUSE_METERS
reg_kwargs['reward'] = LinearReward
reg_kwargs['reward_kwargs'] = {
'temperature_variables': [
'office_temperature',
'fstorage_temperature',
'bstorage_temperature'],
'energy_variables': 'HVAC_electricity_demand_rate',
'range_comfort_winter': (
18,
27),
'range_comfort_summer': (
18,
27)}
elif building == 'office':
reg_kwargs['building_file'] = 'ASHRAE901_OfficeMedium_STD2019_Denver.epJSON'
action_space_continuous = DEFAULT_OFFICE_ACTION_SPACE_CONTINUOUS
action_space_discrete = DEFAULT_OFFICE_ACTION_SPACE_DISCRETE
reg_kwargs['action_mapping'] = DEFAULT_OFFICE_ACTION_MAPPING
reg_kwargs['actuators'] = DEFAULT_OFFICE_ACTUATORS
reg_kwargs['variables'] = DEFAULT_OFFICE_VARIABLES
reg_kwargs['meters'] = DEFAULT_OFFICE_METERS
reg_kwargs['reward'] = LinearReward
reg_kwargs['reward_kwargs'] = {
'temperature_variables': [
'zone1_temperature',
'zone2_temperature',
'zone3_temperature',
'zone4_temperature',
'zone5_temperature',
'zone6_temperature',
'zone7_temperature',
'zone8_temperature',
'zone9_temperature',
'zone10_temperature',
'zone11_temperature',
'zone12_temperature',
'zone13_temperature',
'zone14_temperature',
'zone15_temperature',
'zone16_temperature',
'zone17_temperature',
'zone18_temperature'
],
'energy_variables': 'HVAC_electricity_demand_rate',
'range_comfort_winter': (18, 27),
'range_comfort_summer': (18, 27)
}
elif building == 'officegrid':
reg_kwargs['building_file'] = 'LrgOff_GridStorageScheduled.epJSON'
action_space_continuous = DEFAULT_OFFICEGRID_ACTION_SPACE_CONTINUOUS
action_space_discrete = DEFAULT_OFFICEGRID_ACTION_SPACE_DISCRETE
reg_kwargs['action_mapping'] = DEFAULT_OFFICEGRID_ACTION_MAPPING
reg_kwargs['actuators'] = DEFAULT_OFFICEGRID_ACTUATORS
reg_kwargs['variables'] = DEFAULT_OFFICEGRID_VARIABLES
reg_kwargs['meters'] = DEFAULT_OFFICEGRID_METERS
reg_kwargs['reward'] = LinearReward
reg_kwargs['reward_kwargs'] = {
'temperature_variables': [
'zone1_temperature',
'zone2_temperature',
'zone3_temperature',
'zone4_temperature',
'zone5_temperature',
'zone6_temperature',
'zone7_temperature',
'zone8_temperature',
'zone9_temperature',
'zone10_temperature',
'zone11_temperature',
'zone12_temperature',
'zone13_temperature',
'zone14_temperature',
'zone15_temperature',
'zone16_temperature',
'zone17_temperature',
'zone18_temperature',
'zone19_temperature'],
'energy_variables': 'HVAC_electricity_demand_rate',
'range_comfort_winter': (
20.0,
23.5),
'range_comfort_summer': (
23.0,
26.0)}
elif building == 'shop':
reg_kwargs['building_file'] = 'ShopWithPVandBattery.epJSON'
action_space_continuous = DEFAULT_SHOP_ACTION_SPACE_CONTINUOUS
action_space_discrete = DEFAULT_SHOP_ACTION_SPACE_DISCRETE
reg_kwargs['action_mapping'] = DEFAULT_SHOP_ACTION_MAPPING
reg_kwargs['actuators'] = DEFAULT_SHOP_ACTUATORS
reg_kwargs['variables'] = DEFAULT_SHOP_VARIABLES
reg_kwargs['meters'] = DEFAULT_SHOP_METERS
reg_kwargs['reward'] = LinearReward
reg_kwargs['reward_kwargs'] = {
'temperature_variables': [
'zone1_temperature',
'zone2_temperature',
'zone3_temperature',
'zone4_temperature',
'zone5_temperature'],
'energy_variables': 'HVAC_electricity_demand_rate',
'range_comfort_winter': (
20.0,
23.5),
'range_comfort_summer': (
23.0,
26.0)}
for id_specific in id_specifics:
id = 'Eplus-' + building + '-' + id_specific + '-v1'
reg_kwargs['env_name'] = building + '-' + id_specific + '-v1'
register_conf = id_specific.split('-')
if register_conf[0] == 'hot':
reg_kwargs['weather_files'] = 'USA_AZ_Davis-Monthan.AFB.722745_TMY3.epw'
elif register_conf[0] == 'mixed':
reg_kwargs['weather_files'] = 'USA_NY_New.York-J.F.Kennedy.Intl.AP.744860_TMY3.epw'
elif register_conf[0] == 'cool':
reg_kwargs['weather_files'] = 'USA_WA_Port.Angeles-William.R.Fairchild.Intl.AP.727885_TMY3.epw'
if register_conf[1] == 'discrete':
reg_kwargs['action_space'] = action_space_discrete
elif register_conf[1] == 'continuous':
reg_kwargs['action_space'] = action_space_continuous
reg_kwargs['weather_variability'] = None
if len(register_conf) == 3:
if register_conf[2] == 'stochastic':
reg_kwargs['weather_variability'] = variation
register(
id=id,
entry_point='sinergym.envs:EplusEnv',
kwargs=reg_kwargs.copy()
)