Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F62176048
launch_ems.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
Sat, May 11, 10:17
Size
1 KB
Mime Type
text/x-python
Expires
Mon, May 13, 10:17 (2 d)
Engine
blob
Format
Raw Data
Handle
17614943
Attached To
R3852 EMS for Smart-Building
launch_ems.py
View Options
__author__
=
'Olivier Van Cutsem'
from
multiprocessing
import
Queue
from
rtevents_interface.rtevents_interf
import
RTEventInterface
from
emscore.ems_main
import
EnergyManagementSystem
from
emscore.simple_control
import
EMS_simple
from
emscore.mpc
import
EMS_MPC
from
ems_gui.gui
import
EMS_gui
########### LAUNCHING THE THREADS ###################
print
(
"Starting EMS "
)
bms_stream_rtevents
=
Queue
()
ems_stream_rtevents
=
Queue
()
gui_stream
=
Queue
()
print
(
"Launching threads for the interface frontend and the CMS"
)
rtevents_interf
=
RTEventInterface
(
bms_stream_rtevents
,
ems_stream_rtevents
)
# RT Interface
ems_core
=
EMS_MPC
(
bms_stream_rtevents
,
ems_stream_rtevents
,
gui_stream
)
# The core of the EMS logic
# Start the thread
rtevents_interf
.
start
()
ems_core
.
start
()
# Do infinite loop here for GUI job
gui
=
EMS_gui
()
while
True
:
# Messages coming from the EMS
try
:
new_msg
=
gui_stream
.
get
(
True
)
except
Queue
.
Empty
:
new_msg
=
None
# Process the message
gui
.
process_message
(
new_msg
)
rtevents_interf
.
join
()
ems_core
.
join
()
Event Timeline
Log In to Comment