I want to loop on all my plant loops, and if the plant loop meets a certain criteria, I want to add it to an array-like object.
Later, I want to be able to create another loop to retrieve each plant loop objects.
I've tried the following:
plant_loops = model.getPlantLoops
plant_handles = OpenStudio::StringVector.new
#Initial loop to store air loops
plant_loops.each do |plant_loop|
#Criteria...
if ....
plant_handles << plant_loop.handle.to_s
end #end if
end #end do
# Loop to retrieve air loop objects
plant_handles do |plant_handle|
#Following line is where it throws an error
if not plant_handle.get.to_PlantLoop.empty?
plant_loop = plant_handle.get.to_PlantLoop.get
end #end if
end #end do
I'm getting an error for plant_handle.get
. If I do plant_handle.to_PlantLoop
directly I'll get the same error anyways.
undefined method 'get' for "{979a795...95f}":String (NoMethodError).
I completely understand that a string doesn't have a 'get' method, but I don't know how to return an object from its handle.
So, how can I store plant loop objects during a loop in order to reuse them in another loop?