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

Python interacts with EnergyPlus [closed]

asked 2020-05-07 21:33:39 -0600

yapan gravatar image

updated 2020-05-08 11:43:29 -0600

Hi, recently I'm working on a project to read and send variables to EnergyPlus simulation. I need my Python algorithm to talk with EnergyPlus at each simulation step. I ended up using pyEp to do this, but I have some problems to configure my EnergyPlus model (Version 9.2.0), Python cannot read variables from E+ when the simulation is running.

Could anyone share some comments or suggestions on this?

Your time are much appreciated.

Thank you so much.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by yapan
close date 2020-05-13 11:21:28.062348


Hi, I got some comments from bcvtb google group (!top... ). I plan to explore and post my solutions later. But I'm still looking forward to your comments or suggestions here. Thank you so much for your time.

yapan gravatar image yapan  ( 2020-05-08 12:17:09 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-05-11 20:37:11 -0600

As of version 9.3.0, EnergyPlus has two ways to interact with a running simulation using Python.

  • A new C API has been added to EnergyPlus, along with Python bindings, that allow you to very simply write a python script that registers callback functions in the simulation, then executes the simulation. At each callback, your python can call into EnergyPlus and read and actuate variables.
  • An alternative to the EMS system allows a user to write Python code that is essentially a plugin to a running simulation. Much like the new runtime API, this method allows your Python functions to read and write data during a simulation, but in this case, the workflow is slightly similar in that you don't need to write a function to call EnergyPlus to run. Instead you just specify your Python class in the original IDF file and run EnergyPlus.

This is a brand new implementation, and the base 9.3.0 version has some issues, but those have already been resolved and we are planning on a bug-fix release version of 9.3.0 that addresses those. It should be out very soon.

edit flag offensive delete link more


Hi Edwin,

Thank you so much for this information. I will definitely check the methods you mentioned.

Best, Yapan

yapan gravatar image yapan  ( 2020-05-11 20:50:45 -0600 )edit

That's really great and revolutionary! Isn't that a good idea to have a forum to discuss problems associated with this feature? Like the one for BCTVB!

Mehrdad Vojdani gravatar image Mehrdad Vojdani  ( 2020-05-12 04:57:42 -0600 )edit

Any update on when the bug-fix release will be available?

carolyng gravatar image carolyng  ( 2020-07-01 12:36:07 -0600 )edit

The bug fix was released, but as it includes changes that only a very small percentage of users would need, we didn't broadcast it widely or call it a replacement of 9.3 and get all users to update for no reason. You can find the version here:

I believe you may have just commented on an issue on our repo, is that correct? I don't see the comment anymore. If it wasn't you then nevermind.

Edwin gravatar image Edwin  ( 2020-07-01 12:53:32 -0600 )edit

Can you just explain the applications for these two primary usage under different scenarios? For the second one, it is similar to other APIs like eppy. But for the first one, it includes EnergyPlus as a package in the library. What is advantages for this one?

Lantonshen gravatar image Lantonshen  ( 2020-08-23 09:17:34 -0600 )edit


Question Tools



Asked: 2020-05-07 21:33:39 -0600

Seen: 450 times

Last updated: May 11 '20