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

How to call Fan Object from Terminal Unit Object

asked 2017-11-07 14:40:33 -0500

Luke.Y gravatar image

updated 2017-11-10 08:00:25 -0500

I'm trying to retrieve fan objects FanConstantVolume associated with terminal units AirTerminalSingleDuctParallelPIUReheat to assign fan parameters, but only want the fans associated with their respective terminal units without changing other fans within the model.

I'm able to retrieve the terminal unit objects, but don't know how to retrieve the fan specifically associated with each one. I got this far:

    model.getAirLoopHVACs.each do |air_loop|
    demand_components = air_loop.demandComponents
        demand_components.each do |demand_component|
        pfpb = demand_component.to_AirTerminalSingleDuctParallelPIUReheat
        if not pfpb.empty?
            unit = pfpb.get
            #how to retrieve terminal unit fan objects?             
        end
        end
    end

One way I can think of is to get the fan name for each terminal unit, then retrieve the fan by that name somehow. From the SDK it looks as if there's a method for this but I don't know how to apply it.

'HVACComponent openstudio::model::AirTerminalSingleDuctParallelPIUReheat::fan ( ) const'

Thanks in advance for any assistance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-11-07 15:33:54 -0500

updated 2017-11-07 15:34:49 -0500

You are almost there. If you look at the OpenStudio SDK for the AirTerminalSingleDuctParallelPIUReheatobject, there is a method to return the fan object. image description

In your case, you would just add this to your code:

model.getAirLoopHVACs.each do |air_loop|
demand_components = air_loop.demandComponents
    demand_components.each do |demand_component|
    pfpb = demand_component.to_AirTerminalSingleDuctParallelPIUReheat
        if not pfpb.empty?
            unit = pfpb.get
            fan_cv = unit.fan.to_FanConstantVolume.get
            #you could split this line to ensure that fan is a FanConstantVolume
            #then call whatever fan methods you'd like
            fan_cv.setFanEfficiency(0.6)
            fan_cv.setPressureRise(75)
        end
    end
end
edit flag offensive delete link more

Comments

Thank you @mdahlhausen. It's not always clear to me how to apply the SDK methods. This certainly helps.

Luke.Y gravatar image Luke.Y  ( 2017-11-07 16:07:40 -0500 )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: 2017-11-07 14:40:33 -0500

Seen: 76 times

Last updated: Nov 07 '17