-
Notifications
You must be signed in to change notification settings - Fork 67
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
baseline step size #302
Comments
Below the branch that I used to merge https://github.com/ibpsa/project1-boptest/tree/issue240_memory and that leads to same baseline results independently of the step size: https://github.com/JavierArroyoBastida/project1-boptest/tree/issue302_baselineStepSize |
Thanks for reporting this. Indeed I reproduced your results, error and fix, on my machine. I merged latest master to https://github.com/ibpsa/project1-boptest/tree/issue240_memory and pushed just to have tests run. But https://github.com/ibpsa/project1-boptest/tree/issue240_memory makes it so that all trajectories are stored, and reported, at 30s intervals, for instance when using /results. This could be more akin to how sensors typically out at regular intervals. One issue is if a user wants to test at a smaller step size, maybe for a feedback controller. |
Tests didn't pass but that's because of small differences and lack of stored event points, which was expected. I think we need to make a decision here. We can allow the user to set the interval at which trajectories are reported and stored, so that there is no restrictions in that regard. In that case we'd get the small differences in results for different intervals. The other option is to fix the step size, which I'm more in favour of since results' consistency should be a priority and also since sensors may typically output at regular intervals as you well pointed out. Maybe a trade-off is to use 10s fixed interval? |
@dhblum and @JavierArroyoBastida, I cannot resist coming back to the option of integrating the measurements inside the emulator. At least for the energy, emissions and cost KPIs this would solve this issue. For the comfort KPIs it is, as mentioned by Javier in #240, a bit more complicated. Javier proposed one solution. An alternative would be to differentiate the integrated measurement to get the average within the timestep and the use this in the same way as the KPIs are calculated now. In my opinion, such solution would allow for setting a fixed timestep (for example 30s), that would result in both consistency and reduced memory consumption. If users need shorter control steps for there controller I guess the current setup will automatically adjust the output interval to the minimum of the predefined output interval and the set control step? This should then not lead to inconsistency in the energy related KPIs, but could lead to small inconsistencies in the comfort KPIs. However I think that when comparing controllers the differences will be so small that a lot of other parameters are considered more important (such as installation complexity, need for sensors etc). |
A couple of comments on options: 1. Setting 2. Performing integration inside the model without passing boundary condition data into the model. This could be done for power variables by adding an integrator to the
|
At this point I'm more in favor of option 1. I understand the point of option 2 and I think that it's a very valid proposal. However, it requires fundamental changes that may generate other issues along the way. One I'm concerned about is the addition of complexity to the emulators, but the worst of all are all those challenges that we can't foresee from here. Integration outside the emulators works fine and has proven to be robust so far, even when used with interactive calls every control step. The issue raised here regards a very specific case where the user sets a very small control step and it leads to very small differences. |
I'm sorry for my delay here. I've started again to study the problem more, also on the bestest_air case. Will report results soon. |
I've benchmarked the performance of A few observations to note:
My thoughts:
Seems like implementing a regular time step of results reporting, along with use of the results filter, leads to more consistent performance as a function of control step size on multiple fronts as BOPTEST is currently implemented: KPI values, reporting of data trajectories, and overall simulation time. Adding integrators to the emulators could indeed provide the most consistent KPI results, and is perhaps more robust against further issues I can't yet see. However, it is also an invasive process to the emulator models and/or the BOPTEST infrastructure, and will not address the issues of consistent result reporting time steps and simulation times. Therefore, I'm wondering if it is a good idea to split some of this thinking/development into two steps. 1) Implement the regular reporting interval for the benefits demonstrated here (discussions of typical data resolution seen in practice aside, which also may differ for each measured variable and sensor type, 30 s seems like a reasonable start to me) and 2) think separately on the necessity and best methods for moving KPI integration within the emulators. |
Thanks a lot @dhblum for this elaborate benchmark study. The average result time step is indeed surprisingly large for large control step sizes. I'm glad to see the consistency in KPI results and the lower simulation time variability when using PR 324. Looks like fixing |
@haraldwalnum I wanted to check if you had any more thoughts on this and on my proposed way forward. |
@dhblum, I your proposed way forward is good. In addition to giving more consistent results, I think the fixes in #324 improves the user expericen (due to the reduced computational time). I have actully used the proposed solution in my local version until now. It also solves the memory issues for long time simulation discussed earlier (at least with the emulator complexity we have worked with until now). I still think energy meters (integrated/accumulative power meters) would be useful. I need it for my controller (at least it works better with that, than i single reading of a power meter), so when I am testing the "bestest hydronic heat pump" emulator I call the result api for each control step and integrate the signal within my controller. Energy meters could of course be implemented already, independent of KPI calculation, just with a read block. One way to allow them to be used for KPI caclulation, could be to add "energy" to the list of KPI related measurements in the list in the read blocks, as alternative to "power". In the KPI calculation it would then be assumed that measurements marked with "energy" are integrated signals that needs to be differentiated. |
@JavierArroyoBastida and @haraldwalnum, thanks for your feedback on this. Sounds good, let's proceed with #324. Thanks for moving it forward Javi, I'll review. About energy meters, I think their presence in an emulator, as an alternative to or in addition to power meters, should be decided on an emulator by emulator basis, similar to the presence of other sensors. For use with KPI calculation, your suggestion is true, but are you suggesting a developer could use either "power" or "energy" to contribute to the same energy-related KPI calculations, so that we have a process on the KPI calculation side where for each variable we'd check which is being used and implement the correct calculation process? |
@dhblum, my initial thought was that the emulator developer should choose either "power" or "energy" to contribute to the KPI calculation. The other could still be a measurement, but not connected to KPI calculation (to avoid double counting). The KPI calculation procedure would be chosen based on how the measurement is tagged (power or energy) In the KPI calculation one would just sum energy/emissions/costs calculated from energy meters and from power meters. |
Closed by #324. |
Current master returns slightly different baseline KPI results when using different step sizes for the same scenario and simulation periods. Here the script to reproduce the issue:
test_kpis_baseline.txt
Running this script in master and in https://github.com/ibpsa/project1-boptest/tree/issue270_scenarioTime_2 returns in both cases the exact same results:
Where it's shown a small discrepancy when running the baseline using a step size of 12 hours vs. a step size of 24 hours.
In the beginning I thought it could be a bug from the KPI calculation module but after reviewing it I figured out that this is because the communication points returned from pyfmi depend on the simulation length, which in turn affects the integration to calculate KPIs. This issue can be solved directly by merging https://github.com/ibpsa/project1-boptest/tree/issue240_memory to master, which fixes the number of communication points. After so the script returns:
which proves that baseline KPIs are independent of step size.
My suggestion is to prioritize merging not only https://github.com/ibpsa/project1-boptest/tree/issue270_scenarioTime_2 but also https://github.com/ibpsa/project1-boptest/tree/issue240_memory.
EDIT: I forgot to mention that I used the
bestest_hydronic_heat_pump
case for all tests.The text was updated successfully, but these errors were encountered: