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

Changing schedule based on Artificial Neural Network using values from energy plus

asked 2022-01-14 10:06:48 -0600

prp92's avatar

updated 2022-01-14 14:55:37 -0600

Hi...

Is it possible to supply the indoor temperature, indoor RH and other values to the ANN model that can predict the opening and closing of the windows? I already have the model. I have to figure out how can I supply the indoor air parameters like temperature and RH from the energy plus to my ANN model. And also how to replace the Window Open/Close values predicted by ANN model as the schedule to window opening?

I believe this can be done using python but I am not sure how to start.

Thank you so much for your time.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-01-16 18:54:51 -0600

mechyai's avatar

I would check out the new EMS Python API and see if it suits your needs. It provides the EMS feature of EnergyPlus with a nice Python API for actuating and sensing simulation objects at runtime. I'd check out the EMS Application Guide from the EnergyPlus documentation and the Python API

Using the Python API you can fetch sensor values of indoor parameters at each timestep, feed them to your ANN, then use actuators to implement the output. You should first check if EMS provides actuators for window opening/closing. I know window shading is possible, but unfamiliar with the rest. If window open/close is schedule driven, you can actuate the schedule itself.

edit flag offensive delete link more

Comments

Hi @mechyai,

thank you so much for replying. I spend last two weeks trying to understand EMS python API and it is still super hard to understand it.

I found that using plugin method 'EnergyPlusPlugin' might be easier for a beginner like me. Is it possible to do all the process like sensing, reading ANN models and actuating using the python plugin mode?

thanks..

prp92's avatar prp92  ( 2022-01-29 12:09:50 -0600 )edit

@prp92 I am not sure as I have only used used EnergyPlus as a "library" with the Python EMS API, not Python as a plugin in EnergyPlus. I made this workflow decision a while ago so I don't remember all my motivations, but I think I remember choosing running E+ as a library in Python because of the ability to keep my namespace (for instance NN model params) in Python for the longevity of the simulation and Python script. If I remember correctly, Python plugin's namespace only persist within the individual call, you would have to read/write your NN model params at each call.

mechyai's avatar mechyai  ( 2022-01-30 12:18:06 -0600 )edit

@prp92, also I believe if using Python as a plugin you have to bottle your ENTIRE Python workflow into the single plugin script. When using EnergyPlus as a library in Python, I can have a normal programming workflow, say with a bunch of PyTorch NN stuff, in Python, then only pass EnergyPlus specific things via a callback function at specific calling points. If I take an OOP approach in Python, I can pass a whole slew of variables and objects (.ie NN models, etc.) into EnergyPlus, preserving namespace inside and outside E+ for the entire simulation run period.

mechyai's avatar mechyai  ( 2022-01-30 12:23:46 -0600 )edit

@prp92 using E+ as a library in Python with the EMS Python API should make sense once you understand how to pass callback functions and calling points. The callback function is the single piece of Python code that gets passed to E+ at runtime, the calling point is specifically when this happens.

mechyai's avatar mechyai  ( 2022-01-30 12:25:10 -0600 )edit
1

@prp92 see @jmarrec great notebook at "Run EnergyPlus in API mode" to see examples of how to use E+ as a library/API

mechyai's avatar mechyai  ( 2022-01-30 12:27:57 -0600 )edit

@mechyai The above link is great. Thank you so much for helping me out..

prp92's avatar prp92  ( 2022-01-30 12:31:59 -0600 )edit

@mechyai I can now import values from zone temperature and outdoor temperature and pass it into my ANN model. I can also get the output from my model. Now, I want to input my value into the actuator. I can see that first I have to define actuator handle and then pass this handle to the get_actuator_value() function. But the problem is, I cannot see where I can enter the results from my ANN model. Is it possible to give ANN output to the actuator? Thanks..

prp92's avatar prp92  ( 2022-02-02 09:16:13 -0600 )edit

@prp92 Great. You need to use set_actuator_value function to change values for a given timestep / calling point. You input your actuator handle and value

mechyai's avatar mechyai  ( 2022-02-03 21:57:29 -0600 )edit

@mechyai I used set_actuator_value and tried to run it. It is giving me following error.

* Severe * Data Exchange API: index error in setActuatorValue; received handle: -1

This means that there is something wrong with my actuator handle. Since my objective is to control Window open/close values using Eplus natural ventilation, I tried to use following syntax.

sch_handle = api.exchange.get_actuator_handle(state, "Zone Ventilation Wind And Stack Open Area", "Opening Area Fraction Schedule Name", "LIV1XWIN_SCH")

I am confused about how to solve this actuator handle issue.

prp92's avatar prp92  ( 2022-02-04 08:10:17 -0600 )edit

@mechyai

I am particularly confused with actuator_key part of the handle. I set actuator_key as already existing dummy schedule named 'LIV1XWIN_SCH'. Actuator should replace this with the value from ANN model.

Thank you so much for helping me out..

prp92's avatar prp92  ( 2022-02-04 08:13:10 -0600 )edit

@prp92 here is a link to a similar question I asked on this topic. First you need to see if what you are trying to actuate is an available actuator, look in the .edd file in the output for list of available actuators

mechyai's avatar mechyai  ( 2022-02-04 11:10:03 -0600 )edit

@mechyai I tried to see the actuator details using the link you posted earlier. I found the following.

EnergyManagementSystem:Actuator Available,LIV1XWIN_SCH,Schedule:Compact,Schedule Value,[ ]

But this does not have the information about the actuator_key part.

prp92's avatar prp92  ( 2022-02-04 11:14: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

Training Workshops

Careers

Question Tools

3 followers

Stats

Asked: 2022-01-14 10:06:48 -0600

Seen: 640 times

Last updated: Feb 01 '22