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

Revision history [back]

You just have to creative a bit.

Use a PythonPlugin file or the EnergyPlus Python API directly, hooking up a callback, say callback_begin_system_timestep_before_predictor for example.

The callback will fire each time, but just check whether you're actually at the first timestep of a day. There are a number of ways you can achieve this, see https://energyplus.readthedocs.io/en/latest/datatransfer.html One way would be to check something like hour() == 0, zone_time_step_number() = 1 (test it yourself)

When that precondition arrives, you call your executable (subprocess.check_call for eg) and retrieve your values for the next 24 hours and store them on your class instance.

Every other callback firing event, you just retrieve what you already computed and assign that to your schedule actuator

It know this may look vague-ish (your question wasn't very specific either) but it's really not that hard to implement

You just have to creative a bit.

Use a PythonPlugin file or the EnergyPlus Python API directly, hooking up a callback, say callback_begin_system_timestep_before_predictor for example.

The callback will fire each time, but just check whether you're actually at the first timestep of a day. There are a number of ways you can achieve this, see https://energyplus.readthedocs.io/en/latest/datatransfer.html One way would be to check something like hour() == 0, zone_time_step_number() = 1 (test it yourself)

When that precondition arrives, you call your executable (subprocess.check_call for eg) and retrieve your values for the next 24 hours and store them on your class instance.

Every other callback firing event, you just retrieve what you already computed and assign that to your schedule actuator

It know this may look vague-ish (your question wasn't very specific either) but it's really not that hard to implement

You just have to creative a bit.

Use a PythonPlugin file or the EnergyPlus Python API directly, hooking up a callback, say callback_begin_system_timestep_before_predictor for example.

The callback will fire each time, but just check whether you're actually at the first timestep of a day. There are a number of ways you can achieve this, see https://energyplus.readthedocs.io/en/latest/datatransfer.html One way would be to check something like hour() == 0, zone_time_step_number() = 1 (test it yourself)

When that precondition arrives, you call your executable (subprocess.check_call for eg) and retrieve your values for the next 24 hours and store them on your class instance.

Every other callback firing event, you just retrieve what you already computed and assign that to your schedule actuator

It know this may look vague-ish (your question wasn't very specific either) but it's really not that hard to implementimplement.


Edit: I got nerdsnipped and added a fully functional demonstration at https://github.com/jmarrec/OpenStudio_to_EnergyPlusAPI/tree/main/call_external_program