class BTAP::Resources::Envelope::Constructions::ConstructionsTests

Public Instance Methods

setup() click to toggle source

This method sets up the model. @author Phylroy A. Lopez <plopez@nrcan.gc.ca>

# File lib/openstudio-standards/btap/envelope.rb, line 74
def setup
  @model = OpenStudio::Model::Model.new()
  #Create opaque layers from defaults
  @insulation = OpenStudio::Model::StandardOpaqueMaterial.new(@model, 'Smooth', 0.1, 0.001, 0.1, 0.1)
  @opaque = OpenStudio::Model::StandardOpaqueMaterial.new(@model, 'Smooth', 0.1, 0.1, 0.1, 100)
  @massless = OpenStudio::Model::MasslessOpaqueMaterial.new(@model, 'Smooth', 0.1)
  #Create fenestration layer from defaults.
  @simple = OpenStudio::Model::SimpleGlazing.new(@model, 0.1, 0.1)
  @simple.setThickness(0.005)
  @simple.setVisibleTransmittance(0.8)
  @standard = OpenStudio::Model::StandardGlazing.new(@model, 'SpectralAverage', 0.003)
  @opaque_construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@opaque, @insulation, @massless, @opaque], @insulation)
  @fenestration_construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@simple, @standard])

  array = [@opaque, "insulation"]
  BTAP::Common::validate_array(@model, array, "Material")
end
test_create_fenestration_construction() click to toggle source

This method will test creation of fenestration construction. @author Phylroy A. Lopez <plopez@nrcan.gc.ca>

# File lib/openstudio-standards/btap/envelope.rb, line 106
def test_create_fenestration_construction()
  construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@simple, @standard])
  assert_equal(6, construction.layers.size)
  assert(!(construction.to_Construction.empty?))
end
test_create_new_construction_based_on_exisiting() click to toggle source

This method will create new construction based on exisiting. @author Phylroy A. Lopez <plopez@nrcan.gc.ca>

# File lib/openstudio-standards/btap/envelope.rb, line 114
def test_create_new_construction_based_on_exisiting()
  #              opaque
  new_construction = BTAP::Resources::Envelope::Constructions::customize_opaque_construction(@model, @opaque_construction, 0.05)
  assert_in_delta(0.05, new_construction.thermalConductance.to_f, 0.00001)
  #              fenestration
  new_construction = BTAP::Resources::Envelope::Constructions::customize_fenestration_construction(@model, @fenestration_construction, 0.5, nil, nil, 0.0)
  assert_in_delta(0.5, OpenstudioStandards::Constructions.construction_get_conductance(new_construction).to_f, 0.00001)
end
test_create_opaque_construction() click to toggle source

This method will create a test opaque construction. @author Phylroy A. Lopez <plopez@nrcan.gc.ca>

# File lib/openstudio-standards/btap/envelope.rb, line 94
def test_create_opaque_construction()
  construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@opaque, @insulation, @massless, @opaque], @insulation)
  #Check that the construction was created
  assert(!(construction.to_Construction.empty?))
  #check that all layers were entered
  assert_equal(5, construction.layers.size)
  #check insulation was set.
  assert(construction.insulation().get == @insulation)
end