-
Notifications
You must be signed in to change notification settings - Fork 70
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
TestCase: Bestest Hydronic pump control #274
Comments
Thanks @haraldwalnum for sharing the issue and script, I could easily reproduce the problem. I've been doing some testing on this and it's indeed an awkward behavior. I'm afraid I've not been able to realize the source of the problem, but have two comments on this:
See results here (also with indoor temperature): What is interesting from here is that the integer variable that sets the pump stage is already corrupted, which indicates that the problem comes from the Where you can see that there is not definition of the output value when I'll keep trying when time allows. |
I have increased the boolean threshold in |
Changing the pump input to be continuous instead of integer to select stage seems to solve the problem. See model: and output from @haraldwalnum's script now: I see this as a fair solution, although there are some things to take into account:
|
Thanks @haraldwalnum for reporting and @JavierArroyoBastida for looking into it. Also, indeed putting a first order filter before the real-to-integer block helps too (see results below from Harald's script). FYI Applying the filter after the real-to-integer block does not help, including using the filter within the pump itself. |
My feeling is that it has to do with triggering event updates at the start of a step related to the real-to-integer block. The filter forces a state event and using the continuous signal removes the real-to-integer block altogether. See also #213 for relation. |
Thanks @dhblum, that helps me understand a bit better. |
In my opinion, the filter solution is the best. It solves point 1 of Javier. However, point 2 is still valid an I guess it can occur in all emulators using real to integer blocks or hysteresis (which is common in controllers). Maybe also in other cases? |
a step function is generally approximated as a ramping function in JModelica. So whether the event is triggered or not depends on how the step function is interpolated, which is associated with the simulation interval the solver selects. Adding a filter basically defines how the step function should be interpolated but my concern is that it may add artificial delays |
I've been spending some time trying to get even further to the root of the issue. Specifically, why potential events aren't checked for at the start of a simulation step, when that simulation step could have changed inputs from the last one? So I've gone digging through the In BOPTEST's
My inclination seems right, that in the preparation for the simulation step, there should be a check of an event at start time (which would occur if the input changed values from the last step). But, notice that the So, I did a test where upon building the testcase docker image I add the following to
Then, I compiled the testcase (original, with the real-to-integrator block and without the filter), ran Harald's script, and BINGO: EDIT:
|
Wow @dhblum this is great, thanks for taking the time to figure it out. FMUModelME1: An FMI Model loaded from a DLL. (see here) But that doesn't say much to me. |
@JavierArroyoBastida Yes, I think the new Dockerfile should be sufficient. But I'd like to repeat the small test I did in #213 to double check on that case, and I think also report an issue with pyfmi development to see what they say. And maybe @haraldwalnum wants to try his previous test case that ran into problems that prompted that previous issue. The 1 and the 2 specify which version of the FMI standard is supported. |
Thanks again @dhblum . This fix works on my test case as well. |
@haraldwalnum Great! I've reported this issue to the pyfmi repo. If a fix is indeed necessary, it will be made in a future version of pyfmi. Currently, the BOPTEST Docker uses the last trunk of JModelica.org and the pyfmi version included therein. There's already an incomplete issue #146 to migrate this to a stand-alone pyfmi install, where we could then utilize any new version of pyfmi that would contain any fix. But there were some challenges to migrating to a stand-alone pyfmi install that needed to be resolved. I've actually made some good progress on this but haven't gotten a chance to formalize and report back to that issue. Will aim to do so soon. In the meantime of hearing back from pyfmi developers and migrating the BOPTEST container to a stand-alone pyfmi install, I suggest using the patch I propose in the Dockerfile here https://github.com/ibpsa/project1-boptest/tree/issue274_hydronicPumpControl. Any thoughts on this? |
EDIT: I referenced the wrong pyfmi issue in the above comment. It is actually: modelon-community/PyFMI#72. |
Sounds good to me. |
Closed by #284. |
@dhblum @JavierArroyoBastida . As discussed yesterday I had some issues in controlling the pump on/off in the besttest hydronic testcase. I have tried to reproduce the issue in a simple test setup. I run the emulator with 3600s control step, turning the pump on/off for each step. The results are show below. One can see that ovePump_u and reaPump_y follows the control signal, but reaPPum_y consumes power more "randomly". This is also reflected by the gas consumed by the heater (reaQHea_y).
I have also attached the code I used to run the test.
pumpTest.txt
The text was updated successfully, but these errors were encountered: