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
idf.add_block(name='vivienda1',
              coordinates=[(5, 5), (15, 5), (15, 10), (5, 10)],
              height=3)

idf.translate([0, 0, 3])

idf.add_block(name='comercio0',
              coordinates=[(0, 0), (10, 0), (10, 5), (0, 5)],
              height=3)

idf.add_block(name='comercio1',
              coordinates=[(0, 5), (10, 5), (10, 10), (0, 10)],
              height=3)

idf.intersect_match()

zones = idf.idfobjects["ZONE"]
target_zone_names = ["vivienda0", "vivienda1", "comercio0", "comercio1"]
initial_zone_names = []
for i in range(len(zones)):
    zones[i].Name = target_zone_names[i]
    initial_zone_names.append(zones[i].Name)
srfs = idf.getsurfaces('')
for srf in srfs:
    for index in range(len(initial_zone_names)):
        if target_zone_names[index] in srf.Zone_Name:
            srf.Zone_Name = target_zone_names[index]

wwr_zones = {"vivienda": 0.2, "comercio": 0.7, "comun": 0.2}
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))