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

Cloning ZoneHVACUniHeater failed to addToThermalZone

asked 9 years ago

Cole.S's avatar

updated 7 years ago

Hi, I am trying to clone a ZoneHVACUnitHeater from a seed .osm file. I was able to successfully clone the heater (heater_in_zone), but was not able to add the unit heater to a thermal zone (thermalZone). My lines of code are:

# Load Heater components unless "no heater" is selected
     if heater_name.eql?("No Heater")
     else
        heat = true
        heater_path = OpenStudio::Path.new("#{File.dirname(__FILE__)}/resources/#{heater_name}.osm")
        heater_inputmodel=translator.loadModel(heater_path)
        heater_inputmodel=heater_inputmodel.get
        heater_in_zone=heater_inputmodel.getZoneHVACUnitHeaters[0]

      end

heater_clone = heater_in_zone.clone(model).to_ZoneHVACUnitHeater.get
heater_clone.addToThermalZone(thermalZones)

When run, the following error occurs:

"Expected argument 1 of type openstudio::model::ThermalZone &, but got Array [#<OpenStudio::Model::ThermalZon....in SWIG method 'addToThermalZone.'"

I'm pretty new to Ruby so am not sure the correct protocol for cloning objects. If anyone could help me that would be great!

Preview: (hide)

Comments

1

You are right. I changed the line of code to

heater_clone.addToThermalZone(thermalZones[0]) .... and the error was resolved.

Cole.S's avatar Cole.S  ( 9 years ago )

Okay, I'm going to move it to an answer.

Adam Hilton's avatar Adam Hilton  ( 9 years ago )

1 Answer

Sort by » oldest newest most voted
2

answered 9 years ago

Adam Hilton's avatar

With respect to your error, I don't know what you have written into your thermalZones variable but it looks like it's probably a string array. addToThermalZone() is only expecting one value, so you can't pass an entire array to it.

Preview: (hide)
link

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: 9 years ago

Seen: 149 times

Last updated: Apr 27 '16