def to_modelica(self, scaffold, keep_original_models=False): """ Save the TEASER representation of the buildings to the filesystem. The path will be scaffold.loads_path.files_dir. :param scaffold: Scaffold object, contains all the paths of the project :param keep_original_models: boolean, whether or not to remove the models after exporting from Teaser """ # Teaser changes the current dir, so make sure to reset it back to where we started building_names = [] curdir = os.getcwd() try: prj = Project(load_data=True) for building in self.buildings: building_name = building["building_id"] prj.add_non_residential( method="bmvbs", usage=self.lookup_building_type(building["building_type"]), name=building_name, year_of_construction=building["year_built"], number_of_floors=building["num_stories"], height_of_floors=building["floor_height"], net_leased_area=building["area"], office_layout=1, window_layout=1, with_ahu=False, construction_type="heavy", ) building_names.append(building_name) prj.used_library_calc = "IBPSA" prj.number_of_elements_calc = self.system_parameters.get_param( "buildings.default.load_model_parameters.rc.order", default=2 ) prj.merge_windows_calc = False # calculate the properties of all the buildings and export to the Buildings library prj.calc_all_buildings() prj.export_ibpsa(library="Buildings", path=os.path.join(curdir, scaffold.loads_path.files_dir)) finally: os.chdir(curdir) self.post_process(scaffold, building_names, keep_original_models=keep_original_models)
def main(): prj = Project(load_data=True) prj.name = "ResidentialCommunityUK_rad" # Building types: detached, terrace, office_lowenergy-early1980s, office_highcost-mid1980s. # Community created based on prj = load_namespace('teaser_prj_residentialUK') prj.name = "ResidentialCommunityUK_rad_2elements" prj.used_library_calc = 'IBPSA' prj.number_of_elements_calc = 3 prj.weather_file_path = os.path.join('path_to_weather_file', 'Nottingham_TRY.mos') prj.calc_all_buildings(raise_errors=True) store_namespace('teaser_prj_residential',prj) bldg_list=[] for bldg in prj.buildings: bldg_list.append(bldg.name) store_namespace('teaser_bldgs_residential',bldg_list) prj.export_parameters_txt(path="\\models") prj.export_ibpsa( internal_id=None, path="\models\\" ) for bldg in prj.buildings: for zone in bldg.thermal_zones: path = os.path.join("\models\\", prj.name) create_ibpsa_mpc_model(prj,bldg,zone,path=path) create_ibpsa_PI_model(prj,bldg,zone,path=path)