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

Get Indoor Air Temperature of Thermal Zone (during Runtime)

asked 2020-12-24 19:19:29 -0600

Chelydrae gravatar image

updated 2020-12-28 11:43:06 -0600

Dear all,

I am looking for a solution on a beginner problem:

I want to extract the indoor air temperature of one specific thermal zone during runtime (with the python api). I did not find a solution in the documentation yet. Any hint is highly welcome!

Best Regards, P

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-12-27 07:02:29 -0600

hermmanhender gravatar image

updated 2020-12-27 07:04:11 -0600


Here a possible solution to your problem.

import sys
sys.path.insert(0, 'C:/EnergyPlusV9-4-0')
from pyenergyplus.api import EnergyPlusAPI
api = EnergyPlusAPI()

#Define your function to execute in runtime
def my_function(state):
   if #Necessary condition
        if == 0:
           # Handles
           To_handle =, "Site Outdoor Air Drybulb Temperature", "Environment")
           Ti_handle =, "Zone Mean Air Temperature", "Thermal Zone: Modelo_Simple")
           # Variable value
           To =, To_handle)      
           Ti =, Ti_handle)
           '''Here you can put Ti in a DataFrame, array, other'''

#After define you function, you must initializate the program
state = api.state_manager.new_state() #Necessary condition
api.runtime.callback_begin_zone_timestep_after_init_heat_balance(state, my_function)
api.runtime.run_energyplus(state, ['-d', Folder_Output_path, '-w', Weather_file_path, IDF_file_path])

I hope that this code will be useful.

Best Regards, Germán Henderson

edit flag offensive delete link more


Thank you very much German! I found another solution using EMS but your approach is much better!

Chelydrae gravatar image Chelydrae  ( 2020-12-27 14:51:33 -0600 )edit

Your Answer

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

Add Answer


Question Tools

1 follower


Asked: 2020-12-24 19:19:29 -0600

Seen: 53 times

Last updated: Dec 27 '20