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

import ZoneHVACTerminalUnitVariableRefrigerantFlow from IDF file

asked 2019-07-14 15:07:57 -0500

Matt Koch's avatar

updated 2019-07-15 09:53:30 -0500

I have a question specific to OpenStudio::Model::ZoneHVACTerminalUnitVariableRefrigerantFlow in OpenStudio 2.8.0.

Let's say I have an .IDF file that is organized as a library for ZoneHVACTerminalUnitVariableRefrigerantFlow units. That is to say, it has all the parameters for various ZoneHVACTerminalUnitVariableRefrigerantFlow, as well as for their respective supply fans, cooling coils and heating coils in a single file in IDF format.

I can get such a file pulled into an OpenStudio measure as follows:

library_file = OpenStudio::Workspace::load("#{File.dirname(__FILE__)}/resources/vrf_indoor_units_library.idf").get

Then I can do the following, provided I know the name library_vrf_indoor_unit_name for one of the library entries:

if not library_vrf_indoor_unit_name.empty?
  library_object = "ZoneHVAC_TerminalUnit_VariableRefrigerantFlow"
  library_check = library_file.getObjectByTypeAndName(library_object.to_IddObjectType, library_vrf_indoor_unit_name)
end

To get to the individual elements, I could then, for example, do the following:

if library_check.is_initialized then
  library_strings = library_check.get


  if not library_strings.getString(6).get.empty? then
    if library_strings.getString(6).get == "autosize" then
      model_vrf_indoor_unit.autosizeSupplyAirFlowRateDuringHeatingOperation()
    else
      model_vrf_indoor_unit.setSupplyAirFlowRateDuringHeatingOperation(library_strings.getDouble(6).get)
    end
  end


  if not library_strings.getString(11).get.empty? then
    model_schedule = availabilityschedule(runner, model, library_strings.getString(11).get)
    model_vrf_indoor_unit.setSupplyAirFanOperatingModeSchedule(model_schedule)
  end


  if not library_strings.getString(18).get.empty? then
    model_cooling_coil = modelcoolingcoil(runner, model, library_file, library_strings.getString(18).get)
    model_vrf_indoor_unit.setCoolingCoil(model_cooling_coil)
  end
end

It turns out that library_strings.getString(6).get (and others not show above) is indeed recognized and read properly. However, neither library_strings.getString(11).get nor library_strings.getString(18).get are recognized and read. The same is true, for example, for library_strings.getString(14).get (supply fan) and library_strings.getString(20).get (heating coil).

I just want to make sure I am doing this right and have justification to develop a workaround, and that I am not misinterpreting this, so that there may be another way to actually capture library_strings.getString(11,14,18,20).get without the need for a workaround.

Thank you.

edit retag flag offensive close merge delete

Comments

1

I find working with workspace objects (EnergyPlus measures) more difficult than OpenStudio measures. Could you convert the library to JSON (or epJSON) so that it could be used in an OS measure?

MatthewSteen's avatar MatthewSteen  ( 2019-07-15 09:52:28 -0500 )edit
1

I would take your IDF library, create a script to import the IDF into OS and manipulate them inside OpenStudio. That way you will have access to all the nice methods for the ZoneHVACTerminalUnitVariableRefrigerantFlow object. Currently, I do the same to manipulate a catalog of manufacturer indoor units inside OpenStudio.

Luis Lara's avatar Luis Lara  ( 2019-07-15 11:34:32 -0500 )edit
2

@Luis Lara does importing ZoneHVACTerminalUnitVariableRefrigerantFlowobjects from an IDF work? It doesn't look like they're reverse translated... https://github.com/NREL/OpenStudio/tr...

MatthewSteen's avatar MatthewSteen  ( 2019-07-15 11:54:12 -0500 )edit
2

