Esempio n. 1
0
def calc_heat_loads_central_ac(bpr, t, tsd):
    """
    Procedure for hourly heating system load calculation for a building with a central AC heating system.

    Gabriel Happle, February 2018

    :param bpr: building properties row object
    :param t: time step / hour of year [0..8760]
    :param tsd: time series data dict
    :return:
    """

    # (0) Extract values from tsd
    # get values from tsd
    m_ve_mech = tsd['m_ve_mech'][t]
    t_ve_mech_after_hex = tsd['theta_ve_mech'][t]
    x_ve_mech = tsd['x_ve_mech'][t]
    t_int_prev = tsd['T_int'][t - 1]
    ta_hs_set = tsd['ta_hs_set'][t]

    # (1) The RC-model gives the sensible energy demand for the hour
    # calc rc model sensible demand
    qh_sen_rc_demand, rc_model_temperatures = calc_rc_heating_demand(
        bpr, tsd, t)

    # (2) The load of the central AC unit is determined by the air mass flows and fixed supply temperature
    # calc central ac unit load
    system_loads_ahu = airconditioning_model.central_air_handling_unit_heating(
        m_ve_mech, t_ve_mech_after_hex, x_ve_mech, ta_hs_set, t_int_prev, bpr)
    qh_sen_central_ac_load = system_loads_ahu['qh_sen_ahu']

    # (3) Check demand vs. central AC heating load
    # check for over heating
    if qh_sen_central_ac_load > qh_sen_rc_demand >= 0.0:

        # case: over heating
        qh_sen_aru = 0.0  # no additional heating via air recirculation unit

        # update rc model temperatures
        rc_model_temperatures = rc_model_SIA.calc_rc_model_temperatures_heating(
            qh_sen_central_ac_load, bpr, tsd, t)

        # ARU values to tsd
        ma_sup_hs_aru = 0.0
        ta_sup_hs_aru = np.nan
        ta_re_hs_aru = np.nan
        tsd['sys_status_aru'][t] = 'Off'
        tsd['sys_status_ahu'][t] = 'On:over heating'

    elif 0.0 <= qh_sen_central_ac_load < qh_sen_rc_demand:

        # case: additional heating by air recirculation unit
        qh_sen_aru = qh_sen_rc_demand - qh_sen_central_ac_load

        # calc recirculation air mass flows
        system_loads_aru = airconditioning_model.local_air_recirculation_unit_heating(
            qh_sen_aru, t_int_prev, bpr)

        # update of rc model not necessary

        ma_sup_hs_aru = system_loads_aru['ma_sup_hs_aru']
        ta_sup_hs_aru = system_loads_aru['ta_sup_hs_aru']
        ta_re_hs_aru = system_loads_aru['ta_re_hs_aru']
        tsd['sys_status_aru'][t] = 'On'

        # check status of ahu
        if qh_sen_central_ac_load > 0.0:
            tsd['sys_status_ahu'][t] = 'On'
        elif qh_sen_central_ac_load == 0.0:
            tsd['sys_status_ahu'][t] = 'Off'
            # this state happens during sensible demand but zero mechanical ventilation air flow
            #  (= sufficient infiltration)

    elif 0.0 == qh_sen_central_ac_load == qh_sen_rc_demand:

        # everything off
        qh_sen_aru = 0.0
        ma_sup_hs_aru = 0.0
        ta_sup_hs_aru = np.nan
        ta_re_hs_aru = np.nan
        tsd['sys_status_aru'][t] = 'Off'
        tsd['sys_status_ahu'][t] = 'Off'

    else:
        raise Exception(
            "Something went wrong in the central AC heating load calculation.")

    # act on humidity
    tsd['T_int'][t] = rc_model_temperatures[
        'T_int']  # humidification load needs zone temperature
    g_hu_ld = latent_loads.calc_humidification_moisture_load(
        bpr, tsd, t)  # calc local humidification load
    tsd['Ehs_lat_aux'][t] = airconditioning_model.electric_humidification_unit(
        g_hu_ld, m_ve_mech)  # calc electricity of humidification unit
    tsd['g_hu_ld'][t] = g_hu_ld  # humidification
    tsd['g_dhu_ld'][t] = 0.0  # no dehumidification
    latent_loads.calc_moisture_content_in_zone_local(
        bpr, tsd, t)  # calculate moisture in zone

    # write sensible loads to tsd
    tsd['Qhs_sen_rc'][t] = qh_sen_rc_demand
    tsd['Qhs_sen_shu'][t] = 0.0
    tsd['sys_status_sen'][t] = 'no system'
    tsd['Qhs_sen_ahu'][t] = qh_sen_central_ac_load
    tsd['Qhs_sen_aru'][t] = qh_sen_aru
    rc_temperatures_to_tsd(rc_model_temperatures, tsd, t)
    tsd['Qhs_sen_sys'][
        t] = qh_sen_central_ac_load + qh_sen_aru  # sum system loads
    tsd['Qhs_lat_sys'][t] = 0.0

    # mass flows to tsd
    tsd['ma_sup_hs_ahu'][t] = system_loads_ahu['ma_sup_hs_ahu']
    tsd['ta_sup_hs_ahu'][t] = system_loads_ahu['ta_sup_hs_ahu']
    tsd['ta_re_hs_ahu'][t] = system_loads_ahu['ta_re_hs_ahu']
    tsd['ma_sup_hs_aru'][t] = ma_sup_hs_aru
    tsd['ta_sup_hs_aru'][t] = ta_sup_hs_aru
    tsd['ta_re_hs_aru'][t] = ta_re_hs_aru

    # emission losses
    q_em_ls_heating = space_emission_systems.calc_q_em_ls_heating(bpr, tsd, t)
    tsd['Qhs_em_ls'][t] = q_em_ls_heating

    # the return is only for the input into the detailed thermal reverse calculations for the dashboard graphs
    return rc_model_temperatures
