def calc_Ctot_cs_building_scale_buildings(network_info): """ Caculates the space cooling cost of disconnected buildings. The calculation for partially disconnected buildings is done in calc_Ctot_cs_building_scale_loads. :param network_info: an object storing information of the current network :return: """ ## Calculate disconnected heat load costs dis_opex = 0.0 dis_capex = 0.0 if len(network_info.disconnected_buildings_index) > 0: # we have disconnected buildings # Make sure files to read in exist for building_index, building in enumerate(network_info.building_names): # iterate through all buildings Opex_var_system = 0.0 if building_index in network_info.disconnected_buildings_index: # disconnected building # Read in demand of building building_demand = pd.read_csv(network_info.locator.get_demand_results_file(building)) # sum up demand of all loads demand_hourly_kWh = building_demand['Qcs_sys_scu_kWh'].abs() + \ building_demand['Qcs_sys_ahu_kWh'].abs() + \ building_demand['Qcs_sys_aru_kWh'].abs() # calculate peak demand peak_demand_kW = demand_hourly_kWh.abs().max() print('Calculate cost of disconnected building production at building ', building) if network_info.yearly_cost_calculations: demand_annual_kWh = demand_hourly_kWh.sum() # calculate plant COP according to the cold water supply temperature in SG context supplied_systems = find_supplied_systems_annual(network_info, building_demand, ['ahu', 'aru', 'scu'], dis_build=True) COP_chiller_system, COP_chiller = VCCModel.calc_VCC_COP(network_info.weather_data, supplied_systems, centralized=False) # calculate cost of producing cooling Opex_var_system = demand_annual_kWh / COP_chiller_system * 1000 * network_info.prices.ELEC_PRICE # calculate chiller heat rejection via CT Q_peak_CT_kW = calc_CT_load_from_chiller_load(COP_chiller, peak_demand_kW) else: Q_CT_kW = [0] * HOURS_IN_YEAR for t in range(HOURS_IN_YEAR): supplied_systems = find_supplied_systems_t(network_info, t, building_demand, ['ahu', 'aru', 'scu'], dis_build=True) # calculate COP of plant operation in this hour based on supplied loads # calculate plant COP according to the cold water supply temperature in SG context COP_chiller_system, COP_chiller = VCCModel.calc_VCC_COP(network_info.weather_data, supplied_systems, centralized=False) # calculate cost of producing cooling Opex_var_system += abs(demand_hourly_kWh[ t]) / COP_chiller_system * 1000 * network_info.prices.ELEC_PRICE # calculate chiller heat rejection via CT Q_CT_kW[t] = calc_CT_load_from_chiller_load(COP_chiller, abs(demand_hourly_kWh[t])) Q_peak_CT_kW = max(Q_CT_kW) # calculate cost of chiller and cooling tower at building level Capex_a_chiller_USD, Opex_fixed_chiller, _ = VCCModel.calc_Cinv_VCC(peak_demand_kW * 1000, network_info.locator, 'CH3') Capex_a_CT_USD, Opex_fixed_CT, _ = CTModel.calc_Cinv_CT(Q_peak_CT_kW * 1000, network_info.locator, 'CT1') # sum up costs dis_opex += Opex_var_system + Opex_fixed_chiller + Opex_fixed_CT dis_capex += Capex_a_chiller_USD + Capex_a_CT_USD dis_total = dis_opex + dis_capex return dis_total, dis_opex, dis_capex
def calc_Ctot_cs_building_scale_loads(network_info): """ Calculates the space cooling cost of disconnected loads at the building level. The calculation for entirely disconnected buildings is done in calc_Ctot_cs_building_scale_buildings. :param Thermal_Network network_info: an object storing information of the current network :return: """ disconnected_systems = [] dis_opex = 0 dis_capex = 0 ''' for system in optimal_network.full_heating_systems: if system not in optimal_network.config.thermal_network.substation_heating_systems: disconnected_systems.append(system) # Make sure files to read in exist for system in disconnected_systems: for building in optimal_network.building_names: assert optimal_network.locator.get_optimization_building_scale_folder_building_result_heating(building), "Missing diconnected building files. Please run disconnected_buildings_heating first." # Read in disconnected cost of all buildings disconnected_cost = optimal_network.locator.get_optimization_building_scale_folder_building_result_heating(building) ''' if network_info.network_type == 'DC': supplied_systems = [] # iterate through all possible cooling systems for system in network_info.full_cooling_systems: if system not in network_info.substation_cooling_systems: # add system to list of loads that are supplied at building level disconnected_systems.append(system) if len(disconnected_systems) > 0: # check if we have any disconnected systems system_string = find_cooling_systems_string(disconnected_systems) # iterate through all buildings for building_index, building in enumerate( network_info.building_names): Opex_var_system = 0.0 if building_index not in network_info.disconnected_buildings_index: # if this building is disconnected it will be calculated separately # Read in building demand building_demand = pd.read_csv( network_info.locator.get_demand_results_file(building)) if not system_string: # this means there are no disconnected loads. Shouldn't happen but is a fail-safe peak_demand_kW = 0.0 disconnected_demand_t_sum = 0.0 else: for system_index, system in enumerate( system_string ): # iterate through all disconnected loads # go through all systems and sum up demand values if system_index == 0: disconnected_demand_t = building_demand[system] else: disconnected_demand_t = disconnected_demand_t + building_demand[ system] peak_demand_kW = disconnected_demand_t.abs().max( ) # calculate peak demand of all disconnected systems disconnected_demand_t_sum = disconnected_demand_t.abs( ).sum() print 'Calculate cost of disconnected loads in building ', building if network_info.yearly_cost_calculations: supplied_systems = find_supplied_systems_annual( network_info, building_demand, supplied_systems) COP_chiller_system, COP_chiller = VCCModel.calc_VCC_COP( network_info.weather_data, system_string, centralized=False) # calculate cost of producing cooling Opex_var_system += disconnected_demand_t_sum / COP_chiller_system * 1000 * network_info.prices.ELEC_PRICE # calculate chiller heat rejection via CT Q_peak_CT_kW = calc_CT_load_from_chiller_load( COP_chiller, peak_demand_kW) else: Q_CT_kW = [0] * HOURS_IN_YEAR for t in range(HOURS_IN_YEAR): # calculate COP of chiller and CT operation in this hour based on supplied loads # calculate chiller COP according to the cold water supply temperature in SG context supplied_systems = find_supplied_systems_t( network_info, t, building_demand, supplied_systems) if len(supplied_systems) > 0: COP_chiller_system, COP_chiller = VCCModel.calc_VCC_COP( network_info.weather_data, supplied_systems, centralized=False) # calculate cost of producing cooling Opex_var_system += abs( disconnected_demand_t[t] ) / COP_chiller_system * 1000 * network_info.prices.ELEC_PRICE # calculate chiller heat rejection via CT Q_CT_kW[t] = calc_CT_load_from_chiller_load( COP_chiller, abs(disconnected_demand_t[t])) Q_peak_CT_kW = max(Q_CT_kW) # calculate disconnected systems cost of disconnected loads. Assumes that all these loads are supplied by one chiller, unless this exceeds maximum chiller capacity of database Capex_a_chiller_USD, Opex_fixed_chiller, _ = VCCModel.calc_Cinv_VCC( peak_demand_kW * 1000, network_info.locator, 'CH3') Capex_a_CT_USD, Opex_fixed_CT, _ = CTModel.calc_Cinv_CT( Q_peak_CT_kW * 1000, network_info.locator, 'CT1') # sum up costs dis_opex += Opex_var_system + Opex_fixed_chiller + Opex_fixed_CT dis_capex += Capex_a_chiller_USD + Capex_a_CT_USD dis_total = dis_opex + dis_capex return dis_total, dis_opex, dis_capex
def calc_Ctot_cooling_plants(network_info): """ Calculates costs of centralized cooling plants (chillers and cooling towers). :param NetworkInfo network_info: an object storing information of the current network :return: """ # read in plant heat requirement plant_heat_hourly_kWh = pd.read_csv( network_info.locator.get_thermal_network_plant_heat_requirement_file( network_info.network_type, network_info.network_names)) # read in number of plants number_of_plants = len(plant_heat_hourly_kWh.columns) plant_heat_original_kWh = plant_heat_hourly_kWh.copy() plant_heat_peak_kW_list = plant_heat_hourly_kWh.abs().max( axis=0).values # calculate peak demand plant_heat_sum_kWh_list = plant_heat_hourly_kWh.abs().sum( ).values # calculate aggregated demand Opex_var_plant = 0.0 Opex_fixed_plant = 0.0 Capex_a_chiller = 0.0 Capex_a_CT = 0.0 # calculate cost of chiller heat production and chiller capex and opex for plant_number in range(number_of_plants): # iterate through all plants if number_of_plants > 1: plant_heat_peak_kW = plant_heat_peak_kW_list[plant_number] else: plant_heat_peak_kW = plant_heat_peak_kW_list[0] plant_heat_yearly_kWh = plant_heat_sum_kWh_list[plant_number] print 'Annual plant heat production:', round(plant_heat_yearly_kWh, 0), '[kWh]' # Read in building demand building_demand = {} for building in network_info.building_names: building_demand[building] = pd.read_csv( network_info.locator.get_demand_results_file(building)) Capex_a_chiller_USD = 0.0 Opex_fixed_chiller = 0.0 Capex_a_CT_USD = 0.0 Opex_fixed_CT = 0.0 if plant_heat_peak_kW > 0: # we have non 0 demand peak_demand_W = plant_heat_peak_kW * 1000 # convert to W print 'Calculating cost of heat production at plant number: ', ( plant_number + 1) if network_info.config.thermal_network_optimization.yearly_cost_calculations: # calculates operation costs with yearly approximation # check which systems are supplied by cooling plants, this is either defined by the optimization # or given as a user input from config. supplied_systems = find_supplied_systems_annual( network_info, building_demand, network_info.full_cooling_systems) # calculate the COP based on the actually supplied demands. COP_plant, COP_chiller = VCCModel.calc_VCC_COP( network_info.weather_data, supplied_systems, centralized=True) Opex_var_plant += abs( plant_heat_yearly_kWh ) / COP_plant * 1000 * network_info.prices.ELEC_PRICE else: # calculates operation costs with hourly simulation for t in range(HOURS_IN_YEAR): # calculate COP of plant operation in this hour based on supplied loads # Depending on the demand of that hour, the COP will change. # E.g. supplied systems = ahu, aru: # t = 10 we have demand for ahu and aru, so the COP is calculated using ahu and aru # t = 11 we only have ahu demand, so COP is calculated using ahu only # t = 12 we only have aru demand, so COP is calculated using aru only # ... etc. supplied_systems = find_supplied_systems_t( network_info, t, building_demand, network_info.full_cooling_systems) COP_plant, COP_chiller = VCCModel.calc_VCC_COP( network_info.weather_data, supplied_systems, centralized=True) # calculate cost of producing cooling column_name = plant_heat_original_kWh.columns[plant_number] Opex_var_plant += abs( plant_heat_original_kWh[column_name][t] ) / COP_plant * 1000 * network_info.prices.ELEC_PRICE # calculate equipment cost of chiller and cooling tower Capex_a_chiller_USD, Opex_fixed_chiller, _ = VCCModel.calc_Cinv_VCC( peak_demand_W, network_info.locator, 'CH1') Capex_a_CT_USD, Opex_fixed_CT, _ = CTModel.calc_Cinv_CT( peak_demand_W, network_info.locator, 'CT1') # sum over all plants Capex_a_chiller += Capex_a_chiller_USD Capex_a_CT += Capex_a_CT_USD Opex_fixed_plant += Opex_fixed_chiller + Opex_fixed_CT return Opex_fixed_plant, Opex_var_plant, Capex_a_chiller, Capex_a_CT