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

With FMI, is it possible to output energy values at the end of each simulation timestep in energyplus, and use python code to change the EMS code for the next timestep?

asked 2017-05-24 04:33:48 -0600

niharkopal gravatar image

I need to call python code from energyplus software and the python code should be able to access my EMS for the next timestep. Keeping the python modules of theano, keras and numpy intact. Is this possible ? If yes, can you please suggest some documentation where I can start this ?

edit retag flag offensive close merge delete


Could you please clarify your question? Are you talking about using EnergyPlus as an FMU, exporting some of the outputs so they can be used in a downstream Python code whose results will be fed back to EnergyPlus through EMS? Best might be to describe your system setup so we know what you want to achieve.

Thierry Nouidui gravatar image Thierry Nouidui  ( 2017-05-24 11:24:17 -0600 )edit

Why do you need a separate code? are using a large python library? You can make an FMU in Modelica and specify all your equations / calculations there.

mdahlhausen gravatar image mdahlhausen  ( 2017-05-24 11:46:51 -0600 )edit

Thanks, Thierry, yes that's what I want. I want to use some python libraries like numpy, theano, do some learning in real-time. That's why I need python code.

niharkopal gravatar image niharkopal  ( 2017-05-24 13:27:21 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-24 15:11:59 -0600

If your Python code is memoryless, that is, the output of the Python code at time t only depends on the inputs at time t, then you could use the SystemCommand actor to call your Python script ( .

I will suggest following:

  • You use the BCVTB as your master program.
  • You use the Simulator actor to run E+ and expose the outputs you want to send to Python.
  • You use the SystemCommand actor to call your Python code with the inputs received from E+.
  • You send the outputs of the SystemCommand actor to the inputs of the Simulator actor which will pass your control actions to EMS.

I suggest you studied few BCVTB examples such as the one which uses an EMS actuator as well as the one which uses the systemComamnd actor. Once you understand the two you will be able to connect the dots.

Note that instead of using the Simulator actor in the BCVTB, you could export EnergyPlus as an FMU, and import it in the BCVTB.

edit flag offensive delete link more

Your Answer

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

Add Answer


Question Tools



Asked: 2017-05-24 04:33:48 -0600

Seen: 276 times

Last updated: May 24 '17