Beispiel #1
0
def converttest(request):
    file = get_eplus_dirs(settings.ep_version) / "ExampleFiles" / request.param
    # file = request.param
    window_file = "W74-lib.dat"
    template_dir = os.path.join("trnslator", "ressources")
    window_filepath = os.path.join(template_dir, window_file)
    template_d18 = "tests/input_data/trnsys/NewFileTemplate.d18"
    trnsidf_exe = "docker/trnsidf/trnsidf.exe"  # 'docker/trnsidf/trnsidf.exe'

    # prepare args (key=value). Key is a unique id for the runs (here the
    # file basename is used). Value is a dict of the function arguments
    kwargs_dict = {
        "u_value": 2.5,
        "shgc": 0.6,
        "t_vis": 0.78,
        "tolerance": 0.05,
        "ordered": True,
    }
    idf = load_idf(file)

    weather_file = os.path.join("tests", "input_data",
                                "CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw")

    output_folder = os.path.relpath(settings.data_folder)

    yield idf, file, weather_file, window_filepath, trnsidf_exe, template_d18, output_folder, kwargs_dict

    del idf
Beispiel #2
0
def test_wwr():
    from trnslator import load_idf

    idf_file = Path("tests/input_data/necb/").glob(
        "*{}*.idf".format("FullServiceRestaurant"))
    idf = load_idf(next(iter(idf_file)))
    print(idf.name)
    print(idf.wwr(round_to=10))
Beispiel #3
0
def test_space_heating_profile(config):
    from trnslator import load_idf

    file = "tests/input_data/necb/NECB 2011-Warehouse-NECB HDD Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf"
    wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw"

    idf = load_idf(file, None, weather_file=wf)

    assert not idf.space_heating_profile().empty
Beispiel #4
0
def test_run_eplus_from_idf(clean_config):
    file = get_eplus_dirs(
        settings.ep_version) / "ExampleFiles" / "5ZoneNightVent1.idf"
    wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw"

    idf = tr.load_idf(file, weather_file=wf)
    sql = idf.run_eplus(prep_outputs=True, output_report="sql")

    assert sql
Beispiel #5
0
def schedules_idf():
    config(cache_folder="tests/.temp/cache")
    idf = load_idf(
        idf_file,
        include=[
            get_eplus_dirs(settings.ep_version) / "DataSets" / "TDV" /
            "TDV_2008_kBtu_CTZ06.csv"
        ],
    )
    return idf
Beispiel #6
0
def test_load_old(config):
    files = [
        "tests/input_data/problematic/nat_ventilation_SAMPLE0.idf",
        get_eplus_dirs(settings.ep_version) / "ExampleFiles" /
        "5ZoneNightVent1.idf",
    ]

    obj = {os.path.basename(file): tr.load_idf(file) for file in files}

    assert not any(isinstance(a, Exception) for a in obj.values())
Beispiel #7
0
def test_space_cooling_profile(config):
    from trnslator import load_idf

    file = (get_eplus_dirs(settings.ep_version) / "ExampleFiles" /
            "BasicsFiles" / "AdultEducationCenter.idf")
    wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw"

    idf = load_idf(file, None, weather_file=wf)

    assert not idf.space_cooling_profile().empty
Beispiel #8
0
def test_dhw_profile(config):
    from trnslator import load_idf

    file = "tests/input_data/necb/NECB 2011-Warehouse-NECB HDD Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf"
    wf = "tests/input_data/CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw"

    idf = load_idf(file, None, weather_file=wf)

    shw = idf.service_water_heating_profile()
    assert shw.sum() > 0
    print(shw.resample("M").sum())
Beispiel #9
0
def test_load_idf(config):
    """Will load an idf object"""

    files = [
        get_eplus_dirs(settings.ep_version) / "ExampleFiles" /
        "5ZoneNightVent1.idf",
        get_eplus_dirs(settings.ep_version) / "ExampleFiles" / "BasicsFiles" /
        "AdultEducationCenter.idf",
    ]

    obj = {os.path.basename(file): tr.load_idf(file) for file in files}
    assert isinstance(obj, dict)
Beispiel #10
0
def test_area(archetype, area):
    """Test the conditioned_area property against published values
    desired values taken from https://github.com/canmet-energy/btap"""
    import numpy as np
    from trnslator import load_idf

    idf_file = Path("tests/input_data/necb/").glob(
        "*{}*.idf".format(archetype))
    idf = load_idf(next(iter(idf_file)))
    np.testing.assert_almost_equal(actual=idf.area_conditioned,
                                   desired=area,
                                   decimal=0)
Beispiel #11
0
def test_schedules_in_necb_specific(config):
    files = [
        "tests/input_data/necb/NECB 2011-MediumOffice-NECB HDD Method-CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw.idf"
    ]
    idfs = {os.path.basename(file): load_idf(file) for file in files}
    import matplotlib.pyplot as plt

    for key in idfs:
        idf = idfs[key]
        s = Schedule(Name="NECB-A-Thermostat Setpoint-Heating",
                     idf=idf,
                     start_day_of_the_week=0)
        s.plot(slice=("2018/01/02", "2018/01/03"), drawstyle="steps-post")
        plt.show()
Beispiel #12
0
def test_partition_ratio():
    from trnslator import load_idf

    idf_file = Path("tests/input_data/necb/").glob("*LargeOffice*.idf")
    idf = load_idf(next(iter(idf_file)))
    print(idf.partition_ratio)