ibpsa / project1-boptest

Building Optimization Performance Tests
Other
109 stars 70 forks source link

'Default' time step gets overwritten in examples #686

Closed Jaap-Neven closed 3 weeks ago

Jaap-Neven commented 1 month ago

Problem description

The examples specified in examples.python make use of the basic interface.py module for communicating with the API. In each example, the user passes some inputs, including start time, end time and the control step. At first, interface.py returns some information about the test case, which includes a default control step. After the first initialization, the default control step is shown to be 60.0 seconds, although the user-specified step was 300 seconds. This far, it makes sense, since the default gets overwritten by the user.

image

Running this script subsequently, the default control step is shown to be the control step which was chosen by the user in the previous simulation. According to the image below, the default step is now the previously specified 300 seconds.

image

This print statement can therefore be confusing to the user, since it does not reflect the real default control step.

Proposed fix

I'm not sure if there is a way to access the default control step in a Python script through API communication. If so, this can be fixed in interface.py for all the example scripts. Otherwise, a workaround can be implemented in each example separately, or in interface.py.

dhblum commented 1 month ago

Thanks for reporting @Jaap-Neven. Maybe a fix could be instead of printing "Default Control Step" print "Current Control Step"? Then it's true for both the 60 (default started) and the 300 (if user overwrites and subsequently runs the script)?

If you agree, feel free to submit a PR :). A good first one.

Jaap-Neven commented 1 month ago

Hi @dhblum, I agree that changing the print statement is a good fix, since in reality the user will always want to specify their own timestep.

However, also the structure of interface.py needs to be changed slightly, because the print statement does not print the selected timestep, but the one used in the previous simulation.

I'll have a look into this :)

dhblum commented 1 month ago

I suggest then to move it down in the code and print a message about the step used in the simulation.

dhblum commented 3 weeks ago

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