ibpsa / project1-boptest

Building Optimization Performance Tests
Other
104 stars 69 forks source link

Cannot follow README- "Run an example test controller"-For Python-based example controllers #537

Closed kefeimo closed 1 year ago

kefeimo commented 1 year ago

Description

For Run an example test controller,

after "Build and deploy testcase1" by running TESTCASE=testcase1 docker-compose up

kefei@ubuntu-22:~/project/project1-boptest$ TESTCASE=testcase1 docker-compose up 
Starting project1-boptest_boptest_1 ... done
Attaching to project1-boptest_boptest_1
boptest_1  | 05/03/2023 07:24:22 PM UTC root                INFO    Control step set successfully.
boptest_1  | 05/03/2023 07:24:22 PM UTC root                INFO    Test simulation initialized successfully to 0.0s with warmup period of 0.0s.
boptest_1  | 05/03/2023 07:24:22 PM UTC root                INFO    Test case scenario was set successfully.
boptest_1  | Final Run Statistics: --- 
boptest_1  | 
boptest_1  | 
boptest_1  | Solver options:
boptest_1  | 
boptest_1  |  Solver                   : CVode
boptest_1  |  Linear multistep method  : BDF
boptest_1  |  Nonlinear solver         : Newton
boptest_1  |  Linear solver type       : DENSE
boptest_1  |  Maximal order            : 5
boptest_1  |  Tolerances (absolute)    : 3e-06
boptest_1  |  Tolerances (relative)    : 1e-06
boptest_1  | 
boptest_1  | Simulation interval    : 0.0 - 0.0 seconds.
boptest_1  | Elapsed simulation time: 5.50746917725e-05 seconds.
boptest_1  | 05/03/2023 07:24:22 PM UTC werkzeug            INFO     * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
boptest_1  |  * Serving Flask app "restapi" (lazy loading)
boptest_1  |  * Environment: production
boptest_1  |    WARNING: This is a development server. Do not use it in a production deployment.
boptest_1  |    Use a production WSGI server instead.
boptest_1  |  * Debug mode: off

Then, "in a separate terminal ", the cd examples/python/ && python testcase1.py didn't work. With the following output

kefei@ubuntu-22:~/project/project1-boptest$ pwd

/home/kefei/project/project1-boptest

kefei@ubuntu-22:~/project/project1-boptest$ ls

contributors.md  data  docker-compose.yml  Dockerfile  docs  examples  forecast  kpis  license.md  makefile  parsing  README.md  releasenotes.md  restapi.py  testcase.py  testcases  testing  version.txt

kefei@ubuntu-22:~/project/project1-boptest$ cd examples/python/ && python testcase1.py
Traceback (most recent call last):
  File "/home/kefei/project/project1-boptest/examples/python/testcase1.py", line 14, in <module>
    from examples.python.interface import control_test
ModuleNotFoundError: No module named 'examples'

Note: in the meantime, the RestAPI command works

kefei@ubuntu-22:~/project/project1-boptest/examples/python$ curl http://127.0.0.1:5000/measurements
{"message":"Queried the measurements successfully.","payload":{"CO2RooAir_y":{"Description":"Zone air CO2 concentration","Maximum":null,"Minimum":null,"Unit":"ppm"},"PHea_y":{"Description":"Heater power","Maximum":null,"Minimum":null,"Unit":"W"},"TRooAir_y":{"Description":"Zone air temperature","Maximum":null,"Minimum":null,"Unit":"K"}},"status":200}

Suggestion

Provide enough enough information for users to follow up the README to reproduce the result.

SenHuang19 commented 1 year ago

You may need to define PAYTHONPATH

dhblum commented 1 year ago

Yes, indeed the path for project1-boptest needs to be added to the PYTHONPATH environment variable. I'm not sure how this got missed before.

Thank you @kefeimo for reporting. This should be added to the readme. Will make PR.

dhblum commented 1 year ago

Closed by https://github.com/ibpsa/project1-boptest/pull/538.