def test_window_shading(result_main_folder, default_main_cfg,
                        ep_version_setup):
    all_config = cesarp.common.load_config_full(default_main_cfg)
    if "EPLUS_ADAPTER" not in all_config.keys():
        all_config["EPLUS_ADAPTER"] = {}
    #all_config["OPERATION"]= {"WINDOW_SHADING_CONTROL": {"ACTIVE": True}}
    if "GEOMETRY" not in all_config.keys():
        all_config["GEOMETRY"] = {}
    if "NEIGHBOURHOIOD" not in all_config["GEOMETRY"].keys():
        all_config["GEOMETRY"]["NEIGHBOURHOOD"] = {}
    all_config["GEOMETRY"]["NEIGHBOURHOOD"][
        "RADIUS"] = 0  # to get less complicated IDF
    base_folder = str(result_main_folder / Path("win_shading_ep85"))
    sim_manager = SimulationManager(base_folder,
                                    all_config,
                                    cesarp.common.init_unit_registry(),
                                    fids_to_use=[4])

    sim_manager.create_bldg_models()
    sim_manager.create_IDFs()
    idf_output = base_folder / Path("idfs") / "fid_4.idf"
    expected_output = os.path.dirname(__file__) / Path(
        "expected_result") / Path("win_shading") / Path(
            "fid_4_win_shading_ep85.idf")
    assert test_helpers.are_files_equal(idf_output,
                                        expected_output,
                                        ignore_changing_config=True,
                                        ignore_filesep_mismatch=True,
                                        ignore_line_nrs=[1])
Пример #2
0
def test_window_shading(result_main_folder, default_main_cfg, ep_version_setup, caplog):
    caplog.set_level(logging.DEBUG, logger="cesarp.manager.processing_steps")
    caplog.set_level(logging.DEBUG, logger="cesarp.manager.SimulationManager")
    all_config = cesarp.common.load_config_full(default_main_cfg)
    if not "EPLUS_ADAPTER" in all_config.keys():
        all_config["EPLUS_ADAPTER"] = {}
    all_config["EPLUS_ADAPTER"]["EPLUS_VERSION"] = "9.5"
    all_config["OPERATION"] = {"WINDOW_SHADING_CONTROL": {"ACTIVE": True}}
    if "GEOMETRY" not in all_config.keys():
        all_config["GEOMETRY"] = {}
    if "NEIGHBOURHOIOD" not in all_config["GEOMETRY"].keys():
        all_config["GEOMETRY"]["NEIGHBOURHOOD"] = {}
    all_config["GEOMETRY"]["NEIGHBOURHOOD"]["RADIUS"] = 0 # to get less complicated IDF
    base_folder = str(result_main_folder / Path("win_shading_ep95"))

    idf_output = base_folder / Path("idfs") / "fid_4.idf"
    #run_single_bldg(4, "dummy_weather.epw", idf_output, str(base_folder/Path("ep_res_fid4")), all_config, cesarp.common.init_unit_registry())

    sim_manager = SimulationManager(base_folder, all_config, cesarp.common.init_unit_registry(), fids_to_use=[4])

    sim_manager.create_bldg_models()
    sim_manager.create_IDFs()

    expected_output = os.path.dirname(__file__) / Path("expected_result") / Path("win_shading") / Path("fid_4_win_shading_ep95.idf")
    assert test_helpers.are_files_equal(idf_output, expected_output, ignore_changing_config=True, ignore_filesep_mismatch=True, ignore_line_nrs=[1])
Пример #3
0
def test_create_idf_with_SIA_generated_profiles(config_sample_case,
                                                result_main_folder):
    config = config_sample_case
    res_base_path = result_main_folder / Path(
        "sia_test_sample_case_no_neighbourhood")
    config["MANAGER"]["BLDG_TYPE_PER_BLDG_FILE"] = {
        "PATH":
        str(
            os.path.dirname(__file__) /
            Path("./testfixture/sample_case/BuildingInformation.csv"))
    }
    config["MANAGER"][
        "BUILDING_OPERATION_FACTORY_CLASS"] = "cesarp.SIA2024.SIA2024Facade.SIA2024Facade"
    config["MANAGER"]["INFILTRATION_RATE_SOURCE"] = "SIA2024"
    expected_folder_path = os.path.dirname(__file__) / Path(
        "./expected_result/sia_test_sample_case_no_neighbourhood/")
    expected_idf_file_path = expected_folder_path / Path("gis_fid2") / Path(
        "fid_2.idf")
    config["GEOMETRY"] = {"NEIGHBOURHOOD": {"RADIUS": 0}}
    gis_fid = 2
    sim_mgr = SimulationManager(res_base_path,
                                config,
                                cesarp.common.init_unit_registry(),
                                fids_to_use=[gis_fid])
    sim_mgr.create_bldg_models()
    sim_mgr.create_IDFs()
    assert are_files_equal(sim_mgr.idf_pathes[gis_fid],
                           expected_idf_file_path,
                           ignore_line_nrs=[1],
                           ignore_filesep_mismatch=True)
Пример #4
0
def test_many_vertices_building(result_main_folder, config_many_vertices, ep_version_setup):
    fid = 14002
    res_base_path = result_main_folder / Path("sample_case_many_vertices_95")
    result_idf_file_path = res_base_path / Path("idfs") / f"fid_{fid}.idf"

    sim_mgr = SimulationManager(res_base_path, config_many_vertices, cesarp.common.init_unit_registry(), fids_to_use=[fid])
    sim_mgr.create_bldg_models()
    sim_mgr.create_IDFs()

    # if not enough vertices can be created or not enough windows can be added for windowshadingcontrol due to an error in the IDD or not adapted IDD
    # creation of IDF file crashes
    # not comparing IDF files to avoid the need to adapt this expected result file when other changes are made
    assert os.path.exists(result_idf_file_path)
def test_weather_per_community(result_main_folder, default_main_cfg):
    base_folder = str(result_main_folder / Path("weather_per_community"))
    sim_manager = SimulationManager(base_folder, default_main_cfg, cesarp.common.init_unit_registry())

    sim_manager.create_bldg_models()
    sim_manager.save_bldg_containers()
    mdls_outpath = base_folder / Path("bldg_containers")
    assert len(os.listdir(mdls_outpath)) == 9
    assert any([os.path.getsize(mdls_outpath / Path(mdl_dump)) > 0 for mdl_dump in os.listdir(mdls_outpath)])

    sim_manager.create_IDFs()
    idf_output = base_folder / Path("idfs")
    idf_res_files = scan_directory(idf_output, "fid_{}.idf").values()
    assert len(idf_res_files) == 9
    assert any([os.path.getsize(idf_output / Path(idf)) > 0 for idf in idf_res_files])
    assert os.path.getsize(idf_output / Path("weather_files_mapped.csvy")) > 0
    assert len(os.listdir(idf_output / Path("profiles"))) == 1
Пример #6
0
    def create_scenario(self, name, specific_config_path=None) -> None:
        """
        Create a new scenario. In case of variability/random constructions, the assignment is not preserved from another scenario!

        :param name: name/key for the scneario. Has to be convertible to string (str(name)) and this string representation valid as a folder name.
        :param specific_config_path: If you have scenario specific configuration parameters, you can specify the
                                     config file path or a dictionary here.
                                     It overwrites properties of project configuration, if parameters are specified in both of them
        :param fids_to_use: the fid's of the site which are used in this scenario. Building models, IDF's and simulation is only performed for those fid's
        :return: nothing
        """
        sc_config = self._merge_config(specific_config_path)
        sc_path = self.__get_scenario_path_for_name(name)
        assert not os.path.exists(
            sc_path
        ), f"cannot create new scenario named {name}, folder {sc_path} exists"
        simMgr = SimulationManager(sc_path,
                                   sc_config,
                                   self.ureg,
                                   fids_to_use=self._fids_to_use)
        simMgr.create_bldg_models()
        simMgr.save_bldg_containers()
        simMgr.create_IDFs()
        self._scenarios[name] = simMgr