Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue550 scenario example #553

Open
wants to merge 11 commits into
base: issue550_scenarioExample
Choose a base branch
from
62 changes: 32 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist: bionic

language: python

git:
Expand All @@ -23,50 +25,50 @@ before_script:

jobs:
include:
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_parser
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_data
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_forecast
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_kpis
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_readme_commands
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_testcase1
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_testcase2
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_testcase3
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_bestest_air
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_bestest_hydronic
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_bestest_hydronic_heat_pump
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_multizone_residential_hydronic
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_singlezone_commercial_hydronic
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_multizone_office_simple_air
- python: 3.11.4
install: pip install --upgrade pip && pip install pandas==1.2.5 numpy==1.20.2 matplotlib==3.3.4 requests==2.25.1
- python: 3.9
install: pip install --upgrade pip && pip install pandas==2.0.3 numpy==1.25.0 matplotlib==3.7.1 requests==2.31.0
script: cd testing && make build_jm_image && make test_twozone_apartment_hydronic
- python: 2.7
install: pip install --upgrade pip && pip install pandas==0.24.2 numpy==1.16.6 matplotlib==2.1.1 requests==2.18.4
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN mkdir models && \
mkdir doc

ENV PYTHONPATH $PYTHONPATH:$HOME
ENV BOPTEST_DASHBOARD_SERVER https://api.boptest.net:8081/
ENV BOPTEST_DASHBOARD_SERVER https://dashboard.boptest.net/

