示例#1
0
def test_night_ventilation(result_main_folder):
    cfg_file = _TESTFIXTURE_FOLDER / Path("cooling") / Path("main_config.yml")
    cfg = cesarp.common.load_config_full(cfg_file)
    cfg["OPERATION"] = {
        "WINDOW_SHADING_CONTROL": {
            "ACTIVE": False
        },
        "NIGHT_VENTILATION": {
            "ACTIVE": True
        }
    }
    # Note: trick to debug results: remove deleting result folder in res_folder(), then run it once, then uncomment
    #       sim_mgr.run_all_steps(), change load_from_disk=True and then debug and check the results...
    sim_mgr = SimulationManager(result_main_folder / Path("sim_test"),
                                cfg,
                                cesarp.common.init_unit_registry(),
                                load_from_disk=False,
                                fids_to_use=[7])
    sim_mgr.run_all_steps()
    results = sim_mgr.get_all_results_summary()
    dhw_annual_expected = pytest.approx(10364.1775, rel=0.005)
    electricity_annual_expected = pytest.approx(71952.9883)
    assert results.loc[7,
                       "h * kiloW / year"]["Cooling Annual"] == pytest.approx(
                           13633.8, rel=0.005)
    assert results.loc[7,
                       "h * kiloW / year"]["Heating Annual"] == pytest.approx(
                           14744.2, rel=0.005)
    assert results.loc[7,
                       "h * kiloW / year"]["DHW Annual"] == dhw_annual_expected
    assert results.loc[7, "h * kiloW / year"][
        "Electricity Annual"] == electricity_annual_expected
def load_from_disk(base_output_folder, main_config_path):
    base_output_folder = __abs_path(base_output_folder)
    assert os.path.exists(
        base_output_folder
    ), f"folder {base_output_folder} to load scenario from is not available!"
    sim_manager = SimulationManager(base_output_folder,
                                    main_config_path,
                                    cesarp.common.init_unit_registry(),
                                    load_from_disk=True)
    if sim_manager.is_demand_results_available():
        res_summary = sim_manager.get_all_results_summary()
        print(res_summary)
    else:
        print(
            f"are you sure simulation was run for scenario saved under {base_output_folder}?"
        )
示例#3
0
def test_window_shading(result_main_folder):
    """ validated agains matlab implementation of ricardo """
    cfg_file = _TESTFIXTURE_FOLDER / Path("cooling") / Path("main_config.yml")
    cfg = cesarp.common.load_config_full(cfg_file)
    cfg["OPERATION"] = {
        "WINDOW_SHADING_CONTROL": {
            "ACTIVE": True
        },
        "NIGHT_VENTILATION": {
            "ACTIVE": False
        }
    }
    # Note: trick to debug results: remove deleting result folder in res_folder(), then run it once, then uncomment
    #       sim_mgr.run_all_steps(), change load_from_disk=True and then debug and check the results...
    sim_mgr = SimulationManager(result_main_folder / Path("sim_test"),
                                cfg,
                                cesarp.common.init_unit_registry(),
                                load_from_disk=False)
    sim_mgr.run_all_steps()
    results = sim_mgr.get_all_results_summary()
    dhw_annual_expected = pytest.approx(10351.6, rel=0.005)
    electricity_annual_expected = pytest.approx(71953)
    assert results.loc[2,
                       "h * kiloW / year"]["Cooling Annual"] == pytest.approx(
                           297.6, rel=0.005)
    assert results.loc[2,
                       "h * kiloW / year"]["Heating Annual"] == pytest.approx(
                           172524, rel=0.005)
    assert results.loc[2,
                       "h * kiloW / year"]["DHW Annual"] == dhw_annual_expected
    assert results.loc[2, "h * kiloW / year"][
        "Electricity Annual"] == electricity_annual_expected

    assert results.loc[7,
                       "h * kiloW / year"]["Cooling Annual"] == pytest.approx(
                           13718.5, rel=0.005)
    assert results.loc[7,
                       "h * kiloW / year"]["Heating Annual"] == pytest.approx(
                           21194.7, rel=0.005)
    assert results.loc[7,
                       "h * kiloW / year"]["DHW Annual"] == dhw_annual_expected
    assert results.loc[7, "h * kiloW / year"][
        "Electricity Annual"] == electricity_annual_expected

    assert results.loc[8,
                       "h * kiloW / year"]["Cooling Annual"] == pytest.approx(
                           16000.9, rel=0.005)
    assert results.loc[8,
                       "h * kiloW / year"]["Heating Annual"] == pytest.approx(
                           15840.86, rel=0.005)
    assert results.loc[8,
                       "h * kiloW / year"]["DHW Annual"] == dhw_annual_expected
    assert results.loc[8, "h * kiloW / year"][
        "Electricity Annual"] == electricity_annual_expected

    assert results.loc[9,
                       "h * kiloW / year"]["Cooling Annual"] == pytest.approx(
                           14822.8, rel=0.005)
    assert results.loc[9,
                       "h * kiloW / year"]["Heating Annual"] == pytest.approx(
                           14548.6, rel=0.005)
    assert results.loc[9,
                       "h * kiloW / year"]["DHW Annual"] == dhw_annual_expected
    assert results.loc[9, "h * kiloW / year"][
        "Electricity Annual"] == electricity_annual_expected