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

Revision history [back]

Like Eric said, ZoneHVACUnitHeater does have a remove method. To illustrate, just open an irb (or pry session).

First, let's create a model with a ZoneHVACUnitHeater:

model = OpenStudio::Model::Model.new
fan = OpenStudio::Model::FanConstantVolume.new(model, model.alwaysOnDiscreteSchedule)
hc = OpenStudio::Model::CoilHeatingWater.new(model)
uh = OpenStudio::Model::ZoneHVACUnitHeater.new(model, model.alwaysOnDiscreteSchedule, fan, hc)

Now, you can quickly check what methods are available by using object.methods. You can chain grep to match a regex pattern, here a simple one that's case insensitive using the i modifier:

uh.methods.grep(/remov/i)
=> [:removeFromThermalZone,
 :isRemovable,
 :remove,
 :removeLifeCycleCosts,
 :remove_instance_variable]

You can remove it, and observe that it also deletes the coils etc.

[1] (main)> model.getZoneHVACUnitHeaters.size
=> 1
[2] (main)> model.getCoilHeatingWaters.size
=> 1
[3] (main)> uh.remove
=> [#<OpenStudio::IdfObject:0x007f990e925de8
  @__swigtype__="_p_openstudio__IdfObject">,
 #<OpenStudio::IdfObject:0x007f990e925d98
  @__swigtype__="_p_openstudio__IdfObject">,
 #<OpenStudio::IdfObject:0x007f990e925d48
  @__swigtype__="_p_openstudio__IdfObject">]
[4] (main)> model.getZoneHVACUnitHeaters.size
=> 0
[5] (main)> model.getCoilHeatingWaters.size
=> 0

Like Eric said, ZoneHVACUnitHeater ZoneHVACUnitHeater does have a remove method. To illustrate, just open an irb (or pry session).

First, let's create a model with a ZoneHVACUnitHeater:

model = OpenStudio::Model::Model.new
fan = OpenStudio::Model::FanConstantVolume.new(model, model.alwaysOnDiscreteSchedule)
hc = OpenStudio::Model::CoilHeatingWater.new(model)
uh = OpenStudio::Model::ZoneHVACUnitHeater.new(model, model.alwaysOnDiscreteSchedule, fan, hc)

Now, you can quickly check what methods are available by using object.methods. You can chain grep to match a regex pattern, here a simple one that's case insensitive using the i modifier:

uh.methods.grep(/remov/i)
=> [:removeFromThermalZone,
 :isRemovable,
 :remove,
 :removeLifeCycleCosts,
 :remove_instance_variable]

You can remove it, and observe that it also deletes the coils etc.

[1] (main)> model.getZoneHVACUnitHeaters.size
=> 1
[2] (main)> model.getCoilHeatingWaters.size
=> 1
[3] (main)> uh.remove
=> [#<OpenStudio::IdfObject:0x007f990e925de8
  @__swigtype__="_p_openstudio__IdfObject">,
 #<OpenStudio::IdfObject:0x007f990e925d98
  @__swigtype__="_p_openstudio__IdfObject">,
 #<OpenStudio::IdfObject:0x007f990e925d48
  @__swigtype__="_p_openstudio__IdfObject">]
[4] (main)> model.getZoneHVACUnitHeaters.size
=> 0
[5] (main)> model.getCoilHeatingWaters.size
=> 0