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:



471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/openstudio-standards/btap/envelope.rb', line 471

def setup
  @model = OpenStudio::Model::Model.new()
  #Create opaque layers from defaults
  @insulation = BTAP::Resources::Envelope::Materials::Opaque::create_opaque_material(@model, "insulation", 0.1, 0.001, 0.1, 0.1, "Smooth", 0.9, 0.7, 0.7)
  @opaque = BTAP::Resources::Envelope::Materials::Opaque::create_opaque_material(@model)
  @air_gap = BTAP::Resources::Envelope::Materials::Opaque::create_air_gap(@model)
  @massless = BTAP::Resources::Envelope::Materials::Opaque::create_massless_opaque_material(@model)
  #Create fenestration layer from defaults.
  @simple = BTAP::Resources::Envelope::Materials::Fenestration::create_simple_glazing(@model)
  @standard = BTAP::Resources::Envelope::Materials::Fenestration::create_standard_glazing(@model)
  @gas = BTAP::Resources::Envelope::Materials::Fenestration::create_gas(@model)
  @blind = BTAP::Resources::Envelope::Materials::Fenestration::create_blind(@model)
  @screen = BTAP::Resources::Envelope::Materials::Fenestration::create_screen(@model)
  @shade = BTAP::Resources::Envelope::Materials::Fenestration::create_shade(@model)
  @opaque_construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@opaque, @air_gap, @insulation, @massless, @opaque], @insulation)
  @fenestration_construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@simple, @standard], @gas)

  array = [@opaque, "insulation", @air_gap]
  BTAP::Common::validate_array(@model, array, "Material")

end

#test_create_fenestration_constructionObject

This method will test creation of fenestration construction.

Author:



520
521
522
523
524
# File 'lib/openstudio-standards/btap/envelope.rb', line 520

def test_create_fenestration_construction()
  construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@simple, @standard, @gas, @blind, @screen, @shade], @gas)
  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:



528
529
530
531
532
533
534
535
# File 'lib/openstudio-standards/btap/envelope.rb', line 528

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, Resources::Envelope::Constructions::get_conductance(new_construction).to_f, 0.00001)
end

#test_create_opaque_constructionObject

This method will create a test opaque construction.

Author:



495
496
497
498
499
500
501
502
503
# File 'lib/openstudio-standards/btap/envelope.rb', line 495

def test_create_opaque_construction()
  construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@opaque, @air_gap, @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

#test_find_and_set_insulaton_layerObject

This method will test find and set insulation layer.

Author:



507
508
509
510
511
512
513
514
515
516
# File 'lib/openstudio-standards/btap/envelope.rb', line 507

def test_find_and_set_insulaton_layer()
  construction = BTAP::Resources::Envelope::Constructions::create_construction(@model, "test construction", [@opaque, @air_gap, @insulation, @massless, @opaque])

  #check insulation was not set.
  assert((construction.insulation().empty?))
  #now set it.
  BTAP::Resources::Envelope::Constructions::find_and_set_insulaton_layer(@model, [construction])
  #Now check that it found the insulation  value.
  assert(construction.insulation().get == @insulation)
end