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

Revision history [back]

Here's a snippet I 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

Here's a snippet I 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

Here's Here are a snippet I 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