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

Revision history [back]

There are a few ways to do this:

ModelObjects = model.getHVACComponents

waterHeaters = []
ModelObjects.each do |obj|
  if obj.to_WaterHeaterMixed.is_initialized
    obj = obj.to_WaterHeaterMixed.get
    waterHeaters << obj
  end
end

waterHeaters.each do |obj|
  puts "#{obj.name}"
  puts "#{obj.class}"
end

#Alternatively 
waterHeaters = model.getWaterHeaterMixeds

There are a few ways to do this:

ModelObjects modelObjects = model.getHVACComponents

waterHeaters = []
ModelObjects.each modelObjects.each do |obj|
  if obj.to_WaterHeaterMixed.is_initialized
    obj = obj.to_WaterHeaterMixed.get
    waterHeaters << obj
  end
end

waterHeaters.each do |obj|
  puts "#{obj.name}"
  puts "#{obj.class}"
end

#Alternatively 
waterHeaters = model.getWaterHeaterMixeds

There are a few ways to do this:

modelObjects = model.getHVACComponents

waterHeaters = []
modelObjects.each do |obj|
  if obj.to_WaterHeaterMixed.is_initialized
    obj = obj.to_WaterHeaterMixed.get
obj.to_WaterHeaterMixed.get #this line converts the object to a waterHeaterMixed object
    waterHeaters << obj
  end
end

waterHeaters.each do |obj|
  puts "#{obj.name}"
  puts "#{obj.class}"
end

#Alternatively 
waterHeaters = model.getWaterHeaterMixeds

There are a few ways to do this:

modelObjects = model.getHVACComponents

waterHeaters = []
modelObjects.each do |obj|
  if obj.to_WaterHeaterMixed.is_initialized
    obj = obj.to_WaterHeaterMixed.get #this line converts #converts the object to a waterHeaterMixed object
    waterHeaters << obj
  end
end

waterHeaters.each do |obj|
  puts "#{obj.name}"
  puts "#{obj.class}"
end

#Alternatively 
waterHeaters = model.getWaterHeaterMixeds