def test_create_buildingsurfacedetailed(self):

        pyidf.validation_level = ValidationLevel.error

        obj = BuildingSurfaceDetailed()
        # alpha
        var_name = "Name"
        obj.name = var_name
        # alpha
        var_surface_type = "Floor"
        obj.surface_type = var_surface_type
        # object-list
        var_construction_name = "object-list|Construction Name"
        obj.construction_name = var_construction_name
        # object-list
        var_zone_name = "object-list|Zone Name"
        obj.zone_name = var_zone_name
        # alpha
        var_outside_boundary_condition = "Adiabatic"
        obj.outside_boundary_condition = var_outside_boundary_condition
        # object-list
        var_outside_boundary_condition_object = "object-list|Outside Boundary Condition Object"
        obj.outside_boundary_condition_object = var_outside_boundary_condition_object
        # alpha
        var_sun_exposure = "SunExposed"
        obj.sun_exposure = var_sun_exposure
        # alpha
        var_wind_exposure = "WindExposed"
        obj.wind_exposure = var_wind_exposure
        # real
        var_view_factor_to_ground = 0.5
        obj.view_factor_to_ground = var_view_factor_to_ground
        # real
        var_number_of_vertices = 3.0
        obj.number_of_vertices = var_number_of_vertices
        paras = []
        var_vertex_1_xcoordinate = 11.11
        paras.append(var_vertex_1_xcoordinate)
        var_vertex_1_ycoordinate = 12.12
        paras.append(var_vertex_1_ycoordinate)
        var_vertex_1_zcoordinate = 13.13
        paras.append(var_vertex_1_zcoordinate)
        obj.add_extensible(*paras)

        idf = IDF()
        idf.add(obj)
        idf.save(self.path, check=False)

        with open(self.path, mode='r') as f:
            for line in f:
                log.debug(line.strip())

        idf2 = IDF(self.path)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].name, var_name)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].surface_type,
                         var_surface_type)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].construction_name,
                         var_construction_name)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].zone_name,
                         var_zone_name)
        self.assertEqual(
            idf2.buildingsurfacedetaileds[0].outside_boundary_condition,
            var_outside_boundary_condition)
        self.assertEqual(
            idf2.buildingsurfacedetaileds[0].outside_boundary_condition_object,
            var_outside_boundary_condition_object)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].sun_exposure,
                         var_sun_exposure)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].wind_exposure,
                         var_wind_exposure)
        self.assertAlmostEqual(
            idf2.buildingsurfacedetaileds[0].view_factor_to_ground,
            var_view_factor_to_ground)
        self.assertAlmostEqual(
            idf2.buildingsurfacedetaileds[0].number_of_vertices,
            var_number_of_vertices)
        index = obj.extensible_field_index("Vertex 1 X-coordinate")
        self.assertAlmostEqual(
            idf2.buildingsurfacedetaileds[0].extensibles[0][index],
            var_vertex_1_xcoordinate)
        index = obj.extensible_field_index("Vertex 1 Y-coordinate")
        self.assertAlmostEqual(
            idf2.buildingsurfacedetaileds[0].extensibles[0][index],
            var_vertex_1_ycoordinate)
        index = obj.extensible_field_index("Vertex 1 Z-coordinate")
        self.assertAlmostEqual(
            idf2.buildingsurfacedetaileds[0].extensibles[0][index],
            var_vertex_1_zcoordinate)
    def test_create_buildingsurfacedetailed(self):

        pyidf.validation_level = ValidationLevel.error

        obj = BuildingSurfaceDetailed()
        # alpha
        var_name = "Name"
        obj.name = var_name
        # alpha
        var_surface_type = "Floor"
        obj.surface_type = var_surface_type
        # object-list
        var_construction_name = "object-list|Construction Name"
        obj.construction_name = var_construction_name
        # object-list
        var_zone_name = "object-list|Zone Name"
        obj.zone_name = var_zone_name
        # alpha
        var_outside_boundary_condition = "Adiabatic"
        obj.outside_boundary_condition = var_outside_boundary_condition
        # object-list
        var_outside_boundary_condition_object = "object-list|Outside Boundary Condition Object"
        obj.outside_boundary_condition_object = var_outside_boundary_condition_object
        # alpha
        var_sun_exposure = "SunExposed"
        obj.sun_exposure = var_sun_exposure
        # alpha
        var_wind_exposure = "WindExposed"
        obj.wind_exposure = var_wind_exposure
        # real
        var_view_factor_to_ground = 0.5
        obj.view_factor_to_ground = var_view_factor_to_ground
        # real
        var_number_of_vertices = 3.0
        obj.number_of_vertices = var_number_of_vertices
        paras = []
        var_vertex_1_xcoordinate = 11.11
        paras.append(var_vertex_1_xcoordinate)
        var_vertex_1_ycoordinate = 12.12
        paras.append(var_vertex_1_ycoordinate)
        var_vertex_1_zcoordinate = 13.13
        paras.append(var_vertex_1_zcoordinate)
        obj.add_extensible(*paras)
        

        idf = IDF()
        idf.add(obj)
        idf.save(self.path, check=False)

        with open(self.path, mode='r') as f:
            for line in f:
                log.debug(line.strip())

        idf2 = IDF(self.path)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].name, var_name)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].surface_type, var_surface_type)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].construction_name, var_construction_name)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].zone_name, var_zone_name)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].outside_boundary_condition, var_outside_boundary_condition)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].outside_boundary_condition_object, var_outside_boundary_condition_object)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].sun_exposure, var_sun_exposure)
        self.assertEqual(idf2.buildingsurfacedetaileds[0].wind_exposure, var_wind_exposure)
        self.assertAlmostEqual(idf2.buildingsurfacedetaileds[0].view_factor_to_ground, var_view_factor_to_ground)
        self.assertAlmostEqual(idf2.buildingsurfacedetaileds[0].number_of_vertices, var_number_of_vertices)
        index = obj.extensible_field_index("Vertex 1 X-coordinate")
        self.assertAlmostEqual(idf2.buildingsurfacedetaileds[0].extensibles[0][index], var_vertex_1_xcoordinate)
        index = obj.extensible_field_index("Vertex 1 Y-coordinate")
        self.assertAlmostEqual(idf2.buildingsurfacedetaileds[0].extensibles[0][index], var_vertex_1_ycoordinate)
        index = obj.extensible_field_index("Vertex 1 Z-coordinate")
        self.assertAlmostEqual(idf2.buildingsurfacedetaileds[0].extensibles[0][index], var_vertex_1_zcoordinate)
