def calc_PVT(locator, config, latitude, longitude, weather_data, date_local, building_name): """ This function first determines the surface area with sufficient solar radiation, and then calculates the optimal tilt angles of panels at each surface location. The panels are categorized into groups by their surface azimuths, tilt angles, and global irradiation. In the last, electricity and heat generation from PVT panels of each group are calculated. :param locator: An InputLocator to locate input files :type locator: cea.inputlocator.InputLocator :param radiation_json_path: path to solar insulation data on all surfaces of each building :type radiation_json_path: string :param metadata_csv_path: path to data of sensor points measuring solar insulation of each building :type metadata_csv_path: string :param latitude: latitude of the case study location :type latitude: float :param longitude: longitude of the case study location :type longitude: float :param weather_path: path to the weather data file of the case study location :type weather_path: .epw :param building_name: list of building names in the case study :type building_name: Series :param T_in: inlet temperature to the solar collectors [C] :return: Building_PVT.csv with solar collectors heat generation potential of each building, Building_PVT_sensors.csv with sensor data of each PVT panel. """ t0 = time.clock() radiation_json_path = locator.get_radiation_building_sensors(building_name) metadata_csv_path = locator.get_radiation_metadata(building_name) # solar properties solar_properties = solar_equations.calc_sun_properties( latitude, longitude, weather_data, date_local, config) print('calculating solar properties done for building %s' % building_name) # get properties of the panel to evaluate # TODO: find a PVT module reference panel_properties_PV = calc_properties_PV_db( locator.get_database_conversion_systems(), config) panel_properties_SC = calc_properties_SC_db( locator.get_database_conversion_systems(), config) print('gathering properties of PVT collector panel for building %s' % building_name) # select sensor point with sufficient solar radiation max_annual_radiation, annual_radiation_threshold, sensors_rad_clean, sensors_metadata_clean = \ solar_equations.filter_low_potential(radiation_json_path, metadata_csv_path, config) print('filtering low potential sensor points done for building %s' % building_name) # Calculate the heights of all buildings for length of vertical pipes tot_bui_height_m = gpd.read_file( locator.get_zone_geometry())['height_ag'].sum() if not sensors_metadata_clean.empty: # calculate optimal angle and tilt for panels according to PV module size sensors_metadata_cat = solar_equations.optimal_angle_and_tilt( sensors_metadata_clean, latitude, solar_properties, max_annual_radiation, panel_properties_PV) print( 'calculating optimal tile angle and separation done for building %s' % building_name) # group the sensors with the same tilt, surface azimuth, and total radiation sensor_groups = solar_equations.calc_groups(sensors_rad_clean, sensors_metadata_cat) print('generating groups of sensor points done for building %s' % building_name) Final = calc_PVT_generation(sensor_groups, weather_data, date_local, solar_properties, latitude, tot_bui_height_m, panel_properties_SC, panel_properties_PV, config) Final.to_csv(locator.PVT_results(building=building_name), index=True, float_format='%.2f') sensors_metadata_cat.to_csv( locator.PVT_metadata_results(building=building_name), index=True, index_label='SURFACE', float_format='%.2f' ) # print selected metadata of the selected sensors print('Building', building_name, 'done - time elapsed:', (time.clock() - t0), ' seconds') else: # This block is activated when a building has not sufficient solar potential Final = pd.DataFrame( { 'Date': date_local, 'PVT_walls_north_E_kWh': 0.0, 'PVT_walls_north_m2': 0.0, 'PVT_walls_north_Q_kWh': 0.0, 'PVT_walls_north_Tout_C': 0.0, 'PVT_walls_south_E_kWh': 0.0, 'PVT_walls_south_m2': 0, 'PVT_walls_south_Q_kWh': 0.0, 'PVT_walls_south_Tout_C': 0.0, 'PVT_walls_east_E_kWh': 0.0, 'PVT_walls_east_m2': 0.0, 'PVT_walls_east_Q_kWh': 0.0, 'PVT_walls_east_Tout_C': 0.0, 'PVT_walls_west_E_kWh': 0.0, 'PVT_walls_west_m2': 0.0, 'PVT_walls_west_Q_kWh': 0.0, 'PVT_walls_west_Tout_C': 0.0, 'PVT_roofs_top_E_kWh': 0.0, 'PVT_roofs_top_m2': 0.0, 'PVT_roofs_top_Q_kWh': 0.0, 'PVT_roofs_top_Tout_C': 0.0, 'Q_PVT_gen_kWh': 0.0, 'T_PVT_sup_C': 0.0, 'T_PVT_re_C': 0.0, 'mcp_PVT_kWperC': 0.0, 'Eaux_PVT_kWh': 0.0, 'Q_PVT_l_kWh': 0.0, 'E_PVT_gen_kWh': 0.0, 'Area_PVT_m2': 0.0, 'radiation_kWh': 0.0 }, index=range(HOURS_IN_YEAR)) Final.to_csv(locator.PVT_results(building=building_name), index=False, float_format='%.2f', na_rep='nan') sensors_metadata_cat = pd.DataFrame( { 'SURFACE': 0, 'AREA_m2': 0, 'BUILDING': 0, 'TYPE': 0, 'Xcoor': 0, 'Xdir': 0, 'Ycoor': 0, 'Ydir': 0, 'Zcoor': 0, 'Zdir': 0, 'orientation': 0, 'total_rad_Whm2': 0, 'tilt_deg': 0, 'B_deg': 0, 'array_spacing_m': 0, 'surface_azimuth_deg': 0, 'area_installed_module_m2': 0, 'CATteta_z': 0, 'CATB': 0, 'CATGB': 0, 'type_orientation': 0 }, index=range(2)) sensors_metadata_cat.to_csv( locator.PVT_metadata_results(building=building_name), index=False, float_format='%.2f') return
def calc_PV(locator, config, latitude, longitude, weather_data, datetime_local, building_name): """ This function first determines the surface area with sufficient solar radiation, and then calculates the optimal tilt angles of panels at each surface location. The panels are categorized into groups by their surface azimuths, tilt angles, and global irradiation. In the last, electricity generation from PV panels of each group is calculated. :param locator: An InputLocator to locate input files :type locator: cea.inputlocator.InputLocator :param radiation_path: solar insulation data on all surfaces of each building (path :type radiation_path: String :param metadata_csv: data of sensor points measuring solar insulation of each building :type metadata_csv: .csv :param latitude: latitude of the case study location :type latitude: float :param longitude: longitude of the case study location :type longitude: float :param weather_path: path to the weather data file of the case study location :type weather_path: .epw :param building_name: list of building names in the case study :type building_name: Series :return: Building_PV.csv with PV generation potential of each building, Building_sensors.csv with sensor data of each PV panel. """ t0 = time.clock() radiation_path = locator.get_radiation_building(building_name) metadata_csv_path = locator.get_radiation_metadata(building_name) # solar properties solar_properties = solar_equations.calc_sun_properties(latitude, longitude, weather_data, datetime_local, config) print('calculating solar properties done') # calculate properties of PV panel panel_properties_PV = calc_properties_PV_db(locator.get_database_supply_systems(), config) print('gathering properties of PV panel') # select sensor point with sufficient solar radiation max_annual_radiation, annual_radiation_threshold, sensors_rad_clean, sensors_metadata_clean = \ solar_equations.filter_low_potential(radiation_path, metadata_csv_path, config) print('filtering low potential sensor points done') if not sensors_metadata_clean.empty: # calculate optimal angle and tilt for panels sensors_metadata_cat = solar_equations.optimal_angle_and_tilt(sensors_metadata_clean, latitude, solar_properties, max_annual_radiation, panel_properties_PV) print('calculating optimal tile angle and separation done') # group the sensors with the same tilt, surface azimuth, and total radiation sensor_groups = solar_equations.calc_groups(sensors_rad_clean, sensors_metadata_cat) print('generating groups of sensor points done') final = calc_pv_generation(sensor_groups, weather_data, datetime_local, solar_properties, latitude, panel_properties_PV) final.to_csv(locator.PV_results(building_name=building_name), index=True, float_format='%.2f') # print PV generation potential sensors_metadata_cat.to_csv(locator.PV_metadata_results(building_name=building_name), index=True, index_label='SURFACE', float_format='%.2f') # print selected metadata of the selected sensors print(building_name, 'done - time elapsed: %.2f seconds' % (time.clock() - t0)) else: # This loop is activated when a building has not sufficient solar potential final = pd.DataFrame( {'Date': datetime_local, 'PV_walls_north_E_kWh': 0, 'PV_walls_north_m2': 0, 'PV_walls_south_E_kWh': 0, 'PV_walls_south_m2': 0, 'PV_walls_east_E_kWh': 0, 'PV_walls_east_m2': 0, 'PV_walls_west_E_kWh': 0, 'PV_walls_west_m2': 0, 'PV_roofs_top_E_kWh': 0, 'PV_roofs_top_m2': 0, 'E_PV_gen_kWh': 0, 'Area_PV_m2': 0, 'radiation_kWh': 0}, index=range(HOURS_IN_YEAR)) final.to_csv(locator.PV_results(building_name=building_name), index=False, float_format='%.2f') sensors_metadata_cat = pd.DataFrame( {'SURFACE': 0, 'AREA_m2': 0, 'BUILDING': 0, 'TYPE': 0, 'Xcoor': 0, 'Xdir': 0, 'Ycoor': 0, 'Ydir': 0, 'Zcoor': 0, 'Zdir': 0, 'orientation': 0, 'total_rad_Whm2': 0, 'tilt_deg': 0, 'B_deg': 0, 'array_spacing_m': 0, 'surface_azimuth_deg': 0, 'area_installed_module_m2': 0, 'CATteta_z': 0, 'CATB': 0, 'CATGB': 0, 'type_orientation': 0}, index=range(2)) sensors_metadata_cat.to_csv(locator.PV_metadata_results(building_name=building_name), index=False, float_format='%.2f') return
def calc_SC(locator, config, radiation_csv, metadata_csv, latitude, longitude, weather_path, building_name): """ This function first determines the surface area with sufficient solar radiation, and then calculates the optimal tilt angles of panels at each surface location. The panels are categorized into groups by their surface azimuths, tilt angles, and global irradiation. In the last, heat generation from SC panels of each group is calculated. :param locator: An InputLocator to locate input files :type locator: cea.inputlocator.InputLocator :param config: cea.config :param radiation_csv: solar insulation data on all surfaces of each building :type radiation_csv: .csv :param metadata_csv: data of sensor points measuring solar insulation of each building :type metadata_csv: .csv :param latitude: latitude of the case study location :type latitude: float :param longitude: longitude of the case study location :type longitude: float :param weather_path: path to the weather data file of the case study location :type weather_path: .epw :param building_name: list of building names in the case study :type building_name: Series :return: Building_SC.csv with solar collectors heat generation potential of each building, Building_SC_sensors.csv with sensor data of each SC panel """ t0 = time.clock() # weather data weather_data = epwreader.epw_reader(weather_path) date_local = solar_equations.cal_date_local_from_weather_file(weather_data, config) print 'reading weather data done' # solar properties solar_properties = solar_equations.calc_sun_properties(latitude, longitude, weather_data, date_local, config) print 'calculating solar properties done' # get properties of the panel to evaluate panel_properties_SC = calc_properties_SC_db(locator.get_supply_systems(config.region), config) print 'gathering properties of Solar collector panel' # select sensor point with sufficient solar radiation max_annual_radiation, annual_radiation_threshold, sensors_rad_clean, sensors_metadata_clean = \ solar_equations.filter_low_potential(weather_data, radiation_csv, metadata_csv, config) print 'filtering low potential sensor points done' # Calculate the heights of all buildings for length of vertical pipes tot_bui_height_m = gpd.read_file(locator.get_zone_geometry())['height_ag'].sum() if not sensors_metadata_clean.empty: # calculate optimal angle and tilt for panels sensors_metadata_cat = solar_equations.optimal_angle_and_tilt(sensors_metadata_clean, latitude, solar_properties, max_annual_radiation, panel_properties_SC) print 'calculating optimal tilt angle and separation done' # group the sensors with the same tilt, surface azimuth, and total radiation sensor_groups = solar_equations.calc_groups(sensors_rad_clean, sensors_metadata_cat) print 'generating groups of sensor points done' # calculate heat production from solar collectors Final = calc_SC_generation(sensor_groups, weather_data, date_local, solar_properties, tot_bui_height_m, panel_properties_SC, latitude, config) # save SC generation potential and metadata of the selected sensors panel_type = panel_properties_SC['type'] Final.to_csv(locator.SC_results(building_name, panel_type), index=True, float_format='%.2f', na_rep='nan') sensors_metadata_cat.to_csv(locator.SC_metadata_results(building_name, panel_type), index=True, index_label='SURFACE', float_format='%.2f') # print selected metadata of the selected sensors print 'Building', building_name, 'done - time elapsed:', (time.clock() - t0), ' seconds' else: # This loop is activated when a building has not sufficient solar potential panel_type = panel_properties_SC['type'] Final = pd.DataFrame( {'SC_walls_north_m2': 0, 'SC_walls_north_Q_kWh': 0, 'SC_walls_north_Tout_C': 0, 'SC_walls_south_m2': 0, 'SC_walls_south_Q_kWh': 0, 'SC_walls_south_Tout_C': 0, 'SC_walls_east_m2': 0, 'SC_walls_east_Q_kWh': 0, 'SC_walls_east_Tout_C': 0, 'SC_walls_west_m2': 0, 'SC_walls_west_Q_kWh': 0, 'SC_walls_west_Tout_C': 0, 'SC_roofs_top_m2': 0, 'SC_roofs_top_Q_kWh': 0, 'SC_roofs_top_Tout_C': 0, 'Q_SC_gen_kWh': 0, 'T_SC_sup_C': 0, 'T_SC_re_C': 0, 'mcp_SC_kWperC': 0, 'Eaux_SC_kWh': 0, 'Q_SC_l_kWh': 0, 'Area_SC_m2': 0, 'radiation_kWh': 0}, index=range(8760)) Final.to_csv(locator.SC_results(building_name, panel_type), index=True, float_format='%.2f') sensors_metadata_cat = pd.DataFrame( {'SURFACE': 0, 'AREA_m2': 0, 'BUILDING': 0, 'TYPE': 0, 'Xcoor': 0, 'Xdir': 0, 'Ycoor': 0, 'Ydir': 0, 'Zcoor': 0, 'Zdir': 0, 'orientation': 0, 'total_rad_Whm2': 0, 'tilt_deg': 0, 'B_deg': 0, 'array_spacing_m': 0, 'surface_azimuth_deg': 0, 'area_installed_module_m2': 0, 'CATteta_z': 0, 'CATB': 0, 'CATGB': 0, 'type_orientation': 0}, index=range(2)) sensors_metadata_cat.to_csv(locator.SC_metadata_results(building_name, panel_type), index=True, float_format='%.2f') return