I am trying to write a measure that can read VRF indoor and outdoor unit information from a library file in .idf format and create a VRF system in my .osm model. The library section for a sample VRF indoor unit looks as follows:
ZoneHVAC:TerminalUnit:VariableRefrigerantFlow,
Daikin VRV IV FXMQ07PA(PB)VJU, !- Name
, !- Terminal Unit Availability Schedule
,
,
autosize, !- Supply Air Flow Rate During Cooling Operation {m3/s}
autosize, !- Supply Air Flow Rate When No Cooling is Needed {m3/s}
autosize, !- Supply Air Flow Rate During Heating Operation {m3/s}
autosize, !- Supply Air Flow Rate When No Heating is Needed {m3/s}
autosize, !- Outdoor Air Flow Rate During Cooling Operation {m3/s}
autosize, !- Outdoor Air Flow Rate During Heating Operation {m3/s}
autosize, !- Outdoor Air Flow Rate When No Cooling or Heating is Needed {m3/s}
, !- Supply Air Fan Operating Mode Schedule
,
Fan:OnOff,
Daikin VRV IV FXMQ07PA(PB)VJU Supply Air Fan, !- Supply Air Fan
,
,
Coil:Cooling:DX:VariableRefrigerantFlow,
Daikin VRV IV Indoor Cooling Coil, !- Cooling Coil
Coil:Heating:DX:VariableRefrigerantFlow,
Daikin VRV IV Indoor Heating Coil, !- Heating Coil
30, !- Zone Terminal Unit On Parasitic Electric Energy Use {W}
20, !- Zone Terminal Unit Off Parasitic Electric Energy Use {W}
1.0; !- Rated Total Heating Capacity Sizing Ratio {W/W}
This library file is called vrf_library.idf, and in my measure (in the "run" function, not the "arguments" function), I am reading and writing it back to the user via the following measure.rb snippet:
>>>
library = OpenStudio::Workspace::load("#{File.dirname(__FILE__)}/resources/vrf_library.idf").get
library_vrf_in_name = runner.getStringArgumentValue("library_vrfs_in", user_arguments)
library_vrf_in = library.getObjectByTypeAndName("ZoneHVAC_TerminalUnit_VariableRefrigerantFlow".to_IddObjectType,library_vrf_in_name).get
puts "Name = #{library_vrf_in.getString(0).get} \n"
puts "Terminal Unit Availability Schedule = #{library_vrf_in.getString(1).get} \n"
puts "Supply Air Flow Rate During Cooling Operation = #{library_vrf_in.getString(4).get} \n"
puts "Supply Air Flow Rate When No Cooling is Needed = #{library_vrf_in.getString(5).get} \n"
puts "Supply Air Flow Rate During Heating Operation = #{library_vrf_in.getString(6).get} \n"
puts "Supply Air Flow Rate When No Heating is Needed = #{library_vrf_in.getString(7).get} \n"
puts "Outdoor Air Flow Rate During Cooling Operation = #{library_vrf_in.getString(8).get} \n"
puts "Outdoor Air Flow Rate During Heating Operation = #{library_vrf_in.getString(9).get} \n"
puts "Outdoor Air Flow Rate When No Cooling or Heating is Needed = #{library_vrf_in.getString(10).get} \n"
puts "Supply Air Fan Operating Mode Schedule = #{library_vrf_in.getString(11).get} \n"
puts "Supply Air Fan = #{library_vrf_in.getString(14).get} \n"
puts "Cooling Coil = #{library_vrf_in.getString(18).get} \n"
puts "Heating Coil = #{library_vrf_in.getString(20).get} \n"
puts "Zone Terminal Unit On Parasitic Electric Energy Use = #{library_vrf_in.getDouble(21).get} \n"
puts "Zone Terminal Unit Off Parasitic Electric Energy Use = #{library_vrf_in.getDouble(22).get} \n"
puts "Rated Total Heating Capacity Sizing Ratio = #{library_vrf_in.getDouble(23).get} \n"
<<<
Strangely, when doing this, neither Supply Air Fan nor Cooling Coil nor Heating Coil get populated in the "puts" output, but everything else does. And when running the following snippet ...
>>>
puts library_vrf_in
<<<
... I get the following output:
ZoneHVAC:TerminalUnit:VariableRefrigerantFlow,
Daikin VRV IV FXMQ07PA(PB)VJU, !- Zone Terminal Unit Name
, !- Terminal Unit Availability Schedule
, !- Terminal Unit Air Inlet Node Name
, !- Terminal Unit Air Outlet Node Name
autosize, !- Cooling Supply Air Flow Rate {m3/s}
autosize, !- No Cooling Supply Air Flow Rate {m3/s}
autosize, !- Heating Supply Air Flow Rate {m3/s}
autosize, !- No Heating Supply Air Flow Rate {m3/s}
autosize, !- Cooling Outdoor Air Flow Rate {m3/s}
autosize, !- Heating Outdoor Air Flow Rate {m3/s}
autosize, !- No Load Outdoor Air Flow Rate {m3/s}
, !- Supply Air Fan Operating Mode Schedule Name
, !- Supply Air Fan Placement
Fan:OnOff, !- Supply Air Fan Object Type
, !- Supply Air Fan Object Name <--- THIS IS EMPTY!
, !- Outside Air Mixer Object Type
, !- Outside Air Mixer Object Name
Coil:Cooling:DX:VariableRefrigerantFlow, !- Cooling Coil Object Type
, !- Cooling Coil Object Name <--- THIS IS EMPTY!
Coil:Heating:DX:VariableRefrigerantFlow, !- Heating Coil Object Type
, !- Heating Coil Object Name <--- THIS IS EMPTY!
30, !- Zone Terminal Unit On Parasitic Electric Energy Use {W}
20, !- Zone Terminal Unit Off Parasitic Electric Energy Use {W}
1.0; !- Rated Total Heating Capacity Sizing Ratio {W/W}
So, it looks like the above "load" function or maybe the "library.getObjectByTypeAndName" function does not collect this particular information from the .idf library in the first place?
Also, if the above did populate the missing fields, I would still have to create a new terminal unit in the model and then assign information to it, for example doing the following:
>>>
vrf_in = OpenStudio::Model::ZoneHVACTerminalUnitVariableRefrigerantFlow.new(model, vrf_in_cooling_coil, vrf_in_heating_coil, vrf_in_supply_fan)
vrf_in.setZoneTerminalUnitOnParasiticElectricEnergyUse(library_vrf_in.getDouble(21).get)
<<<
However, I would prefer to use something like the following:
>>>
vrf_in.setZoneTerminalUnitOnParasiticElectricEnergyUse(library_vrf_in.zoneTerminalUnitOffParasiticElectricEnergyUse())
<<<
But I find I cannot do this to library_vrf_in. Is there a fix?
I was tring something like:
>>>
library_vrf_in = library.getObjectByTypeAndName(OpenStudio::Model::ZoneHVACTerminalUnitVariableRefrigerantFlow::iddObjectType,library_vrf_in_name).get.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get
<<<
or:
>>>
library_vrf_in = library.getObjectByTypeAndName("ZoneHVAC_TerminalUnit_VariableRefrigerantFlow".to_IddObjectType,library_vrf_in_name).get.to_ZoneHVACTerminalUnitVariableRefrigerantFlow.get
<<<
... but neither lead to success in creating something that I could apply ".zoneTerminalUnitOffParasiticElectricEnergyUse()" to.