Beispiel #1
0
def test_to_dict():
    """Test the Door to_dict method."""
    vertices = [[0, 0, 0], [0, 10, 0], [0, 10, 3], [0, 0, 3]]
    dr = Door.from_vertices('Rectangle Door', vertices)

    drd = dr.to_dict()
    assert drd['type'] == 'Door'
    assert drd['name'] == 'RectangleDoor'
    assert drd['display_name'] == 'Rectangle Door'
    assert 'geometry' in drd
    assert len(drd['geometry']['boundary']) == len(vertices)
    assert 'properties' in drd
    assert drd['properties']['type'] == 'DoorProperties'
    assert drd['boundary_condition']['type'] == 'Outdoors'
Beispiel #2
0
def test_writer_to_idf():
    """Test the Door to_idf method."""
    door = Door.from_vertices(
        'front_door', [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]])
    concrete5 = EnergyMaterial('5cm Concrete', 0.05, 2.31, 2322, 832,
                               'MediumRough', 0.95, 0.75, 0.8)
    mass_constr = OpaqueConstruction('ConcreteDoor', [concrete5])
    door.properties.energy.construction = mass_constr

    assert hasattr(door.to, 'idf')
    idf_string = door.to.idf(door)
    assert 'front_door,' in idf_string
    assert 'FenestrationSurface:Detailed,' in idf_string
    assert 'ConcreteDoor' in idf_string
Beispiel #3
0
def test_set_construction():
    """Test the setting of a construction on a Door."""
    vertices_wall = [[0, 0, 0], [0, 10, 0], [0, 10, 3], [0, 0, 3]]
    concrete5 = EnergyMaterial('5cm Concrete', 0.05, 2.31, 2322, 832,
                               'MediumRough', 0.95, 0.75, 0.8)
    mass_constr = OpaqueConstruction('Concrete Door', [concrete5])

    door = Door.from_vertices('wall door', vertices_wall)
    door.properties.energy.construction = mass_constr

    assert door.properties.energy.construction == mass_constr
    assert door.properties.energy.is_construction_set_by_user

    with pytest.raises(AttributeError):
        door.properties.energy.construction[0].thickness = 0.1
Beispiel #4
0
def test_to_dict():
    """Test the Door to_dict method."""
    vertices = [[0, 0, 0], [0, 10, 0], [0, 10, 3], [0, 0, 3]]
    unique_id = str(py_uuid.uuid4())
    dr = Door.from_vertices(unique_id, vertices)
    dr.display_name = 'Rectangle Door'

    drd = dr.to_dict()
    assert drd['type'] == 'Door'
    assert drd['identifier'] == unique_id
    assert drd['display_name'] == 'Rectangle Door'
    assert 'geometry' in drd
    assert len(drd['geometry']['boundary']) == len(vertices)
    assert 'properties' in drd
    assert drd['properties']['type'] == 'DoorProperties'
    assert drd['boundary_condition']['type'] == 'Outdoors'
Beispiel #5
0
def test_door_from_vertices():
    """Test the initialization of Door objects from vertices."""
    pts = (Point3D(0, 0, 0), Point3D(0, 0, 3), Point3D(1, 0, 3), Point3D(1, 0, 0))
    door = Door.from_vertices('Test Door', pts)

    assert door.name == 'TestDoor'
    assert door.display_name == 'Test Door'
    assert isinstance(door.geometry, Face3D)
    assert len(door.vertices) == 4
    assert door.upper_left_vertices[0] == Point3D(1, 0, 3)
    assert len(door.triangulated_mesh3d.faces) == 2
    assert door.normal == Vector3D(0, 1, 0)
    assert door.center == Point3D(0.5, 0, 1.5)
    assert door.area == 3
    assert door.perimeter == 8
    assert isinstance(door.boundary_condition, Outdoors)
    assert not door.has_parent
