-
Notifications
You must be signed in to change notification settings - Fork 1
/
csl_load_razor_starter.py
59 lines (57 loc) · 1.73 KB
/
csl_load_razor_starter.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
"""
CMU 48721 Fall 2019
Assignment 3 part 1: "The right time"
Note:
1: Never use "print" function, it will block the code,
use "logger.info()" instead.
2: ob is a python list with the following items:
0: hour (0-23)
1: min (0-59)
2: weekday (0-7, 0 is Monday)
3: outdoor air temperature (C)
4: outdoor air RH (%)
5: diffuse dolar radiation (W/m2)
6: direct solar radiation (W/m2)
7-16: IAT of 10 zones (C)
17-26: IAT cooling setpoint of 10 zones (C)
27-36: PMV of 10 zones (-999 if no occupied)
37: HVAC total electric demand (W)
38-61: Hourly outdoor air temperature forecast (provided at 0:00,
for all other time, the values are -999)
"""
import gym, eplus_env, logging
logger = logging.getLogger('Ctrl-Tester');
logger.setLevel(logging.DEBUG);
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG);
logger.addHandler(ch);
logger.info('Running the simulation test...')
logger.info('Environment warm-up may take time.')
env = gym.make('CSL-load-razor-v1');
ob, is_terminal = env.reset();
logger.info('Environment warm-up is done.')
while is_terminal == False:
# !!DO NOT change the above lines!!
# The following lines are the baseline control strategy
# You should implement your control strategy here
weekday = ob[2];
hour = ob[0];
# For all the weekends
if weekday >= 5:
# Do not do anything
act = 0;
# For all the weekdays
else:
# 10:00 AM to 12:00 PM, lower the setpoint
if hour >= 10 and hour < 12:
act = -2; # Lower by 2 C
# 12:00 PM to 16:00 PM, higher the setpoint
elif hour >= 12 and hour < 16:
act = 2; # Higher by 0 C
# For other time, do nothing
else:
act = 0;
logger.info('This observation is: %s'%ob);
ob, is_terminal = env.step([act])
# !!DO NOT change the following lines!!
env.end_env();