First time here? Check our help page!
2

How to call Fan Object from Terminal Unit Object

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.

Luke.Y's avatar
89
Luke.Y
asked 2017-11-07 14:40:33 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-11-10 08:00:25 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

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
mdahlhausen's avatar
9.5k
mdahlhausen
answered 2017-11-07 15:33:54 -0500, updated 2017-11-07 15:34:49 -0500
edit flag offensive 0 remove flag delete link

Comments

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

Luke.Y's avatar Luke.Y (2017-11-07 16:07:40 -0500) edit
add a comment see more comments