Esempio n. 2
0
def calc_rc_heating_demand(bpr, tsd, t):
    """
       Crank-Nicholson Procedure to calculate heating / cooling demand of buildings
       following the procedure in 2.3.2 in SIA 2044 / Korrigenda C1 zum Merkblatt SIA 2044:2011
       / Korrigenda C2 zum Mekblatt SIA 2044:2011

       Special procedures for updating ventilation air AC-heated and AC-cooled buildings

       Author: Gabriel Happle
       Date: 01/2017

       :param bpr: building properties row object
       :param tsd: time series data dict
       :param t: time step / hour of year [0..8760]
       :return: phi_h_act, rc_model_temperatures
       """

    # following the procedure in 2.3.2 in SIA 2044 / Korrigenda C1 zum Merkblatt SIA 2044:2011
    #  / Korrigenda C2 zum Mekblatt SIA 2044:2011

    # STEP 1
    # ******
    # calculate temperatures with 0 heating power
    rc_model_temperatures_0 = rc_model_SIA.calc_rc_model_temperatures_no_heating_cooling(
        bpr, tsd, t)

    t_int_0 = rc_model_temperatures_0['T_int']

    # CHECK FOR DEMAND
    if not rc_model_SIA.has_sensible_heating_demand(t_int_0, tsd, t):

        # return zero demand
        rc_model_temperatures = rc_model_temperatures_0
        phi_h_act = 0.0

    elif rc_model_SIA.has_sensible_heating_demand(t_int_0, tsd, t):
        # continue

        # STEP 2
        # ******
        # calculate temperatures with 10 W/m2 heating power
        phi_hc_10 = 10.0 * bpr.rc_model['Af']
        rc_model_temperatures_10 = rc_model_SIA.calc_rc_model_temperatures_heating(
            phi_hc_10, bpr, tsd, t)

        t_int_10 = rc_model_temperatures_10['T_int']

        t_int_set = tsd['ta_hs_set'][t]

        # interpolate heating power
        # (64) in SIA 2044 / Korrigenda C1 zum Merkblatt SIA 2044:2011 / Korrigenda C2 zum Mekblatt SIA 2044:2011
        phi_hc_ul = phi_hc_10 * (t_int_set - t_int_0) / (t_int_10 - t_int_0)

        # STEP 3
        # ******
        # check if available power is sufficient
        phi_h_max = bpr.hvac['Qhsmax_Wm2'] * bpr.rc_model['Af']

        if 0.0 < phi_hc_ul <= phi_h_max:
            # case heating with phi_hc_ul
            # calculate temperatures with this power
            phi_h_act = phi_hc_ul

        elif 0.0 < phi_hc_ul > phi_h_max:
            # case heating with max power available
            # calculate temperatures with this power
            phi_h_act = phi_h_max
        else:
            raise Exception("Unexpected status in 'calc_rc_heating_demand'")

        # STEP 4
        # ******
        rc_model_temperatures = rc_model_SIA.calc_rc_model_temperatures_heating(
            phi_h_act, bpr, tsd, t)

    else:
        raise Exception("Unexpected status in 'calc_rc_heating_demand'")

    return phi_h_act, rc_model_temperatures
