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

Revision history [back]

click to hide/show revision 1
initial version

You can follow what I did in the E+ measure to add Storage tank for Rainwater collection. In order to grab a list of the CoolingTower:VariableSpeed in your model try something like that:

# argument for CoolingTower:VariableSpeed selection
    coolTowList = OpenStudio::StringVector.new
    coolTowers = workspace.getObjectsByType("CoolingTower:VariableSpeed".to_IddObjectType)
    coolTowers.each do |coolTower|
        coolTowList << coolTower.getString(0).to_s
    end

    coolTowsSel = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('coolTowsSel', coolTowList, false)
    coolTowsSel.setDisplayName("Plant Loop To add Availability Managers to?")       
    args << coolTowsSel

Then you will need to find the selected object in the run method:

# assign the user inputs to variables
    coolTowsSel = runner.getStringArgumentValue("coolTowsSel", user_arguments)

# find the selected Cooling Tower
    coolTowList = workspace.getObjectsByType("CoolingTower:VariableSpeed".to_IddObjectType)
    selCoolTower = coolTowList[0]
    coolTowList.each do |coolTow|
        if coolTow.getString(0).to_s == coolTowsSel.to_s
            selCoolTower = coolTow
            break
        end
    end

For sure that can be written more elegantly, but that should work.