read VRF indoor unit from .idf file and use in .osm file
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 ...
I suggest sharing your idf library file. This is a very lengthy question (=doesn't really make you try hard...), and dependent on what the file does hold, so being able to try it out seems like a requirement.
Thanks Julien. How do I share the library file? (I may not have tried smart, but I tried very hard, to the tune of several hours).
Host it wherever, and include the link in your original question (wherever = gist/dropbox/google drive for eg)