Class: BTAP::EQuest::DOEConstruction

Inherits:
DOECommand show all
Defined in:
lib/openstudio-standards/btap/equest.rb

Instance Attribute Summary

Attributes inherited from DOECommand

#building, #children, #commandName, #commandType, #comments, #exempt, #keywordPairs, #non_utype_commands, #one_line_commands, #parents, #utype, #uvalue

Instance Method Summary collapse

Methods inherited from DOECommand

#basic_output, #check_keyword?, #depth, #doe_scope, #get_children, #get_children_of_command, #get_command_from_string, #get_keyword_value, #get_name, #get_parent, #get_parents, #name, #output, #remove, #remove_keyword_pair, #set_keyword_value, #set_parent

Constructor Details

#initializeDOEConstruction

Returns a new instance of DOEConstruction.



1856
1857
1858
# File 'lib/openstudio-standards/btap/equest.rb', line 1856

def initialize
  super()
end

Instance Method Details

#get_materialsObject



1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
# File 'lib/openstudio-standards/btap/equest.rb', line 1860

def get_materials()
  bdllib = DOE2::DOEBDLlib.instance
  materials = Array.new

  case self.get_keyword_value("TYPE")
  when "LAYERS"
    # finds the command associated with the layers keyword
    layers_command = building.find_command_with_utype( self.get_keyword_value("LAYERS") )

    #if Layres command cannot be found in the inp file... find it in the bdl database.
    layers_command = bdllib.find_layer(self.get_keyword_value("LAYERS")) unless layers_command.length == 1

    # if there ends up to be more than one command with the layers keyword
    # raise an exception
    raise "Layers was defined more than once " + self.get_keyword_value("LAYERS").to_s if layers_command.length > 1

    # get all the materials, separate it by the quotation marks and push it
    # onto the materials array
    layers_command[0].get_keyword_value("MATERIAL").scan(/(\".*?\")/).each do |material|
      material_command = ""

      #Try to find material in doe model.
      material_command_array = building.find_command_with_utype(material.to_s.strip)

      # if there ends up to be more than one, raise an exception
      raise "Material was defined more than once #{material}" if material_command_array.length > 1

      # if the material cannot be found within the model, find it within the doe2 database
      material_command = bdllib.find_material(material) if material_command_array.length < 1

      #If material was found then set it.
      material_command = material_command_array[0] if material_command_array.length == 1

      materials.push(material_command)
    end
    return materials
  when "U-VALUE"
    return nil
  end
end

#get_u_valueObject

This method finds the u-value of the given construction Output => total conductivity as a float



1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
# File 'lib/openstudio-standards/btap/equest.rb', line 1903

def get_u_value()
  total_conductivity = 0.0
  case self.get_keyword_value("TYPE")
  when "LAYERS"
    self.get_materials().each do |material_command|
      case material_command.get_keyword_value("TYPE")
      when  "RESISTANCE"
        conductivity = 1 / material_command.get_keyword_value("RESISTANCE").to_f
      when "PROPERTIES"
        conductivity = material_command.get_keyword_value("CONDUCTIVITY").to_f
      else
        raise "Error in material properties"
      end
      total_conductivity = total_conductivity + conductivity
    end
    return total_conductivity
  when "U-VALUE"
    return self.get_keyword_value("U-VALUE").to_f
  end
end