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

Use EnergyPlus component lib

asked 2017-08-10 17:40:48 -0500

ngkhanh gravatar image

updated 2017-08-13 13:14:48 -0500

I want to use some of energyplus components libs : ChillerEIR.cc and ChillerEIR.hh to get chiller output only while i have all input data of real chiller (no sizing, all parameters known) like an independent .dll or library, which could be called in python. The current approach EMS or FMI-EMS requires too much steps or build the whole idf file which should be hard to review. Could i do like that with current energyplus architect ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-08-13 14:01:56 -0500

The answer to your question is a solid "Possibly, but it'll probably require some work". Generally speaking, the challenge you are going to face is that there is a lot of global data that is intertwined with the operation of the component parts of EnergyPlus that makes completely separate use of the component parts difficult. Basically, the chiller component will probably assume that things are set up (e.g. global data arrays) and if the full set up is not done, that will eventually lead to bad things. In the future, this should be easier as more parts of EnergyPlus are refactored to be more object oriented.

However, for an ever-growing number of components we have unit tests that provide a roadmap on how to use things separately. In your specific case, take a look here. There are a couple of examples of setting up the chiller component and making sure things work as expected. One possible path would be to write a unit test (or modify one that is already there) to do something like what you want. If you can do that, then the EnergyPlus part is solved and you would have demonstrated that what you want is possible with things as they are. Getting something working and hooked up to Python could still be pretty challenging, but presumably that sort of thing has been done before.

edit flag offensive delete link more

Comments

Thank you so much. Should i use compile unit test ChillerElectricEIR.unit.cc to be an lib/.so/.dll to be callable from python ? Currently, input is hard-coded in test file so it would be good if have any reference for object types used in those files. In worst case, i am thinking about use minimal.idf as template for adding my data but it would be awful process to review.

ngkhanh gravatar imagengkhanh ( 2017-08-13 19:50:07 -0500 )edit

No, that's not the way to go. There's already a shared library (energyplusapi.dll on my Windows machine) that should be produced by the build, so part of the packaging is already done. The unit test route is probably the quickest way to figuring out how to set the component up. If you're comfortable with the CMake build system, then you could skip that completely. A minimal IDF template is not a bad idea, if you look at the unit tests a lot of them do essentially use a minimal IDF chunk to get things started.

Jason DeGraw gravatar imageJason DeGraw ( 2017-08-14 10:37:48 -0500 )edit

This mean i can use functions written in ChilerEIR.cc/.hh by call them from energyplusapi.dll ? - Sorry because i have done any C++ code before. I focus on HVAC component only so any idf even minimal would over kill (loop setup, sizing input etc,,,)

ngkhanh gravatar imagengkhanh ( 2017-08-14 16:15:34 -0500 )edit

Yes, that's correct. This line links the main program main.cc against the dll. It'll be very difficult to do what you're describing without C++/CMake experience. Very difficult.

Jason DeGraw gravatar imageJason DeGraw ( 2017-08-14 21:09:54 -0500 )edit

yeah I know it's hard for newbie. I have use python call mylib = ctypes.WinDLL('energyplusapi.dll') but it doesn't expose to function in ChilerEIR.cc. I would try step-by-step so please point me some outline about further steps.

ngkhanh gravatar imagengkhanh ( 2017-08-18 01:09:00 -0500 )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

Stats

Asked: 2017-08-10 17:40:48 -0500

Seen: 188 times

Last updated: Aug 13