CMD python restapi.py && bash

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ that is being developed as part of the [IBPSA Project 1](https://ibpsa.github.io

## Structure
- ``/testcases`` contains test cases, including docs, models, and configuration settings.
- ``/examples`` contains code for interacting with a test case and running example tests with simple controllers. Those controllers are implemented in Python (Version 2.7 and 3.11.4), Julia (Version 1.0.3), and JavaScript (Version ECMAScript 2018).
- ``/examples`` contains code for interacting with a test case and running example tests with simple controllers. Those controllers are implemented in Python (Version 2.7 and 3.9), Julia (Version 1.0.3), and JavaScript (Version ECMAScript 2018).
- ``/parsing`` contains code for a script that parses a Modelica model using signal exchange blocks and outputs a wrapper FMU and KPI json.
- ``/testing`` contains code for unit and functional testing of this software. See the README there for more information about running these tests.
- ``/data`` contains code for generating and managing data associated with test cases. This includes boundary conditions, such as weather, schedules, and energy prices, as well as a map of test case FMU outputs needed to calculate KPIs.
Expand Down
6 changes: 3 additions & 3 deletions examples/python/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ def control_test(control_module='', start_time=0, warmup_period=0, length=24*360
print(res)
# Record test simulation start time
start_time = int(res['time'])
# Set final time and total time steps to be very large since scenario defines length
final_time = np.inf
total_time_steps = int((365 * 24 * 3600)/step)
# Set final time and total time steps
final_time = start_time + 14*86400
total_time_steps = int((final_time-start_time)/step)
else:
# Initialize test with a specified start time and warmup period
res = check_response(requests.put('{0}/initialize'.format(url), json={'start_time': start_time, 'warmup_period': warmup_period}))
Expand Down
4 changes: 3 additions & 1 deletion releasenotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Released on xx/xx/xxxx.
- In examples and unit test Python requests, use ``json`` attribute instead of ``data``. This is for [#528](https://github.com/ibpsa/project1-boptest/issues/528).
- In unit test checking fetching of single forecast variable, specify specific forecast point to check for each test case. This is for [#529](https://github.com/ibpsa/project1-boptest/issues/529).
- Update ``KPI_Calculator.get_computational_time_ratio`` to return ``None`` if no simulation steps have been processed. This is for [#540](https://github.com/ibpsa/project1-boptest/issues/540).
- Update example and unit test environment to Python 3.11.4. This is for [#550](https://github.com/ibpsa/project1-boptest/issues/550).
- Add ``forecastParameters`` to dashboard submission with empty dictionary and update url for submitting dashboard results. This is for [#548](https://github.com/ibpsa/project1-boptest/issues/548).
- Update example and unit test environment with the latest packages for Python 3.9. This is for [#550](https://github.com/ibpsa/project1-boptest/issues/550).


## BOPTEST v0.4.0

Expand Down
1 change: 1 addition & 0 deletions testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ def post_results_to_dashboard(self, api_key, tags, unit_test=False):
"account": {
"apiKey": api_key
},
"forecastParameters":{},
"tags": tags,
"kpis": self.get_kpis()[2],
"scenario": self.add_forecast_uncertainty(self.keys_to_camel_case(self.get_scenario()[2])),
Expand Down
2 changes: 1 addition & 1 deletion testing/references/bestest_air/submit.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dash_url": "https://api.boptest.net:8081//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "bestest_air"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.0273067557575723, "emis_tot": 0.785588519629367, "ener_tot": 3.722732131848899, "idis_tot": 1220.1797359785448, "pdih_tot": null, "pele_tot": 0.010215810323849649, "pgas_tot": 0.12133181119488147, "tdis_tot": 5.687315396946064, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "bestest_air"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.0273067557575723, "emis_tot": 0.785588519629367, "ener_tot": 3.722732131848899, "idis_tot": 1220.1797359785448, "pdih_tot": null, "pele_tot": 0.010215810323849649, "pgas_tot": 0.12133181119488147, "tdis_tot": 5.687315396946064, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "forecastParameters":{}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
2 changes: 1 addition & 1 deletion testing/references/bestest_hydronic/submit.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dash_url": "https://api.boptest.net:8081//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "bestest_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.465938501176076, "emis_tot": 1.628640744152675, "ener_tot": 9.000706489138203, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.00025517153990852034, "pgas_tot": 0.11798039028403248, "tdis_tot": 18.217583154564775, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "bestest_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.465938501176076, "emis_tot": 1.628640744152675, "ener_tot": 9.000706489138203, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.00025517153990852034, "pgas_tot": 0.11798039028403248, "tdis_tot": 18.217583154564775, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "forecastParameters":{}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
2 changes: 1 addition & 1 deletion testing/references/bestest_hydronic_heat_pump/submit.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dash_url": "https://api.boptest.net:8081//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "bestest_hydronic_heat_pump"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.8828705411678542, "emis_tot": 0.5808444758926209, "ener_tot": 3.4781106340875496, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.018913031427716383, "pgas_tot": null, "tdis_tot": 8.382467492017371, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "bestest_hydronic_heat_pump"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.8828705411678542, "emis_tot": 0.5808444758926209, "ener_tot": 3.4781106340875496, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.018913031427716383, "pgas_tot": null, "tdis_tot": 8.382467492017371, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "forecastParameters":{}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
2 changes: 1 addition & 1 deletion testing/references/multizone_office_simple_air/submit.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dash_url": "https://api.boptest.net:8081//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "multizone_office_simple_air"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.16537569781601175, "emis_tot": 0.6104861553474377, "ener_tot": 1.790281980491019, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.03334238212125819, "pgas_tot": null, "tdis_tot": 11.835569616547645, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "multizone_office_simple_air"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.16537569781601175, "emis_tot": 0.6104861553474377, "ener_tot": 1.790281980491019, "idis_tot": 0.0, "pdih_tot": null, "pele_tot": 0.03334238212125819, "pgas_tot": null, "tdis_tot": 11.835569616547645, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "forecastParameters":{}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dash_url": "https://api.boptest.net:8081//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "multizone_residential_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.7912501281574299, "emis_tot": 1.4253043873549793, "ener_tot": 8.140085161898376, "idis_tot": 9114.593818178417, "pdih_tot": null, "pele_tot": 0.0017390231869758264, "pgas_tot": 0.09592720495532536, "tdis_tot": 22.003355978645242, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "multizone_residential_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.7912501281574299, "emis_tot": 1.4253043873549793, "ener_tot": 8.140085161898376, "idis_tot": 9114.593818178417, "pdih_tot": null, "pele_tot": 0.0017390231869758264, "pgas_tot": 0.09592720495532536, "tdis_tot": 22.003355978645242, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "forecastParameters":{}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dash_url": "https://api.boptest.net:8081//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "singlezone_commercial_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.26318819272610183, "emis_tot": 0.3835824174014755, "ener_tot": 3.216803183654829, "idis_tot": 5.423240054209877, "pdih_tot": 0.08966901817018418, "pele_tot": 0.004907824412797784, "pgas_tot": null, "tdis_tot": 7.9949290180759505, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "singlezone_commercial_hydronic"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.26318819272610183, "emis_tot": 0.3835824174014755, "ener_tot": 3.216803183654829, "idis_tot": 5.423240054209877, "pdih_tot": 0.08966901817018418, "pele_tot": 0.004907824412797784, "pgas_tot": null, "tdis_tot": 7.9949290180759505, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "peak_heat_day", "weatherForecastUncertainty": "deterministic"}, "forecastParameters":{}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
2 changes: 1 addition & 1 deletion testing/references/testcase1/submit.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dash_url": "https://api.boptest.net:8081//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "testcase1"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.8993115895520294, "emis_tot": 2.5694616844343696, "ener_tot": 12.847308422171846, "idis_tot": 7118.611500670603, "pdih_tot": null, "pele_tot": null, "pgas_tot": 0.11536491775500209, "tdis_tot": 503.7616200965347, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "test_day", "weatherForecastUncertainty": "deterministic"}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
{"dash_url": "https://dashboard.boptest.net//api/results", "payload": {"results": [{"account": {"apiKey": "valid_api_key"}, "boptestVersion": "0.4.0-dev\n", "buildingType": {"uid": "testcase1"}, "controlStep": "86400.0", "dateRun": "2020-05-17 00:00:00", "isShared": true, "kpis": {"cost_tot": 0.8993115895520294, "emis_tot": 2.5694616844343696, "ener_tot": 12.847308422171846, "idis_tot": 7118.611500670603, "pdih_tot": null, "pele_tot": null, "pgas_tot": 0.11536491775500209, "tdis_tot": 503.7616200965347, "time_rat": 0}, "scenario": {"electricityPrice": "dynamic", "timePeriod": "test_day", "weatherForecastUncertainty": "deterministic"}, "forecastParameters":{}, "tags": ["baseline", "unit_test"], "uid": "1"}]}}
Loading