Class: BTAP::Resources::Envelope::Constructions::ConstructionsTests

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/openstudio-standards/btap/envelope.rb

Instance Method Summary collapse

Instance Method Details

#setupObject

This method sets up the model.

Author:



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# 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_constructionObject

This method will test creation of fenestration construction.

Author:



106
107
108
109
110
# 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_exisitingObject

This method will create new construction based on exisiting.

Author:



114
115
116
117
118
119
120
121
# 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_constructionObject

This method will create a test opaque construction.

Author:



94
95
96
97
98
99
100
101
102
# 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