def test_newidfobject(): """py.test for newidfobject""" # make a blank idf # make a function for this and then continue. idf = IDF() idf.new() objtype = 'material:airgap'.upper() obj = idf.newidfobject(objtype, Name='Argon') obj = idf.newidfobject(objtype, Name='Krypton') obj = idf.newidfobject(objtype, Name='Xenon') assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Krypton'], ['MATERIAL:AIRGAP', 'Xenon'], ] # remove an object idf.popidfobject(objtype, 1) assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Xenon'], ] lastobject = idf.idfobjects[objtype][-1] idf.removeidfobject(lastobject) assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ] # copyidfobject onlyobject = idf.idfobjects[objtype][0] idf.copyidfobject(onlyobject) assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Argon'], ] # test some functions objtype = 'FENESTRATIONSURFACE:DETAILED' obj = idf.newidfobject(objtype, Name='A Wall') assert obj.coords == [] assert obj.fieldvalues[1] == 'A Wall'
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)
def test_removeidfobject(self): """py.test for IDF.removeidfobject """ idftxt = "" idfhandle = StringIO(idftxt) idf = IDF(idfhandle) key = "BUILDING" idf.newidfobject(key, Name="Building_remove") idf.newidfobject(key, Name="Building1") idf.newidfobject(key, Name="Building_remove") idf.newidfobject(key, Name="Building2") buildings = idf.idfobjects["building"] removethis = buildings[-2] idf.removeidfobject(removethis) assert buildings[2].Name == "Building2" assert idf.model.dt[key][2][1] == "Building2"
def test_removeidfobject(self): """py.test for IDF.removeidfobject """ idftxt = "" idfhandle = StringIO(idftxt) idf = IDF(idfhandle) key = "BUILDING" idf.newidfobject(key, Name="Building_remove") idf.newidfobject(key, Name="Building1") idf.newidfobject(key, Name="Building_remove") idf.newidfobject(key, Name="Building2") buildings = idf.idfobjects["building".upper()] removethis = buildings[-2] idf.removeidfobject(removethis) assert buildings[2].Name == "Building2" assert idf.model.dt[key][2][1] == "Building2"
def test_newidfobject(): """py.test for newidfobject""" # make a blank idf # make a function for this and then continue. idf = IDF() idf.new() objtype = "material:airgap".upper() obj = idf.newidfobject(objtype, Name="Argon") obj = idf.newidfobject(objtype, Name="Krypton") obj = idf.newidfobject(objtype, Name="Xenon") assert idf.model.dt[objtype] == [ ["MATERIAL:AIRGAP", "Argon"], ["MATERIAL:AIRGAP", "Krypton"], ["MATERIAL:AIRGAP", "Xenon"], ] # remove an object idf.popidfobject(objtype, 1) assert idf.model.dt[objtype] == [ ["MATERIAL:AIRGAP", "Argon"], ["MATERIAL:AIRGAP", "Xenon"], ] lastobject = idf.idfobjects[objtype][-1] idf.removeidfobject(lastobject) assert idf.model.dt[objtype] == [["MATERIAL:AIRGAP", "Argon"]] # copyidfobject onlyobject = idf.idfobjects[objtype][0] idf.copyidfobject(onlyobject) assert idf.model.dt[objtype] == [ ["MATERIAL:AIRGAP", "Argon"], ["MATERIAL:AIRGAP", "Argon"], ] # remove all objects idf.removeallidfobjects(objtype) assert len(idf.idfobjects[objtype]) == 0 # test some functions objtype = "FENESTRATIONSURFACE:DETAILED" obj = idf.newidfobject(objtype, Name="A Wall") assert obj.coords == [] assert obj.fieldvalues[1] == "A Wall" # test defaultvalues=True and defaultvalues=False sim_deftrue = idf.newidfobject("SimulationControl".upper(), defaultvalues=True) assert sim_deftrue.Do_Zone_Sizing_Calculation == "No" sim_deffalse = idf.newidfobject("SimulationControl".upper(), defaultvalues=False) assert sim_deffalse.Do_Zone_Sizing_Calculation == ""
def test_newidfobject(): """py.test for newidfobject""" # make a blank idf # make a function for this and then continue. idf = IDF() idf.new() objtype = 'material:airgap'.upper() obj = idf.newidfobject(objtype, Name='Argon') obj = idf.newidfobject(objtype, Name='Krypton') obj = idf.newidfobject(objtype, Name='Xenon') assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Krypton'], ['MATERIAL:AIRGAP', 'Xenon'], ] # remove an object idf.popidfobject(objtype, 1) assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Xenon'], ] lastobject = idf.idfobjects[objtype][-1] idf.removeidfobject(lastobject) assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ] # copyidfobject onlyobject = idf.idfobjects[objtype][0] idf.copyidfobject(onlyobject) assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Argon'], ] # test some functions objtype = 'FENESTRATIONSURFACE:DETAILED' obj = idf.newidfobject(objtype, Name='A Wall') assert obj.coords == [] assert obj.fieldvalues[1] == 'A Wall' # test defaultvalues=True and defaultvalues=False sim_deftrue = idf.newidfobject('SimulationControl'.upper(), defaultvalues=True) assert sim_deftrue.Do_Zone_Sizing_Calculation == 'No' sim_deffalse = idf.newidfobject('SimulationControl'.upper(), defaultvalues=False) assert sim_deffalse.Do_Zone_Sizing_Calculation == ''
def test_newidfobject(): """py.test for newidfobject""" # make a blank idf # make a function for this and then continue. idf = IDF() idf.new() objtype = 'material:airgap'.upper() obj = idf.newidfobject(objtype, Name='Argon') obj = idf.newidfobject(objtype, Name='Krypton') obj = idf.newidfobject(objtype, Name='Xenon') assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Krypton'], ['MATERIAL:AIRGAP', 'Xenon'], ] # remove an object idf.popidfobject(objtype, 1) assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Xenon'], ] lastobject = idf.idfobjects[objtype][-1] idf.removeidfobject(lastobject) assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ] # copyidfobject onlyobject = idf.idfobjects[objtype][0] idf.copyidfobject(onlyobject) assert idf.model.dt[objtype] == [['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Argon'], ] # test some functions objtype = 'FENESTRATIONSURFACE:DETAILED' obj = idf.newidfobject(objtype, Name='A Wall') assert obj.coords == [] assert obj.fieldvalues[1] == 'A Wall' # test defaultvalues=True and defaultvalues=False sim_deftrue = idf.newidfobject('SimulationControl'.upper(), defaultvalues=True) assert sim_deftrue.Do_Zone_Sizing_Calculation == 'No' sim_deffalse = idf.newidfobject('SimulationControl'.upper(), defaultvalues=False) assert sim_deffalse.Do_Zone_Sizing_Calculation == ''
def test_newidfobject(): """py.test for newidfobject""" # make a blank idf # make a function for this and then continue. idf = IDF() idf.new() objtype = 'material:airgap'.upper() obj = idf.newidfobject(objtype, Name='Argon') obj = idf.newidfobject(objtype, Name='Krypton') obj = idf.newidfobject(objtype, Name='Xenon') assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Krypton'], ['MATERIAL:AIRGAP', 'Xenon'], ] # remove an object idf.popidfobject(objtype, 1) assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Xenon'], ] lastobject = idf.idfobjects[objtype][-1] idf.removeidfobject(lastobject) assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ] # copyidfobject onlyobject = idf.idfobjects[objtype][0] idf.copyidfobject(onlyobject) assert idf.model.dt[objtype] == [ ['MATERIAL:AIRGAP', 'Argon'], ['MATERIAL:AIRGAP', 'Argon'], ] # test some functions objtype = 'FENESTRATIONSURFACE:DETAILED' obj = idf.newidfobject(objtype, Name='A Wall') assert obj.coords == [] assert obj.fieldvalues[1] == 'A Wall'
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)
# <codecell> print(idf.idfobjects['MATERIAL']) # <markdowncell> # You can see that the second material is gone ! Now let us remove the first material, but do it using a different function # <codecell> firstmaterial = idf.idfobjects['MATERIAL'][-1] # <codecell> idf.removeidfobject(firstmaterial) # <codecell> print(idf.idfobjects['MATERIAL']) # <markdowncell> # So we have two ways of deleting an idf object: # # 1. popidfobject -> give it the idf key: "MATERIAL", and the index number # 2. removeidfobject -> give it the idf object to be deleted # <headingcell level=3> # Copying/Adding an idf object
# <codecell> print(idf.idfobjects["MATERIAL"]) # <markdowncell> # You can see that the second material is gone ! Now let us remove the first material, but do it using a different function # <codecell> firstmaterial = idf.idfobjects["MATERIAL"][-1] # <codecell> idf.removeidfobject(firstmaterial) # <codecell> print(idf.idfobjects["MATERIAL"]) # <markdowncell> # So we have two ways of deleting an idf object: # # 1. popidfobject -> give it the idf key: "MATERIAL", and the index number # 2. removeidfobject -> give it the idf object to be deleted # <headingcell level=3> # Copying/Adding an idf object
def main(): start = time() # print(strftime('%H:%M:%S', localtime()), '- idf development start time') # sys.stdout.flush() # Find the computer's operating system and set path to E+ idd file system = platform.system().lower() if system in ['windows', 'linux', 'darwin']: iddfile = os.path.join(EP_DIR, 'ep8.9_{}/Energy+.idd'.format(system)) IDF.setiddname(iddfile) # Load input data (preprocessing outputs) and find unique built islands osgb3D_df = pd.read_csv(osgb3D) osgb3D_list = variable_polygon_pairs(osgb3D_df, 'osgb', 'AMD_polygon') df = pd.read_csv(input_data) # bi_list = df['osgb'].unique().tolist() # print(bi_list[:1]) bi_list = df['bi'].unique().tolist() # Create EnergyPlus idf file for each built islands for bi in bi_list: pst = time() zone_use_dict = dict() # bi_df = df[df['osgb'] == bi] bi_df = df[df['bi'] == bi] idf = IDF(ep_basic_settings) # Change the name filed of the building object building_object = idf.idfobjects['BUILDING'][0] building_object.Name = bi # Move all objects towards origins origin = loads(bi_df['AMD_polygon'].iloc[0]) origin = list(origin.exterior.coords[0]) origin.append(0) # Built island polygon - convex and buffer osgb_in_bi = bi_df['osgb'].unique().tolist() polygons_in_bi = bi_df['AMD_polygon'].unique().tolist() polygons_in_bi = [loads(p) for p in polygons_in_bi] bi_polygon = unary_union(polygons_in_bi).convex_hull buffered_zone = bi_polygon.buffer(radius) # Surrounding context converted to shading elements osgbs_in_buffered_zone = list() for osgb, polygon in osgb3D_list: if osgb not in osgb_in_bi: if polygon.intersects(buffered_zone): osgbs_in_buffered_zone.append(osgb) surrounding_df = osgb3D_df.loc[osgb3D_df['osgb'].isin( osgbs_in_buffered_zone)] surrounding_df.apply(shading_volumes, args=( osgb3D_df, idf, origin, ), axis=1) # Adiabatic volumes converted to shading elements """ shading_osgb = bi_df.loc[bi_df['AMD_adiabatic_volume_only'], 'osgb'].unique().tolist() shading_df = osgb3D_df.loc[osgb3D_df['osgb'].isin(shading_osgb)] shading_df.apply(shading_volumes, args=(osgb3D_df, idf, origin,), axis=1) """ osgb_list = bi_df['osgb'].unique().tolist() for osgb in osgb_list: floor_use = bi_df.loc[bi_df['osgb'] == osgb][['floor_no', 'use' ]].values.tolist() # print(non_dom_floors) #floor_use = [item for item in non_dom_floors if not np.isnan(item[0])] row = bi_df[bi_df['osgb'] == osgb].iloc[0] polygon = loads(row.AMD_polygon) hor_polygon = row.AMD_polygon_horizontal hor_poly_coord_dict = polygon_coordinates_dictionary(hor_polygon) horiz_surf_coord = horizontal_surface_coordinates( hor_poly_coord_dict, origin) ext_surf_polygon = loads(row.AMD_polygon_exposed_wall) ext_surf_coord = surface_coordinates(ext_surf_polygon, origin) adj_osgb_list = literal_eval(row.AMD_collinear_touching) # print(adj_osgb_list) glazing_ratio = row.AMD_glazing_ratio for floor_no, use in floor_use: # non_dom_floors: if floor_no == 1: if row.floors == 1: zone_name = '{}_floor_{}'.format(row.osgb, floor_no) zone_use_dict[zone_name] = use zone_floor_h = (int(floor_no) - 1) * f2f space_below_floor = 'Ground' zone_ceiling_h = int(floor_no) * f2f space_above_floor = 'Outdoors' idf.newidfobject('ZONE', Name=zone_name) floor_const = row.AMD_ground_floor floor(idf, zone_name, space_below_floor, horiz_surf_coord, zone_floor_h, floor_const) roof_const = row.AMD_roof roof_ceiling(idf, zone_name, space_above_floor, horiz_surf_coord, zone_ceiling_h, roof_const) glazing_const = row.AMD_glazing zone_height = zone_ceiling_h - zone_floor_h wall_const = row.AMD_wall external_walls(idf, zone_name, floor_no, ext_surf_coord, zone_ceiling_h, zone_floor_h, zone_height, min_avail_height, min_avail_width_for_window, wall_const, glazing_const, glazing_ratio) else: zone_name = '{}_floor_{}'.format(row.osgb, floor_no) zone_use_dict[zone_name] = use zone_floor_h = (int(floor_no) - 1) * f2f space_below_floor = 'Ground' zone_ceiling_h = int(floor_no) * f2f space_above_floor = '{}_floor_{}'.format( row.osgb, (floor_no + 1)) idf.newidfobject('ZONE', Name=zone_name) floor_const = row.AMD_ground_floor floor(idf, zone_name, space_below_floor, horiz_surf_coord, zone_floor_h, floor_const) roof_const = row.AMD_ceiling roof_ceiling(idf, zone_name, space_above_floor, horiz_surf_coord, zone_ceiling_h, roof_const) glazing_const = row.AMD_glazing zone_height = zone_ceiling_h - zone_floor_h wall_const = row.AMD_wall external_walls(idf, zone_name, floor_no, ext_surf_coord, zone_ceiling_h, zone_floor_h, zone_height, min_avail_height, min_avail_width_for_window, wall_const, glazing_const, glazing_ratio) elif floor_no == row.floors: zone_name = '{}_floor_{}'.format(row.osgb, floor_no) zone_use_dict[zone_name] = use zone_floor_h = (int(floor_no) - 1) * f2f space_below_floor = '{}_floor_{}'.format( row.osgb, (floor_no - 1)) zone_ceiling_h = int(floor_no) * f2f space_above_floor = 'Outdoors' idf.newidfobject('ZONE', Name=zone_name) floor_const = row.AMD_floor floor(idf, zone_name, space_below_floor, horiz_surf_coord, zone_floor_h, floor_const) roof_const = row.AMD_roof roof_ceiling(idf, zone_name, space_above_floor, horiz_surf_coord, zone_ceiling_h, roof_const) glazing_const = row.AMD_glazing zone_height = zone_ceiling_h - zone_floor_h wall_const = row.AMD_wall external_walls(idf, zone_name, floor_no, ext_surf_coord, zone_ceiling_h, zone_floor_h, zone_height, min_avail_height, min_avail_width_for_window, wall_const, glazing_const, glazing_ratio) else: zone_name = '{}_floor_{}'.format(row.osgb, floor_no) zone_use_dict[zone_name] = use zone_floor_h = (int(floor_no) - 1) * f2f space_below_floor = '{}_floor_{}'.format( row.osgb, (floor_no - 1)) zone_ceiling_h = floor_no * f2f space_above_floor = '{}_floor_{}'.format( row.osgb, (floor_no + 1)) idf.newidfobject('ZONE', Name=zone_name) floor_const = row.AMD_floor floor(idf, zone_name, space_below_floor, horiz_surf_coord, zone_floor_h, floor_const) roof_const = row.AMD_ceiling roof_ceiling(idf, zone_name, space_above_floor, horiz_surf_coord, zone_ceiling_h, roof_const) glazing_const = row.AMD_glazing zone_height = zone_ceiling_h - zone_floor_h wall_const = row.AMD_wall external_walls(idf, zone_name, floor_no, ext_surf_coord, zone_ceiling_h, zone_floor_h, zone_height, min_avail_height, min_avail_width_for_window, wall_const, glazing_const, glazing_ratio) use_list = list(set(list(zone_use_dict.values()))) for use in use_list: zone_list = list() for key, value in zone_use_dict.items(): if value == use: zone_list.append(key) idf.newidfobject('ZONELIST', Name=use) objects = idf.idfobjects['ZONELIST'][-1] for i, zone in enumerate(zone_list): exec('objects.Zone_%s_Name = zone' % (i + 1)) objects_to_delete = list() for obj in [ 'PEOPLE', 'LIGHTS', 'ELECTRICEQUIPMENT', 'ZONEINFILTRATION:DESIGNFLOWRATE', 'ZONEVENTILATION:DESIGNFLOWRATE', 'ZONECONTROL:THERMOSTAT' ]: objects = idf.idfobjects[obj] for item in objects: if item.Zone_or_ZoneList_Name not in use_list: objects_to_delete.append(item) for item in objects_to_delete: idf.removeidfobject(item) all_zones = list(zone_use_dict.keys()) for zone in all_zones: system_name = '{}_HVAC'.format(zone) eq_name = '{}_Eq'.format(zone) supp_air_node = '{}_supply'.format(zone) air_node = '{}_air_node'.format(zone) ret_air_node = '{}_return'.format(zone) idf.newidfobject('ZONEHVAC:IDEALLOADSAIRSYSTEM', Name=system_name, Zone_Supply_Air_Node_Name=supp_air_node, Dehumidification_Control_Type='None') idf.newidfobject( 'ZONEHVAC:EQUIPMENTLIST', Name=eq_name, Zone_Equipment_1_Object_Type='ZONEHVAC:IDEALLOADSAIRSYSTEM', Zone_Equipment_1_Name=system_name, Zone_Equipment_1_Cooling_Sequence=1, Zone_Equipment_1_Heating_or_NoLoad_Sequence=1) idf.newidfobject( 'ZONEHVAC:EQUIPMENTCONNECTIONS', Zone_Name=zone, Zone_Conditioning_Equipment_List_Name=eq_name, Zone_Air_Inlet_Node_or_NodeList_Name=supp_air_node, Zone_Air_Node_Name=air_node, Zone_Return_Air_Node_or_NodeList_Name=ret_air_node) ep_bs = str(ep_basic_settings).strip("\basic_settings\.idf") idf.saveas(os.path.join(IDF_DIR, '{}.idf'.format(bi))) pt('{}.idf file created in:'.format(bi), pst) print(strftime('%H:%M:%S', localtime()), '- idf development finish time') sys.stdout.flush() pt('##### idf development completed in:'.format(bi), start)