def test_pythonic(): """py.test for ex_pythonic.py""" zones = bunchdt["zone"] # all the zones zone0 = zones[0] # - printout = "PLENUM-1" assert zone0.Name == printout # - printout = [ "PLENUM-1", "SPACE1-1", "SPACE2-1", "SPACE3-1", "SPACE4-1", "SPACE5-1", "Sup-PLENUM-1", ] zonenames = [zone.Name for zone in zones] assert printout == zonenames # - printout = [ "283.2", "239.247360229", "103.311355591", "239.247360229", "103.311355591", "447.682556152", "208.6", ] zonevolumes = [zone.Volume for zone in zones] for item1, item2 in zip(printout, zonevolumes): item1, item2 = float(item1), float(item2) assert pytest_helpers.almostequal(item1, item2) # - printout = [("SPACE2-1", "103.311355591"), ("SPACE4-1", "103.311355591")] smallzones = [zn for zn in zones if float(zn.Volume) < 150] namevolume = [(zn.Name, zn.Volume) for zn in smallzones] for (n1, v1), (n2, v2) in zip(printout, namevolume): (n1, v1) = (n1, float(v1)) (n2, v2) = (n2, float(v2)) assert n1 == n2 assert pytest_helpers.almostequal(v1, v2) # - printout = 2 assert printout == len(smallzones) # - printout = [ "PLENUM-1", "SPACE1-1", "FIRST-SMALL-ZONE", "SPACE3-1", "SECOND-SMALL-ZONE", "SPACE5-1", "Sup-PLENUM-1", ] smallzones[0].Name = "FIRST-SMALL-ZONE" smallzones[1].Name = "SECOND-SMALL-ZONE" # now the zone names are: zonenames = [zone.Name for zone in zones] assert printout == zonenames
def test_heatcapacity_airgap_construction(self): self.idf.initreadtxt(air_gap) c = self.idf.getobject('CONSTRUCTION', 'TestConstruction') m = self.idf.getobject('MATERIAL', 'TestMaterial') expected = m.Thickness * m.Specific_Heat * m.Density * 0.001 * 2 assert almostequal(c.heatcapacity, expected, places=2) assert almostequal(c.heatcapacity, 240, places=2)
def test_heatcapacity_infraredtransparent_construction(self): self.idf.initreadtxt(infrared_transparent) c = self.idf.getobject("CONSTRUCTION", "TestConstruction") m = self.idf.getobject("MATERIAL", "TestMaterial") expected = m.Thickness * m.Specific_Heat * m.Density * 0.001 * 2 assert almostequal(c.heatcapacity, expected, places=2) assert almostequal(c.heatcapacity, 240, places=2)
def test_ufactor_infraredtransparent_construction(self): self.idf.initreadtxt(infrared_transparent) c = self.idf.getobject("CONSTRUCTION", "TestConstruction") m = self.idf.getobject("MATERIAL", "TestMaterial") expected = 1 / (INSIDE_FILM_R + m.Thickness / m.Conductivity + m.Thickness / m.Conductivity + OUTSIDE_FILM_R) assert almostequal(c.ufactor, expected, places=2) assert almostequal(c.ufactor, 1 / 0.55, places=2)
def test_rvalue_infraredtransparent_construction(self): self.idf.initreadtxt(infrared_transparent) c = self.idf.getobject('CONSTRUCTION', 'TestConstruction') m = self.idf.getobject('MATERIAL', 'TestMaterial') expected = (INSIDE_FILM_R + m.Thickness / m.Conductivity + m.Thickness / m.Conductivity + OUTSIDE_FILM_R) assert almostequal(c.rvalue, expected, places=2) assert almostequal(c.rvalue, 0.55, places=2)
def test_bhp2pascal(): """py.test for bhp2pascal""" bhp = 10.182489271962908 cfm = 74999.99998975938 fan_tot_eff = 0.58 exp_pascal, exp_m3s = (124.544455, 35.39605824) result_pascal, result_m3s = fanpower.bhp2pascal(bhp, cfm, fan_tot_eff) assert almostequal(result_pascal, exp_pascal) assert almostequal(result_m3s, exp_m3s)
def test_watts2pascal(): """py.test for watts2pascal""" watts = 7593.0822501027405 cfm = 74999.99998975938 fan_tot_eff = 0.58 exp_pascal, exp_m3s = (124.544455, 35.39605824) result_pascal, result_m3s = fanpower.watts2pascal(watts, cfm, fan_tot_eff) assert almostequal(result_pascal, exp_pascal) assert almostequal(result_m3s, exp_m3s)
def test_surface_function(): fhandle = StringIO(idftxt) idf = IDF(fhandle) surface = idf.idfobjects["BuildingSurface:Detailed"][0] # test the azimuth assert almostequal(surface.azimuth, 180, places=3) == True # test the true azimuth assert almostequal(surface.true_azimuth, 255, places=3) == True
def test_rvalue_nomass_construction(self): self.idf.initreadtxt(no_mass) c = self.idf.getobject('CONSTRUCTION', 'TestConstruction') m = self.idf.getobject('MATERIAL', 'TestMaterial') n = self.idf.getobject('MATERIAL:NOMASS', 'NoMass') expected = (INSIDE_FILM_R + m.Thickness / m.Conductivity + n.Thermal_Resistance + m.Thickness / m.Conductivity + OUTSIDE_FILM_R) assert almostequal(c.rvalue, expected, places=2) assert almostequal(c.rvalue, 0.65, places=2)
def test_rvalue_airgap_construction(self): self.idf.initreadtxt(air_gap) c = self.idf.getobject('CONSTRUCTION', 'TestConstruction') m = self.idf.getobject('MATERIAL', 'TestMaterial') a = self.idf.getobject('MATERIAL:AIRGAP', 'AirGap') expected = (INSIDE_FILM_R + m.Thickness / m.Conductivity + a.Thermal_Resistance + m.Thickness / m.Conductivity + OUTSIDE_FILM_R) assert almostequal(c.rvalue, expected, places=2) assert almostequal(c.rvalue, 0.65, places=2)
def test_ufactor_airgap_construction(self): self.idf.initreadtxt(air_gap) c = self.idf.getobject("CONSTRUCTION", "TestConstruction") m = self.idf.getobject("MATERIAL", "TestMaterial") a = self.idf.getobject("MATERIAL:AIRGAP", "AirGap") expected = 1 / (INSIDE_FILM_R + m.Thickness / m.Conductivity + a.Thermal_Resistance + m.Thickness / m.Conductivity + OUTSIDE_FILM_R) assert almostequal(c.ufactor, expected, places=2) assert almostequal(c.ufactor, 1 / 0.65, places=2)
def test_heatcapacity_nomass_construction(self): self.idf.initreadtxt(no_mass) c = self.idf.getobject("CONSTRUCTION", "TestConstruction") m = self.idf.getobject("MATERIAL", "TestMaterial") expected = m.Thickness * m.Specific_Heat * m.Density * 0.001 * 2 with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") assert almostequal(c.heatcapacity, expected, places=2) assert almostequal(c.heatcapacity, 240, places=2) assert issubclass(w[-1].category, UserWarning)
def test_ufactor_nomass_construction(self): self.idf.initreadtxt(no_mass) c = self.idf.getobject("CONSTRUCTION", "TestConstruction") m = self.idf.getobject("MATERIAL", "TestMaterial") n = self.idf.getobject("MATERIAL:NOMASS", "NoMass") expected = 1 / (INSIDE_FILM_R + m.Thickness / m.Conductivity + n.Thermal_Resistance + m.Thickness / m.Conductivity + OUTSIDE_FILM_R) assert almostequal(c.ufactor, expected, places=2) assert almostequal(c.ufactor, 1 / 0.65, places=2)
def test_heatcapacity_roofvegetation_construction(self): self.idf.initreadtxt(roof_vegetation) c = self.idf.getobject("CONSTRUCTION", "TestConstruction") m = self.idf.getobject("MATERIAL:ROOFVEGETATION", "RoofVegetation") expected = (m.Thickness * m.Specific_Heat_of_Dry_Soil * m.Density_of_Dry_Soil * 0.001) with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") # check that a UserWarning is raised assert almostequal(c.heatcapacity, expected, places=2) assert almostequal(c.heatcapacity, 120, places=2) assert issubclass(w[-1].category, UserWarning)
def test_pascal2inh2o(): """py.test for pascal2inh2o and inh2o2pascal""" data = ( (1, 0.00401865), # pascal, expected (186.816675, 0.7507501808391), # pascal, expected ) for pascal, expected in data: result = fanpower.pascal2inh2o(pascal) assert almostequal(result, expected, places=5) data = ( (1, 0.00401865), # expected, inh20 (186.816675, 0.7507501808391), # expected, inh20 ) for expected, inh20 in data: result = fanpower.inh2o2pascal(inh20) assert almostequal(result, expected, places=3)
def test_height(): """test the height of a polygon poly""" data = ( ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 1), # polygon, answer, ([(0, 0, 0), (8, 0, 0), (11, 0, 4), (3, 0, 4)], 5), ([(0, 0, 0), (10, 0, 0), (10, 9, 0), (0, 9, 0)], 9), ( [ (3.571913, -9.390334, 1.487381), (10.905826, -6.194443, 1.487381), (8.998819, -1.818255, 0.0), (1.664906, -5.014146, 0.0)], 5), ( [ (0.0, 0.0, 3.0), (0.0, 0.0, 2.4), (30.5, 0.0, 2.4), (30.5, 0.0, 3.0) ], 0.6 ), ) for poly, answer in data: result = surface.height(poly) assert almostequal(answer, result, places=5) == True
def test_functions(): """py.test for ex_functions.py""" surfaces = bunchdt["BuildingSurface:Detailed"] # all the surfaces assert len(surfaces) == 1 surface = surfaces[0] assert surface.Name == "WALL-1PF" assert surface.azimuth == 180.0 assert surface.tilt == 90.0 assert pytest_helpers.almostequal(surface.area, 18.3)
def test_azimuth(): """test the azimuth of a polygon poly""" data = (([(0,0,0), (1,0,0), (1,1,1), (0,1,1)],180),# polygon, answer, ([(0,0,0), (1,0,0), (1,1,0), (0,1,0)],0), ([(3.571913,-9.390334,1.487381), (10.905826,-6.194443,1.487381), (8.998819,-1.818255,0.0), (1.664906, -5.014146, 0.0)],360 - 23.546134), ) for poly,answer in data: result = surface.azimuth(poly) assert almostequal(answer, result, places=3) == True
def test_functions(): """py.test for ex_functions.py""" surfaces = bunchdt['BuildingSurface:Detailed'.upper()] # all the surfaces assert len(surfaces) == 1 surface = surfaces[0] assert surface.Name == "WALL-1PF" assert surface.azimuth == 180.0 assert surface.tilt == 90.0 assert pytest_helpers.almostequal(surface.area, 18.3)
def test_tilt(): """test the tilt of a polygon poly""" data = (([(0,0,0), (1,0,0), (1,1,0), (0,1,0)],0),# polygon, answer, ([(0,0,0), (5,0,0), (5,0,8), (0,0,8)],90), ([(0,0,0), (1,0,0), (1,1,1), (0,1,1)],45), ([(3.571913,-9.390334,1.487381), (10.905826,-6.194443,1.487381), (8.998819,-1.818255,0.0), (1.664906, -5.014146, 0.0)],90-72.693912), ) for poly,answer in data: result = surface.tilt(poly) assert almostequal(answer, result, places=3) == True
def test_pythonic(): """py.test for ex_pythonic.py""" zones = bunchdt['zone'.upper()] # all the zones zone0 = zones[0] # - printout = "PLENUM-1" assert zone0.Name == printout # - printout = [ 'PLENUM-1', 'SPACE1-1', 'SPACE2-1', 'SPACE3-1', 'SPACE4-1', 'SPACE5-1', 'Sup-PLENUM-1'] zonenames = [zone.Name for zone in zones] assert printout == zonenames # - printout = [ '283.2', '239.247360229', '103.311355591', '239.247360229', '103.311355591', '447.682556152', '208.6'] zonevolumes = [zone.Volume for zone in zones] for item1, item2 in zip(printout, zonevolumes): item1, item2 = float(item1), float(item2) assert pytest_helpers.almostequal(item1, item2) # - printout = [('SPACE2-1', '103.311355591'), ('SPACE4-1', '103.311355591')] smallzones = [zn for zn in zones if float(zn.Volume) < 150] namevolume = [(zn.Name, zn.Volume) for zn in smallzones] for (n1, v1), (n2, v2) in zip(printout, namevolume): (n1, v1) = (n1, float(v1)) (n2, v2) = (n2, float(v2)) assert n1 == n2 assert pytest_helpers.almostequal(v1, v2) # - printout = 2 assert printout == len(smallzones) # - printout = [ 'PLENUM-1', 'SPACE1-1', 'FIRST-SMALL-ZONE', 'SPACE3-1', 'SECOND-SMALL-ZONE', 'SPACE5-1', 'Sup-PLENUM-1'] smallzones[0].Name = "FIRST-SMALL-ZONE" smallzones[1].Name = "SECOND-SMALL-ZONE" # now the zone names are: zonenames = [zone.Name for zone in zones] assert printout == zonenames
def test_fan_maxcfm(): """py.test for fan_maxcfm in idf""" idf = IDF(StringIO(vavfan)) thefans = idf.idfobjects['Fan:VariableVolume'.upper()] thefan = thefans[0] cfm = thefan.f_fan_maxcfm assert almostequal(cfm, 12000, places=5) # test autosize thefan.Maximum_Flow_Rate = 'autosize' watts = thefan.f_fanpower_watts assert watts == 'autosize'
def test_width(): """test the width of a polygon poly """ data = (([(0,0,0), (1,0,0), (1,1,0), (0,1,0)],1),# polygon, answer, ([(0,0,0), (8,0,0), (11,0,4), (3,0,4)],8), ([(0,0,0), (10,0,0), (10,9,0), (0,9,0)],10), ([(3.571913,-9.390334,1.487381), (10.905826,-6.194443,1.487381), (8.998819,-1.818255,0.0), (1.664906, -5.014146, 0.0)],8), ) for poly,answer in data: result = surface.width(poly) assert almostequal(answer, result, places=4) == True
def test_fan_watts(): """py.test for fan_watts""" data = ( (0.342, 186.816675, 1.28442384, 700.9139283649118), # fan_tot_eff, pascal, m3s, expected (0.537, 871.81115, 2.44326719, 3962.6516573000763), # fan_tot_eff, pascal, m3s, expected ) for fan_tot_eff, pascal, m3s, expected in data: result = fanpower.fan_watts(fan_tot_eff, pascal, m3s) assert almostequal(result, expected)
def test_fan_bhp(): """py.test for fan_bhp""" data = ( (0.342, 186.816675, 1.28442384, 0.939940898974), # fan_tot_eff, pascal, m3s, expected (0.537, 871.81115, 2.44326719, 5.31400249068), # fan_tot_eff, pascal, m3s, expected ) for fan_tot_eff, pascal, m3s, expected in data: result = fanpower.fan_bhp(fan_tot_eff, pascal, m3s) assert almostequal(result, expected)
def testfanpower_watts(): """py.test for fanpower_watts in idf""" idf = IDF(StringIO(vavfan)) thefans = idf.idfobjects['Fan:VariableVolume'.upper()] thefan = thefans[0] watts = thefan.f_fanpower_watts assert almostequal(watts, 1791.9664027495671) # test autosize thefan.Maximum_Flow_Rate = 'autosize' watts = thefan.f_fanpower_watts assert watts == 'autosize'
def test_area(): """test for area of a zone""" data = (([(0,0,0), (1,0,1), (1,1,0), (0,1,1)],1),# polygon, answer, ([(0,0,0), (1,0,0), (1,0,1), (0,0,1)],0), ([(0,0,0), (0,1,0), (0,1,1), (0,0,1)],0), ([(0,0,4), (5,0,4), (5,5,6), (0,5,6)],25), ) for poly,answer in data: result = area_zone.area(poly) assert almostequal(answer, result, places=4) == True
def testfanpower_bhp(): """py.test for fanpower_bhp in idf""" idf = IDF(StringIO(vavfan)) thefans = idf.idfobjects['Fan:VariableVolume'.upper()] thefan = thefans[0] bhp = thefan.f_fanpower_bhp assert almostequal(bhp, 2.40306611606) # test autosize thefan.Maximum_Flow_Rate = 'autosize' bhp = thefan.f_fanpower_bhp assert bhp == 'autosize'
def test_tilt(): """test the tilt of a polygon poly""" data = ( ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 0), # polygon, answer, ([(0, 0, 0), (5, 0, 0), (5, 0, 8), (0, 0, 8)], 90), ([(0, 0, 0), (1, 0, 0), (1, 1, 1), (0, 1, 1)], 45), ([(3.571913, -9.390334, 1.487381), (10.905826, -6.194443, 1.487381), (8.998819, -1.818255, 0.0), (1.664906, -5.014146, 0.0)], 90 - 72.693912), ) for poly, answer in data: result = surface.tilt(poly) assert almostequal(answer, result, places=3) == True
def test_azimuth(): """test the azimuth of a polygon poly""" data = ( ([(0, 0, 0), (1, 0, 0), (1, 1, 1), (0, 1, 1)], 180), # polygon, answer, ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 0), ([(3.571913, -9.390334, 1.487381), (10.905826, -6.194443, 1.487381), (8.998819, -1.818255, 0.0), (1.664906, -5.014146, 0.0)], 360 - 23.546134), ) for poly, answer in data: result = surface.azimuth(poly) assert almostequal(answer, result, places=3) == True
def test_volume(): """py.test for volume""" data = ( ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], [(0, 0, 1), (1, 0, 1), (1, 1, 1), (0, 1, 1)], 1), # poly1, poly2, answer ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], [(0, 0, 0), (1, 0, 0), (1, 1, 2), (0, 1, 2)], 1), # poly1, poly2, answer ) for poly1, poly2, answer in data: result = volume_zone.vol(poly1, poly2) assert almostequal(answer, result, places=4) == True
def test_width(): """test the width of a polygon poly """ data = ( ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 1), # polygon, answer, ([(0, 0, 0), (8, 0, 0), (11, 0, 4), (3, 0, 4)], 8), ([(0, 0, 0), (10, 0, 0), (10, 9, 0), (0, 9, 0)], 10), ([(3.571913, -9.390334, 1.487381), (10.905826, -6.194443, 1.487381), (8.998819, -1.818255, 0.0), (1.664906, -5.014146, 0.0)], 8), ) for poly, answer in data: result = surface.width(poly) assert almostequal(answer, result, places=4) == True
def test_true_azimuth(coord_system, bldg_north, zone_rel_north, expected): """py.test for true_azimuth""" fhandle = StringIO(idftxt) idf = IDF(fhandle) geom_rules = idf.idfobjects["GlobalGeometryRules"][0] building = idf.idfobjects["Building"][0] zone = idf.idfobjects["Zone"][0] surface = idf.idfobjects["BuildingSurface:Detailed"][0] geom_rules.Coordinate_System = coord_system building.North_Axis = bldg_north zone.Direction_of_Relative_North = zone_rel_north result = fh.true_azimuth(surface) assert almostequal(expected, result, places=3) == True
def test_area(): """test the area of a polygon poly""" data = (([(0,0,0), (1,0,0), (1,1,0), (0,1,0)],1),# polygon, answer, ([(0,0,0), (1,0,0), (1,0,1), (0,0,1)],1), ([(0,0,0), (0,1,0), (0,1,1), (0,0,1)],1), ([(0,0,0), (0,1,0), (0,2,0), (0,3,0)],0), ([(-4.611479, 6.729214, -0.332978), (-0.694944, 4.990984, 2.243709), (-2.147088,0.302854,1.288344), (-6.063622,2.041084,-1.288344)],25), ) for poly,answer in data: result = surface.area(poly) assert almostequal(answer, result, places=4) == True
def test_area(): """test the area of a polygon poly""" data = ( ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 1), # polygon, answer, ([(0, 0, 0), (1, 0, 0), (1, 0, 1), (0, 0, 1)], 1), ([(0, 0, 0), (0, 1, 0), (0, 1, 1), (0, 0, 1)], 1), ([(0, 0, 0), (0, 1, 0), (0, 2, 0), (0, 3, 0)], 0), ([(-4.611479, 6.729214, -0.332978), (-0.694944, 4.990984, 2.243709), (-2.147088, 0.302854, 1.288344), (-6.063622, 2.041084, -1.288344)], 25), ) for poly, answer in data: result = surface.area(poly) assert almostequal(answer, result, places=4) == True
def test_height(): """test the height of a polygon poly""" data = ( ([(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], 1), # polygon, answer, ([(0, 0, 0), (8, 0, 0), (11, 0, 4), (3, 0, 4)], 5), ([(0, 0, 0), (10, 0, 0), (10, 9, 0), (0, 9, 0)], 9), ([(3.571913, -9.390334, 1.487381), (10.905826, -6.194443, 1.487381), (8.998819, -1.818255, 0.0), (1.664906, -5.014146, 0.0)], 5), ([(0.0, 0.0, 3.0), (0.0, 0.0, 2.4), (30.5, 0.0, 2.4), (30.5, 0.0, 3.0)], 0.6), ) for poly, answer in data: result = surface.height(poly) assert almostequal(answer, result, places=5) == True
def test_volume(): """py.test for volume""" data = ( ( [(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], [(0, 0, 1), (1, 0, 1), (1, 1, 1), (0, 1, 1)] , 1 ), # poly1, poly2, answer ( [(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)], [(0, 0, 0), (1, 0, 0), (1, 1, 2), (0, 1, 2)] , 1 ), # poly1, poly2, answer ) for poly1, poly2, answer in data: result = volume_zone.vol(poly1, poly2) assert almostequal(answer, result, places=4) == True
def test_true_azimuth(): """test the true azimuth of a polygon poly""" data = ( (45, 30, 0, 75), # bldg_north, zone_rel_north, surf_azimuth, expected, ("", 0, 180, 180), (20, "", 20, 40), (240, 90, 180, 150), ) for ( bldg_north, zone_rel_north, surf_azimuth, expected, ) in data: result = surface.true_azimuth(bldg_north, zone_rel_north, surf_azimuth) assert almostequal(expected, result, places=3) == True
def test_volume(): for poly1,poly2,answer in data: result = volume_zone.vol(poly1,poly2) assert almostequal(answer, result, places=4) == True
def test_zonearea_zonevolume(): """py.test for zonearea and zonevolume""" idftxt = """Zone, 473222, 0.0, 0.0, 0.0, 0.0, , 1; BuildingSurface:Detailed, F7289B, Floor, Exterior Floor, 473222, Ground, , NoSun, NoWind, , 4, 2.23, 2.56, 0.0, 2.23, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.56, 0.0; BuildingSurface:Detailed, F3659B, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 2.56, 1.49, 2.23, 2.56, 0.0, 0.0, 2.56, 0.0, 0.0, 2.56, 1.49; BuildingSurface:Detailed, 46C6C9, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 0.0, 1.49, 2.23, 0.0, 0.0, 2.23, 1.02548139464, 0.0, 2.23, 1.02548139464, 1.49; BuildingSurface:Detailed, 4287DD, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 0.0, 2.56, 1.49, 0.0, 2.56, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.49; BuildingSurface:Detailed, 570C2E, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 0.0, 0.0, 1.49, 0.0, 0.0, 0.0, 2.23, 0.0, 0.0, 2.23, 0.0, 1.49; BuildingSurface:Detailed, BAEA99, Roof, Exterior Roof, 473222, Outdoors, , SunExposed, WindExposed, , 4, 0.0, 2.56, 1.49, 0.0, 0.0, 1.49, 2.23, 0.0, 1.49, 2.23, 2.56, 1.49; BuildingSurface:Detailed, C879FE, Floor, Exterior Floor, 473222, Ground, , NoSun, NoWind, , 4, 3.22, 2.52548139464, 0.0, 3.22, 1.02548139464, 0.0, 2.23, 1.02548139464, 0.0, 2.23, 2.52548139464, 0.0; BuildingSurface:Detailed, 25B601, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 1.02548139464, 1.49, 2.23, 1.02548139464, 0.0, 2.23, 2.52548139464, 0.0, 2.23, 2.52548139464, 1.49; BuildingSurface:Detailed, F5EADC, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 1.02548139464, 1.49, 2.23, 1.02548139464, 0.0, 3.22, 1.02548139464, 0.0, 3.22, 1.02548139464, 1.49; BuildingSurface:Detailed, D0AABE, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 3.22, 1.02548139464, 1.49, 3.22, 1.02548139464, 0.0, 3.22, 2.52548139464, 0.0, 3.22, 2.52548139464, 1.49; BuildingSurface:Detailed, B0EA02, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 3.22, 2.52548139464, 1.49, 3.22, 2.52548139464, 0.0, 2.23, 2.52548139464, 0.0, 2.23, 2.52548139464, 1.49; BuildingSurface:Detailed, E6DF3B, Roof, Exterior Roof, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 2.52548139464, 1.49, 2.23, 1.02548139464, 1.49, 3.22, 1.02548139464, 1.49, 3.22, 2.52548139464, 1.49; BuildingSurface:Detailed, 4F8681, Wall, Exterior Wall, 473222, Outdoors, , SunExposed, WindExposed, , 4, 2.23, 2.52548139464, 1.49, 2.23, 2.52548139464, 0.0, 2.23, 2.56, 0.0, 2.23, 2.56, 1.49; """ idf = IDF(StringIO(idftxt)) result = modeleditor.zonearea(idf, '473222') assert almostequal(result, 7.1938) result = modeleditor.zonearea_floor(idf, '473222') assert almostequal(result, 7.1938) result = modeleditor.zonearea_roofceiling(idf, '473222') assert almostequal(result, 7.1938) result = modeleditor.zone_floor2roofheight(idf, '473222') assert almostequal(result, 1.49) result = modeleditor.zoneheight(idf, '473222') assert almostequal(result, 1.49) result = modeleditor.zone_floor2roofheight(idf, '473222') assert almostequal(result, 1.49) result = modeleditor.zonevolume(idf, '473222') assert almostequal(result, 10.718762) # remove floor zone = idf.getobject('ZONE', '473222') surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()] zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name] floors = [s for s in zone_surfs if s.Surface_Type.upper() == 'FLOOR'] for floor in floors: idf.removeidfobject(floor) result = modeleditor.zonearea_floor(idf, '473222') assert almostequal(result, 0) result = modeleditor.zonearea_roofceiling(idf, '473222') assert almostequal(result, 7.1938) result = modeleditor.zonearea(idf, '473222') assert almostequal(result, 7.1938) result = modeleditor.zoneheight(idf, '473222') assert almostequal(result, 1.49) result = modeleditor.zonevolume(idf, '473222') assert almostequal(result, 10.718762) # reload idf and remove roof/ceiling idf = IDF(StringIO(idftxt)) zone = idf.getobject('ZONE', '473222') surfs = idf.idfobjects['BuildingSurface:Detailed'.upper()] zone_surfs = [s for s in surfs if s.Zone_Name == zone.Name] roofs = [s for s in zone_surfs if s.Surface_Type.upper() == 'ROOF'] ceilings = [s for s in zone_surfs if s.Surface_Type.upper() == 'CEILING'] topsurfaces = roofs + ceilings for surf in topsurfaces: idf.removeidfobject(surf) result = modeleditor.zonearea_roofceiling(idf, '473222') assert almostequal(result, 0) result = modeleditor.zonearea(idf, '473222') assert almostequal(result, 7.1938) result = modeleditor.zoneheight(idf, '473222') assert almostequal(result, 1.49) result = modeleditor.zonevolume(idf, '473222') assert almostequal(result, 10.718762)