First time here? Check our help page!
3

Cloning ZoneHVACUniHeater failed to addToThermalZone

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!

Cole.S's avatar
91
Cole.S
asked 2016-04-27 07:41:17 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-10-18 07:21:09 -0500
edit flag offensive 0 remove flag 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 -0500) edit

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

Adam Hilton's avatar Adam Hilton (2016-04-27 10:06:46 -0500) edit
add a comment see more comments

1 Answer

2

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.

Adam Hilton's avatar
3.5k
Adam Hilton
answered 2016-04-27 10:07:51 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments