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

Revision history [back]

Here's what I've found. Rather than using ZoneHVACEquipmentList, f you call zone.equipment, you get a vector of objects of class ModelObject, which can then be 'converted' to the specific equipment object you want with something like (for a fan coil):

zones = model.getThermalZones
zones.each do |zone|
  zone_eqp = zone.equipment
  zone_eqp.each do |eqp|
    if eqp.to_ZoneHVACFourPipeFanCoil.is_initialized
      fcu = eqp.to_ZoneHVACFourPipeFanCoil.get
    end
  end
end

From there, calling fcu.coolingCoil again returns a ModelObject, which can be converted to the correct object class by again checking if the class is initialized, then using "to_[class name].get", so ccoil = coil.to_CoilCoolingWater.get. The obvious downside is you have to know what equipment types you'll have in the zones ahead of time, or include logic for all available zone equipment.

To make changes based on space type or name, you'd just include logic for each zone to get the associated spaces (zone.spaces) and do your check before moving on to the equipment loop.

Here's what I've found. Rather than using ZoneHVACEquipmentList, f if you call zone.equipment, you get a vector of objects of class ModelObject, which can then be 'converted' to the specific equipment object you want with something like (for a fan coil):

zones = model.getThermalZones
zones.each do |zone|
  zone_eqp = zone.equipment
  zone_eqp.each do |eqp|
    if eqp.to_ZoneHVACFourPipeFanCoil.is_initialized
      fcu = eqp.to_ZoneHVACFourPipeFanCoil.get
    end
  end
end

From there, calling fcu.coolingCoil again returns a ModelObject, which can be converted to the correct object class by again checking if the class is initialized, then using "to_[class name].get", so ccoil = coil.to_CoilCoolingWater.get. The obvious downside is you have to know what equipment types you'll have in the zones ahead of time, or include logic for all available zone equipment.

To make changes based on space type or name, you'd just include logic for each zone to get the associated spaces (zone.spaces) and do your check before moving on to the equipment loop.

Here's what I've found. Rather than using ZoneHVACEquipmentList, if you call zone.equipment, you get a vector of objects of class ModelObject, which can then be 'converted' to the specific equipment object you want with something like (for a fan coil):

zones = model.getThermalZones
zones.each do |zone|
  zone_eqp = zone.equipment
  zone_eqp.each do |eqp|
    if eqp.to_ZoneHVACFourPipeFanCoil.is_initialized
      fcu = eqp.to_ZoneHVACFourPipeFanCoil.get
    end
  end
end

From there, calling fcu.coolingCoil again returns a ModelObject, which can be converted to the correct object class by again checking if the class is initialized, then using "to_[class name].get", so ccoil = coil.to_CoilCoolingWater.get. The obvious downside is you have to know what equipment types you'll have in the zones ahead of time, or include logic for all available zone equipment.

To make changes based on space type or name, you'd just include logic for each zone within zones.each do |zone| to get the associated spaces (zone.spaces) and do your check before moving on to the equipment loop.