Class: OpenStudio::Model::Construction

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-standards/btap/btap.model.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_and_set_insulaton_layerObject

This method will search through the layers and find the layer with the lowest conductance and set that as the insulation layer. Note: Concrete walls or slabs with no insulation layer but with a carper will see the carpet as the insulation layer.

Returns:

  • OpenStudio::Model::Material insulation_material_layer

Author:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/openstudio-standards/btap/btap.model.rb', line 11

def self.find_and_set_insulaton_layer()
    insulation_material_layer = nil
    #return if there is already a defined insulation layer.
    return self.insulation unless self.insulation.empty?
    #set minimum conductance to 100.0
    min_conductance = 100.0
    #loop through Layers
    self.layers.each do |layer|
      #try casting the layer to an OpaqueMaterial.
      material = nil
      material = layer.to_OpaqueMaterial.get unless layer.to_OpaqueMaterial.empty?
      material = layer.to_FenestrationMaterial.get unless layer.to_FenestrationMaterial.empty?
      #check if the cast was successful, then find the insulation layer.
      unless nil == material
        if BTAP::Resources::Envelope::Materials::get_conductance(material) < min_conductance
          #Keep track of the highest thermal resistance value.
          min_conductance = BTAP::Resources::Envelope::Materials::get_conductance(material)
          insulation_material_layer = material
          unless material.to_OpaqueMaterial.empty?
            self.setInsulation(material)
          end
        end
      end
    end
    if self.insulation.empty? and self.isOpaque
      raise ("construction #{self.name.get.to_s} insulation layer could not be set!. This occurs when a insulation layer is duplicated in the construction.")
    end
    return insulation_material_layer
end

Instance Method Details

#customize(model, construction, conductance, solarTransmittanceatNormalIncidence = nil, visibleTransmittance = nil) ⇒ <String]OpenStudio::Model::getConstructionByName

This method will create a new construction based on self and a new conductance value. It will check to see if a similar construction has already been created by this method if so it will return the existing construction. If you wish to keep some of the properties, enter the string “default” instead of a numerical value.

Parameters:

Returns:

  • (<String]OpenStudio::Model::getConstructionByName)

    new_construction

Author:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/openstudio-standards/btap/btap.model.rb', line 53

def customize(model,
              construction,
              conductance,
              solarTransmittanceatNormalIncidence = nil,
              visibleTransmittance = nil
              )

  if self.isOpaque

  minimum_resistance = 0
  name_prefix = "Customized opaque construction #{construction.handle()} to conductance of #{conductance}"

  #Check to see if we already made one like this.
  existing_construction = OpenStudio::Model::getConstructionByName(self.model,name_prefix)
  if not existing_construction.empty?
    # if so, return existing construction
    return existing_construction.get
  end

  #create a copy
  new_construction = self.deep_copy(self.model,construction)

  #Change Construction name in clone
  new_construction.setName( name_prefix)

  if  conductance.kind_of?(Float)
    #re-find insulation layer
    find_and_set_insulaton_layer(self.model,new_construction)

    #Determine how low the resistance can be set. Subtract existing insulation
    #Values from the total resistance to see how low we can go.
    minimum_resistance = (1 / new_construction.thermalConductance.to_f) - (1.0 / new_construction.insulation.get.thermalConductance.to_f)

    #Check if the requested resistance is smaller than the minimum
    # resistance. If so, use the minimum resistance instead.
    if minimum_resistance > ( 1 / conductance )
      #tell user why we are defaulting and set the conductance of the
      # construction.
      raise ("could not set conductance of construction #{new_construction.name.to_s} to because existing layers make this impossible. Change the construction to allow for this conductance to be set." + (conductance).to_s + "setting to closest value possible value:" + (1.0 / minimum_resistance).to_s )
      # new_construction.setConductance((1.0/minimum_resistance))
    else
      unless new_construction.setConductance(conductance)
        raise("could not set conductance of construction #{new_construction.name.to_s}")
      end
    end
  end
  return new_construction
  elsif self.isFenestration()

      #get equivilant values for tsol, tvis, and conductances.
      solarTransmittanceatNormalIncidence = self.get_tsol(model, construction) if solarTransmittanceatNormalIncidence == nil
      visibleTransmittance = self.get_tvis(model,construction) if visibleTransmittance == nil
      conductance = self.get_conductance(construction) if conductance == nil
      frontSideSolarReflectanceatNormalIncidence = 1.0 - solarTransmittanceatNormalIncidence
      backSideSolarReflectanceatNormalIncidence = 1.0 - solarTransmittanceatNormalIncidence
      frontSideVisibleReflectanceatNormalIncidence = 0.081000
      backSideVisibleReflectanceatNormalIncidence = 0.081000
      infraredTransmittanceatNormalIncidence = 0.0
      frontSideInfraredHemisphericalEmissivity = 0.84
      backSideInfraredHemisphericalEmissivity = 0.84
      #store part of fenestation in array bins.
      glazing_array = Array.new()
      shading_material_array = Array.new()
      gas_array = Array.new()
      construction.layers.each do |material|
        glazing_array << material unless material.to_Glazing.empty?
        shading_material_array << material unless material.to_ShadingMaterial.empty?
        gas_array << material unless material.to_GasLayer.empty?
      end

      #set value of fictious glazing based on the fenestrations front and back if available
      unless glazing_array.first.to_StandardGlazing.empty?
        frontSideSolarReflectanceatNormalIncidence  = glazing_array.first.to_StandardGlazing.get.frontSideSolarReflectanceatNormalIncidence
        frontSideVisibleReflectanceatNormalIncidence = glazing_array.first.to_StandardGlazing.get.frontSideVisibleReflectanceatNormalIncidence
        frontSideInfraredHemisphericalEmissivity = glazing_array.first.to_StandardGlazing.get.frontSideInfraredHemisphericalEmissivity
      end

      unless glazing_array.last.to_StandardGlazing.empty?
        backSideSolarReflectanceatNormalIncidence  = glazing_array.last.to_StandardGlazing.get.backSideSolarReflectanceatNormalIncidence
        backSideVisibleReflectanceatNormalIncidence = glazing_array.last.to_StandardGlazing.get.backSideVisibleReflectanceatNormalIncidence
        backSideInfraredHemisphericalEmissivity = glazing_array.last.to_StandardGlazing.get.backSideInfraredHemisphericalEmissivity
      end
      #create fictious glazing.
      #assume a thickness of 0.10m
      thickness = 0.10
      #calculate conductivity
      conductivity = conductance * thickness
      data_name_suffix = " cond=#{("%.3f" % conductivity).to_s} tvis=#{("%.3f" % visibleTransmittance).to_s} tsol=#{("%.3f" % solarTransmittanceatNormalIncidence).to_s}"
      cons_name = "Customized Fenestration:" + data_name_suffix
      glazing_name = "Customized Fenestration::" + data_name_suffix
      #Search to prevent the massive duplication that may ensue.
      return model.getConstructionByName(cons_name).get unless model.getConstructionByName(cons_name).empty?

      #fix for Simple glazing
      conductivity = conductance
      glazing = BTAP::Resources::Envelope::Materials::Fenestration::create_simple_glazing(
          construction.model,#model
          glazing_name,  #name
          0.60,          #SHGC
          conductivity,  #u-factor
          thickness,     #Thickness
          0.21           #vis trans
      )

      new_materials_array = Array.new()
      new_materials_array << glazing
      new_materials_array.concat(shading_material_array) unless shading_material_array.empty?
      return self.create_construction(construction.model, cons_name, new_materials_array)
  end
end