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

Insert Component from BCL with Ruby API

asked 2015-05-27 21:16:15 -0500

pflaumingo's avatar

updated 2017-08-05 13:22:24 -0500

What's the best way to insert a component from a BCL (local or remote) into a model? For example, if I wanted to grab one of the LG heatpump BCL components and place it into my model. Would you first create an object of the same type and set it's properties from the BCL class? Or is there an easy way to instantiate an object straight from the BCL?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2015-05-27 22:55:01 -0500

updated 2015-05-27 23:14:14 -0500

Good question, I have a few sample measures to do this with both a construction and a weather file (actually site component with a few object types). They are not ready to go on BCL, but here is a link to the construction example on a public repo which is probably the better example for you of the two (keep in mind they are not on BCL because they are not flushed out and tested, but they should still be a useful guide to follow). You want to bring in the real BCL object vs. creating a new object and copying the attributes. The measure first hits BCL in the arguments section to populate a choice list. Then hits it again in the run section to download and apply the selected component.

The trick is coming up with logic to have a choice list that works but doesn't have too many items in it. In the construction example linked above I assume the model has a climate zone set (in the site tab); that narrows down the choices to constructions tagged for that climate zone. I also wrote it only for exterior walls to further narrow it down. The SketchUp plugin user script that hits BCL and gets a weather file can first ask you to type the name of a city and then bring up a choice list of 4-5 options. With measures you don't have interactive arguments in that the selection made on the first argument can't change what choices are shown for the next one. You might be ok for now for Technology Performance Exchange Objects. If you had an argument for Indoor Unit, and another for Outdoor, they would have 79 and 52 choices respectively. Long but still manageable.

edit flag offensive delete link more

Comments

@David Goldwasser, thanks!. The link definitely cleaned a few things up. I am doing something rather similar, but I was also curious if there was a convenient method that was something like componentData = model.insertComponentFromBCL(uid) that I may have been missing or not seen. Moving slightly off topic, when you pull an outdoor component from the BCL and instantiate an object will it always create all objects in the associated .osc? If I had multiple outdoor units with the same performance curves, is there a simple way to just create one OS:Table:MultiVariableLookup object?

pflaumingo's avatar pflaumingo  ( 2015-05-28 19:47:13 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

1 follower

Stats

Asked: 2015-05-27 21:16:15 -0500

Seen: 369 times

Last updated: May 27 '15