Beispiel #6
0
def test_to_dict():
    """Test the Door to_dict method with energy properties."""
    door = Door.from_vertices('front door',
                              [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]])
    concrete5 = EnergyMaterial('5cm Concrete', 0.05, 2.31, 2322, 832,
                               'MediumRough', 0.95, 0.75, 0.8)
    mass_constr = OpaqueConstruction('Concrete Door', [concrete5])

    drd = door.to_dict()
    assert 'properties' in drd
    assert drd['properties']['type'] == 'DoorProperties'
    assert 'energy' in drd['properties']
    assert drd['properties']['energy']['type'] == 'DoorEnergyProperties'

    door.properties.energy.construction = mass_constr
    drd = door.to_dict()
    assert 'construction' in drd['properties']['energy']
    assert drd['properties']['energy']['construction'] is not None
Beispiel #7
0
def test_to_dict():
    """Test the Door to_dict method with radiance properties."""
    door = Door.from_vertices('front_door',
                              [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]])
    painted_door = Plastic.from_single_reflectance('PaintedDoor', 0.75)

    drd = door.to_dict()
    assert 'properties' in drd
    assert drd['properties']['type'] == 'DoorProperties'
    assert 'radiance' in drd['properties']
    assert drd['properties']['radiance']['type'] == 'DoorRadianceProperties'

    door.properties.radiance.modifier = painted_door
    drd = door.to_dict()
    assert 'modifier' in drd['properties']['radiance']
    assert drd['properties']['radiance']['modifier'] is not None
    assert drd['properties']['radiance']['modifier'][
        'identifier'] == 'PaintedDoor'
Beispiel #8
0
def test_set_construction_set():
    """Test the setting of a ConstructionSet on a Room."""
    room = Room.from_box('Shoe Box', 5, 10, 3)
    door_verts = [[1, 0, 0.1], [2, 0, 0.1], [2, 0, 3], [1, 0, 3]]
    room[3].add_door(Door.from_vertices('test_door', door_verts))
    room[1].apertures_by_ratio(0.4, 0.01)
    room[1].apertures[0].overhang(0.5, indoor=False)
    room[1].apertures[0].overhang(0.5, indoor=True)
    room[1].apertures[0].move_shades(Vector3D(0, 0, -0.5))

    mass_set = ConstructionSet('Thermal Mass Construction Set')
    concrete20 = EnergyMaterial('20cm Concrete', 0.2, 2.31, 2322, 832,
                                'MediumRough', 0.95, 0.75, 0.8)
    concrete10 = EnergyMaterial('10cm Concrete', 0.1, 2.31, 2322, 832,
                                'MediumRough', 0.95, 0.75, 0.8)
    stone_door = EnergyMaterial('Stone Door', 0.05, 2.31, 2322, 832,
                                'MediumRough', 0.95, 0.75, 0.8)
    thick_constr = OpaqueConstruction('Thick Concrete Construction',
                                      [concrete20])
    thin_constr = OpaqueConstruction('Thin Concrete Construction',
                                     [concrete10])
    door_constr = OpaqueConstruction('Stone Door', [stone_door])
    shade_constr = ShadeConstruction('Light Shelf', 0.5, 0.5)
    mass_set.wall_set.exterior_construction = thick_constr
    mass_set.roof_ceiling_set.exterior_construction = thin_constr
    mass_set.door_set.exterior_construction = door_constr
    mass_set.shade_construction = shade_constr

    room.properties.energy.construction_set = mass_set
    assert room.properties.energy.construction_set == mass_set
    assert room[1].properties.energy.construction == thick_constr
    assert room[5].properties.energy.construction == thin_constr
    assert room[3].doors[0].properties.energy.construction == door_constr
    assert room[1].apertures[0].shades[
        0].properties.energy.construction == shade_constr

    with pytest.raises(AttributeError):
        room[1].properties.energy.construction.thickness = 0.3
    with pytest.raises(AttributeError):
        room[5].properties.energy.construction.thickness = 0.3
    with pytest.raises(AttributeError):
        room[3].doors[0].properties.energy.construction.thickness = 0.3