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

OpenStudio measure .each does not work?

I am trying to put together a measure that autosizes all the VRF equipment that one can import for LG.

So far, I have the following, but it fails at the first .each it encounters. It says the method does not exist?

Does the makeChoicesArgumentOfWorkspaceObjects not generate a proper Ruby collection for .each to apply?

Also, am I on the right track to accessing the coolingCoil?

  vrfs_in = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("vrfs_in","OS_ZoneHVAC_TerminalUnit_VariableRefrigerantFlow".to_IddObjectType,model,true)

  puts vrfs_in

  puts "Indoor VRF Air Flow"
  vrfs_in.each do vrf_in
    puts vrf_in

    if not vrf_in.autosizedSupplyAirFlowRateDuringCoolingOperation()
      puts vrf_in.supplyAirFlowRateDuringCoolingOperation()
      vrf_in.autosizeSupplyAirFlowRateDuringCoolingOperation()
    else
      puts "indoor cooling air flow autosized already"
    end

    if not vrf_in.autosizedSupplyAirFlowRateDuringHeatingOperation()
      puts vrf_in.supplyAirFlowRateDuringHeatingOperation()
      vrf_in.autosizeSupplyAirFlowRateDuringHeatingOperation()
    else
      puts "indoor heating air flow autosized already"
    end
  end

  puts "Indoor VRF Cooling"
  vrfs_in.each do vrf_in
    cooling_coil = vrf_in.coolingCoil()

    if not cooling_coil.autosizedRatedTotalCoolingCapacity()
      puts cooling_coil.ratedTotalCoolingCapacity()
       cooling_coil.autosizeRatedTotalCoolingCapacity()
    else
      puts "indoor cooling capacity autosized already"
    end
    if not cooling_coil.autosizedRatedAirFlowRate()
      puts cooling_coil.ratedAirFlowRate()
      cooling_coil.autosizeRatedAirFlowRate()
    else
      puts "indoor cooling air flow autosized already"
    end
  end

OpenStudio measure .each does not work?

I am trying to put together a measure that autosizes all the VRF equipment that one can import for LG.

So far, I have the following, but it fails at the first .each it encounters. It says the method does not exist?

Does the makeChoicesArgumentOfWorkspaceObjects not generate a proper Ruby collection for .each to apply?

Also, am I on the right track to accessing the coolingCoil?

  vrfs_in = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("vrfs_in","OS_ZoneHVAC_TerminalUnit_VariableRefrigerantFlow".to_IddObjectType,model,true)

  puts vrfs_in

  puts "Indoor VRF Air Flow"
  vrfs_in.each do vrf_in
    puts vrf_in

    if not vrf_in.autosizedSupplyAirFlowRateDuringCoolingOperation()
      puts vrf_in.supplyAirFlowRateDuringCoolingOperation()
      vrf_in.autosizeSupplyAirFlowRateDuringCoolingOperation()
    else
      puts "indoor cooling air flow autosized already"
    end

    if not vrf_in.autosizedSupplyAirFlowRateDuringHeatingOperation()
      puts vrf_in.supplyAirFlowRateDuringHeatingOperation()
      vrf_in.autosizeSupplyAirFlowRateDuringHeatingOperation()
    else
      puts "indoor heating air flow autosized already"
    end
  end

  puts "Indoor VRF Cooling"
  vrfs_in.each do vrf_in
    cooling_coil = vrf_in.coolingCoil()

    if not cooling_coil.autosizedRatedTotalCoolingCapacity()
      puts cooling_coil.ratedTotalCoolingCapacity()
       cooling_coil.autosizeRatedTotalCoolingCapacity()
    else
      puts "indoor cooling capacity autosized already"
    end
    if not cooling_coil.autosizedRatedAirFlowRate()
      puts cooling_coil.ratedAirFlowRate()
      cooling_coil.autosizeRatedAirFlowRate()
    else
      puts "indoor cooling air flow autosized already"
    end
  end

OpenStudio measure .each does not work?

I am trying to put together a measure that autosizes all the VRF equipment that one can import for LG.

So far, I have the following, but it fails at the first .each it encounters. It says the method does not exist?

Does the makeChoicesArgumentOfWorkspaceObjects not generate a proper Ruby collection for .each to apply?

Also, am I on the right track to accessing the coolingCoil?

  vrfs_in = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("vrfs_in","OS_ZoneHVAC_TerminalUnit_VariableRefrigerantFlow".to_IddObjectType,model,true)

  puts vrfs_in

  puts "Indoor VRF Air Flow"
  vrfs_in.each do vrf_in
    puts vrf_in

    if not vrf_in.autosizedSupplyAirFlowRateDuringCoolingOperation()
      puts vrf_in.supplyAirFlowRateDuringCoolingOperation()
      vrf_in.autosizeSupplyAirFlowRateDuringCoolingOperation()
    else
      puts "indoor cooling air flow autosized already"
    end

    if not vrf_in.autosizedSupplyAirFlowRateDuringHeatingOperation()
      puts vrf_in.supplyAirFlowRateDuringHeatingOperation()
      vrf_in.autosizeSupplyAirFlowRateDuringHeatingOperation()
    else
      puts "indoor heating air flow autosized already"
    end
  end

  puts "Indoor VRF Cooling"
  vrfs_in.each do vrf_in
    cooling_coil = vrf_in.coolingCoil()

    if not cooling_coil.autosizedRatedTotalCoolingCapacity()
      puts cooling_coil.ratedTotalCoolingCapacity()
       cooling_coil.autosizeRatedTotalCoolingCapacity()
    else
      puts "indoor cooling capacity autosized already"
    end
    if not cooling_coil.autosizedRatedAirFlowRate()
      puts cooling_coil.ratedAirFlowRate()
      cooling_coil.autosizeRatedAirFlowRate()
    else
      puts "indoor cooling air flow autosized already"
    end
  end