def calc_delta_theta_int_inc_heating(bpr): """ Model of losses in the emission and control system for space heating and cooling. Correction factor for the heating and cooling setpoints. Extracted from EN 15316-2 (see cea\databases\CH\Systems\emission_systems.xls for valid values for the heating and cooling system values) T0 means there's no heating/cooling systems installed, therefore, also no control systems for heating/cooling. In short, when the input system is T0, the output set point correction should be 0.0. So if there is no cooling systems, the setpoint_correction_for_space_emission_systems function input: (T1, T0, T1) (type_hs, type_cs, type_ctrl), return should be (2.65, 0.0), the control system is only specified for the heating system. In another case with no heating systems: input: (T0, T3, T1) return: (0.0, -2.0), the control system is only specified for the heating system. :param bpr: BuildingPropertiesRow :type bpr: BuildingPropertiesRow object :returns: delta T to correct the set point temperature for heating :rtype: double """ __author__ = ["Shanshan Hsieh", "Gabriel Happle"] __credits__ = ["Shanshan Hsieh", "Daren Thomas"] try: delta_theta_int_inc_heating = ( 0.0 if not has_heating_system(bpr.hvac["class_hs"]) else (bpr.hvac['dT_Qhs'] + bpr.hvac['dThs_C'])) except KeyError: raise ValueError('Invalid system / control combination: %s, %s' % (bpr.hvac['class_hs'], bpr.hvac['type_ctrl'])) return delta_theta_int_inc_heating
def calc_Eaux_Qhs_Qcs(tsd, bpr): """ Auxiliary electric loads from Legacy :param tsd: Time series data of building :type tsd: dict :param bpr: Building Properties Row object :type bpr: cea.demand.thermal_loads.BuildingPropertiesRow :return: """ # TODO: documentation Ll = bpr.geometry['Blength'] Lw = bpr.geometry['Bwidth'] Qcs_sys = tsd['Qcs_sys'] Qhs_sys = tsd['Qhs_sys'] Tcs_re_ahu = tsd['Tcs_sys_re_ahu'] Tcs_sup_ahu = tsd['Tcs_sys_sup_ahu'] Tcs_re_aru = tsd['Tcs_sys_re_aru'] Tcs_sup_aru = tsd['Tcs_sys_sup_aru'] Tcs_re_scu = tsd['Tcs_sys_re_scu'] Tcs_sup_scu = tsd['Tcs_sys_sup_scu'] Ths_re_ahu = tsd['Ths_sys_re_ahu'] Ths_sup_ahu = tsd['Ths_sys_sup_ahu'] Ths_re_aru = tsd['Ths_sys_re_aru'] Ths_sup_aru = tsd['Ths_sys_sup_aru'] Ths_re_shu = tsd['Ths_sys_re_shu'] Ths_sup_shu = tsd['Ths_sys_sup_shu'] Year = bpr.age['built'] fforma = bpr.building_systems['fforma'] nf_ag = bpr.geometry['floors_ag'] Ehs_lat_aux = tsd['Ehs_lat_aux'] # split up the final demands according to the fraction of energy frac_heat_ahu = [ ahu / sys if sys > 0 else 0 for ahu, sys in zip(tsd['Qhs_sen_ahu'], tsd['Qhs_sen_sys']) ] Qhs_sys_ahu = Qhs_sys * frac_heat_ahu Qhs_sys_0_ahu = np.nanmax(Qhs_sys_ahu) frac_heat_aru = [ aru / sys if sys > 0 else 0 for aru, sys in zip(tsd['Qhs_sen_aru'], tsd['Qhs_sen_sys']) ] Qhs_sys_aru = Qhs_sys * frac_heat_aru Qhs_sys_0_aru = np.nanmax(Qhs_sys_aru) frac_heat_shu = [ shu / sys if sys > 0 else 0 for shu, sys in zip(tsd['Qhs_sen_shu'], tsd['Qhs_sen_sys']) ] Qhs_sys_shu = Qhs_sys * frac_heat_shu Qhs_sys_0_shu = np.nanmax(Qhs_sys_shu) frac_cool_ahu = [ ahu / sys if sys < 0 else 0 for ahu, sys in zip(tsd['Qcs_sen_ahu'], tsd['Qcs_sen_sys']) ] Qcs_sys_ahu = Qcs_sys * frac_cool_ahu Qcs_sys_0_ahu = np.nanmin(Qcs_sys_ahu) frac_cool_aru = [ aru / sys if sys < 0 else 0 for aru, sys in zip(tsd['Qcs_sen_aru'], tsd['Qcs_sen_sys']) ] Qcs_sys_aru = Qcs_sys * frac_cool_aru Qcs_sys_0_aru = np.nanmin(Qcs_sys_aru) frac_cool_scu = [ scu / sys if sys < 0 else 0 for scu, sys in zip(tsd['Qcs_sen_scu'], tsd['Qcs_sen_sys']) ] Qcs_sys_scu = Qcs_sys * frac_cool_scu Qcs_sys_0_scu = np.nanmin(Qcs_sys_scu) Imax = 2 * (Ll + Lw / 2 + H_F + (nf_ag) + 10) * fforma deltaP_des = Imax * DELTA_P_1 * (1 + F_SR) if Year >= 2000: b = 1 else: b = 1.2 if control_heating_cooling_systems.has_heating_system(bpr): # for all subsystems Eaux_hs_ahu = np.vectorize(calc_Eauxf_hs_dis)(Qhs_sys_ahu, Qhs_sys_0_ahu, deltaP_des, b, Ths_sup_ahu, Ths_re_ahu) Eaux_hs_aru = np.vectorize(calc_Eauxf_hs_dis)(Qhs_sys_aru, Qhs_sys_0_aru, deltaP_des, b, Ths_sup_aru, Ths_re_aru) Eaux_hs_shu = np.vectorize(calc_Eauxf_hs_dis)(Qhs_sys_shu, Qhs_sys_0_shu, deltaP_des, b, Ths_sup_shu, Ths_re_shu) tsd['Eaux_hs'] = Eaux_hs_ahu + Eaux_hs_aru + Eaux_hs_shu # sum up else: tsd['Eaux_hs'] = np.zeros(8760) if control_heating_cooling_systems.has_cooling_system(bpr): # for all subsystems Eaux_cs_ahu = np.vectorize(calc_Eauxf_cs_dis)(Qcs_sys_ahu, Qcs_sys_0_ahu, deltaP_des, b, Tcs_sup_ahu, Tcs_re_ahu) Eaux_cs_aru = np.vectorize(calc_Eauxf_cs_dis)(Qcs_sys_aru, Qcs_sys_0_aru, deltaP_des, b, Tcs_sup_aru, Tcs_re_aru) Eaux_cs_scu = np.vectorize(calc_Eauxf_cs_dis)(Qcs_sys_scu, Qcs_sys_0_scu, deltaP_des, b, Tcs_sup_scu, Tcs_re_scu) tsd['Eaux_cs'] = Eaux_cs_ahu + Eaux_cs_aru + Eaux_cs_scu # sum up else: tsd['Eaux_cs'] = np.zeros(8760) return tsd
def calc_temperatures_emission_systems(bpr, tsd): """ Calculate temperature of emission systems. Using radiator function also for cooling ('radiators.calc_radiator') Modified from legacy Gabriel Happle, Feb. 2018 :param bpr: Building Properties :type bpr: BuildingPropertiesRow :param tsd: Time series data of building :type tsd: dict :return: modifies tsd :rtype: None """ from cea.technologies import radiators, heating_coils, tabs # # TEMPERATURES HEATING SYSTEMS # if not control_heating_cooling_systems.has_heating_system( bpr.hvac["class_hs"]): # if no heating system tsd['Ths_sys_sup_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_ahu'] = np.zeros(HOURS_IN_YEAR) tsd['Ths_sys_sup_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_aru'] = np.zeros(HOURS_IN_YEAR) tsd['Ths_sys_sup_shu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_shu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_shu'] = np.zeros(HOURS_IN_YEAR) elif control_heating_cooling_systems.has_radiator_heating_system(bpr): # if radiator heating system Ta_heating_0 = np.nanmax(tsd['ta_hs_set']) Qhs_sys_0 = np.nanmax(tsd['Qhs_sys']) # in W tsd['Ths_sys_sup_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_ahu'] = np.zeros(HOURS_IN_YEAR) tsd['Ths_sys_sup_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_aru'] = np.zeros(HOURS_IN_YEAR) Ths_sup, Ths_re, mcphs = np.vectorize(radiators.calc_radiator)( tsd['Qhs_sys'], tsd['T_int'], Qhs_sys_0, Ta_heating_0, bpr.building_systems['Ths_sup_shu_0'], bpr.building_systems['Ths_re_shu_0']) tsd['Ths_sys_sup_shu'] = Ths_sup tsd['Ths_sys_re_shu'] = Ths_re tsd['mcphs_sys_shu'] = mcphs elif control_heating_cooling_systems.has_central_ac_heating_system(bpr): # ahu # consider losses according to loads of systems frac_ahu = [ ahu / sys if sys > 0 else 0 for ahu, sys in zip(tsd['Qhs_sen_ahu'], tsd['Qhs_sen_sys']) ] qhs_sys_ahu = tsd['Qhs_sen_ahu'] + (tsd['Qhs_em_ls'] + tsd['Qhs_dis_ls']) * frac_ahu Qhs_sys_ahu_0 = np.nanmax(qhs_sys_ahu) # in W index = np.where(qhs_sys_ahu == Qhs_sys_ahu_0) ma_sup_0 = tsd['ma_sup_hs_ahu'][index[0][0]] Ta_sup_0 = tsd['ta_sup_hs_ahu'][index[0][0]] + KELVIN_OFFSET Ta_re_0 = tsd['ta_re_hs_ahu'][index[0][0]] + KELVIN_OFFSET Ths_sup, Ths_re, mcphs = np.vectorize(heating_coils.calc_heating_coil)( qhs_sys_ahu, Qhs_sys_ahu_0, tsd['ta_sup_hs_ahu'], tsd['ta_re_hs_ahu'], bpr.building_systems['Ths_sup_ahu_0'], bpr.building_systems['Ths_re_ahu_0'], tsd['ma_sup_hs_ahu'], ma_sup_0, Ta_sup_0, Ta_re_0) tsd['Ths_sys_sup_ahu'] = Ths_sup # in C tsd['Ths_sys_re_ahu'] = Ths_re # in C tsd['mcphs_sys_ahu'] = mcphs # ARU # consider losses according to loads of systems frac_aru = [ aru / sys if sys > 0 else 0 for aru, sys in zip(tsd['Qhs_sen_aru'], tsd['Qhs_sen_sys']) ] qhs_sys_aru = tsd['Qhs_sen_aru'] + (tsd['Qhs_em_ls'] + tsd['Qhs_dis_ls']) * frac_aru Qhs_sys_aru_0 = np.nanmax(qhs_sys_aru) # in W index = np.where(qhs_sys_aru == Qhs_sys_aru_0) ma_sup_0 = tsd['ma_sup_hs_aru'][index[0][0]] Ta_sup_0 = tsd['ta_sup_hs_aru'][index[0][0]] + KELVIN_OFFSET Ta_re_0 = tsd['ta_re_hs_aru'][index[0][0]] + KELVIN_OFFSET Ths_sup, Ths_re, mcphs = np.vectorize(heating_coils.calc_heating_coil)( qhs_sys_aru, Qhs_sys_aru_0, tsd['ta_sup_hs_aru'], tsd['ta_re_hs_aru'], bpr.building_systems['Ths_sup_aru_0'], bpr.building_systems['Ths_re_aru_0'], tsd['ma_sup_hs_aru'], ma_sup_0, Ta_sup_0, Ta_re_0) tsd['Ths_sys_sup_aru'] = Ths_sup # in C tsd['Ths_sys_re_aru'] = Ths_re # in C tsd['mcphs_sys_aru'] = mcphs # SHU tsd['Ths_sup_shu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_shu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_shu'] = np.zeros(HOURS_IN_YEAR) elif control_heating_cooling_systems.has_floor_heating_system(bpr): Ta_heating_0 = np.nanmax(tsd['ta_hs_set']) Qhs_sys_0 = np.nanmax(tsd['Qhs_sys']) # in W tsd['Ths_sys_sup_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_ahu'] = np.zeros(HOURS_IN_YEAR) tsd['Ths_sys_sup_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Ths_sys_re_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcphs_sys_aru'] = np.zeros(HOURS_IN_YEAR) Ths_sup, Ths_re, mcphs = np.vectorize(radiators.calc_radiator)( tsd['Qhs_sys'], tsd['T_int'], Qhs_sys_0, Ta_heating_0, bpr.building_systems['Ths_sup_shu_0'], bpr.building_systems['Ths_re_shu_0']) tsd['Ths_sys_sup_shu'] = Ths_sup tsd['Ths_sys_re_shu'] = Ths_re tsd['mcphs_sys_shu'] = mcphs else: raise Exception( 'Heating system not defined in function: "calc_temperatures_emission_systems"' ) # # TEMPERATURES COOLING SYSTEMS # if not control_heating_cooling_systems.has_cooling_system( bpr.hvac["class_cs"]): # if no cooling system tsd['Tcs_sys_sup_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_ahu'] = np.zeros(HOURS_IN_YEAR) tsd['Tcs_sys_sup_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_aru'] = np.zeros(HOURS_IN_YEAR) tsd['Tcs_sys_sup_scu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_scu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_scu'] = np.zeros(HOURS_IN_YEAR) elif control_heating_cooling_systems.has_central_ac_cooling_system(bpr): # AHU # consider losses according to loads of systems frac_ahu = [ ahu / sys if sys < 0 else 0 for ahu, sys in zip(tsd['Qcs_sen_ahu'], tsd['Qcs_sen_sys']) ] qcs_sys_ahu = tsd['Qcs_sen_ahu'] + tsd['Qcs_lat_ahu'] + ( tsd['Qcs_em_ls'] + tsd['Qcs_dis_ls']) * frac_ahu Qcs_sys_ahu_0 = np.nanmin(qcs_sys_ahu) # in W index = np.where(qcs_sys_ahu == Qcs_sys_ahu_0) ma_sup_0 = tsd['ma_sup_cs_ahu'][index[0][0]] Ta_sup_0 = tsd['ta_sup_cs_ahu'][index[0][0]] + KELVIN_OFFSET Ta_re_0 = tsd['ta_re_cs_ahu'][index[0][0]] + KELVIN_OFFSET Tcs_sup, Tcs_re, mcpcs = np.vectorize(heating_coils.calc_cooling_coil)( qcs_sys_ahu, Qcs_sys_ahu_0, tsd['ta_sup_cs_ahu'], tsd['ta_re_cs_ahu'], bpr.building_systems['Tcs_sup_ahu_0'], bpr.building_systems['Tcs_re_ahu_0'], tsd['ma_sup_cs_ahu'], ma_sup_0, Ta_sup_0, Ta_re_0) tsd['Tcs_sys_sup_ahu'] = Tcs_sup # in C tsd['Tcs_sys_re_ahu'] = Tcs_re # in C tsd['mcpcs_sys_ahu'] = mcpcs # ARU # consider losses according to loads of systems frac_aru = [ aru / sys if sys < 0 else 0 for aru, sys in zip(tsd['Qcs_sen_aru'], tsd['Qcs_sen_sys']) ] qcs_sys_aru = tsd['Qcs_sen_aru'] + tsd['Qcs_lat_aru'] + ( tsd['Qcs_em_ls'] + tsd['Qcs_dis_ls']) * frac_aru Qcs_sys_aru_0 = np.nanmin(qcs_sys_aru) # in W index = np.where(qcs_sys_aru == Qcs_sys_aru_0) ma_sup_0 = tsd['ma_sup_cs_aru'][index[0][0]] Ta_sup_0 = tsd['ta_sup_cs_aru'][index[0][0]] + KELVIN_OFFSET Ta_re_0 = tsd['ta_re_cs_aru'][index[0][0]] + KELVIN_OFFSET Tcs_sup, Tcs_re, mcpcs = np.vectorize(heating_coils.calc_cooling_coil)( qcs_sys_aru, Qcs_sys_aru_0, tsd['ta_sup_cs_aru'], tsd['ta_re_cs_aru'], bpr.building_systems['Tcs_sup_aru_0'], bpr.building_systems['Tcs_re_aru_0'], tsd['ma_sup_cs_aru'], ma_sup_0, Ta_sup_0, Ta_re_0) tsd['Tcs_sys_sup_aru'] = Tcs_sup # in C tsd['Tcs_sys_re_aru'] = Tcs_re # in C tsd['mcpcs_sys_aru'] = mcpcs # SCU tsd['Tcs_sys_sup_scu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_scu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_scu'] = np.zeros(HOURS_IN_YEAR) elif control_heating_cooling_systems.has_local_ac_cooling_system(bpr): # AHU tsd['Tcs_sys_sup_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_ahu'] = np.zeros(HOURS_IN_YEAR) # ARU # consider losses according to loads of systems qcs_sys_aru = tsd['Qcs_sen_aru'] + tsd['Qcs_lat_aru'] + ( tsd['Qcs_em_ls'] + tsd['Qcs_dis_ls']) qcs_sys_aru = np.nan_to_num(qcs_sys_aru) # Calc nominal temperatures of systems Qcs_sys_aru_0 = np.nanmin(qcs_sys_aru) # in W index = np.where(qcs_sys_aru == Qcs_sys_aru_0) ma_sup_0 = tsd['ma_sup_cs_aru'][index[0][0]] Ta_sup_0 = tsd['ta_sup_cs_aru'][index[0][0]] + KELVIN_OFFSET Ta_re_0 = tsd['ta_re_cs_aru'][index[0][0]] + KELVIN_OFFSET Tcs_sup, Tcs_re, mcpcs = np.vectorize(heating_coils.calc_cooling_coil)( qcs_sys_aru, Qcs_sys_aru_0, tsd['ta_sup_cs_aru'], tsd['ta_re_cs_aru'], bpr.building_systems['Tcs_sup_aru_0'], bpr.building_systems['Tcs_re_aru_0'], tsd['ma_sup_cs_aru'], ma_sup_0, Ta_sup_0, Ta_re_0) tsd['Tcs_sys_sup_aru'] = Tcs_sup # in C tsd['Tcs_sys_re_aru'] = Tcs_re # in C tsd['mcpcs_sys_aru'] = mcpcs # SCU tsd['Tcs_sys_sup_scu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_scu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_scu'] = np.zeros(HOURS_IN_YEAR) elif control_heating_cooling_systems.has_3for2_cooling_system(bpr): # AHU # consider losses according to loads of systems frac_ahu = [ ahu / sys if sys < 0 else 0 for ahu, sys in zip(tsd['Qcs_sen_ahu'], tsd['Qcs_sen_sys']) ] qcs_sys_ahu = tsd['Qcs_sen_ahu'] + tsd['Qcs_lat_ahu'] + ( tsd['Qcs_em_ls'] + tsd['Qcs_dis_ls']) * frac_ahu qcs_sys_ahu = np.nan_to_num(qcs_sys_ahu) Qcs_sys_ahu_0 = np.nanmin(qcs_sys_ahu) # in W index = np.where(qcs_sys_ahu == Qcs_sys_ahu_0) ma_sup_0 = tsd['ma_sup_cs_ahu'][index[0][0]] Ta_sup_0 = tsd['ta_sup_cs_ahu'][index[0][0]] + KELVIN_OFFSET Ta_re_0 = tsd['ta_re_cs_ahu'][index[0][0]] + KELVIN_OFFSET Tcs_sup, Tcs_re, mcpcs = np.vectorize(heating_coils.calc_cooling_coil)( qcs_sys_ahu, Qcs_sys_ahu_0, tsd['ta_sup_cs_ahu'], tsd['ta_re_cs_ahu'], bpr.building_systems['Tcs_sup_ahu_0'], bpr.building_systems['Tcs_re_ahu_0'], tsd['ma_sup_cs_ahu'], ma_sup_0, Ta_sup_0, Ta_re_0) tsd['Tcs_sys_sup_ahu'] = Tcs_sup # in C tsd['Tcs_sys_re_ahu'] = Tcs_re # in C tsd['mcpcs_sys_ahu'] = mcpcs # ARU # consider losses according to loads of systems frac_aru = [ aru / sys if sys < 0 else 0 for aru, sys in zip(tsd['Qcs_sen_aru'], tsd['Qcs_sen_sys']) ] qcs_sys_aru = tsd['Qcs_sen_aru'] + tsd['Qcs_lat_aru'] + ( tsd['Qcs_em_ls'] + tsd['Qcs_dis_ls']) * frac_aru qcs_sys_aru = np.nan_to_num(qcs_sys_aru) # Calc nominal temperatures of systems Qcs_sys_aru_0 = np.nanmin(qcs_sys_aru) # in W index = np.where(qcs_sys_aru == Qcs_sys_aru_0) ma_sup_0 = tsd['ma_sup_cs_aru'][index[0][0]] Ta_sup_0 = tsd['ta_sup_cs_aru'][index[0][0]] + KELVIN_OFFSET Ta_re_0 = tsd['ta_re_cs_aru'][index[0][0]] + KELVIN_OFFSET Tcs_sup, Tcs_re, mcpcs = np.vectorize(heating_coils.calc_cooling_coil)( qcs_sys_aru, Qcs_sys_aru_0, tsd['ta_sup_cs_aru'], tsd['ta_re_cs_aru'], bpr.building_systems['Tcs_sup_aru_0'], bpr.building_systems['Tcs_re_aru_0'], tsd['ma_sup_cs_aru'], ma_sup_0, Ta_sup_0, Ta_re_0) tsd['Tcs_sys_sup_aru'] = Tcs_sup # in C tsd['Tcs_sys_re_aru'] = Tcs_re # in C tsd['mcpcs_sys_aru'] = mcpcs # SCU # consider losses according to loads of systems frac_scu = [ scu / sys if sys < 0 else 0 for scu, sys in zip(tsd['Qcs_sen_scu'], tsd['Qcs_sen_sys']) ] qcs_sys_scu = tsd['Qcs_sen_scu'] + (tsd['Qcs_em_ls'] + tsd['Qcs_dis_ls']) * frac_scu qcs_sys_scu = np.nan_to_num(qcs_sys_scu) Qcs_sys_scu_0 = np.nanmin(qcs_sys_scu) # in W Ta_cooling_0 = np.nanmin(tsd['ta_cs_set']) Tcs_sup, Tcs_re, mcpcs = np.vectorize(radiators.calc_radiator)( qcs_sys_scu, tsd['T_int'], Qcs_sys_scu_0, Ta_cooling_0, bpr.building_systems['Tcs_sup_scu_0'], bpr.building_systems['Tcs_re_scu_0']) tsd['Tcs_sys_sup_scu'] = Tcs_sup # in C tsd['Tcs_sys_re_scu'] = Tcs_re # in C tsd['mcpcs_sys_scu'] = mcpcs elif control_heating_cooling_systems.has_ceiling_cooling_system(bpr) or \ control_heating_cooling_systems.has_floor_cooling_system(bpr): # SCU # consider losses according to loads of systems qcs_sys_scu = tsd['Qcs_sen_scu'] + (tsd['Qcs_em_ls'] + tsd['Qcs_dis_ls']) qcs_sys_scu = np.nan_to_num(qcs_sys_scu) Qcs_sys_scu_0 = np.nanmin(qcs_sys_scu) # in W Ta_cooling_0 = np.nanmin(tsd['ta_cs_set']) # use radiator for ceiling cooling calculation Tcs_sup, Tcs_re, mcpcs = np.vectorize(radiators.calc_radiator)( qcs_sys_scu, tsd['T_int'], Qcs_sys_scu_0, Ta_cooling_0, bpr.building_systems['Tcs_sup_scu_0'], bpr.building_systems['Tcs_re_scu_0']) tsd['Tcs_sys_sup_scu'] = Tcs_sup # in C tsd['Tcs_sys_re_scu'] = Tcs_re # in C tsd['mcpcs_sys_scu'] = mcpcs # AHU tsd['Tcs_sys_sup_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_ahu'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_ahu'] = np.zeros(HOURS_IN_YEAR) # ARU tsd['Tcs_sys_sup_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['Tcs_sys_re_aru'] = np.zeros( HOURS_IN_YEAR ) * np.nan # in C #FIXME: I don't like that non-existing temperatures are 0 tsd['mcpcs_sys_aru'] = np.zeros(HOURS_IN_YEAR) else: raise Exception( 'Cooling system not defined in function: "calc_temperatures_emission_systems"' ) return tsd
def calc_Eaux_Qhs_Qcs(tsd, bpr): """ Auxiliary electric loads from Legacy Following EN 15316-3-2:2007 Annex F :param tsd: Time series data of building :type tsd: dict :param bpr: Building Properties Row object :type bpr: cea.demand.thermal_loads.BuildingPropertiesRow :return: """ # TODO: documentation Ll = bpr.geometry['Blength'] Lw = bpr.geometry['Bwidth'] fforma = bpr.building_systems['fforma'] Qcs_sys = tsd['Qcs_sys'] Qhs_sys = tsd['Qhs_sys'] Tcs_re_ahu = tsd['Tcs_sys_re_ahu'] Tcs_sup_ahu = tsd['Tcs_sys_sup_ahu'] Tcs_re_aru = tsd['Tcs_sys_re_aru'] Tcs_sup_aru = tsd['Tcs_sys_sup_aru'] Tcs_re_scu = tsd['Tcs_sys_re_scu'] Tcs_sup_scu = tsd['Tcs_sys_sup_scu'] Ths_re_ahu = tsd['Ths_sys_re_ahu'] Ths_sup_ahu = tsd['Ths_sys_sup_ahu'] Ths_re_aru = tsd['Ths_sys_re_aru'] Ths_sup_aru = tsd['Ths_sys_sup_aru'] Ths_re_shu = tsd['Ths_sys_re_shu'] Ths_sup_shu = tsd['Ths_sys_sup_shu'] Year = bpr.age['YEAR'] nf_ag = bpr.geometry['floors_ag'] # split up the final demands according to the fraction of energy frac_heat_ahu = [ ahu / sys if sys > 0 else 0 for ahu, sys in zip(tsd['Qhs_sen_ahu'], tsd['Qhs_sen_sys']) ] Qhs_sys_ahu = Qhs_sys * frac_heat_ahu Qhs_sys_0_ahu = np.nanmax(Qhs_sys_ahu) frac_heat_aru = [ aru / sys if sys > 0 else 0 for aru, sys in zip(tsd['Qhs_sen_aru'], tsd['Qhs_sen_sys']) ] Qhs_sys_aru = Qhs_sys * frac_heat_aru Qhs_sys_0_aru = np.nanmax(Qhs_sys_aru) frac_heat_shu = [ shu / sys if sys > 0 else 0 for shu, sys in zip(tsd['Qhs_sen_shu'], tsd['Qhs_sen_sys']) ] Qhs_sys_shu = Qhs_sys * frac_heat_shu Qhs_sys_0_shu = np.nanmax(Qhs_sys_shu) frac_cool_ahu = [ ahu / sys if sys < 0 else 0 for ahu, sys in zip(tsd['Qcs_sen_ahu'], tsd['Qcs_sen_sys']) ] Qcs_sys_ahu = Qcs_sys * frac_cool_ahu Qcs_sys_0_ahu = np.nanmin(Qcs_sys_ahu) frac_cool_aru = [ aru / sys if sys < 0 else 0 for aru, sys in zip(tsd['Qcs_sen_aru'], tsd['Qcs_sen_sys']) ] Qcs_sys_aru = Qcs_sys * frac_cool_aru Qcs_sys_0_aru = np.nanmin(Qcs_sys_aru) frac_cool_scu = [ scu / sys if sys < 0 else 0 for scu, sys in zip(tsd['Qcs_sen_scu'], tsd['Qcs_sen_sys']) ] Qcs_sys_scu = Qcs_sys * frac_cool_scu Qcs_sys_0_scu = np.nanmin(Qcs_sys_scu) # pressure losses deltaP_fittings_gen_kPa = 16 # equation F.4 -standard values l_w_dis_col = 2 * (max(Ll, Lw) + 2.5 + nf_ag * H_F) * fforma # equation F.5 deltaP_kPa = DELTA_P_1 * l_w_dis_col + deltaP_fittings_gen_kPa if Year >= 2000: b = 1 else: b = 2 if control_heating_cooling_systems.has_heating_system(bpr): # for all subsystems Eaux_hs_ahu = np.vectorize(calc_Eauxf_hs_dis)(Qhs_sys_ahu, Qhs_sys_0_ahu, deltaP_kPa, b, Ths_sup_ahu, Ths_re_ahu) Eaux_hs_aru = np.vectorize(calc_Eauxf_hs_dis)(Qhs_sys_aru, Qhs_sys_0_aru, deltaP_kPa, b, Ths_sup_aru, Ths_re_aru) Eaux_hs_shu = np.vectorize(calc_Eauxf_hs_dis)(Qhs_sys_shu, Qhs_sys_0_shu, deltaP_kPa, b, Ths_sup_shu, Ths_re_shu) tsd['Eaux_hs'] = Eaux_hs_ahu + Eaux_hs_aru + Eaux_hs_shu # sum up else: tsd['Eaux_hs'] = np.zeros(HOURS_IN_YEAR) if control_heating_cooling_systems.has_cooling_system(bpr): # for all subsystems Eaux_cs_ahu = np.vectorize(calc_Eauxf_cs_dis)(Qcs_sys_ahu, Qcs_sys_0_ahu, deltaP_kPa, b, Tcs_sup_ahu, Tcs_re_ahu) Eaux_cs_aru = np.vectorize(calc_Eauxf_cs_dis)(Qcs_sys_aru, Qcs_sys_0_aru, deltaP_kPa, b, Tcs_sup_aru, Tcs_re_aru) Eaux_cs_scu = np.vectorize(calc_Eauxf_cs_dis)(Qcs_sys_scu, Qcs_sys_0_scu, deltaP_kPa, b, Tcs_sup_scu, Tcs_re_scu) tsd['Eaux_cs'] = Eaux_cs_ahu + Eaux_cs_aru + Eaux_cs_scu # sum up else: tsd['Eaux_cs'] = np.zeros(HOURS_IN_YEAR) return tsd
def calc_heating_cooling_loads(bpr, tsd, t): """ :param bpr: :param tsd: :param t: :return: """ # first check for season if control_heating_cooling_systems.is_heating_season(t, bpr)\ and not control_heating_cooling_systems.is_cooling_season(t, bpr): # +++++++++++++++++++++++++++++++++++++++++++ # HEATING # +++++++++++++++++++++++++++++++++++++++++++ # check system if not control_heating_cooling_systems.has_heating_system(bpr) \ or not control_heating_cooling_systems.heating_system_is_active(tsd, t): # no system = no loads rc_model_temperatures = calc_rc_no_loads(bpr, tsd, t) elif control_heating_cooling_systems.has_radiator_heating_system(bpr)\ or control_heating_cooling_systems.has_floor_heating_system(bpr): # radiator or floor heating rc_model_temperatures = calc_heat_loads_radiator(bpr, t, tsd) tsd['Ehs_lat_aux'][t] = 0 # TODO # elif has_local_ac_heating_system: # TODO: here could be a heating system using the mini-split unit ("T5") elif control_heating_cooling_systems.has_central_ac_heating_system( bpr): rc_model_temperatures = calc_heat_loads_central_ac(bpr, t, tsd) else: # message and no heating system warnings.warn( 'Unknown heating system. Calculation without system.') # no system = no loads rc_model_temperatures = calc_rc_no_loads(bpr, tsd, t) # update tsd update_tsd_no_cooling(tsd, t) # for dashboard detailed_thermal_balance_to_tsd(tsd, bpr, t, rc_model_temperatures) elif control_heating_cooling_systems.is_cooling_season(t, bpr) \ and not control_heating_cooling_systems.is_heating_season(t, bpr): # +++++++++++++++++++++++++++++++++++++++++++ # COOLING # +++++++++++++++++++++++++++++++++++++++++++ # check system if not control_heating_cooling_systems.has_cooling_system(bpr)\ or not control_heating_cooling_systems.cooling_system_is_active(bpr, tsd, t): # no system = no loads rc_model_temperatures = calc_rc_no_loads(bpr, tsd, t) elif control_heating_cooling_systems.has_local_ac_cooling_system(bpr): rc_model_temperatures = calc_cool_loads_mini_split_ac(bpr, t, tsd) elif control_heating_cooling_systems.has_central_ac_cooling_system( bpr): rc_model_temperatures = calc_cool_loads_central_ac(bpr, t, tsd) elif control_heating_cooling_systems.has_3for2_cooling_system(bpr): rc_model_temperatures = calc_cool_loads_3for2(bpr, t, tsd) elif control_heating_cooling_systems.has_ceiling_cooling_system(bpr) or \ control_heating_cooling_systems.has_floor_cooling_system(bpr): rc_model_temperatures = calc_cool_loads_radiator(bpr, t, tsd) else: # message and no cooling system warnings.warn( 'Unknown cooling system. Calculation without system.') # no system = no loads rc_model_temperatures = calc_rc_no_loads(bpr, tsd, t) # update tsd update_tsd_no_heating(tsd, t) # for dashboard detailed_thermal_balance_to_tsd(tsd, bpr, t, rc_model_temperatures) else: warnings.warn('Timestep %s not in heating season nor cooling season' % t) calc_rc_no_loads(bpr, tsd, t) return
def calc_prop_rc_model(self, locator, typology, envelope, geometry, hvac_temperatures): """ Return the RC model properties for all buildings. The RC model used is described in ISO 13790:2008, Annex C (Full set of equations for simple hourly method). :param typology: The contents of the `typology.shp` file, indexed by building name. Each column is the name of an typology type (GYM, HOSPITAL, HOTEL, INDUSTRIAL, MULTI_RES, OFFICE, PARKING, etc.) except for the "PFloor" column which is a fraction of heated floor area. The typology types must add up to 1.0. :type typology: Gdf :param envelope: The contents of the `architecture.shp` file, indexed by building name. It contains the following fields: - n50: Air tightness at 50 Pa [h^-1]. - type_shade: shading system type. - win_wall: window to wall ratio. - U_base: U value of the floor construction [W/m2K] - U_roof: U value of roof construction [W/m2K] - U_wall: U value of wall construction [W/m2K] - U_win: U value of window construction [W/m2K] - Hs: Fraction of gross floor area that is heated/cooled {0 <= Hs <= 1} - Cm_Af: Internal heat capacity per unit of area [J/K.m2] :type envelope: Gdf :param geometry: The contents of the `zone.shp` file indexed by building name - the list of buildings, their floor counts, heights etc. Includes additional fields "footprint" and "perimeter" as calculated in `read_building_properties`. :type geometry: Gdf :param hvac_temperatures: The return value of `get_properties_technical_systems`. :type hvac_temperatures: DataFrame :returns: RC model properties per building :rtype: DataFrame Sample result data calculated or manipulated by this method: Name: B153767 datatype: float64 ========= ============ ================================================================================================ Column e.g. Description ========= ============ ================================================================================================ Atot 4.564827e+03 (area of all surfaces facing the building zone in [m2]) Aw 4.527014e+02 (area of windows in [m2]) Am 6.947967e+03 (effective mass area in [m2]) Aef 2.171240e+03 (floor area with electricity in [m2]) Af 2.171240e+03 (conditioned floor area (heated/cooled) in [m2]) Cm 6.513719e+08 (internal heat capacity in [J/k]) Htr_is 1.574865e+04 (thermal transmission coefficient between air and surface nodes in RC-model in [W/K]) Htr_em 5.829963e+02 (thermal transmission coefficient between exterior and thermal mass nodes in RC-model in [W/K]) Htr_ms 6.322650e+04 (thermal transmission coefficient between surface and thermal mass nodes in RC-model in [W/K]) Htr_op 5.776698e+02 (thermal transmission coefficient for opaque surfaces in [W/K]) Hg 2.857637e+02 (steady-state thermal transmission coefficient to the ground in [W/K]) HD 2.919060e+02 (direct thermal transmission coefficient to the external environment in [W/K]) Htr_w 1.403374e+03 (thermal transmission coefficient for windows and glazing in [W/K]) ========= ============ ================================================================================================ FIXME: rename Awall_all to something more sane... """ # calculate building geometry df = self.geometry_reader_radiation_daysim(locator, envelope, geometry) df = df.merge(typology, left_index=True, right_index=True) df = df.merge(hvac_temperatures, left_index=True, right_index=True) from cea.demand.control_heating_cooling_systems import has_heating_system, has_cooling_system for building in self.building_names: has_system_heating_flag = has_heating_system(hvac_temperatures.loc[building, 'class_hs']) has_system_cooling_flag = has_cooling_system(hvac_temperatures.loc[building, 'class_cs']) if (not has_system_heating_flag and not has_system_cooling_flag and np.max([df.loc[building, 'Hs_ag'], df.loc[building, 'Hs_bg']]) <= 0.0): df.loc[building, 'Hs_ag'] = 0.0 df.loc[building, 'Hs_bg'] = 0.0 print('Building {building} has no heating and cooling system, Hs corrected to 0.'.format( building=building)) df = calc_useful_areas(df) if 'Cm_Af' in self.get_overrides_columns(): # Internal heat capacity is not part of input, calculate [J/K] df['Cm'] = self._overrides['Cm_Af'] * df['Af'] else: df['Cm'] = df['Cm_Af'] * df['Af'] df['Am'] = df['Cm_Af'].apply(self.lookup_effective_mass_area_factor) * df['Af'] # Effective mass area in [m2] # Steady-state Thermal transmittance coefficients and Internal heat Capacity # Thermal transmission coefficient for windows and glazing in [W/K] # Weigh area of windows with fraction of air-conditioned space, relationship of area and perimeter is squared df['Htr_w'] = df['Awin_ag'] * df['U_win'] * np.sqrt(df['Hs_ag']) # direct thermal transmission coefficient to the external environment in [W/K] # Weigh area of with fraction of air-conditioned space, relationship of area and perimeter is squared df['HD'] = df['Awall_ag'] * df['U_wall'] * np.sqrt(df['Hs_ag']) + df['Aroof'] * df['U_roof'] * df['Hs_ag'] # steady-state Thermal transmission coefficient to the ground. in W/K df['Hg'] = B_F * df['Aop_bg'] * df['U_base'] * df['Hs_bg'] # calculate RC model properties df['Htr_op'] = df['Hg'] + df['HD'] df['Htr_ms'] = H_MS * df['Am'] # Coupling conductance 1 in W/K df['Htr_em'] = 1 / (1 / df['Htr_op'] - 1 / df['Htr_ms']) # Coupling conductance 2 in W/K df['Htr_is'] = H_IS * df['Atot'] fields = ['Atot', 'Awin_ag', 'Am', 'Aef', 'Af', 'Cm', 'Htr_is', 'Htr_em', 'Htr_ms', 'Htr_op', 'Hg', 'HD', 'Aroof', 'U_wall', 'U_roof', 'U_win', 'U_base', 'Htr_w', 'GFA_m2', 'Aocc', 'Aop_bg', 'empty_envelope_ratio', 'Awall_ag', 'footprint'] result = df[fields] return result