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

time value in the plugin call

asked 2022-09-01 23:29:19 -0600

halimgur's avatar

I would like to access the time of the day from within a plugin function as a python datetime variable or similar. Is this possible?

edit retag flag offensive close merge delete


@halimgur can you confirm that you're using EnergyPlus for this Python plugin?

Aaron Boranian's avatar Aaron Boranian  ( 2022-09-02 09:56:59 -0600 )edit

Correct. I am using the latest version of EnergyPlus with the Python plugin.

halimgur's avatar halimgur  ( 2022-09-04 17:56:19 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-09-06 03:36:41 -0600

updated 2022-09-06 03:37:37 -0600

Refer to the Data Transfer API:

Potentially of interest are actual_date_time(), actual_time(), current_time(), day_of_month(), month(), year(), minutes()

I have an example here:

Something along these lines will get you started:

month =
day =
hour =
minute =
current_time =
actual_date_time =
actual_time =

# Year is bogus, seems to be reading the weather file year instead...         
# So harcode it to 2009
# year =
year = 2009

# E+ uses "end of timestep" conventions, which python does NOT like AT ALL.
timedelta = datetime.timedelta()
if hour >= 24.0:
    hour = 23.0
    timedelta += datetime.timedelta(hours=1)
if minute >= 60.0:
    minute = 59
    timedelta += datetime.timedelta(minutes=1)

dt = datetime.datetime(year=year, month=month, day=day, hour=hour, minute=minute)
dt += timedelta
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

1 follower


Asked: 2022-09-01 23:29:19 -0600

Seen: 134 times

Last updated: Sep 08 '22