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:



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/openstudio-standards/btap/envelope.rb', line 467

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:



516
517
518
519
520
# File 'lib/openstudio-standards/btap/envelope.rb', line 516

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:



524
525
526
527
528
529
530
531
# File 'lib/openstudio-standards/btap/envelope.rb', line 524

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:



491
492
493
494
495
496
497
498
499
# File 'lib/openstudio-standards/btap/envelope.rb', line 491

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:



503
504
505
506
507
508
509
510
511
512
# File 'lib/openstudio-standards/btap/envelope.rb', line 503

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