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
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