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 2016-04-27 07:41:17 -0600

Cole.S's avatar

updated 2017-10-18 07:21:09 -0600

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!

edit retag flag offensive close merge delete

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  ( 2016-04-27 09:22:24 -0600 )edit

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

Adam Hilton's avatar Adam Hilton  ( 2016-04-27 10:06:46 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-04-27 10:07:51 -0600

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.

edit flag offensive delete link more

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: 2016-04-27 07:33:33 -0600

Seen: 139 times

Last updated: Apr 27 '16