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!
You are right. I changed the line of code to
heater_clone.addToThermalZone(thermalZones[0]) .... and the error was resolved.
Okay, I'm going to move it to an answer.