Module: OpenstudioStandards::Constructions::Materials

Defined in:
lib/openstudio-standards/constructions/materials/modify.rb,
lib/openstudio-standards/constructions/materials/information.rb

Overview

The Materials module provides methods create, modify, and get information about Materials

Modify collapse

Information collapse

Class Method Details

.material_get_conductance(material, temperature: 0.0) ⇒ Double

Return the thermal conductance for an OpenStudio Material object, a parent object to all kinds of materials

Parameters:

  • material (OpenStudio::Model::Material)

    OpenStudio Material object

  • temperature (Double) (defaults to: 0.0)

    Temperature in Celsius, used for gas or gas mixture thermal conductance

Returns:

  • (Double)

    thermal conductance in W/m^2*K



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
40
# File 'lib/openstudio-standards/constructions/materials/information.rb', line 14

def self.material_get_conductance(material, temperature: 0.0)
  conductance = nil
  conductance = material.to_OpaqueMaterial.get.thermalConductance unless material.to_OpaqueMaterial.empty?

  # ShadingMaterial
  conductance = material.to_Shade.get.thermalConductance unless material.to_Shade.empty?
  conductance = material.to_Screen.get.thermalConductance unless material.to_Screen.empty?
  conductance = 9999.9 unless material.to_Blind.empty?

  # Glazing
  conductance = material.to_SimpleGlazing.get.uFactor unless material.to_SimpleGlazing.empty?
  conductance = material.to_StandardGlazing.get.thermalConductance unless material.to_StandardGlazing.empty?
  conductance = material.to_RefractionExtinctionGlazing.get.thermalConductance unless material.to_RefractionExtinctionGlazing.empty?

  # Gas
  # Convert C to K
  temperature_k = temperature + 273.0
  conductance = material.to_Gas.get.getThermalConductivity(temperature_k) unless material.to_Gas.empty?
  conductance = material.to_GasMixture.get.getThermalConductance(temperature_k) unless material.to_GasMixture.empty?

  if conductance.nil?
    OpenStudio.logFree(OpenStudio::Error, 'OpenstudioStandards::Constructions::Materials', "Unable to determinte conductance for material #{material.name}.")
    return nil
  end

  return conductance
end

.opaque_material_set_surface_properties(opaque_material, roughness: nil, thermal_absorptance: nil, solar_absorptance: nil, visible_absorptance: nil) ⇒ OpenStudio::Model::OpaqueMaterial

set material surface properties

Parameters:

  • opaque_material (OpenStudio::Model::OpaqueMaterial)

    OpenStudio OpaqueMaterial object

  • roughness (String) (defaults to: nil)

    surface roughness. Options are ‘VeryRough’, ‘Rough’, ‘MediumRough’, ‘MediumSmooth’, ‘Smooth’, and ‘VerySmooth’

  • thermal_absorptance (Double) (defaults to: nil)

    target thermal absorptance

  • solar_absorptance (Double) (defaults to: nil)

    target solar absorptance

  • visible_absorptance (Double) (defaults to: nil)

    target visible absorptance

Returns:

  • (OpenStudio::Model::OpaqueMaterial)

    OpenStudio OpaqueMaterial object



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
# File 'lib/openstudio-standards/constructions/materials/modify.rb', line 47

def self.opaque_material_set_surface_properties(opaque_material,
                                                roughness: nil,
                                                thermal_absorptance: nil,
                                                solar_absorptance: nil,
                                                visible_absorptance: nil)
  unless opaque_material.to_OpaqueMaterial.is_initialized
    OpenStudio.logFree(OpenStudio::Error, 'OpenstudioStandards::Construction::Materials', "Object #{opaque_material} cannot be cast as an OpaqueMaterial object.")
    return false
  end

  # set requested material properties
  material = opaque_material.to_OpaqueMaterial.get
  if material.to_StandardOpaqueMaterial.is_initialized
    material = material.to_StandardOpaqueMaterial.get
    material.setRoughness(roughness) unless roughness.nil?
  elsif material.to_MasslessOpaqueMaterial.is_initialized
    material = material.to_MasslessOpaqueMaterial.get
    material.setRoughness(roughness) unless roughness.nil?
  end
  material.setThermalAbsorptance(thermal_absorptance) unless thermal_absorptance.nil?
  material.setSolarAbsorptance(solar_absorptance) unless solar_absorptance.nil?
  material.setVisibleAbsorptance(visible_absorptance) unless visible_absorptance.nil?

  return material.to_OpaqueMaterial.get
end

.opaque_material_set_thermal_resistance(opaque_material, thermal_resistance) ⇒ OpenStudio::Model::OpaqueMaterial

change thermal resistance of opaque materials by increasing material thickness, or setting thermal resistance directly for massless or airgap materials.

Parameters:

  • opaque_material (OpenStudio::Model::OpaqueMaterial)

    OpenStudio OpaqueMaterial object

  • thermal_resistance (Double)

    Target thermal resistance of the material in m^2*K/W

Returns:

  • (OpenStudio::Model::OpaqueMaterial)

    OpenStudio OpaqueMaterial object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/openstudio-standards/constructions/materials/modify.rb', line 15

def self.opaque_material_set_thermal_resistance(opaque_material, thermal_resistance)
  unless opaque_material.to_OpaqueMaterial.is_initialized
    OpenStudio.logFree(OpenStudio::Error, 'OpenstudioStandards::Construction::Materials', "Object #{opaque_material} cannot be cast as an OpaqueMaterial object.")
    return false
  end

  # edit insulation material
  material = opaque_material.to_OpaqueMaterial.get
  if material.to_MasslessOpaqueMaterial.is_initialized
    material = material.to_MasslessOpaqueMaterial.get
    material.setThermalResistance(thermal_resistance)
  elsif material.to_AirGap.is_initialized
    material = material.to_AirGap.get
    material.setThermalResistance(thermal_resistance)
  else
    starting_thickness = material.thickness
    target_thickness = starting_thickness * thermal_resistance / material.thermalResistance
    material.setThickness(target_thickness)
  end

  return material.to_OpaqueMaterial.get
end