Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91067111
thermostat_control.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Nov 7, 12:52
Size
2 KB
Mime Type
text/x-python
Expires
Sat, Nov 9, 12:52 (2 d)
Engine
blob
Format
Raw Data
Handle
22189600
Attached To
R3852 EMS for Smart-Building
thermostat_control.py
View Options
__author__
=
'Olivier Van Cutsem'
from
building_data_management.category_management.category_config
import
*
from
ems_config
import
*
from
ems_main
import
EnergyManagementSystem
## Various strategies
class
EMS_Thermostat
(
EnergyManagementSystem
):
def
__init__
(
self
,
in_q
,
out_q
,
gui_q
):
"""
Initialize ClusteringManagementSystem object.
Read messages from the BMS interface bubble messages through a Queue
"""
super
(
EMS_Thermostat
,
self
)
.
__init__
(
in_q
,
out_q
,
gui_q
)
def
update
(
self
):
"""
TODO
"""
commands_set
=
[]
## HVAC commands
hvac_list
=
self
.
building_data
.
get_entity_list
([
EMS_CATEGORY_ENTITY_LOAD
,
EMS_CATEGORY_ENTITY_LOAD_THERM
])
for
(
hvac_id
,
hvac_obj
)
in
hvac_list
:
room_id
=
self
.
get_thermal_load_room
(
hvac_id
)
# Get the id of the room where the HVAC is active
room_th_constr
=
self
.
building_data
.
room
(
room_id
)
.
get_comfort_constraint
(
EMS_COMFORT_temperature
)
# Get the id of the room where the HVAC is active
room_temperature
=
self
.
building_data
.
room
(
room_id
)
.
get_comfort_value
(
EMS_COMFORT_temperature
)
print
(
"Room temp: {0}"
.
format
(
room_temperature
))
print
(
"Room temp constraints: {0} - {1}"
.
format
(
room_th_constr
.
get_min
(
self
.
current_time
),
room_th_constr
.
get_max
(
self
.
current_time
)))
if
room_temperature
<
room_th_constr
.
get_min
(
self
.
current_time
):
## Switch it on ?
commands_set
.
append
(
self
.
hvac_set_point
(
hvac_id
,
100
))
elif
room_temperature
>
room_th_constr
.
get_max
(
self
.
current_time
):
## Switch it off ?
commands_set
.
append
(
self
.
hvac_set_point
(
hvac_id
,
0
))
print
(
"[{1}s] EMS core decides to send: {0}"
.
format
(
commands_set
,
self
.
current_time
))
return
commands_set
def
get_thermal_load_room
(
self
,
th_l_id
):
for
r_id
in
self
.
building_data
.
room_ids_list
:
if
th_l_id
in
self
.
building_data
.
room
(
r_id
)
.
get_comfort_loads
(
EMS_COMFORT_temperature
):
return
r_id
return
None
Event Timeline
Log In to Comment