Package: volttron-lib-boptest-integration
boptest-integrationThis python library is used for integrating boptest simulation into VOLTTRON platform.BOPTEST is designed to facilitate
the performance evaluation and benchmarking of building control strategies, which
contains these key components:Run-Time Environment (RTE): Deployed with Docker and accessed with a RESTful HTTP API, use the RTE to set up tests,
control building emulators, access data, and report KPIs.Test Case Repository: A collection of ready-to-use building emulators representing a range of building types and HVAC
systems.Key Performance Indicator (KPI) Reporting: A set of KPIs is calculated by the the RTE using data from the building
emulator being controlled.For more information, please visitIBPSA Project 1 - BOPTEST.PrerequisitesPython 3 (tested with Python3.10)Linux OS (tested with Ubuntu 22.04)PythonTo install specific Python version (e.g., Python 3.10), we recommend usingpyenv.# install pyenvgitclonehttps://github.com/pyenv/pyenv~/.pyenv# setup pyenv (you should also put these three lines in .bashrc or similar)exportPATH="${HOME}/.pyenv/bin:${PATH}"exportPYENV_ROOT="${HOME}/.pyenv"eval"$(pyenvinit-)"# install Python 3.10pyenvinstall3.10# make it available globallypyenvglobalsystem3.10InstallationThe following recipe walks through the steps to install and run use case example.Note: For the ease of reproducibility, in this demo, we
will git clone thevolttron-boptestrepo to the~/sandbox/path. Feel free to modify the workflow as desired.kefei@ubuntu-22:~/sandbox$gitclonehttps://github.com/eclipse-volttron/volttron-boptest.git
Cloninginto'volttron-boptest'...
remote:Enumeratingobjects:450,done.
remote:Countingobjects:100%(450/450),done.
remote:Compressingobjects:100%(242/242),done.
remote:Total450(delta192),reused424(delta170),pack-reused0Receivingobjects:100%(450/450),3.66MiB|7.06MiB/s,done.
Resolvingdeltas:100%(192/192),done.
kefei@ubuntu-22:~/sandbox$cdvolttron-boptest/
kefei@ubuntu-22:~/sandbox/volttron-boptest$Create and activate a virtual environment.It is recommended to use a virtual environment for installing library.kefei@ubuntu-22:~/sandbox/volttron-boptest$python-mvenvenv
kefei@ubuntu-22:~/sandbox/volttron-boptest$sourceenv/bin/activate(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$Install the "volttron-boptest-integration" library.There are two options to install "volttron-boptest-integration". You can install this library using the version on
PyPi or install
it from the source code (git clonemight be required.)# option 1: install from pypipipinstallvolttron-lib-boptest-integration# option 2: install from the source code (Note: `-e` option to use editable mode, useful for development.)pipinstall[-e]<path-to-the-source-code-root>/volttron-lib-boptest-integration/(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$pipinstallvolttron-lib-boptest-integration
Collectingvolttron-lib-boptest-integrationDownloadingvolttron_lib_boptest_integration-0.1.1a0-py3-none-any.whl(20kB)Collectingpandas>0.0.0
...(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$piplist|grepvolttron
volttron10.0.4rc1
volttron-lib-boptest-integration0.1.1a0
...Basic UsageIn order to demonstrate the basic usage of volttron-lib-boptest-integration, we need to setup the boptest simulation
server.Setup the boptest simulation server locally.In order to demonstrate the basic usage of volttron-boptest-agent, we need to setup the boptest simulation server.(Please see more details about boptest quick-start
atQuick-Start to Deploy a Test Case)DownloadIBPSA Project 1 - BOPTESTrepository to <boptest_repo>. For
demo purpose, let boptest_repo be~/project1-boptest.gitclonehttps://github.com/ibpsa/project1-boptest~/project1-boptestInstallDockerandDocker Compose.Note: this demo run docker as a non-root user, you can
followLinux post-installation steps for Docker Engineto achieve similar setup.(Optional) Verify withdocker-compose versionto verify the installation(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$docker-composeversion
docker-composeversion1.29.2,buildunknown
docker-pyversion:5.0.3
CPythonversion:3.10.6
OpenSSLversion:OpenSSL3.0.215Mar2022Build and deploy a test case.The basic command to start a test case is by usingTESTCASE=<testcase_name> docker-compose up.For demo purpose, we will build and deploy testcase1, for available testcases please
seetestcases/(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$TESTCASE=testcase1docker-compose--file~/project1-boptest/docker-compose.ymlup
Creatingnetwork"boptest-net"withthedefaultdriver
Creatingproject1-boptest_boptest_1...doneAttachingtoproject1-boptest_boptest_1
boptest_1|07/13/202309:59:42PMUTCrootINFOControlstepsetsuccessfully.
boptest_1|07/13/202309:59:42PMUTCrootINFOTestsimulationinitializedsuccessfullyto0.0swithwarmupperiodof0.0s.
boptest_1|07/13/202309:59:42PMUTCrootINFOTestcasescenariowassetsuccessfully.
...
boptest_1|*Debugmode:off
boptest_1|07/13/202309:59:42PMUTCwerkzeugINFO*Runningonhttp://0.0.0.0:5000/(PressCTRL+Ctoquit)Or use detach mode(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$TESTCASE=testcase1docker-compose--file~/project1-boptest/docker-compose.ymlup--detachStartingproject1-boptest_boptest_1...done(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$dockercontainerls
CONTAINERIDIMAGECOMMANDCREATEDSTATUSPORTSNAMES
ddd0f2cc1f99boptest_base"/bin/sh -c 'python …"23hoursagoUp12seconds127.0.0.1:5000->5000/tcpproject1-boptest_boptest_1Note: Usedocker-compose downto shut down the service.Verify boptest simulation server is running properly:(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$curlhttp://127.0.0.1:5000/name{"message":"Queried the name of the test case successfully.","payload":{"name":"testcase1"},"status":200}Run example usecases.There are several exmaple usecases available atexamples/. In this demo,
we will runtestcase1.py.(env)kefei@ubuntu-22:~/sandbox/volttron-boptest$pythonvolttron-lib-boptest-integration/examples/testcase1.py
INFO:root:===========run_workflow
INFO:root:
TESTCASEINFORMATION
---------------------
INFO:root:Name:testcase1
...
INFO:root:========runworkflowcompleted.=============kpi{'cost_tot':0.075149821513246,'emis_tot':0.2147137757521314,'ener_tot':1.073568878760657,'idis_tot':508.47225004790033,'pdih_tot':None,'pele_tot':None,'pgas_tot':0.09615811655434148,'tdis_tot':5.316029375566828,'time_rat':1.531114146269157e-05}Note: the example usecase must match the test case that is running. For example when TESTCASE=testcase1, we can
runtestcase1.pyandtestcase1_scenario.py, but
nottestcase2.py.DevelopmentPlease see the following for contributing
guidelinescontributing.Please see the following helpful guide
aboutdeveloping modular VOLTTRON agentsDisclaimer NoticeThis material was prepared as an account of work sponsored by an agency of the
United States Government. Neither the United States Government nor the United
States Department of Energy, nor Battelle, nor any of their employees, nor any
jurisdiction or organization that has cooperated in the development of these
materials, makes any warranty, express or implied, or assumes any legal
liability or responsibility for the accuracy, completeness, or usefulness or any
information, apparatus, product, software, or process disclosed, or represents
that its use would not infringe privately owned rights.Reference herein to any specific commercial product, process, or service by
trade name, trademark, manufacturer, or otherwise does not necessarily
constitute or imply its endorsement, recommendation, or favoring by the United
States Government or any agency thereof, or Battelle Memorial Institute. The
views and opinions of authors expressed herein do not necessarily state or
reflect those of the United States Government or any agency thereof.