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

Error setting scenario for multizone_residential_hydronic #698

Open
Rapi1234 opened this issue Oct 29, 2024 · 1 comment
Open

Error setting scenario for multizone_residential_hydronic #698

Rapi1234 opened this issue Oct 29, 2024 · 1 comment

Comments

@Rapi1234
Copy link

Rapi1234 commented Oct 29, 2024

Hi, i am trying to implement a controller for multizone_residential_hydronic and am I am unsure if it is supposed to be so slow as other testcase seem to run faster. Also running it with the local and web-based version (code below) will take about 5 minutes to initialize the scenario. Furthermore, sometimes it prints an error shown after the code.

# run TESTCASE=multizone_residential_hydronic docker-compose up

import requests

url = 'http://127.0.0.1:5000'

scenario_return = requests.put('{0}/scenario'.format(url),
                            json={'time_period':'peak_heat_day',
                                    'electricity_price':'constant'}).json()['payload']

Additionally, the following error is displayed (sadly I am not able to reproduce the error - I think you have to terminate one call and start again). Here, I first set the scenario, received the error, then it took about 5 minutes to finish.

ecreating project1-boptest-060_boptest_1 ... done
Attaching to project1-boptest-060_boptest_1
boptest_1  | 10/29/2024 05:37:56 AM UTC	root                INFO	Control step set successfully.
boptest_1  | 10/29/2024 05:37:56 AM UTC	root                INFO	Test simulation initialized successfully to 0.0s with warmup period of 0.0s.
boptest_1  | 10/29/2024 05:37:56 AM UTC	root                INFO	Test case scenario was set successfully.
boptest_1  | Simulation interval    : 0.0 - 0.0 seconds.
boptest_1  | Elapsed simulation time: 0.01302071700047236 seconds.
boptest_1  |  * Serving Flask app 'restapi'
boptest_1  |  * Debug mode: off
boptest_1  | 10/29/2024 05:37:56 AM UTC	werkzeug            INFO	WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
boptest_1  |  * Running on all addresses (0.0.0.0)
boptest_1  |  * Running on http://127.0.0.1:5000
boptest_1  |  * Running on http://172.19.0.2:5000
boptest_1  | 10/29/2024 05:37:56 AM UTC	werkzeug            INFO	Press CTRL+C to quit
boptest_1  | 10/29/2024 05:43:42 AM UTC	root                ERROR	Failed to initialize test simulation: Traceback (most recent call last):
boptest_1  |   File "/home/user/testcase.py", line 170, in __simulation
boptest_1  |     res = self.fmu.simulate(start_time=start_time,
boptest_1  |   File "src/pyfmi/fmi.pyx", line 7573, in pyfmi.fmi.FMUModelCS2.simulate
boptest_1  |   File "src/pyfmi/fmi.pyx", line 378, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "src/pyfmi/fmi.pyx", line 374, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/fmi_algorithm_drivers.py", line 1150, in solve
boptest_1  |     result_handler.integration_point()
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/common/io.py", line 2655, in integration_point
boptest_1  |     self._make_consistent()
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/common/io.py", line 2670, in _make_consistent
boptest_1  |     t = np.array([float(self.model.time)])
boptest_1  | TypeError: float() argument must be a string or a real number, not 'NoneType'
boptest_1  | .
boptest_1  | 10/29/2024 05:43:42 AM UTC	root                ERROR	Failed to initialize test simulation: Traceback (most recent call last):
boptest_1  |   File "/home/user/testcase.py", line 170, in __simulation
boptest_1  |     res = self.fmu.simulate(start_time=start_time,
boptest_1  |   File "src/pyfmi/fmi.pyx", line 7573, in pyfmi.fmi.FMUModelCS2.simulate
boptest_1  |   File "src/pyfmi/fmi.pyx", line 378, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "src/pyfmi/fmi.pyx", line 374, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/fmi_algorithm_drivers.py", line 1150, in solve
boptest_1  |     result_handler.integration_point()
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/common/io.py", line 2655, in integration_point
boptest_1  |     self._make_consistent()
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/common/io.py", line 2670, in _make_consistent
boptest_1  |     t = np.array([float(self.model.time)])
boptest_1  | TypeError: float() argument must be a string or a real number, not 'NoneType'
boptest_1  | .
boptest_1  | 10/29/2024 05:43:42 AM UTC	werkzeug            INFO	172.19.0.1 - - [29/Oct/2024 05:43:42] "PUT /scenario HTTP/1.1" 500 -
boptest_1  | 10/29/2024 05:48:37 AM UTC	root                INFO	Test simulation initialized successfully to 2592000.0s with warmup period of 604800.0s.
boptest_1  | 10/29/2024 05:48:37 AM UTC	root                INFO	Test case scenario was set successfully.
boptest_1  | 10/29/2024 05:48:37 AM UTC	werkzeug            INFO	172.19.0.1 - - [29/Oct/2024 05:48:37] "PUT /scenario HTTP/1.1" 200 -

Furthermore, I managed created a segmentation fault by trying to set the scenario while one client is already waiting for the response (also if i cancel one call and then try to set it again). Here the output:

boptest_1  | 10/29/2024 06:04:02 AM UTC	root                WARNING	The simulation start time (1987200.000000) and the current time in the model (2155710.000000) is different. Is the simulation start time correctly set?
boptest_1  | 10/29/2024 06:04:02 AM UTC	root                ERROR	Failed to initialize test simulation: Traceback (most recent call last):
boptest_1  |   File "/home/user/testcase.py", line 170, in __simulation
boptest_1  |     res = self.fmu.simulate(start_time=start_time,
boptest_1  |   File "src/pyfmi/fmi.pyx", line 7573, in pyfmi.fmi.FMUModelCS2.simulate
boptest_1  |   File "src/pyfmi/fmi.pyx", line 378, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "src/pyfmi/fmi.pyx", line 374, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/fmi_algorithm_drivers.py", line 1124, in solve
boptest_1  |     raise fmi.FMUException("The simulation failed. See the log for more information. Return flag %d."%status)
boptest_1  | pyfmi.fmi.FMUException: The simulation failed. See the log for more information. Return flag 3.
boptest_1  | .
boptest_1  | 10/29/2024 06:04:02 AM UTC	root                ERROR	Failed to initialize test simulation: Traceback (most recent call last):
boptest_1  |   File "/home/user/testcase.py", line 170, in __simulation
boptest_1  |     res = self.fmu.simulate(start_time=start_time,
boptest_1  |   File "src/pyfmi/fmi.pyx", line 7573, in pyfmi.fmi.FMUModelCS2.simulate
boptest_1  |   File "src/pyfmi/fmi.pyx", line 378, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "src/pyfmi/fmi.pyx", line 374, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
boptest_1  |   File "/home/user/miniconda/envs/pyfmi3/lib/python3.10/site-packages/pyfmi/fmi_algorithm_drivers.py", line 1124, in solve
boptest_1  |     raise fmi.FMUException("The simulation failed. See the log for more information. Return flag %d."%status)
boptest_1  | pyfmi.fmi.FMUException: The simulation failed. See the log for more information. Return flag 3.
boptest_1  | .
boptest_1  | 10/29/2024 06:04:02 AM UTC	werkzeug            INFO	172.19.0.1 - - [29/Oct/2024 06:04:02] "PUT /scenario HTTP/1.1" 500 -
boptest_1  | Traceback (most recent call last):
boptest_1  |   File "src/pyfmi/fmi.pyx", line 704, in pyfmi.fmi.ModelBase._logger
boptest_1  | Segmentation fault (core dumped)
project1-boptest-060_boptest_1 exited with code 139
@dhblum
Copy link
Collaborator

dhblum commented Oct 30, 2024

Hey @Rapi1234, thanks for reporting. Yes the multizone_residential_hydronic test case runs slower than other test cases in general. When initializing a scenario time period, BOPTEST runs the model for one week leading up to the start time of the scenario. Unfortunately, for the multizone_residential_hydronic, this indeed seems to take about 5 minutes to run. We would like to look at ways to speed up simulation of this model, but it will take some time, as the speed is related to a few things: the mathematical model implementation, embedded control logic implementation, the size of the model, the FMU compilation tool, and the FMU simulation tool and method.

Regarding your errors, they may be related to trying to send commands to the Docker container while the initialization is still running, though I haven't tested this too much to understand more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants