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

Replace Terminal Unit Meausure

asked 2016-06-20 10:39:21 -0600

Adam Hilton gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-06-20 12:19:00 -0600

updated 2016-06-20 13:05:12 -0600

Here are a couple snippets I've used to do something similar:

# get model and model objects
model = OpenStudio::Model::Model.load(osm_path).get
objs = model.getAirTerminalSingleDuctVAVNoReheats
air_loops = model.getAirLoopHVACs

# do stuff
air_loops.each do |al|

    zones = al.thermalZones

    zones.each do |z|

        al.removeBranchForZone(z)
        atu_new = OpenStudio::Model::AirTerminalSingleDuctUncontrolled.new(model, model.alwaysOnDiscreteSchedule)
        al.addBranchForZone(z, atu_new.to_StraightComponent)

    end

end

model.getThermalZones.each do |z|

    zone_eqpt = z.equipment #vector

    zone_eqpt.each do |eqpt|

        if eqpt.to_AirTerminalSingleDuctUncontrolled.is_initialized
            atu_old = eqpt.to_AirTerminalSingleDuctUncontrolled.get
            atu_old.remove
            atu_new = OpenStudio::Model::AirTerminalSingleDuctVAVNoReheat.new(model)

        end

    end

end
edit flag offensive delete link more

Comments

Thanks Matt. I was trying to use the air loop addBranchForZone method but it doesn't appear to work with return plenums. I was thinking maybe I have to call it through the return plenum object (the addBranchForZone is listed under that object as well), but the thermal zone object doesn't seem to have a method that returns the AirLoopHVACReturnPlenum object.

Adam Hilton gravatar image Adam Hilton  ( 2016-06-20 12:29:40 -0600 )edit

@adhilton are you trying to get the new zone branch to connect to the return plenum? I think you'll have to use the zone methodsetReturnPlenum after adding the new branch.

Eric Ringold gravatar image Eric Ringold  ( 2016-06-20 12:41:39 -0600 )edit

The old ones also connect to a return plenum and that seems to be the problem. When I call airLoop.addBranchForZone nothing happens. If I call airLoop.removeBranchForZone first and then use addBranch it works fine and then I can manually add the return plenum back, but that doesn't seem like a very efficienct method.

Adam Hilton gravatar image Adam Hilton  ( 2016-06-20 12:45:47 -0600 )edit

Oh, yeah if the zone is already on a loop, addBranchForZone will return false.

Eric Ringold gravatar image Eric Ringold  ( 2016-06-20 12:49:53 -0600 )edit

Hmm, okay, thanks. Do you know how I can return the return plenum thermal zone using the thermal zone before I remove its' branch?

Adam Hilton gravatar image Adam Hilton  ( 2016-06-20 12:53:38 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

 

Question Tools

1 follower

Stats

Asked: 2016-06-20 10:39:21 -0600

Seen: 157 times

Last updated: Jun 20 '16