Runtime Data Exchange for controls

Hi @chris , I am scouring the discourse looking for information on runtime data exchange capability with the honeybee component. I have a separate Python based proprietary data predictive control that I need to use to make set point recommendations for next time steps and I am looking to see how I can accomplish this in Honeybee. I know outside of GH, there is the option of Simulink + FMU that lets you do runtime data exchange but I am trying to keep it all within GH and Honeybee environment and minimize interconnections of other programs outside of just GH and my Python script.

I’m not sure if this has been discussed with different tags within the discourse. Any help or direction is welcome. Thank you.

Hi @Resh, out of interest what are you trying to achieve from this?

Hi @charlie.brooker , we’re trying to do custom predictive control scheme. Essentially emulating real time predictive BAS system control that can send new set points to the room controller based on an objective function to minimize energy and maximize patient comfort. But to be able to do that, we need to interject energy plus at each time step and exchange the data during the simulation. Does that make sense?

Thanks @Resh, that roughly makes sense to me. This might all already be familiar to you, but HB is using EnergyPlus as the simulation engine for energy calculations.

Googling what it sounds you’re after I came across this on Big Ladder that sounds like it’s along the lines of your needs:

  • The Energy Management System, which was the first method to allow reading and writing simulation data while a simulation was running, and allowing user-defined scripts to be executed to alter simulation data.

There’s a few posts regarding EMS usage with HB on the forum. Not an answer, but I hope this info helps get your research moving

1 Like

Hi Charlie, thank you. However, I think EMS is a predefined script that would execute custom controls (with predefined if and else based set points) developed by the user. I’m not sure if EMS applications are widely adopted in Honeybee environment accept for the Airflow Network for which I’ve seen some posts.

I’m looking to actively update the set point during run-time simulation based on a prediction model that also runs alongside the simulation time. Therefore, my set point values are not predefined, they are populated actively based on a data predictive model. I feel like a combination of the python energy plus API may be useful. But I’m not sure where exactly I can customize HB to interject each timestep to proceed with this type of data exchange during simulation.

https://nrel.github.io/EnergyPlus/api/python/index.html

1 Like

Thanks for sharing, I wasn’t aware of the API. It looks like exactly what you need, in particular this in the Data Transfer api.

set_actuator_value(actuator_handle: int, actuator_value: ctypes.c_double) → None[source]
Sets the value of an actuator in a running simulation. The get_actuator_handle function is first used to get a handle to the actuator by name. Then once the handle is retrieved, it is passed into this function, along with the value to assign, to then set the value of the actuator. Internally, actuators can alter floating point, integer, and boolean operational values. The API only exposes this set function with a floating point argument. For floating point types, the value is assigned directly. For integer types, the value is rounded to the nearest integer, with the halfway point rounded away from zero (2.5 becomes 3), then cast to a plain integer. For logical values, the original EMS convention is kept, where a value of 1.0 means TRUE, and a value of 0.0 means FALSE – and any other value defaults to FALSE. A small tolerance is applied internally to allow for small floating point round-off. A value very close to 1.0 will still evaluate to TRUE.

Parameters
actuator_handle – An integer returned from the get_actuator_handle function.
actuator_value – The floating point value to assign to the actuator
Returns
Nothing

If I were to try and work with this I think I would assume that it is separate from HB. I would use HB to generate the IDF and then use the E+ python api to run the IDF and apply the Data Transfer methods.

The link you sent references the Energy Plus Input Output Reference.
Pages 39-43 demonstrate how to use the api, essentially taking a defined idf (which HB could generate) and the using the api to run it and apply Data Transfer methods.

1 Like