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
I think this maybe a syntax error. Have you tried vrfs_in.each do |vrf_in| , instead of leaving it open without the | | encapsulating your vrf_in variable?
Thanks for the hint, but no, adding the || does not make a difference. It seems to me .each is a class function that ought to be available for vrfs_in but for some reason is not. The only idea I have is that vrfs_in is not a proper Ruby collection? So what would be?