Class: OpenStudio::Model::Construction
- Inherits:
-
Object
- Object
- OpenStudio::Model::Construction
- Defined in:
- lib/openstudio-standards/standards/Standards.Construction.rb
Overview
Reopen the OpenStudio class to add methods to apply standards to this object
Instance Method Summary collapse
- #calculated_solar_heat_gain_coefficient ⇒ Object
-
#calculated_u_factor ⇒ Object
Get the U-Factor as calculated by EnergyPlus in W/m^2*K.
-
#calculated_visible_transmittance ⇒ Object
Get the VT as calculated by EnergyPlus.
-
#film_coefficients_r_value(intended_surface_type) ⇒ Object
U value [double].
-
#set_slab_f_factor(target_f_factor_ip, insulation_layer_name = nil) ⇒ Bool
Set the F-Factor of a slab to a specified value.
-
#set_u_value(target_u_value_ip, insulation_layer_name = nil, intended_surface_type = 'ExteriorWall', target_includes_film_coefficients = true) ⇒ Bool
Sets the U-value of a construction to a specified value by modifying the thickness of the insulation layer.
-
#set_underground_wall_c_factor(target_c_factor_ip, insulation_layer_name = nil) ⇒ Bool
Set the C-Factor of an underground wall to a specified value.
Instance Method Details
#calculated_solar_heat_gain_coefficient ⇒ Object
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/openstudio-standards/standards/Standards.Construction.rb', line 209 def calculated_solar_heat_gain_coefficient construction_name = self.name.get.to_s shgc = nil sql = self.model.sqlFile if sql.is_initialized sql = sql.get row_query = "SELECT RowName FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND Value='#{construction_name.upcase}'" row_id = sql.execAndReturnFirstString(row_query) if row_id.is_initialized row_id = row_id.get else OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "SHGC row ID not found for construction: #{construction_name}.") row_id = 9999 end shgc_query = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND ColumnName='Glass SHGC' AND RowName='#{row_id}'" shgc = sql.execAndReturnFirstDouble(shgc_query) if shgc.is_initialized shgc = shgc.get else shgc = nil end else OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.Construction', 'Model has no sql file containing results, cannot lookup data.') end return shgc end |
#calculated_u_factor ⇒ Object
Get the U-Factor as calculated by EnergyPlus in W/m^2*K
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/openstudio-standards/standards/Standards.Construction.rb', line 317 def calculated_u_factor construction_name = self.name.get.to_s u_factor_w_per_m2_k = nil sql = self.model.sqlFile if sql.is_initialized sql = sql.get row_query = "SELECT RowName FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND Value='#{construction_name.upcase}'" row_id = sql.execAndReturnFirstString(row_query) if row_id.is_initialized row_id = row_id.get else OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "U-Factor row ID not found for construction: #{construction_name}.") row_id = 9999 end u_factor_query = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND ColumnName='Glass U-Factor' AND RowName='#{row_id}'" u_factor_w_per_m2_k = sql.execAndReturnFirstDouble(u_factor_query) if u_factor_w_per_m2_k.is_initialized u_factor_w_per_m2_k = u_factor_w_per_m2_k.get else u_factor_w_per_m2_k = nil end else OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.Space', 'Model has no sql file containing results, cannot lookup data.') end return u_factor_w_per_m2_k end |
#calculated_visible_transmittance ⇒ Object
Get the VT as calculated by EnergyPlus
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/openstudio-standards/standards/Standards.Construction.rb', line 263 def calculated_visible_transmittance construction_name = self.name.get.to_s vt = nil sql = self.model.sqlFile if sql.is_initialized sql = sql.get row_query = "SELECT RowName FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND Value='#{construction_name.upcase}'" row_id = sql.execAndReturnFirstString(row_query) if row_id.is_initialized row_id = row_id.get else OpenStudio::logFree(OpenStudio::Warn, "openstudio.model.Model", "VT row ID not found for construction: #{construction_name}.") row_id = 9999 end vt_query = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='EnvelopeSummary' AND ReportForString='Entire Facility' AND TableName='Exterior Fenestration' AND ColumnName='Glass Visible Transmittance' AND RowName='#{row_id}'" vt = sql.execAndReturnFirstDouble(vt_query) if vt.is_initialized vt = vt.get else vt = nil end else OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.Space', 'Model has no sql file containing results, cannot lookup data.') end return vt end |
#film_coefficients_r_value(intended_surface_type) ⇒ Object
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/openstudio-standards/standards/Standards.Construction.rb', line 371 def film_coefficients_r_value(intended_surface_type) other_layer_r_value_si = 0.0 # Determine the R-value of the air films, if requested # Film values from 90.1-2010 A9.4.1 Air Films film_ext_surf_r_ip = 0.17 film_semi_ext_surf_r_ip = 0.46 film_int_surf_ht_flow_up_r_ip = 0.61 film_int_surf_ht_flow_dwn_r_ip = 0.92 fil_int_surf_vertical_r_ip = 0.68 film_ext_surf_r_si = OpenStudio.convert(film_ext_surf_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get film_semi_ext_surf_r_si = OpenStudio.convert(film_semi_ext_surf_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get film_int_surf_ht_flow_up_r_si = OpenStudio.convert(film_int_surf_ht_flow_up_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get film_int_surf_ht_flow_dwn_r_si = OpenStudio.convert(film_int_surf_ht_flow_dwn_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get fil_int_surf_vertical_r_si = OpenStudio.convert(fil_int_surf_vertical_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get case intended_surface_type when 'AtticFloor' other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside other_layer_r_value_si += film_semi_ext_surf_r_si # Inside when 'AtticWall', 'AtticRoof' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += film_semi_ext_surf_r_si # Inside when 'DemisingFloor', 'InteriorFloor' other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside when 'InteriorCeiling' other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside when 'DemisingWall', 'InteriorWall', 'InteriorPartition', 'InteriorWindow', 'InteriorDoor' other_layer_r_value_si += fil_int_surf_vertical_r_si # Outside other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside when 'DemisingRoof', 'ExteriorRoof', 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside when 'ExteriorFloor' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside when 'ExteriorWall', 'ExteriorWindow', 'ExteriorDoor', 'GlassDoor', 'OverheadDoor' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside when 'GroundContactFloor' other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside when 'GroundContactWall' other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside when 'GroundContactRoof' other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside end return other_layer_r_value_si end |
#set_slab_f_factor(target_f_factor_ip, insulation_layer_name = nil) ⇒ Bool
Set the F-Factor of a slab to a specified value. Assumes an unheated, fully insulated slab, and modifies the insulation layer according to the values from 90.1-2004 Table A6.3 Assembly F-Factors for Slab-on-Grade Floors.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/openstudio-standards/standards/Standards.Construction.rb', line 169 def set_slab_f_factor(target_f_factor_ip, insulation_layer_name = nil) # Regression from table A6.3 unheated, fully insulated slab r_value_ip = 1.0248 * target_f_factor_ip**-2.186 u_value_ip = 1.0/r_value_ip # Set the insulation U-value set_u_value(u_value_ip, insulation_layer_name, 'GroundContactFloor', true) # Modify the construction name self.setName("#{self.name} F-#{target_f_factor_ip.round(3)}") return true end |
#set_u_value(target_u_value_ip, insulation_layer_name = nil, intended_surface_type = 'ExteriorWall', target_includes_film_coefficients = true) ⇒ Bool
Put in Phlyroy’s logic for inferring the insulation layer of a construction
Sets the U-value of a construction to a specified value by modifying the thickness of the insulation layer.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 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 |
# File 'lib/openstudio-standards/standards/Standards.Construction.rb', line 20 def set_u_value(target_u_value_ip, insulation_layer_name = nil, intended_surface_type = 'ExteriorWall', target_includes_film_coefficients = true) OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "Setting U-Value for #{self.name}.") # Skip fenestration constructions if self.isFenestration OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.ConstructionBase', "Can only set the u-value of opaque constructions. #{self.name} is not opaque.") return false end # Make sure an insulation layer was specified if insulation_layer_name.nil? && target_u_value_ip == 0.0 # Do nothing if the construction already doesn't have an insulation layer elsif insulation_layer_name.nil? OpenStudio::logFree(OpenStudio::Error, 'openstudio.standards.ConstructionBase', "Requested U-value of #{target_u_value_ip} for #{self.name}, but this construction has no insulation layer specified. Requested U-value will not be set.") return false else # TODO put in Phlyroy's logic for inferring the insulation layer of a construction end # Remove the insulation layer if the specified U-value is zero. if target_u_value_ip == 0.0 layer_index = 0 self.layers.each do |layer| break if layer.name.get == insulation_layer_name layer_index += 1 end self.eraseLayer(layer_index) return true end # Convert the target U-value to SI target_u_value_ip = target_u_value_ip.to_f target_r_value_ip = 1.0/target_u_value_ip target_u_value_si = OpenStudio.convert(target_u_value_ip, 'Btu/ft^2*hr*R', 'W/m^2*K').get target_r_value_si = 1.0/target_u_value_si OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "#{self.name}.") OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_u_value_ip = #{target_u_value_ip.round(3)} for #{self.name}.") OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_r_value_ip = #{target_r_value_ip.round(2)} for #{self.name}.") OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_u_value_si = #{target_u_value_si.round(3)} for #{self.name}.") OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.ConstructionBase', "---target_r_value_si = #{target_r_value_si.round(2)} for #{self.name}.") # Determine the R-value of the non-insulation layers other_layer_r_value_si = 0.0 self.layers.each do |layer| next if layer.to_OpaqueMaterial.empty? next if layer.name.get == insulation_layer_name other_layer_r_value_si += layer.to_OpaqueMaterial.get.thermalResistance end # todo - remove code below and use film_coefficients_u_value method instead # Determine the R-value of the air films, if requested # Film values from 90.1-2010 A9.4.1 Air Films if target_includes_film_coefficients film_ext_surf_r_ip = 0.17 film_semi_ext_surf_r_ip = 0.46 film_int_surf_ht_flow_up_r_ip = 0.61 film_int_surf_ht_flow_dwn_r_ip = 0.92 fil_int_surf_vertical_r_ip = 0.68 film_ext_surf_r_si = OpenStudio.convert(film_ext_surf_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get film_semi_ext_surf_r_si = OpenStudio.convert(film_semi_ext_surf_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get film_int_surf_ht_flow_up_r_si = OpenStudio.convert(film_int_surf_ht_flow_up_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get film_int_surf_ht_flow_dwn_r_si = OpenStudio.convert(film_int_surf_ht_flow_dwn_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get fil_int_surf_vertical_r_si = OpenStudio.convert(fil_int_surf_vertical_r_ip, 'ft^2*hr*R/Btu', 'm^2*K/W').get case intended_surface_type when 'AtticFloor' other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside other_layer_r_value_si += film_semi_ext_surf_r_si # Inside when 'AtticWall', 'AtticRoof' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += film_semi_ext_surf_r_si # Inside when 'DemisingFloor', 'InteriorFloor' other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside when 'InteriorCeiling' other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside when 'DemisingWall', 'InteriorWall', 'InteriorPartition', 'InteriorWindow', 'InteriorDoor' other_layer_r_value_si += fil_int_surf_vertical_r_si # Outside other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside when 'DemisingRoof', 'ExteriorRoof', 'Skylight', 'TubularDaylightDome', 'TubularDaylightDiffuser' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside when 'ExteriorFloor' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside when 'ExteriorWall', 'ExteriorWindow', 'ExteriorDoor', 'GlassDoor', 'OverheadDoor' other_layer_r_value_si += film_ext_surf_r_si # Outside other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside when 'GroundContactFloor' other_layer_r_value_si += film_int_surf_ht_flow_dwn_r_si # Inside when 'GroundContactWall' other_layer_r_value_si += fil_int_surf_vertical_r_si # Inside when 'GroundContactRoof' other_layer_r_value_si += film_int_surf_ht_flow_up_r_si # Inside end end # Determine the difference between the desired R-value # and the R-value of the non-insulation layers and air films. # This is the desired R-value of the insulation. ins_r_value_si = target_r_value_si - other_layer_r_value_si if ins_r_value_si <= 0.0 OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.ConstructionBase', "Requested U-value of #{target_u_value_ip} for #{self.name} is too low given the other materials in the construction; insulation layer will not be modified.") return false end ins_r_value_ip = OpenStudio.convert(ins_r_value_si, 'm^2*K/W', 'ft^2*h*R/Btu').get # Set the R-value of the insulation layer self.layers.each do |layer| next unless layer.name.get == insulation_layer_name if layer.to_StandardOpaqueMaterial.is_initialized layer = layer.to_StandardOpaqueMaterial.get layer.setThickness(ins_r_value_si * layer.getConductivity) layer.setName("#{layer.name} R-#{ins_r_value_ip.round(2)}") break # Stop looking for the insulation layer once found elsif layer.to_MasslessOpaqueMaterial.is_initialized layer = layer.to_MasslessOpaqueMaterial.get layer.setThermalResistance(ins_r_value_si) layer.setName("#{layer.name} R-#{ins_r_value_ip.round(2)}") break # Stop looking for the insulation layer once found elsif layer.to_AirGap.is_initialized layer = layer.to_AirGap.get target_thickness = ins_r_value_si * layer.thermalConductivity layer.setThickness(target_thickness) layer.setName("#{layer.name} R-#{ins_r_value_ip.round(2)}") break # Stop looking for the insulation layer once found end end # Modify the construction name self.setName("#{self.name} R-#{target_r_value_ip.round(2)}") return true end |
#set_underground_wall_c_factor(target_c_factor_ip, insulation_layer_name = nil) ⇒ Bool
Set the C-Factor of an underground wall to a specified value. Assumes continuous exterior insulation and modifies the insulation layer according to the values from 90.1-2004 Table A4.2 Assembly C-Factors for Below-Grade walls.
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/openstudio-standards/standards/Standards.Construction.rb', line 193 def set_underground_wall_c_factor(target_c_factor_ip, insulation_layer_name = nil) # Regression from table A4.2 continuous exterior insulation r_value_ip = 0.775 * target_c_factor_ip**-1.067 u_value_ip = 1.0/r_value_ip # Set the insulation U-value set_u_value(u_value_ip, insulation_layer_name, 'GroundContactWall', true) # Modify the construction name self.setName("#{self.name} C-#{target_c_factor_ip.round(3)}") return true end |