def test_window_construction_init_shade(): """Test the initalization of WindowConstruction objects with shades.""" lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517, 0.359, 0.714, 0.207, 0, 0.84, 0.046578, 1.0) 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) shade_mat = EnergyWindowMaterialShade('Low-e Diffusing Shade', 0.025, 0.15, 0.5, 0.25, 0.5, 0, 0.4, 0.2, 0.1, 0.75, 0.25) double_low_e_shade = WindowConstruction( 'Double Low-E with Shade', [lowe_glass, gap, clear_glass, shade_mat]) double_low_e_between_shade = WindowConstruction( 'Double Low-E Between Shade', [lowe_glass, shade_mat, clear_glass]) double_low_e_ext_shade = WindowConstruction( 'Double Low-E Outside Shade', [shade_mat, lowe_glass, gap, clear_glass]) assert double_low_e_shade.name == 'Double Low-E with Shade' assert double_low_e_shade.u_factor == pytest.approx(0.9091, rel=1e-2) assert double_low_e_between_shade.name == 'Double Low-E Between Shade' assert double_low_e_between_shade.u_factor == pytest.approx(1.13374, rel=1e-2) assert double_low_e_ext_shade.name == 'Double Low-E Outside Shade' assert double_low_e_ext_shade.u_factor == pytest.approx(0.97678, rel=1e-2)
def test_window_temperature_profile(): """Test the window construction temperature profile.""" 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]) temperatures, r_values = triple_clear.temperature_profile() assert len(temperatures) == 8 assert temperatures[0] == pytest.approx(-18, rel=1e-2) assert temperatures[-1] == pytest.approx(21, rel=1e-2) assert len(r_values) == 7 assert sum(r_values) == pytest.approx(triple_clear.r_factor, rel=1e-1) assert r_values[-1] == pytest.approx((1 / triple_clear.in_h_simple()), rel=1) temperatures, r_values = triple_clear.temperature_profile( 36, 21, 4, 2., 180.0, 100000) assert len(temperatures) == 8 assert temperatures[0] == pytest.approx(36, rel=1e-2) assert temperatures[-1] == pytest.approx(21, rel=1e-2) assert len(r_values) == 7
def test_window_construction_init_blind(): """Test the initalization of WindowConstruction objects with blinds.""" lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517, 0.359, 0.714, 0.207, 0, 0.84, 0.046578, 1.0) 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) shade_mat = EnergyWindowMaterialBlind('Plastic Blind', 'Vertical', 0.025, 0.01875, 0.003, 90, 0.2, 0.05, 0.4, 0.05, 0.45, 0, 0.95, 0.1, 1) double_low_e_shade = WindowConstruction( 'Double Low-E with Shade', [lowe_glass, gap, clear_glass, shade_mat]) double_low_e_between_shade = WindowConstruction( 'Double Low-E Between Shade', [lowe_glass, shade_mat, clear_glass]) double_low_e_ext_shade = WindowConstruction( 'Double Low-E Outside Shade', [shade_mat, lowe_glass, gap, clear_glass]) assert double_low_e_shade.name == 'Double Low-E with Shade' assert double_low_e_shade.u_factor == pytest.approx(1.26296, rel=1e-2) assert double_low_e_between_shade.name == 'Double Low-E Between Shade' assert double_low_e_between_shade.u_factor == pytest.approx(1.416379, rel=1e-2) assert double_low_e_ext_shade.name == 'Double Low-E Outside Shade' assert double_low_e_ext_shade.u_factor == pytest.approx(1.2089, rel=1e-2)
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
def test_window_dict_methods(): """Test the to/from dict methods.""" 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]) constr_dict = triple_clear.to_dict() new_constr = WindowConstruction.from_dict(constr_dict) assert constr_dict == new_constr.to_dict()
def test_window_to_from_standards_dict(): """Test the initialization of OpaqueConstruction objects from standards gem.""" filename = './tests/standards/OpenStudio_Standards_materials.json' if filename: with open(filename, 'r') as f: data_store = json.load(f) standards_dict = { "name": "U 0.19 SHGC 0.20 Trp LoE Film (55) Bronze 6mm/13mm Air", "intended_surface_type": "ExteriorWindow", "standards_construction_type": "Metal framing (all other)", "insulation_layer": None, "skylight_framing": None, "materials": ["BRONZE 6MM", "AIR 13MM", "COATED POLY-55", "AIR 13MM", "CLEAR 3MM"] } glaz_constr = WindowConstruction.from_standards_dict( standards_dict, data_store) assert glaz_constr.name == 'U 0.19 SHGC 0.20 Trp LoE Film (55) Bronze 6mm/13mm Air' assert glaz_constr.r_value == pytest.approx(0.645449, rel=1e-2) assert glaz_constr.u_value == pytest.approx(1.549307, rel=1e-2) assert glaz_constr.u_factor == pytest.approx(1.2237779, rel=1e-2) assert glaz_constr.r_factor == pytest.approx(0.817141, rel=1e-2)
def test_check_duplicate_construction_names(): """Test the check_duplicate_construction_names method.""" room = Room.from_box('Tiny House Zone', 5, 10, 3) stone = EnergyMaterial('Thick Stone', 0.3, 2.31, 2322, 832, 'Rough', 0.95, 0.75, 0.8) thermal_mass_constr = OpaqueConstruction('Custom Construction', [stone]) room[0].properties.energy.construction = thermal_mass_constr north_face = room[1] aperture_verts = [ Point3D(4.5, 10, 1), Point3D(2.5, 10, 1), Point3D(2.5, 10, 2.5), Point3D(4.5, 10, 2.5) ] aperture = Aperture('Front Aperture', Face3D(aperture_verts)) aperture.is_operable = True triple_pane = WindowConstruction( 'Custom Window Construction', [clear_glass, air_gap, clear_glass, air_gap, clear_glass]) aperture.properties.energy.construction = triple_pane north_face.add_aperture(aperture) model = Model('Tiny House', [room]) assert model.properties.energy.check_duplicate_construction_names(False) triple_pane.unlock() triple_pane.name = 'Custom Construction' triple_pane.lock() assert not model.properties.energy.check_duplicate_construction_names( False) with pytest.raises(ValueError): model.properties.energy.check_duplicate_construction_names(True)
def test_window_construction_init(): """Test the initalization of WindowConstruction objects and basic properties.""" lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517, 0.359, 0.714, 0.207, 0, 0.84, 0.046578, 1.0) 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) double_low_e = WindowConstruction('Double Low-E Window', [lowe_glass, gap, clear_glass]) double_clear = WindowConstruction('Double Clear Window', [clear_glass, gap, clear_glass]) triple_clear = WindowConstruction( 'Triple Clear Window', [clear_glass, gap, clear_glass, gap, clear_glass]) double_low_e_dup = double_low_e.duplicate() str(double_low_e) # test the string representation of the construction assert double_low_e.name == double_low_e_dup.name == 'Double Low-E Window' assert len(double_low_e.materials) == len(double_low_e_dup.materials) == 3 assert double_low_e.r_value == double_low_e_dup.r_value == \ pytest.approx(0.41984, rel=1e-2) assert double_low_e.u_value == double_low_e_dup.u_value == \ pytest.approx(2.3818, rel=1e-2) assert double_low_e.u_factor == double_low_e_dup.u_factor == \ pytest.approx(1.69802, rel=1e-2) assert double_low_e.r_factor == double_low_e_dup.r_factor == \ pytest.approx(0.588919, rel=1e-2) assert double_low_e.inside_emissivity == \ double_low_e_dup.inside_emissivity == 0.84 assert double_low_e.outside_emissivity == \ double_low_e_dup.outside_emissivity == 0.84 assert double_low_e.unshaded_solar_transmittance == \ double_low_e_dup.unshaded_solar_transmittance == 0.4517 * 0.770675 assert double_low_e.unshaded_visible_transmittance == \ double_low_e_dup.unshaded_visible_transmittance == 0.714 * 0.8836 assert double_low_e.glazing_count == double_low_e_dup.glazing_count == 2 assert double_low_e.gap_count == double_low_e_dup.gap_count == 1 assert double_low_e.has_shade is double_low_e_dup.has_shade is False assert double_low_e.shade_location is double_low_e_dup.shade_location is None assert double_clear.u_factor == pytest.approx(2.72, rel=1e-2) assert double_low_e.u_factor == pytest.approx(1.698, rel=1e-2) assert triple_clear.u_factor == pytest.approx(1.757, rel=1e-2)
def test_window_construction_init_from_idf_file(): """Test the initalization of WindowConstruction from file.""" lbnl_window_idf_file = './tests/idf/GlzSys_Triple Clear_Avg.idf' glaz_constrs, glaz_mats = WindowConstruction.extract_all_from_idf_file( lbnl_window_idf_file) assert len(glaz_mats) == 2 glaz_constr = glaz_constrs[0] constr_str = glaz_constr.to_idf() mat_str = [mat.to_idf() for mat in glaz_constr.unique_materials] new_glaz_constr = WindowConstruction.from_idf(constr_str, mat_str) new_constr_str = new_glaz_constr.to_idf() assert glaz_constr.name == new_glaz_constr.name == 'GlzSys_5' assert glaz_constr.u_factor == new_glaz_constr.u_factor == \ pytest.approx(1.75728, rel=1e-2) assert glaz_constr.thickness == new_glaz_constr.thickness == \ pytest.approx(0.0425, rel=1e-2) assert constr_str == new_constr_str
def test_window_lockability(): """Test the lockability of the window construction.""" 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) double_clear = WindowConstruction('Double Clear Window', [clear_glass, gap, clear_glass]) double_clear.materials = [clear_glass, gap, clear_glass, gap, clear_glass] double_clear.lock() with pytest.raises(AttributeError): double_clear.materials = [clear_glass] with pytest.raises(AttributeError): double_clear[0].solar_transmittance = 0.45 double_clear.unlock() double_clear.materials = [clear_glass] double_clear[0].solar_transmittance = 0.45
def test_window_equivalency(): """Test the equality of a window construction to another.""" 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) double_clear = WindowConstruction('Clear Window', [clear_glass, gap, clear_glass]) double_clear_2 = double_clear.duplicate() triple_clear = WindowConstruction( 'Clear Window', [clear_glass, gap, clear_glass, gap, clear_glass]) double_clear_3 = WindowConstruction('Double Clear Window', [clear_glass, gap, clear_glass]) collection = [double_clear, double_clear, double_clear_2, triple_clear] assert len(set(collection)) == 2 assert double_clear == double_clear_2 assert double_clear != triple_clear assert double_clear != double_clear_3 double_clear_2.name = 'Cool Window' assert double_clear != double_clear_2
def test_window_construction_init_gas_mixture(): """Test the initalization of WindowConstruction objects with a gas mixture.""" lowe_glass = EnergyWindowMaterialGlazing('Low-e Glass', 0.00318, 0.4517, 0.359, 0.714, 0.207, 0, 0.84, 0.046578, 1.0) clear_glass = EnergyWindowMaterialGlazing('Clear Glass', 0.005715, 0.770675, 0.07, 0.8836, 0.0804, 0, 0.84, 0.84, 1.0) air_argon = EnergyWindowMaterialGasMixture('Air Argon Gap', 0.0125, ('Air', 'Argon'), (0.1, 0.9)) double_low_e_argon = WindowConstruction( 'Double Low-E with Argon', [lowe_glass, air_argon, clear_glass]) assert double_low_e_argon.u_factor == pytest.approx(1.46319708, rel=1e-2)
def test_from_dict(): """Test the Aperture from_dict method with energy properties.""" aperture = Aperture.from_vertices( 'wall_window', [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]]) 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_pane = WindowConstruction( 'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass]) aperture.properties.energy.construction = triple_pane ad = aperture.to_dict() new_aperture = Aperture.from_dict(ad) assert new_aperture.properties.energy.construction == triple_pane assert new_aperture.to_dict() == ad
def test_set_construction(): """Test the setting of a construction on an Aperture.""" vertices_wall = [[0, 0, 0], [0, 10, 0], [0, 10, 3], [0, 0, 3]] 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_pane = WindowConstruction( 'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass]) aperture = Aperture.from_vertices('wall window', vertices_wall) aperture.properties.energy.construction = triple_pane assert aperture.properties.energy.construction == triple_pane assert aperture.properties.energy.is_construction_set_by_user with pytest.raises(AttributeError): aperture.properties.energy.construction[0].thickness = 0.1
def test_to_dict(): """Test the Aperture to_dict method with energy properties.""" aperture = Aperture.from_vertices( 'wall_window', [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]]) 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_pane = WindowConstruction( 'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass]) ad = aperture.to_dict() assert 'properties' in ad assert ad['properties']['type'] == 'ApertureProperties' assert 'energy' in ad['properties'] assert ad['properties']['energy']['type'] == 'ApertureEnergyProperties' aperture.properties.energy.construction = triple_pane ad = aperture.to_dict() assert 'construction' in ad['properties']['energy'] assert ad['properties']['energy']['construction'] is not None
def test_duplicate(): """Test what happens to energy properties when duplicating an Aperture.""" verts = [ Point3D(0, 0, 0), Point3D(10, 0, 0), Point3D(10, 0, 10), Point3D(0, 0, 10) ] 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_pane = WindowConstruction( 'Triple Pane', [clear_glass, gap, clear_glass, gap, clear_glass]) aperture_original = Aperture('wall window', Face3D(verts)) aperture_dup_1 = aperture_original.duplicate() assert aperture_original.properties.energy.host is aperture_original assert aperture_dup_1.properties.energy.host is aperture_dup_1 assert aperture_original.properties.energy.host is not \ aperture_dup_1.properties.energy.host assert aperture_original.properties.energy.construction == \ aperture_dup_1.properties.energy.construction aperture_dup_1.properties.energy.construction = triple_pane assert aperture_original.properties.energy.construction != \ aperture_dup_1.properties.energy.construction aperture_dup_2 = aperture_dup_1.duplicate() assert aperture_dup_1.properties.energy.construction == \ aperture_dup_2.properties.energy.construction aperture_dup_2.properties.energy.construction = None assert aperture_dup_1.properties.energy.construction != \ aperture_dup_2.properties.energy.construction
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()
def test_to_from_dict(): """Test the Model to_dict and from_dict method with a single zone model.""" room = Room.from_box('Tiny House Zone', 5, 10, 3) room.properties.energy.program_type = office_program room.properties.energy.hvac = IdealAirSystem() stone = EnergyMaterial('Thick Stone', 0.3, 2.31, 2322, 832, 'Rough', 0.95, 0.75, 0.8) thermal_mass_constr = OpaqueConstruction('Thermal Mass Floor', [stone]) room[0].properties.energy.construction = thermal_mass_constr south_face = room[3] south_face.apertures_by_ratio(0.4, 0.01) south_face.apertures[0].overhang(0.5, indoor=False) south_face.apertures[0].overhang(0.5, indoor=True) south_face.apertures[0].move_shades(Vector3D(0, 0, -0.5)) light_shelf_out = ShadeConstruction('Outdoor Light Shelf', 0.5, 0.5) light_shelf_in = ShadeConstruction('Indoor Light Shelf', 0.7, 0.7) south_face.apertures[0].shades[ 0].properties.energy.construction = light_shelf_out south_face.apertures[0].shades[ 1].properties.energy.construction = light_shelf_in north_face = room[1] door_verts = [ Point3D(2, 10, 0.1), Point3D(1, 10, 0.1), Point3D(1, 10, 2.5), Point3D(2, 10, 2.5) ] door = Door('Front Door', Face3D(door_verts)) north_face.add_door(door) aperture_verts = [ Point3D(4.5, 10, 1), Point3D(2.5, 10, 1), Point3D(2.5, 10, 2.5), Point3D(4.5, 10, 2.5) ] aperture = Aperture('Front Aperture', Face3D(aperture_verts)) aperture.is_operable = True triple_pane = WindowConstruction( 'Triple Pane Window', [clear_glass, air_gap, clear_glass, air_gap, clear_glass]) aperture.properties.energy.construction = triple_pane north_face.add_aperture(aperture) tree_canopy_geo = Face3D.from_regular_polygon( 6, 2, Plane(Vector3D(0, 0, 1), Point3D(5, -3, 4))) tree_canopy = Shade('Tree Canopy', tree_canopy_geo) tree_trans = ScheduleRuleset.from_constant_value('Tree Transmittance', 0.75, schedule_types.fractional) tree_canopy.properties.energy.transmittance_schedule = tree_trans model = Model('Tiny House', [room], orphaned_shades=[tree_canopy]) model.north_angle = 15 model_dict = model.to_dict() new_model = Model.from_dict(model_dict) assert model_dict == new_model.to_dict() assert stone in new_model.properties.energy.materials assert thermal_mass_constr in new_model.properties.energy.constructions assert new_model.rooms[0][ 0].properties.energy.construction == thermal_mass_constr assert new_model.rooms[0][3].apertures[0].indoor_shades[ 0].properties.energy.construction == light_shelf_in assert new_model.rooms[0][3].apertures[0].outdoor_shades[ 0].properties.energy.construction == light_shelf_out assert triple_pane in new_model.properties.energy.constructions assert new_model.rooms[0][1].apertures[ 0].properties.energy.construction == triple_pane assert new_model.rooms[0][1].apertures[0].is_operable assert len(new_model.orphaned_shades) == 1 assert new_model.north_angle == 15 assert new_model.rooms[0][0].type == face_types.floor assert new_model.rooms[0][1].type == face_types.wall assert isinstance(new_model.rooms[0][0].boundary_condition, Ground) assert isinstance(new_model.rooms[0][1].boundary_condition, Outdoors) assert new_model.rooms[0].properties.energy.program_type == office_program assert len(new_model.properties.energy.schedule_type_limits) == 3 assert len(model.properties.energy.schedules) == 8 assert new_model.rooms[0].properties.energy.is_conditioned assert new_model.rooms[0].properties.energy.hvac == IdealAirSystem() assert new_model.orphaned_shades[ 0].properties.energy.transmittance_schedule == tree_trans
def test_to_dict_single_zone(): """Test the Model to_dict method with a single zone model.""" room = Room.from_box('Tiny House Zone', 5, 10, 3) room.properties.energy.program_type = office_program room.properties.energy.hvac = IdealAirSystem() stone = EnergyMaterial('Thick Stone', 0.3, 2.31, 2322, 832, 'Rough', 0.95, 0.75, 0.8) thermal_mass_constr = OpaqueConstruction('Thermal Mass Floor', [stone]) room[0].properties.energy.construction = thermal_mass_constr south_face = room[3] south_face.apertures_by_ratio(0.4, 0.01) south_face.apertures[0].overhang(0.5, indoor=False) south_face.apertures[0].overhang(0.5, indoor=True) south_face.move_shades(Vector3D(0, 0, -0.5)) light_shelf_out = ShadeConstruction('Outdoor Light Shelf', 0.5, 0.5) light_shelf_in = ShadeConstruction('Indoor Light Shelf', 0.7, 0.7) south_face.apertures[0].outdoor_shades[ 0].properties.energy.construction = light_shelf_out south_face.apertures[0].indoor_shades[ 0].properties.energy.construction = light_shelf_in north_face = room[1] north_face.overhang(0.25, indoor=False) door_verts = [ Point3D(2, 10, 0.1), Point3D(1, 10, 0.1), Point3D(1, 10, 2.5), Point3D(2, 10, 2.5) ] door = Door('Front Door', Face3D(door_verts)) north_face.add_door(door) aperture_verts = [ Point3D(4.5, 10, 1), Point3D(2.5, 10, 1), Point3D(2.5, 10, 2.5), Point3D(4.5, 10, 2.5) ] aperture = Aperture('Front Aperture', Face3D(aperture_verts)) triple_pane = WindowConstruction( 'Triple Pane Window', [clear_glass, air_gap, clear_glass, air_gap, clear_glass]) aperture.properties.energy.construction = triple_pane north_face.add_aperture(aperture) tree_canopy_geo = Face3D.from_regular_polygon( 6, 2, Plane(Vector3D(0, 0, 1), Point3D(5, -3, 4))) tree_canopy = Shade('Tree Canopy', tree_canopy_geo) table_geo = Face3D.from_rectangle(2, 2, Plane(o=Point3D(1.5, 4, 1))) table = Shade('Table', table_geo) room.add_indoor_shade(table) model = Model('Tiny House', [room], orphaned_shades=[tree_canopy]) model.north_angle = 15 model_dict = model.to_dict() 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 'global_construction_set' in model_dict['properties']['energy'] assert len(model_dict['properties']['energy']['materials']) == 16 assert len(model_dict['properties']['energy']['constructions']) == 18 assert len(model_dict['properties']['energy']['construction_sets']) == 1 assert model_dict['rooms'][0]['faces'][0]['properties']['energy']['construction'] == \ thermal_mass_constr.name south_ap_dict = model_dict['rooms'][0]['faces'][3]['apertures'][0] assert south_ap_dict['outdoor_shades'][0]['properties']['energy']['construction'] == \ light_shelf_out.name assert south_ap_dict['indoor_shades'][0]['properties']['energy']['construction'] == \ light_shelf_in.name assert model_dict['rooms'][0]['faces'][1]['apertures'][0]['properties']['energy']['construction'] == \ triple_pane.name assert model_dict['rooms'][0]['properties']['energy']['program_type'] == \ office_program.name assert model_dict['rooms'][0]['properties']['energy']['hvac'] == \ IdealAirSystem().to_dict() """
'Generic Interior Ceiling'] = generic_interior_ceiling try: generic_underground_roof = _idf_opaque_constructions[ 'Generic Underground Roof'] except KeyError: generic_underground_roof = OpaqueConstruction( 'Generic Underground Roof', _default_prop['generic_underground_roof']) generic_underground_roof.lock() _idf_opaque_constructions[ 'Generic Underground Roof'] = generic_underground_roof try: generic_double_pane = _idf_window_constructions['Generic Double Pane'] except KeyError: generic_double_pane = WindowConstruction( 'Generic Double Pane', _default_prop['generic_double_pane']) generic_double_pane.lock() _idf_window_constructions['Generic Double Pane'] = generic_double_pane try: generic_single_pane = _idf_window_constructions['Generic Single Pane'] except KeyError: generic_single_pane = WindowConstruction( 'Generic Single Pane', _default_prop['generic_single_pane']) generic_single_pane.lock() _idf_window_constructions['Generic Single Pane'] = generic_single_pane try: generic_exterior_door = _idf_opaque_constructions['Generic Exterior Door'] except KeyError: generic_exterior_door = OpaqueConstruction(