Beispiel #3
0
    obj24 = GlobalGeometryRules()
    obj24.starting_vertex_position = "UpperLeftCorner"
    obj24.vertex_entry_direction = "Counterclockwise"
    obj24.coordinate_system = "World"
    idf.add(obj24)

    obj25 = BuildingSurfaceDetailed()
    obj25.name = "SURFACE NORTH"
    obj25.surface_type = "Wall"
    obj25.construction_name = "LTWALL"
    obj25.zone_name = "ZONE ONE"
    obj25.outside_boundary_condition = "Outdoors"
    obj25.outside_boundary_condition_object = None
    obj25.sun_exposure = "SunExposed"
    obj25.wind_exposure = "WindExposed"
    obj25.view_factor_to_ground = 0.5
    obj25.number_of_vertices = 4.0
    obj25.add_extensible(8.0, 6.0, 2.7)
    obj25.add_extensible(8.0, 6.0, 0.0)
    obj25.add_extensible(0.0, 6.0, 0.0)
    obj25.add_extensible(0.0, 6.0, 2.7)
    idf.add(obj25)

    obj26 = BuildingSurfaceDetailed()
    obj26.name = "ZONE SURFACE EAST"
    obj26.surface_type = "Wall"
    obj26.construction_name = "LTWALL"
    obj26.zone_name = "ZONE ONE"
    obj26.outside_boundary_condition = "Outdoors"
    obj26.outside_boundary_condition_object = None
    obj24 = GlobalGeometryRules()
    obj24.starting_vertex_position = "UpperLeftCorner"
    obj24.vertex_entry_direction = "Counterclockwise"
    obj24.coordinate_system = "World"
    idf.add(obj24)

    obj25 = BuildingSurfaceDetailed()
    obj25.name = "SURFACE NORTH"
    obj25.surface_type = "Wall"
    obj25.construction_name = "LTWALL"
    obj25.zone_name = "ZONE ONE"
    obj25.outside_boundary_condition = "Outdoors"
    obj25.outside_boundary_condition_object = None
    obj25.sun_exposure = "SunExposed"
    obj25.wind_exposure = "WindExposed"
    obj25.view_factor_to_ground = 0.5
    obj25.number_of_vertices = 4.0
    obj25.add_extensible(8.0, 6.0, 2.7)
    obj25.add_extensible(8.0, 6.0, 0.0)
    obj25.add_extensible(0.0, 6.0, 0.0)
    obj25.add_extensible(0.0, 6.0, 2.7)
    idf.add(obj25)

    obj26 = BuildingSurfaceDetailed()
    obj26.name = "ZONE SURFACE EAST"
    obj26.surface_type = "Wall"
    obj26.construction_name = "LTWALL"
    obj26.zone_name = "ZONE ONE"
    obj26.outside_boundary_condition = "Outdoors"
    obj26.outside_boundary_condition_object = None