First time here? Check out the Help page!

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

Solar Hot Water with Open Studio measure

asked 1 year ago

DanV's avatar

updated 1 year ago

I am trying to create an OpenStudio measure the incorporates a solar hot water collector into a plant loop. I can create a new SolarCollectorFlatPlateWater object but cannot create a SolarCollectorPerformanceFlatPlate object.

Within measure.rb:

def run(model, runner, user_arguments)
  super(model, runner, user_arguments)  # Do **NOT** remove this line
  new_collector = OpenStudio::Model::SolarCollectorFlatPlateWater.new(model)
  new_collector_perf = OpenStudio::Model::SolarCollectorPerformanceFlatPlate.new(model)

This produces the following error in Ruby:

Error: allocator undefined for OpenStudio::Model::SolarCollectorPerformanceFlatPlate

Is there another way to create a SolarCollectorPerformanceFlatPlate object in an open studio measure?

Preview: (hide)

Comments

I can't seem to get the code to look right. There are several lines that are all shown together but are separate lines.

DanV's avatar DanV  ( 1 year ago )

1 Answer

Sort by » oldest newest most voted
3

answered 1 year ago

OpenStudio automatically creates the performance object when you create the solar collector.

So:

new_collector = OpenStudio::Model::SolarCollectorFlatPlateWater.new(model)
new_collector_perf = new_collector.solarCollectorPerformance

You can find an example like this with more code here.

And of course the OpenStudio SDK documentation can be found here.

Preview: (hide)
link

Comments

That fixed it. I also was able to use your code to do most of what I was planning to do. Thank you!

DanV's avatar DanV  ( 1 year ago )

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

1 follower

Stats

Asked: 1 year ago

Seen: 124 times

Last updated: Sep 01 '23