Python API skipping function when not ready

asked 2023-01-27 16:39:26 -0500

modeler96's avatar

updated 2023-01-28 07:16:35 -0500

I have used EnergyPlus EMS for a long time and recently attempted using the Python API. I implemented the example from the EnergyPlus GitHub: in PyCharm. To verify that I was using it correctly and understood the details, I created an identical idf file with an EMS program that matched the logic and ran it in standalone EnergyPlus. However, when I compared the outputs, there was a small difference for many of the reported values.

When writing a custom Python function to be called at each callback point, it is required to include the to ensure that the actuator is not manipulated before the api is ready. However, I believe this means that for the first few hundred or thousand callbacks, the function is not applied. I added a counter to compare the number of times the function was called outside the condition versus inside the condition, and they do not match. The counter also did not match the number of times the EMS program was called in the .edd file.

This page: explains that "For almost all applications, if this is not ready, the client should just return from the callback and let EnergyPlus continue, and wait until it is ready before doing any manipulation." However, from my experiment, it leads to a discrepancy between the standalone EnergyPlus EMS and the Python API results. Is there a way to make sure it is fully ready BEFORE the first callback? So the results end up the same? I tried with my own examples as well and found the same issue.

edit retag flag offensive close merge delete