I have the following to remove all PIU reheat boxes and replace them with VAV reheat boxes. The variable airLoop
is defined from do loop with mode.getAirLoopHVACs.each
.
thermalZones = airLoop.thermalZones
thermalZones.each do |thermalZone|
originalTerminal = thermalZone.airLoopHVACTerminal.get.to_AirTerminalSingleDuctParallelPIUReheat
if not originalTerminal.empty?
originalTerminal = originalTerminal.get
reheatLoop = originalTerminal.reheatCoil.plantLoop.get
originalTerminal.remove
reheatCoil = OpenStudio::Model::CoilHeatingWater.new(model, model.alwaysOnDiscreteSchedule)
reheatLoop.addDemandBranchForComponent(reheatCoil)
newTerminal = OpenStudio::Model::AirTerminalSingleDuctVAVReheat.new(model,model.alwaysOnDiscreteSchedule(), reheatCoil)
runner.registerInfo("The new terminal created is called '#{newTerminal.name}'.")
thermalZone.addEquipment(newTerminal)
end #end if not originalTerminal.empty?
end #thermalZones.each do |thermalZone|
It performs the desired task, but the OS:Connection
objects aren't created and the terminal units don't appear in the loop graphics in the HVAC tab. I don't think addEquipment
is the correct method to use but I'm not to grab the correct thermal zone inlet node in order to use the addToNode
method. Anyone see what I'm missing here? Additionally, if there is something non-nonsensical or extraneous that I'm doing, please don't hesitate to let me know.