I tried importing this IDF example file (https://github.com/NREL/EnergyPlus/bl...) with OS 2.8.0 but it returned a message saying that it was not imported:

AirConditioner:VariableRefrigerantFlow named VRF Heat Pump

ZoneTerminalUnitList named VRF Heat Pump TU List

ZoneHVAC:TerminalUnit:VariableRefrigerantFlow named TU1

ZoneHVAC:TerminalUnit:VariableRefrigerantFlow named TU2

ZoneHVAC:TerminalUnit:VariableRefrigerantFlow named TU4

So it looks like it is not possible to import them automatically.

Luis Lara's avatar Luis Lara  ( 2019-07-15 12:08:56 -0500 )edit
1

So, I know that the reverse translator cannot do much more than a few curves. That is why I am going to getString, getDouble, getInt straight from the IDF file. The whole approach has worked fine for me on may occasions. The issue is that the

OpenStudio::Workspace::load("#{File.dirname(__FILE__)}/resources/vrf_indoor_units_library.idf").get

line is very selective in what it loads. It catches most getDouble and getInt items just fine, and many getString items as well. However, in this instance, it specifically does not catch the cooling coil, heating coil or supply fan names.

Matt Koch's avatar Matt Koch  ( 2019-07-21 17:24:03 -0500 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2020-09-12 20:42:25 -0500

mattkoch's avatar

Wow, over a year since Matthew Steen's suggestion! But I kept at it and can now confirm that converting to epJSON and using require 'json' is by far the better way compared to reverse-translating IDF. I have a complete tool chain now for Daikin units, using Python scripts to read in CSV performance data and generate epJSON from them - both indoor and outdoor - and then using OpenStudio measures to pull in units from epJSON and assign indoor units to outdoor units. Thanks again, Matthew Steen, for the epJSON advice!

edit flag offensive delete link more

Comments

@mattkoch glad it worked! Consider marking my answer correct.

MatthewSteen's avatar MatthewSteen  ( 2020-09-14 12:51:22 -0500 )edit

Wish I could, but it does not allow me to. Must have gotten one of my multiple logins confused or something. Suggest moderator marks it as “two thumbs way up”?

mattkoch's avatar mattkoch  ( 2020-09-14 16:45:53 -0500 )edit

@mattkoch Do you think that you would be able to share your tools? I am working on developing the exact same thing so it would be great if you could and share it :)

Luis Lara's avatar Luis Lara  ( 2020-09-16 09:30:22 -0500 )edit

Luis, I’ll try to put together a more user friendly compilation this weekend and make it available for download on my website. Don’t know how far I will get, though.

mattkoch's avatar mattkoch  ( 2020-09-17 08:28:01 -0500 )edit

Luis, I am too rusty on all that website stuff. It has been over ten years since I last touched it and when I just opened it for the first time since then, I realized it would take me a while to get up to speed again. Instead, why don't contact me at mattkoch@scitex.us and I will e-mail you what I have as a ZIP file.

mattkoch's avatar mattkoch  ( 2020-09-21 20:21:08 -0500 )edit
3

answered 2019-07-15 15:41:30 -0500

updated 2019-07-27 14:50:47 -0500

I suggest converting your IDF library to epJSON format to allow it to be used from an OpenStudio measure.

  1. On a windows machine, first add the path to your energyplus.exe file to your system path (e.g. C:\EnergyPlusV9-1-0).
  2. Open a terminal from the directory where the IDF library is.
  3. energyplus -c my_awesome_idf_library.idf

Then, you'll be able to load the epJSON file in an OpenStudio measure and retrieve the data from it using standard associative array (Ruby Hash) syntax.

edit flag offensive delete link more

Comments

1

Thank you kindly for your reply, Matthew. Unfortunately, I would start from scratch with JSON, while I have gone a bit of the way with IDF already. Is there a quick start for JSON that I might use as a guide?

Matt Koch's avatar Matt Koch  ( 2019-07-21 17:16:26 -0500 )edit
1

JSON is part of the Ruby's standard library, so just require 'json'in your measure, parse it in to a hash, and retrieve data using hash syntax. https://ruby-doc.org/stdlib-2.2.4/lib...

MatthewSteen's avatar MatthewSteen  ( 2019-07-27 14:48:03 -0500 )edit
1

GitHub is a good reference for examples... https://github.com/NREL/openstudio-st...

MatthewSteen's avatar MatthewSteen  ( 2019-07-27 14:49:11 -0500 )edit
1

Thanks Matthew! I have been away from OS/EP for a while. I just saw that EP is moving from IDF to epJSON altogether in the near future. This makes your suggested approach very attractive. My main intent was to stay with something that is standard with EP - that was IDF, but it looks like it will be epJSON.

Matt Koch's avatar Matt Koch  ( 2019-07-27 17:20:30 -0500 )edit
0

answered 2019-07-15 12:03:20 -0500

updated 2019-07-15 12:03:44 -0500

It seems like you are trying to create ModelObjects using your IDF file values. You are not using the correct constructors to create ModelObjects for the schedule, or the cooling coil. Most likely the same is happening for the supply fan and your heating coil.

As an example, for your cooling coil you would need to do:

  unless library_strings.getString(18).get.empty? then
    model_cooling_coil = OpenStudio::Model::CoilCoolingDXVariableRefrigerantFlow.new(model)
    model_cooling_coil.setName(library_strings.getString(11).get)
    # Most likely you would want to add more coil properties here
    model_vrf_indoor_unit.setCoolingCoil(model_cooling_coil)
  end
edit flag offensive delete link more

Comments

Thank you kindly for your reply, Luis. You are correct, my makecoolingcoil function does not look like it would create a model object. However, inside that function, it does precisely what you suggest in your answer.

Matt Koch's avatar Matt Koch  ( 2019-07-21 17:19:54 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

2 followers

Stats

Asked: 2019-07-14 15:07:57 -0500

Seen: 756 times

Last updated: Sep 12 '20