Esempio n. 3
0
def calc_rc_model_demand_heating_cooling(bpr, tsd, t, gv):
    """
    Crank-Nicholson Procedure to calculate heating / cooling demand of buildings
    following the procedure in 2.3.2 in SIA 2044 / Korrigenda C1 zum Merkblatt SIA 2044:2011 / Korrigenda C2 zum Mekblatt SIA 2044:2011

    Special procedures for updating ventilation air AC-heated and AC-cooled buildings

    Author: Gabriel Happle
    Date: 01/2017

    :param bpr: building properties row object
    :param tsd: time series data dict
    :param t: time step / hour of year [0..8760]
    :param gv: globalvars
    :return: updates values in tsd
    """

    # following the procedure in 2.3.2 in SIA 2044 / Korrigenda C1 zum Merkblatt SIA 2044:2011
    #  / Korrigenda C2 zum Mekblatt SIA 2044:2011

    # ++++++++++++++++++++++++++++++
    # CASE 0 - NO HEATING OR COOLING
    # ++++++++++++++++++++++++++++++
    if not control_heating_cooling_systems.is_active_heating_system(bpr, tsd, t) \
            and not control_heating_cooling_systems.is_active_cooling_system(bpr, tsd, t):

        # STEP 1
        # ******
        # calculate temperatures
        rc_model_temperatures = rc_model_SIA.calc_rc_model_temperatures_no_heating_cooling(
            bpr, tsd, t)

        # write to tsd
        tsd['theta_a'][t] = rc_model_temperatures['theta_a']
        tsd['theta_m'][t] = rc_model_temperatures['theta_m']
        tsd['theta_c'][t] = rc_model_temperatures['theta_c']
        tsd['theta_o'][t] = rc_model_temperatures['theta_o']
        update_tsd_no_cooling(tsd, t)
        update_tsd_no_heating(tsd, t)
        tsd['system_status'][t] = 'systems off'

    # ++++++++++++++++
    # CASE 1 - HEATING
    # ++++++++++++++++
    elif control_heating_cooling_systems.is_active_heating_system(bpr, tsd, t):
        # case for heating
        tsd['system_status'][t] = 'Radiative heating'

        # STEP 1
        # ******
        # calculate temperatures with 0 heating power
        rc_model_temperatures_0 = rc_model_SIA.calc_rc_model_temperatures_no_heating_cooling(
            bpr, tsd, t)

        theta_a_0 = rc_model_temperatures_0['theta_a']

        # STEP 2
        # ******
        # calculate temperatures with 10 W/m2 heating power
        phi_hc_10 = 10 * bpr.rc_model['Af']
        rc_model_temperatures_10 = rc_model_SIA.calc_rc_model_temperatures_heating(
            phi_hc_10, bpr, tsd, t)

        theta_a_10 = rc_model_temperatures_10['theta_a']

        theta_a_set = tsd['ta_hs_set'][t]

        # interpolate heating power
        # (64) in SIA 2044 / Korrigenda C1 zum Merkblatt SIA 2044:2011 / Korrigenda C2 zum Mekblatt SIA 2044:2011
        phi_hc_ul = phi_hc_10 * (theta_a_set - theta_a_0) / (theta_a_10 -
                                                             theta_a_0)

        # STEP 3
        # ******
        # check if available power is sufficient
        phi_h_max = bpr.hvac['Qhsmax_Wm2'] * bpr.rc_model['Af']

        if 0 < phi_hc_ul <= phi_h_max:
            # case heating with phi_hc_ul
            # calculate temperatures with this power
            phi_h_act = phi_hc_ul

        elif 0 < phi_hc_ul > phi_h_max:
            # case heating with max power available
            # calculate temperatures with this power
            phi_h_act = phi_h_max

        else:
            raise

        # STEP 4
        # ******
        rc_model_temperatures = rc_model_SIA.calc_rc_model_temperatures_heating(
            phi_h_act, bpr, tsd, t)
        # write necessary parameters for AC calculation to tsd
        tsd['theta_a'][t] = rc_model_temperatures['theta_a']
        tsd['theta_m'][t] = rc_model_temperatures['theta_m']
        tsd['theta_c'][t] = rc_model_temperatures['theta_c']
        tsd['theta_o'][t] = rc_model_temperatures['theta_o']
        tsd['Qhs_sen'][t] = phi_h_act
        tsd['Qhs_sen_sys'][t] = phi_h_act
        tsd['Qhs_lat_sys'][t] = 0
        tsd['Ehs_lat_aux'][t] = 0
        tsd['ma_sup_hs'][t] = 0
        tsd['Ta_sup_hs'][t] = 0
        tsd['Ta_re_hs'][t] = 0
        tsd['m_ve_recirculation'][t] = 0

        # STEP 5 - latent and sensible heat demand of AC systems
        # ******
        if control_heating_cooling_systems.heating_system_is_ac(bpr):
            air_con_model_loads_flows_temperatures = airconditioning_model.calc_hvac_heating(
                tsd, t, gv)

            tsd['system_status'][t] = 'AC heating'

            # update temperatures for over heating case
            if air_con_model_loads_flows_temperatures[
                    'q_hs_sen_hvac'] > phi_h_act:
                phi_h_act_over_heating = air_con_model_loads_flows_temperatures[
                    'q_hs_sen_hvac']
                rc_model_temperatures = rc_model_SIA.calc_rc_model_temperatures_heating(
                    phi_h_act_over_heating, bpr, tsd, t)

                # update temperatures
                tsd['theta_a'][t] = rc_model_temperatures['theta_a']
                tsd['theta_m'][t] = rc_model_temperatures['theta_m']
                tsd['theta_c'][t] = rc_model_temperatures['theta_c']
                tsd['theta_o'][t] = rc_model_temperatures['theta_o']
                tsd['system_status'][t] = 'AC over heating'

            # update AC energy demand
            tsd['Qhs_sen_sys'][t] = air_con_model_loads_flows_temperatures[
                'q_hs_sen_hvac']
            tsd['Qhs_lat_sys'][t] = air_con_model_loads_flows_temperatures[
                'q_hs_lat_hvac']
            tsd['ma_sup_hs'][t] = air_con_model_loads_flows_temperatures[
                'ma_sup_hs']
            tsd['Ta_sup_hs'][t] = air_con_model_loads_flows_temperatures[
                'ta_sup_hs']
            tsd['Ta_re_hs'][t] = air_con_model_loads_flows_temperatures[
                'ta_re_hs']
            tsd['Ehs_lat_aux'][t] = air_con_model_loads_flows_temperatures[
                'e_hs_lat_aux']
            tsd['m_ve_recirculation'][
                t] = air_con_model_loads_flows_temperatures[
                    'm_ve_hvac_recirculation']

        # STEP 6 - emission system losses
        # ******
        q_em_ls_heating = space_emission_systems.calc_q_em_ls_heating(
            bpr, tsd, t)

        # set temperatures to tsd for heating
        tsd['theta_a'][t] = rc_model_temperatures['theta_a']
        tsd['theta_m'][t] = rc_model_temperatures['theta_m']
        tsd['theta_c'][t] = rc_model_temperatures['theta_c']
        tsd['theta_o'][t] = rc_model_temperatures['theta_o']
        tsd['Qhs_lat_sys'][t] = 0
        tsd['Qhs_em_ls'][t] = q_em_ls_heating
        tsd['Qhs_sen'][t] = phi_h_act
        tsd['Qhsf'][t] = 0
        tsd['Qhsf_lat'][t] = 0
        update_tsd_no_cooling(tsd, t)

    # ++++++++++++++++
    # CASE 2 - COOLING
    # ++++++++++++++++
    elif control_heating_cooling_systems.is_active_cooling_system(bpr, tsd, t):

        # case for cooling
        tsd['system_status'][t] = 'Radiative cooling'

        # STEP 1
        # ******
        # calculate temperatures with 0 heating power
        rc_model_temperatures_0 = rc_model_SIA.calc_rc_model_temperatures_no_heating_cooling(
            bpr, tsd, t)

        theta_a_0 = rc_model_temperatures_0['theta_a']

        # STEP 2
        # ******
        # calculate temperatures with 10 W/m2 cooling power
        phi_hc_10 = 10 * bpr.rc_model['Af']
        rc_model_temperatures_10 = rc_model_SIA.calc_rc_model_temperatures_cooling(
            phi_hc_10, bpr, tsd, t)

        theta_a_10 = rc_model_temperatures_10['theta_a']

        theta_a_set = tsd['ta_cs_set'][t]

        # interpolate heating power
        # (64) in SIA 2044 / Korrigenda C1 zum Merkblatt SIA 2044:2011 / Korrigenda C2 zum Mekblatt SIA 2044:2011
        phi_hc_ul = phi_hc_10 * (theta_a_set - theta_a_0) / (theta_a_10 -
                                                             theta_a_0)

        # STEP 3
        # ******
        # check if available power is sufficient
        phi_c_max = -bpr.hvac['Qcsmax_Wm2'] * bpr.rc_model['Af']

        if 0 > phi_hc_ul >= phi_c_max:
            # case heating with phi_hc_ul
            # calculate temperatures with this power
            phi_c_act = phi_hc_ul

        elif 0 > phi_hc_ul < phi_c_max:
            # case heating with max power available
            # calculate temperatures with this power
            phi_c_act = phi_c_max

        else:
            raise

        # STEP 4
        # ******
        rc_model_temperatures = rc_model_SIA.calc_rc_model_temperatures_cooling(
            phi_c_act, bpr, tsd, t)

        # write necessary parameters for AC calculation to tsd
        tsd['theta_a'][t] = rc_model_temperatures['theta_a']
        tsd['theta_m'][t] = rc_model_temperatures['theta_m']
        tsd['theta_c'][t] = rc_model_temperatures['theta_c']
        tsd['theta_o'][t] = rc_model_temperatures['theta_o']
        tsd['Qcs_sen'][t] = phi_c_act
        tsd['Qcs_sen_sys'][t] = phi_c_act
        tsd['Qcs_lat_sys'][t] = 0
        tsd['ma_sup_cs'][t] = 0
        tsd['m_ve_recirculation'][t] = 0

        # STEP 5 - latent and sensible heat demand of AC systems
        # ******
        if control_heating_cooling_systems.cooling_system_is_ac(bpr):

            tsd['system_status'][t] = 'AC cooling'

            air_con_model_loads_flows_temperatures = airconditioning_model.calc_hvac_cooling(
                tsd, t, gv)

            # update temperatures for over cooling case
            if air_con_model_loads_flows_temperatures[
                    'q_cs_sen_hvac'] < phi_c_act:

                phi_c_act_over_cooling = air_con_model_loads_flows_temperatures[
                    'q_cs_sen_hvac']
                rc_model_temperatures = rc_model_SIA.calc_rc_model_temperatures_cooling(
                    phi_c_act_over_cooling, bpr, tsd, t)
                # update temperatures
                tsd['theta_a'][t] = rc_model_temperatures['theta_a']
                tsd['theta_m'][t] = rc_model_temperatures['theta_m']
                tsd['theta_c'][t] = rc_model_temperatures['theta_c']
                tsd['theta_o'][t] = rc_model_temperatures['theta_o']
                tsd['system_status'][t] = 'AC over cooling'

            # update AC energy demand

            tsd['Qcs_sen_sys'][t] = air_con_model_loads_flows_temperatures[
                'q_cs_sen_hvac']
            tsd['Qcs_lat_sys'][t] = air_con_model_loads_flows_temperatures[
                'q_cs_lat_hvac']
            tsd['ma_sup_cs'][t] = air_con_model_loads_flows_temperatures[
                'ma_sup_cs']
            tsd['Ta_sup_cs'][t] = air_con_model_loads_flows_temperatures[
                'ta_sup_cs']
            tsd['Ta_re_cs'][t] = air_con_model_loads_flows_temperatures[
                'ta_re_cs']
            tsd['m_ve_recirculation'][
                t] = air_con_model_loads_flows_temperatures[
                    'm_ve_hvac_recirculation']

        # STEP 6 - emission system losses
        # ******
        q_em_ls_cooling = space_emission_systems.calc_q_em_ls_cooling(
            bpr, tsd, t)

        # set temperatures to tsd for heating
        tsd['theta_a'][t] = rc_model_temperatures['theta_a']
        tsd['theta_m'][t] = rc_model_temperatures['theta_m']
        tsd['theta_c'][t] = rc_model_temperatures['theta_c']
        tsd['theta_o'][t] = rc_model_temperatures['theta_o']
        tsd['Qcs'][t] = 0
        tsd['Qcs_em_ls'][t] = q_em_ls_cooling
        tsd['Qcsf'][t] = 0
        tsd['Qcsf_lat'][t] = 0
        update_tsd_no_heating(tsd, t)

    return