Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
1

Unwanted sub-timestep callbacks in EMS (Python API)

asked 2021-08-18 10:17:05 -0500

mechyai's avatar

Hello,

I am running some test scripts with the EMS Python API and am seeing redundant callbacks for each simulation timestep. It doesn't happen entirely throughout the simulation, however, but still quite often. My understanding is there should only be one unique callback per timestep.

It is better to explain this visually. This model has 6 timesteps/hour and the calling point is somewhat arbitrarily "Callback After Predictor After HVAC Managers".

Below, is a dataframe snippet from the original simulation when I noticed my issue. You can see the first hour is normal, but the rest seem to be running my callback function more frequently than desired. And you can see the Datetime is messed up, going backward occasionally (yellow highlight). Although, the data is the same for these sub-timesteps luckily.

For a 365-day simulation, this resulted in 80,198 callbacks. Way more than (6 timesteps/hr) * (24 hr/day) * (365 day) = 52,560 callbacks/timesteps expected.

image description

To fix this, I added this bit of Python code to catch when the read timestep is the same as the previous one, then ignore that callback.

image description

This showed good results, with chronological Datetime, no redundancy, and 52,560 callbacks as seen below.

image description

However, I am not confident this is a solution. I am curious why I was experiencing this redundant callbacks / sub-timesteps in the first place, and if this means there are any bugs with my model or the API?

Thank you

edit retag flag offensive close merge delete

Comments

I think this may have to do with my choice of calling point. I got different number of redundant callbacks depending on my calling point. With little knowledge of the solving algorithms at each zone and system timestep, I wonder if the predictor-corrector iteration has something to do with it.

mechyai's avatar mechyai  ( 2021-08-18 11:32:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-08-18 11:57:46 -0500

I recommend that you look at the EMS documentation on calling points. It has a couple workflow diagrams (one for Zone Timestep=System Timestep and one for Zone Timestep=2xSystem Timestep) that show the order of execution within EnergyPlus and where each calling point occurs within the sequence.

edit flag offensive delete link more

Comments

Thank you, I have already read this but revisiting it was very helpful. By choosing my calling points based on if they're in the 'HVAC Iteration Loop' or 'System Timestep' or not, I saw a different number of callbacks, this makes sense now. There were no extra system timesteps with calling points outside these loops, as expected. I was only expecting callbacks for zone timesteps, but now I understand why this is wrong.

However, there are still issues with the Datetime minutes not being chronological when within the 'System Timestep' only (example seen in the first image above)??

mechyai's avatar mechyai  ( 2021-08-18 13:34:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

2 followers

Stats

Asked: 2021-08-18 10:17:05 -0500

Seen: 333 times

Last updated: Aug 18 '21