5

Method to import DDY file

I want to change the DesignDay objects in a model through an OpenStudio measure. Changing it will allow me to change the design day in the PAT.

I found the action performed when you click the Import DDY button, it seems like there is some well-worked logic to importing it and I think that using this method would be the best approach. Is there any way in the current SDK to access it?

Luis Lara's avatar
2.1k
Luis Lara
asked 2019-10-02 10:18:58 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

2

Change Building Location measure would be a good place to start. It not only sets up EPW and ASHRAE climate zone, but imports design days. You can also directly edit existing design day objects in a model or make new design day objects from scratch instead of importing from ddy files. Here is a link to the documentation for DesignDay object.

David Goldwasser's avatar
20.4k
David Goldwasser
answered 2019-10-02 10:58:58 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
2

Here's how you would load DDY file, and try to limit yourself to the two most common design days:

  if !OpenStudio::exists(ddy_path)
     raise "Path doesn't exist: #{ddy_path}"
  end
  ddy_idf = OpenStudio::IdfFile::load(ddy_path, "EnergyPlus".to_IddFileType).get
  ddy_workspace = OpenStudio::Workspace.new(ddy_idf)
  reverse_translator = OpenStudio::EnergyPlus::ReverseTranslator.new()
  ddy_model = reverse_translator.translateWorkspace(ddy_workspace)

  # Try to limit to the two main design days
  ddy_objects = ddy_model.getDesignDays().select { |d| d.name.get.include?('.4% Condns DB') || d.name.get.include?('99.6% Condns DB') }
  # Otherwise, get all .4% and 99.6%
  if ddy_objects.size < 2
    ddy_objects = ddy_model.getDesignDays().select { |d| d.name.get.include?('.4%') || d.name.get.include?('99.6%') }
  end
  #add the objects in the ddy file to the model
  model.addObjects(ddy_objects)

This is loosely adapted from what we do in OpenStudio-resources, where we look at the workflow.osw to find the EPW name and load the matching DDY file next to it. See code here

Julien Marrec's avatar
29.7k
Julien Marrec
answered 2019-10-04 02:52:34 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments