예제 #1
0
def test_constructionset_to_dict_full():
    """Test the to_dict method writing out all constructions."""
    default_set = ConstructionSet('Default Set')

    constr_dict = default_set.to_dict(none_for_defaults=False)

    assert constr_dict['wall_set']['exterior_construction'] is not None
    assert constr_dict['wall_set']['interior_construction'] is not None
    assert constr_dict['wall_set']['ground_construction'] is not None
    assert constr_dict['floor_set']['exterior_construction'] is not None
    assert constr_dict['floor_set']['interior_construction'] is not None
    assert constr_dict['floor_set']['ground_construction'] is not None
    assert constr_dict['roof_ceiling_set']['exterior_construction'] is not None
    assert constr_dict['roof_ceiling_set']['interior_construction'] is not None
    assert constr_dict['roof_ceiling_set']['ground_construction'] is not None
    assert constr_dict['aperture_set']['window_construction'] is not None
    assert constr_dict['aperture_set']['interior_construction'] is not None
    assert constr_dict['aperture_set']['skylight_construction'] is not None
    assert constr_dict['aperture_set']['operable_construction'] is not None
    assert constr_dict['door_set']['exterior_construction'] is not None
    assert constr_dict['door_set']['interior_construction'] is not None
    assert constr_dict['door_set']['exterior_glass_construction'] is not None
    assert constr_dict['door_set']['interior_glass_construction'] is not None
    assert constr_dict['door_set']['overhead_construction'] is not None
    assert constr_dict['shade_construction'] is not None
예제 #2
0
def test_set_construction_set():
    """Test the setting of a ConstructionSet on a Room2D."""
    pts = (Point3D(0, 0, 3), Point3D(10, 0, 3), Point3D(10, 10,
                                                        3), Point3D(0, 10, 3))
    ashrae_base = SimpleWindowRatio(0.4)
    overhang = Overhang(1)
    boundarycs = (bcs.outdoors, bcs.ground, bcs.outdoors, bcs.ground)
    window = (ashrae_base, None, ashrae_base, None)
    shading = (overhang, None, None, None)
    room = Room2D('SquareShoebox', Face3D(pts), 3, boundarycs, window, shading)

    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)
    thick_constr = OpaqueConstruction('Thick Concrete Construction',
                                      [concrete20])
    thin_constr = OpaqueConstruction('Thin Concrete Construction',
                                     [concrete10])
    shade_constr = ShadeConstruction('Light Shelf', 0.5, 0.5)
    mass_set.wall_set.exterior_construction = thick_constr
    mass_set.roof_ceiling_set.interior_construction = thin_constr
    mass_set.shade_construction = shade_constr

    room.properties.energy.construction_set = mass_set
    assert room.properties.energy.construction_set == mass_set

    hb_room, adj = room.to_honeybee()
    assert hb_room.properties.energy.construction_set == mass_set
    assert hb_room[1].properties.energy.construction == thick_constr
    assert hb_room[5].properties.energy.construction == thin_constr
    assert hb_room[1].shades[0].properties.energy.construction == shade_constr
예제 #3
0
def validate_construction_set(construction_set_json):
    """Validate all properties of a ConstructionSet or ConstructionSetAbridged JSON.

    \b
    Args:
        construction_set_json: Full path to a ConstructionSet or ConstructionSetAbridged
            JSON file.
    """
    try:
        # first check the JSON against the OpenAPI specification
        with open(construction_set_json) as json_file:
            data = json.load(json_file)
        if data['type'] == 'ConstructionSet':
            click.echo('Validating ConstructionSet JSON ...')
            schema_constructionset.ConstructionSet.parse_file(construction_set_json)
            click.echo('Pydantic validation passed.')
            ConstructionSet.from_dict(data)
            click.echo('Python re-serialization passed.')
        else:  # assume it's a ConstructionSetAbridged schema
            click.echo('Validating ConstructionSetAbridged JSON ...')
            schema_constructionset.ConstructionSetAbridged.parse_file(
                construction_set_json)
            click.echo('Pydantic validation passed.')
        # if we made it to this point, report that the object is valid
        click.echo('Congratulations! Your Program JSON is valid!')
    except Exception as e:
        _logger.exception('ConstructionSet validation failed.\n{}'.format(e))
        sys.exit(1)
    else:
        sys.exit(0)
예제 #4
0
def test_constructionset_dict_methods():
    """Test the to/from dict methods."""
    insulated_set = ConstructionSet('Insulated Set')
    clear_glass = EnergyWindowMaterialGlazing(
        'Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804,
        0, 0.84, 0.84, 1.0)
    gap = EnergyWindowMaterialGas('air gap', thickness=0.0127)
    triple_clear = WindowConstruction(
        'Triple Clear Window', [clear_glass, gap, clear_glass, gap, clear_glass])

    insulated_set.aperture_set.window_construction = triple_clear
    constr_dict = insulated_set.to_dict()

    assert constr_dict['wall_set']['exterior_construction'] is None
    assert constr_dict['wall_set']['interior_construction'] is None
    assert constr_dict['wall_set']['ground_construction'] is None
    assert constr_dict['floor_set']['exterior_construction'] is None
    assert constr_dict['floor_set']['interior_construction'] is None
    assert constr_dict['floor_set']['ground_construction'] is None
    assert constr_dict['roof_ceiling_set']['exterior_construction'] is None
    assert constr_dict['roof_ceiling_set']['interior_construction'] is None
    assert constr_dict['roof_ceiling_set']['ground_construction'] is None
    assert constr_dict['aperture_set']['window_construction'] is not None
    assert constr_dict['aperture_set']['interior_construction'] is None
    assert constr_dict['aperture_set']['skylight_construction'] is None
    assert constr_dict['aperture_set']['operable_construction'] is None
    assert constr_dict['door_set']['exterior_construction'] is None
    assert constr_dict['door_set']['interior_construction'] is None
    assert constr_dict['door_set']['exterior_glass_construction'] is None
    assert constr_dict['door_set']['interior_glass_construction'] is None
    assert constr_dict['door_set']['overhead_construction'] is None
    assert constr_dict['shade_construction'] is None

    new_constr = ConstructionSet.from_dict(constr_dict)
    assert constr_dict == new_constr.to_dict()
예제 #5
0
def test_setting_construction():
    """Test the setting of constructions on the ConstructionSet."""
    default_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])
    light_shelf = ShadeConstruction('Light Shelf', 0.5, 0.5, True)

    default_set.wall_set.exterior_construction = thick_constr
    assert default_set.wall_set.exterior_construction == thick_constr
    assert len(default_set.modified_constructions_unique) == 1
    assert len(default_set.modified_materials_unique) == 1

    assert isinstance(default_set.wall_set.exterior_construction[0],
                      EnergyMaterial)
    with pytest.raises(AttributeError):
        default_set.wall_set.exterior_construction[0].thickness = 0.15

    default_set.wall_set.interior_construction = thin_constr
    assert default_set.wall_set.interior_construction == thin_constr
    default_set.wall_set.ground_construction = thick_constr
    assert default_set.wall_set.ground_construction == thick_constr
    default_set.floor_set.exterior_construction = thick_constr
    assert default_set.floor_set.exterior_construction == thick_constr
    default_set.floor_set.interior_construction = thin_constr
    assert default_set.floor_set.interior_construction == thin_constr
    default_set.floor_set.ground_construction = thick_constr
    assert default_set.floor_set.ground_construction == thick_constr
    default_set.roof_ceiling_set.exterior_construction = thick_constr
    assert default_set.roof_ceiling_set.exterior_construction == thick_constr
    default_set.roof_ceiling_set.interior_construction = thin_constr
    assert default_set.roof_ceiling_set.interior_construction == thin_constr
    default_set.roof_ceiling_set.ground_construction = thick_constr
    assert default_set.roof_ceiling_set.ground_construction == thick_constr
    default_set.door_set.exterior_construction = door_constr
    assert default_set.door_set.exterior_construction == door_constr
    default_set.door_set.interior_construction = door_constr
    assert default_set.door_set.interior_construction == door_constr
    default_set.door_set.overhead_construction = door_constr
    assert default_set.door_set.overhead_construction == door_constr
    default_set.shade_construction = light_shelf
    assert default_set.shade_construction == light_shelf

    assert len(default_set.modified_constructions_unique) == 4
    assert len(default_set.modified_materials_unique) == 3
예제 #6
0
def test_check_duplicate_construction_set_identifiers():
    """Test the check_duplicate_construction_set_identifiers method."""
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    room2d_1 = Room2D('Office1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office2', Face3D(pts_2), 3)
    story = Story('OfficeFloor', [room2d_1, room2d_2])
    story.solve_room_2d_adjacency(0.01)
    story.set_outdoor_window_parameters(SimpleWindowRatio(0.4))
    story.multiplier = 4
    for room in story.room_2ds:
        room.properties.energy.program_type = office_program
        room.properties.energy.add_default_ideal_air()
    building = Building('OfficeBuilding', [story])
    building.separate_top_bottom_floors()

    constr_set = ConstructionSet('Attic Construction Set')
    polyiso = EnergyMaterial('PolyIso', 0.2, 0.03, 43, 1210, 'MediumRough')
    roof_constr = OpaqueConstruction('Attic Roof Construction',
                                     [roof_membrane, polyiso, wood])
    floor_constr = OpaqueConstruction('Attic Floor Construction',
                                      [wood, insulation, wood])
    constr_set.floor_set.interior_construction = floor_constr
    constr_set.roof_ceiling_set.exterior_construction = roof_constr
    building.unique_room_2ds[
        -1].properties.energy.construction_set = constr_set
    building.unique_room_2ds[
        -2].properties.energy.construction_set = constr_set

    tree_canopy_geo1 = Face3D.from_regular_polygon(6, 6,
                                                   Plane(o=Point3D(5, -10, 6)))
    tree_canopy_geo2 = Face3D.from_regular_polygon(
        6, 2, Plane(o=Point3D(-5, -10, 3)))
    tree_canopy = ContextShade('TreeCanopy',
                               [tree_canopy_geo1, tree_canopy_geo2])

    model = Model('NewDevelopment', [building], [tree_canopy])

    assert model.properties.energy.check_duplicate_construction_set_identifiers(
        False)
    constr_set2 = ConstructionSet('Attic Construction Set')
    building.unique_room_2ds[
        -2].properties.energy.construction_set = constr_set2
    assert not model.properties.energy.check_duplicate_construction_set_identifiers(
        False)
    with pytest.raises(ValueError):
        model.properties.energy.check_duplicate_construction_set_identifiers(
            True)
예제 #7
0
def load_construction_set_object(cset_dict):
    """Load a construction set object from a dictionary and add it to the lib dict."""
    try:
        if cset_dict['type'] == 'ConstructionSetAbridged':
            cset = ConstructionSet.from_dict_abridged(cset_dict, _all_constructions)
        else:
            cset = ConstructionSet.from_dict(cset_dict)
        cset.lock()
        assert cset_dict['identifier'] not in _default_sets, 'Cannot overwrite ' \
            'default construction set "{}".'.format(cset_dict['identifier'])
        _construction_sets[cset_dict['identifier']] = cset
    except (TypeError, KeyError, ValueError):
        pass  # not a Honeybee ConstructionSet JSON; possibly a comment
예제 #8
0
def test_setting_window_construction():
    """Test the setting of aperture and glass door constructions on ConstructionSet."""
    default_set = ConstructionSet('Tinted Window Set')
    tinted_glass = EnergyWindowMaterialGlazing('Tinted Glass', 0.006, 0.35,
                                               0.03, 0.884, 0.0804, 0, 0.84,
                                               0.84, 1.0)
    gap = EnergyWindowMaterialGas('Window Air Gap', thickness=0.0127)
    double_tint = WindowConstruction('Double Tinted Window',
                                     [tinted_glass, gap, tinted_glass])
    single_tint = WindowConstruction('Single Tinted Window', [tinted_glass])

    default_set.aperture_set.window_construction = double_tint
    assert default_set.aperture_set.window_construction == double_tint
    assert len(default_set.modified_constructions_unique) == 1
    assert len(default_set.modified_materials_unique) == 2

    assert isinstance(default_set.aperture_set.window_construction[0],
                      EnergyWindowMaterialGlazing)
    with pytest.raises(AttributeError):
        default_set.aperture_set.window_construction[0].thickness = 0.003

    default_set.aperture_set.interior_construction = single_tint
    assert default_set.aperture_set.interior_construction == single_tint
    default_set.aperture_set.skylight_construction = double_tint
    assert default_set.aperture_set.skylight_construction == double_tint
    default_set.aperture_set.operable_construction = double_tint
    assert default_set.aperture_set.operable_construction == double_tint

    default_set.door_set.exterior_glass_construction = double_tint
    assert default_set.door_set.exterior_glass_construction == double_tint
    default_set.door_set.interior_glass_construction = single_tint
    assert default_set.door_set.interior_glass_construction == single_tint

    assert len(default_set.modified_constructions_unique) == 2
    assert len(default_set.modified_materials_unique) == 2
예제 #9
0
def test_to_dict_shoe_box():
    """Test the Model to_dict method with a shoebox zone model."""
    room = Room.from_box('SimpleShoeBoxZone', 5, 10, 3)
    room[0].boundary_condition = boundary_conditions.adiabatic
    for face in room[2:]:
        face.boundary_condition = boundary_conditions.adiabatic

    north_face = room[1]
    north_face.apertures_by_ratio_rectangle(0.4, 2, 0.7, 2, 0, 0.01)

    constr_set = ConstructionSet('Shoe Box Construction Set')
    constr_set.wall_set.exterior_construction = generic_exterior_wall
    constr_set.wall_set.interior_construction = generic_interior_wall
    constr_set.floor_set.interior_construction = generic_interior_floor
    constr_set.roof_ceiling_set.interior_construction = generic_interior_ceiling
    constr_set.aperture_set.window_construction = generic_double_pane
    room.properties.energy.construction_set = constr_set

    model = Model('ShoeBox', [room])
    model_dict = model.to_dict()
    model_dict['properties']['energy'] = model.properties.energy.to_dict()['energy']

    assert 'energy' in model_dict['properties']
    assert 'materials' in model_dict['properties']['energy']
    assert 'constructions' in model_dict['properties']['energy']
    assert 'construction_sets' in model_dict['properties']['energy']

    assert len(model_dict['properties']['energy']['materials']) == 10
    assert len(model_dict['properties']['energy']['constructions']) == 5

    assert model_dict['rooms'][0]['faces'][0]['boundary_condition']['type'] == 'Adiabatic'
    assert model_dict['rooms'][0]['faces'][2]['boundary_condition']['type'] == 'Adiabatic'
예제 #10
0
def test_duplicate():
    """Test what happens to energy properties when duplicating a Room."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    room_original = Room.from_box('ShoeBox', 5, 10, 3)
    room_original.properties.energy.program_type = office_program
    room_original.properties.energy.add_default_ideal_air()

    room_dup_1 = room_original.duplicate()

    assert room_original.properties.energy.program_type == \
        room_dup_1.properties.energy.program_type
    assert room_original.properties.energy.hvac == \
        room_dup_1.properties.energy.hvac

    assert room_original.properties.energy.host is room_original
    assert room_dup_1.properties.energy.host is room_dup_1
    assert room_original.properties.energy.host is not \
        room_dup_1.properties.energy.host

    assert room_original.properties.energy.construction_set == \
        room_dup_1.properties.energy.construction_set
    room_dup_1.properties.energy.construction_set = mass_set
    assert room_original.properties.energy.construction_set != \
        room_dup_1.properties.energy.construction_set

    room_dup_1.add_prefix('Opt1')
    assert room_dup_1.identifier.startswith('Opt1')

    room_dup_2 = room_dup_1.duplicate()

    assert room_dup_1.properties.energy.construction_set == \
        room_dup_2.properties.energy.construction_set
    room_dup_2.properties.energy.construction_set = None
    assert room_dup_1.properties.energy.construction_set != \
        room_dup_2.properties.energy.construction_set
예제 #11
0
def test_constructionset_equality():
    """Test the equality of ConstructionSets to one another."""
    default_set = ConstructionSet('Default Set')
    concrete = EnergyMaterial('Concrete', 0.15, 2.31, 2322, 832, 'MediumRough',
                              0.95, 0.75, 0.8)
    wall_constr = OpaqueConstruction('Concrete Construction', [concrete])
    default_set.wall_set.exterior_construction = wall_constr
    new_default_set = default_set.duplicate()

    cnstr_set_list = [default_set, default_set, new_default_set]
    assert cnstr_set_list[0] is cnstr_set_list[1]
    assert cnstr_set_list[0] is not cnstr_set_list[2]
    assert cnstr_set_list[0] == cnstr_set_list[2]

    new_default_set.name = 'ASHRAE 90.1 Construction Set'
    assert cnstr_set_list[0] != cnstr_set_list[2]
예제 #12
0
    def from_dict(cls, data, host):
        """Create Room2DEnergyProperties from a dictionary.

        Note that the dictionary must be a non-abridged version for this
        classmethod to work.

        Args:
            data: A dictionary representation of Room2DEnergyProperties.
            host: A Room2D object that hosts these properties.
        """
        assert data['type'] == 'Room2DEnergyProperties', \
            'Expected Room2DEnergyProperties. Got {}.'.format(data['type'])

        new_prop = cls(host)
        if 'construction_set' in data and data['construction_set'] is not None:
            new_prop.construction_set = \
                ConstructionSet.from_dict(data['construction_set'])
        if 'program_type' in data and data['program_type'] is not None:
            new_prop.program_type = ProgramType.from_dict(data['program_type'])
        if 'hvac' in data and data['hvac'] is not None:
            hvac_class = HVAC_TYPES_DICT[data['hvac']['type']]
            new_prop.hvac = hvac_class.from_dict(data['hvac'])
        cls._deserialize_window_vent(new_prop, data)

        return new_prop
예제 #13
0
def test_to_dict():
    """Test the Story to_dict method with energy properties."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    pts_3 = (Point3D(0, 10, 3), Point3D(0, 20,
                                        3), Point3D(10, 20,
                                                    3), Point3D(10, 10, 3))
    pts_4 = (Point3D(10, 10, 3), Point3D(10, 20,
                                         3), Point3D(20, 20,
                                                     3), Point3D(20, 10, 3))
    room2d_1 = Room2D('Office1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office2', Face3D(pts_2), 3)
    room2d_3 = Room2D('Office3', Face3D(pts_3), 3)
    room2d_4 = Room2D('Office4', Face3D(pts_4), 3)
    story = Story('OfficeFloor', [room2d_1, room2d_2, room2d_3, room2d_4])
    story.solve_room_2d_adjacency(0.01)
    story.set_outdoor_window_parameters(SimpleWindowRatio(0.4))

    sd = story.to_dict()
    assert 'properties' in sd
    assert sd['properties']['type'] == 'StoryProperties'
    assert 'energy' in sd['properties']
    assert sd['properties']['energy']['type'] == 'StoryEnergyProperties'
    assert 'construction_set' not in sd['properties']['energy'] or \
        sd['properties']['energy']['construction_set'] is None

    story.properties.energy.construction_set = mass_set
    sd = story.to_dict()
    assert sd['properties']['energy']['construction_set'] is not None
예제 #14
0
def test_duplicate():
    """Test what happens to energy properties when duplicating a Room2D."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    pts = (Point3D(0, 0, 3), Point3D(10, 0, 3), Point3D(10, 10,
                                                        3), Point3D(0, 10, 3))
    ashrae_base = SimpleWindowRatio(0.4)
    room_original = Room2D('SquareShoebox', Face3D(pts), 3)
    room_original.set_outdoor_window_parameters(ashrae_base)
    room_dup_1 = room_original.duplicate()

    assert room_original.properties.energy.host is room_original
    assert room_dup_1.properties.energy.host is room_dup_1
    assert room_original.properties.energy.host is not \
        room_dup_1.properties.energy.host

    assert room_original.properties.energy.construction_set == \
        room_dup_1.properties.energy.construction_set
    room_dup_1.properties.energy.construction_set = mass_set
    assert room_original.properties.energy.construction_set != \
        room_dup_1.properties.energy.construction_set

    room_dup_2 = room_dup_1.duplicate()

    assert room_dup_1.properties.energy.construction_set == \
        room_dup_2.properties.energy.construction_set
    room_dup_2.properties.energy.construction_set = None
    assert room_dup_1.properties.energy.construction_set != \
        room_dup_2.properties.energy.construction_set
예제 #15
0
def test_to_dict():
    """Test the Room2D to_dict method with energy properties."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    pts = (Point3D(0, 0, 3), Point3D(10, 0, 3), Point3D(10, 10,
                                                        3), Point3D(0, 10, 3))
    ashrae_base = SimpleWindowRatio(0.4)
    overhang = Overhang(1)
    boundarycs = (bcs.outdoors, bcs.ground, bcs.outdoors, bcs.ground)
    window = (ashrae_base, None, ashrae_base, None)
    shading = (overhang, None, None, None)
    room = Room2D('ShoeBoxZone', Face3D(pts), 3, boundarycs, window, shading)

    rd = room.to_dict()
    assert 'properties' in rd
    assert rd['properties']['type'] == 'Room2DProperties'
    assert 'energy' in rd['properties']
    assert rd['properties']['energy']['type'] == 'Room2DEnergyProperties'
    assert 'program_type' not in rd['properties']['energy'] or \
        rd['properties']['energy']['program_type'] is None
    assert 'construction_set' not in rd['properties']['energy'] or \
        rd['properties']['energy']['construction_set'] is None
    assert 'hvac' not in rd['properties']['energy'] or \
        rd['properties']['energy']['hvac'] is None

    room.properties.energy.construction_set = mass_set
    room.properties.energy.program_type = office_program
    rd = room.to_dict()
    assert rd['properties']['energy']['construction_set'] is not None
    assert rd['properties']['energy']['program_type'] is not None
예제 #16
0
def test_from_dict():
    """Test the Story from_dict method with energy properties."""
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    pts_3 = (Point3D(0, 10, 3), Point3D(0, 20,
                                        3), Point3D(10, 20,
                                                    3), Point3D(10, 10, 3))
    pts_4 = (Point3D(10, 10, 3), Point3D(10, 20,
                                         3), Point3D(20, 20,
                                                     3), Point3D(20, 10, 3))
    room2d_1 = Room2D('Office1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office2', Face3D(pts_2), 3)
    room2d_3 = Room2D('Office3', Face3D(pts_3), 3)
    room2d_4 = Room2D('Office4', Face3D(pts_4), 3)
    story = Story('OfficeFloor', [room2d_1, room2d_2, room2d_3, room2d_4])
    story.solve_room_2d_adjacency(0.01)
    story.set_outdoor_window_parameters(SimpleWindowRatio(0.4))

    mass_set = ConstructionSet('Thermal Mass Construction Set')
    story.properties.energy.construction_set = mass_set

    sd = story.to_dict()
    new_story = Story.from_dict(sd)
    assert new_story.properties.energy.construction_set.identifier == \
        'Thermal Mass Construction Set'
    assert new_story.to_dict() == sd
def test_to_dict():
    """Test the Room to_dict method with energy properties."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    room = Room.from_box('ShoeBox', 5, 10, 3)

    rd = room.to_dict()
    assert 'properties' in rd
    assert rd['properties']['type'] == 'RoomProperties'
    assert 'energy' in rd['properties']
    assert rd['properties']['energy']['type'] == 'RoomEnergyProperties'
    assert 'program_type' not in rd['properties']['energy'] or \
        rd['properties']['energy']['program_type'] is None
    assert 'construction_set' not in rd['properties']['energy'] or \
        rd['properties']['energy']['construction_set'] is None
    assert 'hvac' not in rd['properties']['energy'] or \
        rd['properties']['energy']['hvac'] is None
    assert 'people' not in rd['properties']['energy'] or \
        rd['properties']['energy']['people'] is None
    assert 'lighting' not in rd['properties']['energy'] or \
        rd['properties']['energy']['lighting'] is None
    assert 'electric_equipment' not in rd['properties']['energy'] or \
        rd['properties']['energy']['electric_equipment'] is None
    assert 'gas_equipment' not in rd['properties']['energy'] or \
        rd['properties']['energy']['gas_equipment'] is None
    assert 'infiltration' not in rd['properties']['energy'] or \
        rd['properties']['energy']['infiltration'] is None
    assert 'ventilation' not in rd['properties']['energy'] or \
        rd['properties']['energy']['ventilation'] is None
    assert 'setpoint' not in rd['properties']['energy'] or \
        rd['properties']['energy']['setpoint'] is None

    room.properties.energy.construction_set = mass_set
    rd = room.to_dict()
    assert rd['properties']['energy']['construction_set'] is not None
예제 #18
0
def story_simple(directory):
    """Generate simple Story sample."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    pts_3 = (Point3D(0, 10, 3), Point3D(0, 20,
                                        3), Point3D(10, 20,
                                                    3), Point3D(10, 10, 3))
    pts_4 = (Point3D(10, 10, 3), Point3D(10, 20,
                                         3), Point3D(20, 20,
                                                     3), Point3D(20, 10, 3))
    room2d_1 = Room2D('Office 1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office 2', Face3D(pts_2), 3)
    room2d_3 = Room2D('Office 3', Face3D(pts_3), 3)
    room2d_4 = Room2D('Office 4', Face3D(pts_4), 3)
    story = Story('Office Floor', [room2d_1, room2d_2, room2d_3, room2d_4])
    story.solve_room_2d_adjacency(0.01)
    story.set_outdoor_window_parameters(SimpleWindowRatio(0.4))
    story.properties.energy.construction_set = mass_set

    dest_file = os.path.join(directory, 'story_simple.json')
    with open(dest_file, 'w') as fp:
        json.dump(story.to_dict(True), fp, indent=4)
예제 #19
0
def test_from_dict_non_abridged():
    """Test the Model from_dict method with non-abridged objects."""
    first_floor = Room.from_box('FirstFloor', 10, 10, 3, origin=Point3D(0, 0, 0))
    second_floor = Room.from_box('SecondFloor', 10, 10, 3, origin=Point3D(0, 0, 3))
    first_floor.properties.energy.program_type = office_program
    second_floor.properties.energy.program_type = office_program
    first_floor.properties.energy.add_default_ideal_air()
    second_floor.properties.energy.add_default_ideal_air()
    for face in first_floor[1:5]:
        face.apertures_by_ratio(0.2, 0.01)
    for face in second_floor[1:5]:
        face.apertures_by_ratio(0.2, 0.01)

    pts_1 = [Point3D(0, 0, 6), Point3D(0, 10, 6), Point3D(10, 10, 6), Point3D(10, 0, 6)]
    pts_2 = [Point3D(0, 0, 6), Point3D(5, 0, 9), Point3D(5, 10, 9), Point3D(0, 10, 6)]
    pts_3 = [Point3D(10, 0, 6), Point3D(10, 10, 6), Point3D(5, 10, 9), Point3D(5, 0, 9)]
    pts_4 = [Point3D(0, 0, 6), Point3D(10, 0, 6), Point3D(5, 0, 9)]
    pts_5 = [Point3D(10, 10, 6), Point3D(0, 10, 6), Point3D(5, 10, 9)]
    face_1 = Face('AtticFace1', Face3D(pts_1))
    face_2 = Face('AtticFace2', Face3D(pts_2))
    face_3 = Face('AtticFace3', Face3D(pts_3))
    face_4 = Face('AtticFace4', Face3D(pts_4))
    face_5 = Face('AtticFace5', Face3D(pts_5))
    attic = Room('Attic', [face_1, face_2, face_3, face_4, face_5], 0.01, 1)

    constr_set = ConstructionSet('Attic Construction Set')
    polyiso = EnergyMaterial('PolyIso', 0.2, 0.03, 43, 1210, 'MediumRough')
    roof_constr = OpaqueConstruction('Attic Roof Construction',
                                     [roof_membrane, polyiso, wood])
    floor_constr = OpaqueConstruction('Attic Floor Construction',
                                      [wood, insulation, wood])
    constr_set.floor_set.interior_construction = floor_constr
    constr_set.roof_ceiling_set.exterior_construction = roof_constr
    attic.properties.energy.construction_set = constr_set

    Room.solve_adjacency([first_floor, second_floor, attic], 0.01)

    model = Model('MultiZoneSingleFamilyHouse', [first_floor, second_floor, attic])
    model_dict = model.to_dict()

    model_dict['properties']['energy']['program_types'][0] = office_program.to_dict()
    model_dict['properties']['energy']['construction_sets'][0] = constr_set.to_dict()

    rebuilt_model = Model.from_dict(model_dict)
    assert rebuilt_model.rooms[0].properties.energy.program_type == office_program
    assert rebuilt_model.rooms[2].properties.energy.construction_set == constr_set
예제 #20
0
def test_set_construction_set():
    """Test the setting of a ConstructionSet on a Story."""
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    pts_3 = (Point3D(0, 10, 3), Point3D(0, 20,
                                        3), Point3D(10, 20,
                                                    3), Point3D(10, 10, 3))
    pts_4 = (Point3D(10, 10, 3), Point3D(10, 20,
                                         3), Point3D(20, 20,
                                                     3), Point3D(20, 10, 3))
    room2d_1 = Room2D('Office1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office2', Face3D(pts_2), 3)
    room2d_3 = Room2D('Office3', Face3D(pts_3), 3)
    room2d_4 = Room2D('Office4', Face3D(pts_4), 3)
    story = Story('OfficeFloor', [room2d_1, room2d_2, room2d_3, room2d_4])
    story.solve_room_2d_adjacency(0.01)
    story.set_outdoor_window_parameters(SimpleWindowRatio(0.4))

    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)
    thick_constr = OpaqueConstruction('Thick Concrete Construction',
                                      [concrete20])
    thin_constr = OpaqueConstruction('Thin Concrete Construction',
                                     [concrete10])
    shade_constr = ShadeConstruction('Light Shelf', 0.5, 0.5)
    mass_set.wall_set.exterior_construction = thick_constr
    mass_set.roof_ceiling_set.interior_construction = thin_constr
    mass_set.shade_construction = shade_constr

    story.properties.energy.construction_set = mass_set
    assert story.properties.energy.construction_set == mass_set
    assert story[0].properties.energy.construction_set == mass_set

    rooms = story.to_honeybee()
    model = hb_model.Model(story.identifier, rooms)
    assert len(model.properties.energy.construction_sets) == 1
    assert model.properties.energy.construction_sets[0] == mass_set
    assert model.rooms[0].properties.energy.construction_set == mass_set
예제 #21
0
def test_constructionset_defaults():
    """Test the ConstructionSet defaults."""
    default_set = ConstructionSet('Default Set')

    assert len(default_set.wall_set) == 3
    assert len(default_set.floor_set) == 3
    assert len(default_set.roof_ceiling_set) == 3
    assert len(default_set.aperture_set) == 4
    assert len(default_set.door_set) == 5

    for constr in default_set.wall_set:
        assert isinstance(constr, OpaqueConstruction)
    for constr in default_set.floor_set:
        assert isinstance(constr, OpaqueConstruction)
    for constr in default_set.roof_ceiling_set:
        assert isinstance(constr, OpaqueConstruction)
    for constr in default_set.aperture_set:
        assert isinstance(constr, WindowConstruction)

    assert isinstance(default_set.wall_set.exterior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.wall_set.interior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.wall_set.ground_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.floor_set.exterior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.floor_set.interior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.floor_set.ground_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.roof_ceiling_set.exterior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.roof_ceiling_set.interior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.roof_ceiling_set.ground_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.aperture_set.window_construction,
                      WindowConstruction)
    assert isinstance(default_set.aperture_set.interior_construction,
                      WindowConstruction)
    assert isinstance(default_set.aperture_set.skylight_construction,
                      WindowConstruction)
    assert isinstance(default_set.aperture_set.operable_construction,
                      WindowConstruction)
    assert isinstance(default_set.door_set.exterior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.door_set.interior_construction,
                      OpaqueConstruction)
    assert isinstance(default_set.door_set.exterior_glass_construction,
                      WindowConstruction)
    assert isinstance(default_set.door_set.interior_glass_construction,
                      WindowConstruction)
    assert isinstance(default_set.door_set.overhead_construction,
                      OpaqueConstruction)
예제 #22
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
def test_from_dict():
    """Test the Room from_dict method with energy properties."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    room = Room.from_box('ShoeBox', 5, 10, 3)
    room.properties.energy.construction_set = mass_set

    rd = room.to_dict()
    new_room = Room.from_dict(rd)
    assert new_room.properties.energy.construction_set.identifier == \
        'Thermal Mass Construction Set'
    assert new_room.to_dict() == rd
예제 #24
0
def test_construction_set_from_standards_dict():
    """Test the from_standards_dict method."""
    constr_set_dict = \
        {
            "name": "2013::ClimateZone5::SteelFramed",
            "wall_set": {
                "exterior_construction": "Typical Insulated Steel Framed Exterior Wall-R19",
                "ground_construction": "Typical Insulated Basement Mass Wall-R8"
            },
            "floor_set": {
                "exterior_construction": "Typical Insulated Steel Framed Exterior Floor-R27",
                "ground_construction": "Typical Insulated Carpeted 8in Slab Floor-R5"
            },
            "roof_ceiling_set": {
                "exterior_construction": "Typical IEAD Roof-R32"
            },
            "aperture_set": {
                "window_construction": "U 0.48 SHGC 0.40 Dbl Ref-D Clr 6mm/13mm",
                "operable_construction": "U 0.48 SHGC 0.40 Dbl Ref-D Clr 6mm/13mm",
                "skylight_construction": "Window_U_0.50_SHGC_0.40_Skylight_Frame_Width_0.430_in"
            },
            "door_set": {
                "exterior_construction": "Typical Insulated Metal Door-R2",
                "overhead_construction": "Typical Overhead Door-R2",
                "exterior_glass_construction": "U 0.44 SHGC 0.26 Dbl Ref-B-H Clr 6mm/13mm Air"
            }
        }
    cz5_constr_set = ConstructionSet.from_standards_dict(constr_set_dict)

    assert cz5_constr_set.wall_set.exterior_construction.name == \
        'Typical Insulated Steel Framed Exterior Wall-R19'
    assert cz5_constr_set.wall_set.ground_construction.name == \
        'Typical Insulated Basement Mass Wall-R8'
    assert cz5_constr_set.floor_set.exterior_construction.name == \
        'Typical Insulated Steel Framed Exterior Floor-R27'
    assert cz5_constr_set.floor_set.ground_construction.name == \
        'Typical Insulated Carpeted 8in Slab Floor-R5'
    assert cz5_constr_set.roof_ceiling_set.exterior_construction.name == \
        'Typical IEAD Roof-R32'
    assert cz5_constr_set.door_set.exterior_construction.name == \
        'Typical Insulated Metal Door-R2'
    assert cz5_constr_set.door_set.overhead_construction.name == \
        'Typical Overhead Door-R2'

    assert cz5_constr_set.aperture_set.window_construction.name == \
        'U 0.48 SHGC 0.40 Dbl Ref-D Clr 6mm/13mm'
    assert cz5_constr_set.aperture_set.operable_construction.name == \
        'U 0.48 SHGC 0.40 Dbl Ref-D Clr 6mm/13mm'
    assert cz5_constr_set.aperture_set.skylight_construction.name == \
        'Window_U_0.50_SHGC_0.40_Skylight_Frame_Width_0.430_in'
    assert cz5_constr_set.door_set.exterior_glass_construction.name == \
        'U 0.44 SHGC 0.26 Dbl Ref-B-H Clr 6mm/13mm Air'
예제 #25
0
def test_check_duplicate_construction_set_identifiers():
    """Test the check_duplicate_construction_set_identifiers method."""
    first_floor = Room.from_box('First_Floor', 10, 10, 3, origin=Point3D(0, 0, 0))
    second_floor = Room.from_box('Second_Floor', 10, 10, 3, origin=Point3D(0, 0, 3))
    for face in first_floor[1:5]:
        face.apertures_by_ratio(0.2, 0.01)
    for face in second_floor[1:5]:
        face.apertures_by_ratio(0.2, 0.01)
    base_constr_set = ConstructionSet('Lower Floor Construction Set')
    first_floor.properties.energy.construction_set = base_constr_set
    second_floor.properties.energy.construction_set = base_constr_set

    pts_1 = [Point3D(0, 0, 6), Point3D(0, 10, 6), Point3D(10, 10, 6), Point3D(10, 0, 6)]
    pts_2 = [Point3D(0, 0, 6), Point3D(5, 0, 9), Point3D(5, 10, 9), Point3D(0, 10, 6)]
    pts_3 = [Point3D(10, 0, 6), Point3D(10, 10, 6), Point3D(5, 10, 9), Point3D(5, 0, 9)]
    pts_4 = [Point3D(0, 0, 6), Point3D(10, 0, 6), Point3D(5, 0, 9)]
    pts_5 = [Point3D(10, 10, 6), Point3D(0, 10, 6), Point3D(5, 10, 9)]
    face_1 = Face('AtticFace1', Face3D(pts_1))
    face_2 = Face('AtticFace2', Face3D(pts_2))
    face_3 = Face('AtticFace3', Face3D(pts_3))
    face_4 = Face('AtticFace4', Face3D(pts_4))
    face_5 = Face('AtticFace5', Face3D(pts_5))
    attic = Room('Attic', [face_1, face_2, face_3, face_4, face_5], 0.01, 1)

    constr_set = ConstructionSet('Attic Construction Set')
    polyiso = EnergyMaterial('PolyIso', 0.2, 0.03, 43, 1210, 'MediumRough')
    roof_constr = OpaqueConstruction('Attic Roof Construction',
                                     [roof_membrane, polyiso, wood])
    floor_constr = OpaqueConstruction('Attic Floor Construction',
                                      [wood, insulation, wood])
    constr_set.floor_set.interior_construction = floor_constr
    constr_set.roof_ceiling_set.exterior_construction = roof_constr
    attic.properties.energy.construction_set = constr_set

    Room.solve_adjacency([first_floor, second_floor, attic], 0.01)

    model = Model('MultiZoneSingleFamilyHouse', [first_floor, second_floor, attic])

    assert model.properties.energy.check_duplicate_construction_set_identifiers(False)
    constr_set.unlock()
    constr_set.identifier = 'Lower Floor Construction Set'
    constr_set.lock()
    assert not model.properties.energy.check_duplicate_construction_set_identifiers(False)
    with pytest.raises(ValueError):
        model.properties.energy.check_duplicate_construction_set_identifiers(True)
예제 #26
0
def test_from_dict():
    """Test the Room2D from_dict method with energy properties."""
    pts = (Point3D(0, 0, 3), Point3D(10, 0, 3), Point3D(10, 10,
                                                        3), Point3D(0, 10, 3))
    ashrae_base = SimpleWindowRatio(0.4)
    room = Room2D('SquareShoebox', Face3D(pts), 3)
    room.set_outdoor_window_parameters(ashrae_base)

    mass_set = ConstructionSet('Thermal Mass Construction Set')
    room.properties.energy.construction_set = mass_set

    rd = room.to_dict()
    new_room = Room2D.from_dict(rd)
    assert new_room.properties.energy.construction_set.identifier == \
        'Thermal Mass Construction Set'
    assert new_room.to_dict() == rd
예제 #27
0
def room2d_simple(directory):
    """Generate simple Room2D sample."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    pts = (Point3D(0, 0, 3), Point3D(10, 0, 3), Point3D(10, 10,
                                                        3), Point3D(0, 10, 3))
    ashrae_base = SimpleWindowRatio(0.4)
    overhang = Overhang(1)
    boundarycs = (bcs.outdoors, bcs.ground, bcs.outdoors, bcs.ground)
    window = (ashrae_base, None, ashrae_base, None)
    shading = (overhang, None, None, None)
    room = Room2D('Shoe Box Zone', Face3D(pts), 3, boundarycs, window, shading)
    room.properties.energy.construction_set = mass_set
    room.properties.energy.program_type = office_program

    dest_file = os.path.join(directory, 'room2d_simple.json')
    with open(dest_file, 'w') as fp:
        json.dump(room.to_dict(True), fp, indent=4)
예제 #28
0
def test_constructionset_init():
    """Test the initalization of ConstructionSet and basic properties."""
    default_set = ConstructionSet('Default Set')
    str(default_set)  # test the string representation of the construction

    assert default_set.name == 'Default Set'
    assert len(default_set.constructions) == 19
    assert len(default_set.constructions_unique) == 14
    assert len(default_set.materials_unique) == 15
    assert len(default_set.modified_constructions_unique) == 0
    assert len(default_set.modified_materials_unique) == 0

    assert isinstance(default_set.wall_set, WallSet)
    assert isinstance(default_set.floor_set, FloorSet)
    assert isinstance(default_set.roof_ceiling_set, RoofCeilingSet)
    assert isinstance(default_set.aperture_set, ApertureSet)
    assert isinstance(default_set.door_set, DoorSet)
    assert isinstance(default_set.shade_construction, ShadeConstruction)
예제 #29
0
def test_duplicate():
    """Test what happens to energy properties when duplicating a Room2D."""
    mass_set = ConstructionSet('Thermal Mass Construction Set')
    pts_1 = (Point3D(0, 0, 3), Point3D(0, 10,
                                       3), Point3D(10, 10,
                                                   3), Point3D(10, 0, 3))
    pts_2 = (Point3D(10, 0, 3), Point3D(10, 10,
                                        3), Point3D(20, 10,
                                                    3), Point3D(20, 0, 3))
    pts_3 = (Point3D(0, 10, 3), Point3D(0, 20,
                                        3), Point3D(10, 20,
                                                    3), Point3D(10, 10, 3))
    pts_4 = (Point3D(10, 10, 3), Point3D(10, 20,
                                         3), Point3D(20, 20,
                                                     3), Point3D(20, 10, 3))
    room2d_1 = Room2D('Office1', Face3D(pts_1), 3)
    room2d_2 = Room2D('Office2', Face3D(pts_2), 3)
    room2d_3 = Room2D('Office3', Face3D(pts_3), 3)
    room2d_4 = Room2D('Office4', Face3D(pts_4), 3)
    story_original = Story('OfficeFloor',
                           [room2d_1, room2d_2, room2d_3, room2d_4])
    story_original.solve_room_2d_adjacency(0.01)
    story_original.set_outdoor_window_parameters(SimpleWindowRatio(0.4))
    story_dup_1 = story_original.duplicate()

    assert story_original.properties.energy.host is story_original
    assert story_dup_1.properties.energy.host is story_dup_1
    assert story_original.properties.energy.host is not \
        story_dup_1.properties.energy.host

    assert story_original.properties.energy.construction_set == \
        story_dup_1.properties.energy.construction_set
    story_dup_1.properties.energy.construction_set = mass_set
    assert story_original.properties.energy.construction_set != \
        story_dup_1.properties.energy.construction_set

    room_dup_2 = story_dup_1.duplicate()

    assert story_dup_1.properties.energy.construction_set == \
        room_dup_2.properties.energy.construction_set
    room_dup_2.properties.energy.construction_set = None
    assert story_dup_1.properties.energy.construction_set != \
        room_dup_2.properties.energy.construction_set
예제 #30
0
    def from_dict(cls, data, host):
        """Create BuildingEnergyProperties from a dictionary.

        Note that the dictionary must be a non-abridged version for this
        classmethod to work.

        Args:
            data: A dictionary representation of BuildingEnergyProperties.
            host: A Building object that hosts these properties.
        """
        assert data['type'] == 'BuildingEnergyProperties', \
            'Expected BuildingEnergyProperties. Got {}.'.format(data['type'])

        new_prop = cls(host)
        if 'construction_set' in data and data['construction_set'] is not None:
            new_prop.construction_set = \
                ConstructionSet.from_dict(data['construction_set'])

        return new_prop