Esempio n. 1
0
def test_tutorial_3():
    IDF.setiddname("C:/EnergyPlusV9-1-0/Energy+.idd", testing=True)
    idf = IDF("C:/EnergyPlusV9-1-0/ExampleFiles/Minimal.idf")
    idf.epw = "USA_CO_Golden-NREL.724666_TMY3.epw"
    idf.add_block(
        name="Two storey",
        coordinates=[(10, 0), (10, 5), (0, 5), (0, 0)],
        height=6,
        num_stories=2,
    )
    idf.add_block(name="One storey",
                  coordinates=[(10, 5), (10, 10), (0, 10), (0, 5)],
                  height=3)
    idf.intersect_match()
    idf.set_wwr(0.25, construction="Project External Window")
    idf.set_default_constructions()
    for c in idf.idfobjects["CONSTRUCTION"]:
        print(c)
    print(idf.getobject("MATERIAL", "DefaultMaterial"))
    print(idf.getobject("WINDOWMATERIAL:SIMPLEGLAZINGSYSTEM",
                        "DefaultGlazing"))

    src_idf = IDF("C:/EnergyPlusV9-1-0/ExampleFiles/WindowTestsSimple.idf")
    copy_constructions(source_idf=src_idf, target_idf=idf)
    for c in idf.idfobjects["CONSTRUCTION"]:
        print(c)
    for wall in idf.getsubsurfaces("wall"):
        wall.Construction_Name = "EXTERIOR"
    for roof in idf.getsubsurfaces("roof"):
        roof.Construction_Name = "ROOF31"
    for floor in idf.getsubsurfaces("floor"):
        floor.Construction_Name = "FLOOR38"
    idf.run(output_directory="tests/tutorial")
Esempio n. 2
0
def test_tutorial_1():
    IDF.setiddname("C:/EnergyPlusV9-1-0/Energy+.idd", testing=True)
    idf = IDF("C:/EnergyPlusV9-1-0/ExampleFiles/Minimal.idf")
    idf.epw = "USA_CO_Golden-NREL.724666_TMY3.epw"
    idf.add_block(name="Boring hut",
                  coordinates=[(10, 0), (10, 10), (0, 10), (0, 0)],
                  height=3.5)
    idf.intersect_match()
    idf.set_wwr(0.6, construction="Project External Window")
    idf.set_default_constructions()
    idf.to_obj("tests/tutorial/boring_hut.obj")
    idf.run(output_directory="tests/tutorial")
Esempio n. 3
0
                    'Not all subsurfaces on wall "{name}" have the same construction'
                    .format(name=wall.Name))
            construction = constructions[0]
        # remove all subsurfaces
        for ss in wall_subsurfaces:
            idf.removeidfobject(ss)

        for i in wwr_zones.keys():
            if i in wall.Zone_Name:
                name = i
                wwr = wwr_zones[name]

        if not wwr:
            print("error in adding windows")
            return

        coords = window_vertices_given_wall(wall, wwr)
        window = idf.newidfobject("FENESTRATIONSURFACE:DETAILED",
                                  Name="%s window" % wall.Name,
                                  Surface_Type="Window",
                                  Construction_Name=construction or "",
                                  Building_Surface_Name=wall.Name,
                                  View_Factor_to_Ground="autocalculate")
        window.setcoords(coords, ggr)


idf.set_default_constructions()
custom_wwr(wwr_zones, construction="Project External Window")
idf.to_obj('test2.obj')

idf.run()
Esempio n. 4
0
def test_tutorial_2():
    IDF.setiddname("C:/EnergyPlusV9-1-0/Energy+.idd", testing=True)
    idf = IDF("C:/EnergyPlusV9-1-0/ExampleFiles/Minimal.idf")
    idf.epw = "USA_CO_Golden-NREL.724666_TMY3.epw"
    idf.add_block(
        name="Two storey",
        coordinates=[(10, 0), (10, 5), (0, 5), (0, 0)],
        height=6,
        num_stories=2,
    )
    idf.add_block(name="One storey",
                  coordinates=[(10, 5), (10, 10), (0, 10), (0, 5)],
                  height=3)
    idf.intersect_match()
    idf.set_default_constructions()
    # add a heating system
    stat = idf.newidfobject(
        "HVACTEMPLATE:THERMOSTAT",
        Name="Zone Stat",
        Constant_Heating_Setpoint=20,
        Constant_Cooling_Setpoint=25,
    )
    for zone in idf.idfobjects["ZONE"]:
        idf.newidfobject(
            "HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM",
            Zone_Name=zone.Name,
            Template_Thermostat_Name=stat.Name,
        )
    # add some output variables
    idf.newidfobject(
        "OUTPUT:VARIABLE",
        Variable_Name="Zone Ideal Loads Supply Air Total Heating Energy",
        Reporting_Frequency="Hourly",
    )
    idf.newidfobject(
        "OUTPUT:VARIABLE",
        Variable_Name="Zone Ideal Loads Supply Air Total Cooling Energy",
        Reporting_Frequency="Hourly",
    )
    # run a set of simulations, moving glazing from mostly on the South facade, to mostly on the North facade
    north_wwr = [i / 10 for i in range(1, 10)]
    south_wwr = [1 - wwr for wwr in north_wwr]
    for north, south in zip(north_wwr, south_wwr):
        idf.set_wwr(north,
                    construction="Project External Window",
                    orientation="north")
        idf.set_wwr(south,
                    construction="Project External Window",
                    orientation="south")
        idf.run(
            output_prefix=f"{north}_{south}_",
            output_directory="tests/tutorial",
            expandobjects=True,
            verbose="q",
        )
    results = []
    for north, south in zip(north_wwr, south_wwr):
        eso = ESO(f"tests/tutorial/{north}_{south}_out.eso")
        heat = eso.total_kwh(
            "Zone Ideal Loads Supply Air Total Heating Energy")
        cool = eso.total_kwh(
            "Zone Ideal Loads Supply Air Total Cooling Energy")
        results.append([north, south, heat, cool, heat + cool])
    # print out the results
    headers = ["WWR-N", "WWR-S", "Heat", "Cool", "Total"]
    header_format = "{:>10}" * (len(headers))
    print(header_format.format(*headers))
    row_format = "{:>10.1f}" * (len(headers))
    for row in results:
        print(row_format.format(*row))
Esempio n. 5
0
for root in L_roots:
    L_elements.append(extract_polygon_elements(root)[0])

L_polygons = []
for i in L_elements:
    for j in i:
        L_polygons.append(element_to_coordinates(j[2]))

make_L_blocks(L_polygons)

print("- Made L Blocks")
#######################################################################################################################
# Move to origin, default construction and intersect match

move_to_origin(coordinates)
idf.set_default_constructions(
)  # INSTEAD OF THIS I NEED TO ASSIGN MATERIALS FOR EACH SURFACE
idf.match()

print("- Set Construction and Match")
#######################################################################################################################
# adding external windows for non adjacent to shading blocks

wwr_zones = {"vivienda": 0.2, "comercio": 0.7, "comun": 0.2}
custom_wwr(wwr_zones, construction="Project External Window")

shading_srfs = idf.getshadingsurfaces()
block_srfs = idf.getsurfaces("Wall")
windows = idf.getsubsurfaces("window")

shading_block = []
for i in shading_srfs: