def calc_w3_heating_case(t5, w2, w5, t3, gv):
    """
    Algorithm 1 Determination of the room's supply moisture content (w3) for the heating case
     from Kaempf's HVAC model [1]

    Source:
    [1] Kämpf, Jérôme Henri
        On the modelling and optimisation of urban energy fluxes
        http://dx.doi.org/10.5075/epfl-thesis-4548


    Parameters
    ----------
    t5 : temperature 5 in (°C)
    w2 : moisture content 2 in (kg/kg dry air)
    w5 : moisture content 5 in (kg/kg dry air)
    t3 : temperature 3 in (°C)
    gv : globalvar

    Returns
    -------
    w3 : moisture content of HVAC supply air in (kg/kg dry air)
    """

    # get constants and properties
    temp_comf_max = gv.temp_comf_max  # limits of comfort in zone TODO: get from properties
    hum_comf_max = gv.rhum_comf_max  # limits of comfort in zone TODO: get from properties

    w_liminf = calc_w(t5, 30)  # TODO: document
    w_limsup = calc_w(t5, 70)  # TODO: document
    w_comf_max = calc_w(
        temp_comf_max,
        hum_comf_max)  # moisture content at maximum comfortable state

    if w5 < w_liminf:
        # humidification
        w3 = w_liminf - w5 + w2

    elif w5 > w_limsup and w5 < w_comf_max:
        # heating and no dehumidification
        # delta_HVAC = calc_t(w5,70)-t5
        w3 = w2

    elif w5 > w_comf_max:
        # dehumidification
        w3 = max(
            min(min(w_comf_max - w5 + w2, calc_w(t3, 100)),
                w_limsup - w5 + w2), 0)

    else:
        # no moisture control
        w3 = w2

    return w3
Exemplo n.º 2
0
def calc_w3_heating_case(t5, w2, w5, t3, gv):
    """
    Algorithm 1 Determination of the room's supply moisture content (w3) for the heating case from Kaempf's HVAC model
    [Kämpf2009]_

    :param t5: temperature 5 in (°C)
    :type t5: numpy.float64

    :param w2: moisture content 2 in (kg/kg dry air)
    :type w2: numpy.float64

    :param w5: moisture content 5 in (kg/kg dry air)
    :type w5: numpy.float64

    :param t3: temperature 3 in (°C)
    :type t3: numpy.float64

    :param gv: global variables
    :type gv: cea.globalvar.GlobalVariables

    :return: w3, moisture content of HVAC supply air in (kg/kg dry air)
    :rtype: numpy.float64
    """

    # get constants and properties
    temp_comf_max = gv.temp_comf_max  # limits of comfort in zone TODO: get from properties
    hum_comf_max = gv.rhum_comf_max  # limits of comfort in zone TODO: get from properties

    w_liminf = calc_w(t5, 30)  # TODO: document
    w_limsup = calc_w(t5, 70)  # TODO: document
    w_comf_max = calc_w(
        temp_comf_max,
        hum_comf_max)  # moisture content at maximum comfortable state

    if w5 < w_liminf:
        # humidification
        w3 = w_liminf - w5 + w2

    elif w5 > w_limsup and w5 < w_comf_max:
        # heating and no dehumidification
        # delta_HVAC = calc_t(w5,70)-t5
        w3 = w2

    elif w5 > w_comf_max:
        # dehumidification
        w3 = max(
            min(min(w_comf_max - w5 + w2, calc_w(t3, 100)),
                w_limsup - w5 + w2), 0)

    else:
        # no moisture control
        w3 = w2

    return w3
def calc_w3_heating_case(t5, w2, w5, t3, gv):
    """
    Algorithm 1 Determination of the room's supply moisture content (w3) for the heating case
     from Kaempf's HVAC model [1]

    Source:
    [1] Kämpf, Jérôme Henri
        On the modelling and optimisation of urban energy fluxes
        http://dx.doi.org/10.5075/epfl-thesis-4548


    Parameters
    ----------
    t5 : temperature 5 in (°C)
    w2 : moisture content 2 in (kg/kg dry air)
    w5 : moisture content 5 in (kg/kg dry air)
    t3 : temperature 3 in (°C)
    gv : globalvar

    Returns
    -------
    w3 : moisture content of HVAC supply air in (kg/kg dry air)
    """

    # get constants and properties
    temp_comf_max = gv.temp_comf_max  # limits of comfort in zone TODO: get from properties
    hum_comf_max = gv.rhum_comf_max  # limits of comfort in zone TODO: get from properties

    w_liminf = calc_w(t5, 30)  # TODO: document
    w_limsup = calc_w(t5, 70)  # TODO: document
    w_comf_max = calc_w(temp_comf_max, hum_comf_max)  # moisture content at maximum comfortable state

    if w5 < w_liminf:
        # humidification
        w3 = w_liminf - w5 + w2

    elif w5 > w_limsup and w5 < w_comf_max:
        # heating and no dehumidification
        # delta_HVAC = calc_t(w5,70)-t5
        w3 = w2

    elif w5 > w_comf_max:
        # dehumidification
        w3 = max(min(min(w_comf_max - w5 + w2, calc_w(t3, 100)), w_limsup - w5 + w2), 0)

    else:
        # no moisture control
        w3 = w2

    return w3
def calc_hex(rel_humidity_ext, gv, temp_ext, temp_zone_prev, timestep):
    """
    Calculates air properties of mechanical ventilation system with heat exchanger
    Modeled after 2.4.2 in SIA 2044

    Parameters
    ----------
    rel_humidity_ext : (%)
    gv : globalvar
    qv_mech : required air volume flow (kg/s)
    temp_ext : external temperature at time t (°C)
    temp_zone_prev : ventilation zone air temperature at time t-1 (°C)

    Returns
    -------
    t2, w2 : temperature and moisture content of inlet air after heat exchanger

    """
    # TODO add literature

    # FIXME: dynamic HEX efficiency
    # Properties of heat recovery and required air incl. Leakage
    # qv_mech = qv_mech * 1.0184  # in m3/s corrected taking into account leakage # TODO: add source
    # Veff = gv.Vmax * qv_mech / qv_mech_dim  # Eq. (85) in SIA 2044
    # nrec = gv.nrec_N - gv.C1 * (Veff - 2)  # heat exchanger coefficient # TODO: add source
    nrec = gv.nrec_N  # for now use constant efficiency for heat recovery

    # State No. 1
    w1 = calc_w(temp_ext, rel_humidity_ext)  # outdoor moisture (kg/kg)

    # State No. 2
    # inlet air temperature after HEX calculated from zone air temperature at time step t-1 (°C)
    t2 = temp_ext + nrec * (temp_zone_prev - temp_ext)
    w2 = min(w1, calc_w(t2,
                        100))  # inlet air moisture (kg/kg), Eq. (4.24) in [1]

    # TODO: document
    # bypass heat exchanger if use is not beneficial
    if temp_zone_prev > temp_ext and not gv.is_heating_season(timestep):
        t2 = temp_ext
        w2 = w1
        # print('bypass HEX cooling')
    elif temp_zone_prev < temp_ext and gv.is_heating_season(timestep):
        t2 = temp_ext
        w2 = w1
        # print('bypass HEX heating')

    return t2, w2
def calc_hex(rel_humidity_ext, gv, temp_ext, temp_zone_prev, timestep):
    """
    Calculates air properties of mechanical ventilation system with heat exchanger
    Modeled after 2.4.2 in SIA 2044

    Parameters
    ----------
    rel_humidity_ext : (%)
    gv : globalvar
    qv_mech : required air volume flow (kg/s)
    temp_ext : external temperature at time t (°C)
    temp_zone_prev : ventilation zone air temperature at time t-1 (°C)

    Returns
    -------
    t2, w2 : temperature and moisture content of inlet air after heat exchanger

    """
    # TODO add literature

    # FIXME: dynamic HEX efficiency
    # Properties of heat recovery and required air incl. Leakage
    # qv_mech = qv_mech * 1.0184  # in m3/s corrected taking into account leakage # TODO: add source
    # Veff = gv.Vmax * qv_mech / qv_mech_dim  # Eq. (85) in SIA 2044
    # nrec = gv.nrec_N - gv.C1 * (Veff - 2)  # heat exchanger coefficient # TODO: add source
    nrec = gv.nrec_N  # for now use constant efficiency for heat recovery

    # State No. 1
    w1 = calc_w(temp_ext, rel_humidity_ext)  # outdoor moisture (kg/kg)

    # State No. 2
    # inlet air temperature after HEX calculated from zone air temperature at time step t-1 (°C)
    t2 = temp_ext + nrec * (temp_zone_prev - temp_ext)
    w2 = min(w1, calc_w(t2, 100))  # inlet air moisture (kg/kg), Eq. (4.24) in [1]

    # TODO: document
    # bypass heat exchanger if use is not beneficial
    if temp_zone_prev > temp_ext and not gv.is_heating_season(timestep):
        t2 = temp_ext
        w2 = w1
        # print('bypass HEX cooling')
    elif temp_zone_prev < temp_ext and gv.is_heating_season(timestep):
        t2 = temp_ext
        w2 = w1
        # print('bypass HEX heating')

    return t2, w2
def calc_w3_cooling_case(t5, w2, t3, w5):
    """
    Algorithm 2 Determination of the room's supply moisture content (w3) for the cooling case from Kaempf's HVAC model
    for non-evaporative cooling

    Source:
    [1] Kämpf, Jérôme Henri
        On the modelling and optimisation of urban energy fluxes
        http://dx.doi.org/10.5075/epfl-thesis-4548


    Parameters
    ----------
    t5 : temperature 5 in (°C)
    w2 : moisture content 2 in (kg/kg dry air)
    t3 : temperature 3 in (°C)
    w5 : moisture content 5 in (kg/kg dry air)

    Returns
    -------
    w3 : moisture content of HVAC supply air in (kg/kg dry air)
    """

    # get constants and properties
    w_liminf = calc_w(t5, 30)  # TODO: document
    w_limsup = calc_w(t5, 70)  # TODO: document

    if w5 > w_limsup:
        # dehumidification
        w3 = max(min(w_limsup - w5 + w2, calc_w(t3, 100)), 0)

    elif w5 < w_liminf:
        # humidification
        w3 = w_liminf - w5 + w2

    else:
        w3 = min(w2, calc_w(t3, 100))

    return w3
Exemplo n.º 7
0
def calc_w3_cooling_case(t5, w2, t3, w5):
    """
    Algorithm 2 Determination of the room's supply moisture content (w3) for the cooling case from Kaempf's HVAC model
    for non-evaporative cooling

    Source: [Kämpf2009]_

    :param t5: temperature 5 in (°C)
    :type t5: numpy.float64

    :param w2 : moisture content 2 in (kg/kg dry air)
    :type w2: numpy.float64

    :param t3: temperature 3 in (°C)
    :type t3: numpy.float64

    :param w5: moisture content 5 in (kg/kg dry air)
    :type w5: numpy.float64

    :return: w3, moisture content of HVAC supply air in (kg/kg dry air)
    :rtype: numpy.float64
    """

    # get constants and properties
    w_liminf = calc_w(t5, 30)  # TODO: document
    w_limsup = calc_w(t5, 70)  # TODO: document

    if w5 > w_limsup:
        # dehumidification
        w3 = max(min(w_limsup - w5 + w2, calc_w(t3, 100)), 0)

    elif w5 < w_liminf:
        # humidification
        w3 = w_liminf - w5 + w2

    else:
        w3 = min(w2, calc_w(t3, 100))

    return w3
def calc_w3_cooling_case(t5, w2, t3, w5):
    """
    Algorithm 2 Determination of the room's supply moisture content (w3) for the cooling case from Kaempf's HVAC model
    for non-evaporative cooling

    Source:
    [1] Kämpf, Jérôme Henri
        On the modelling and optimisation of urban energy fluxes
        http://dx.doi.org/10.5075/epfl-thesis-4548


    Parameters
    ----------
    t5 : temperature 5 in (°C)
    w2 : moisture content 2 in (kg/kg dry air)
    t3 : temperature 3 in (°C)
    w5 : moisture content 5 in (kg/kg dry air)

    Returns
    -------
    w3 : moisture content of HVAC supply air in (kg/kg dry air)
    """

    # get constants and properties
    w_liminf = calc_w(t5, 30)  # TODO: document
    w_limsup = calc_w(t5, 70)  # TODO: document

    if w5 > w_limsup:
        # dehumidification
        w3 = max(min(w_limsup - w5 + w2, calc_w(t3, 100)), 0)

    elif w5 < w_liminf:
        # humidification
        w3 = w_liminf - w5 + w2

    else:
        w3 = min(w2, calc_w(t3, 100))

    return w3
Exemplo n.º 9
0
def calc_hvac_cooling(tsd, hoy, gv):
    """
    Calculate AC air mass flows, energy demand and temperatures
    For the cooling case for AC systems with demand controlled ventilation air flows (mechanical ventilation) and
    conditioning of recirculated air (outdoor air flows are not modified)

    :param tsd: time series data dict
    :type tsd: Dict[str, numpy.ndarray[numpy.float64]]
    :param hoy: time step
    :type hoy: int
    :param gv: global variables
    :type gv: cea.globalvar.GlobalVariables
    :return: AC air mass flows, energy demand and temperatures for the cooling case
    :rtype: Dict[str, numpy.float64]
    """

    temp_zone_set = tsd['theta_a'][
        hoy]  # zone set temperature according to scheduled set points
    qe_sen = tsd['Qcs_sen'][
        hoy] / 1000  # get the total sensible load from the RC model in [W]
    m_ve_mech = tsd['m_ve_mech'][
        hoy]  # mechanical ventilation flow rate according to ventilation control
    wint = tsd['w_int'][hoy]  # internal moisture gains from occupancy
    rel_humidity_ext = tsd['rh_ext'][hoy]  # exterior relative humidity
    temp_ext = tsd['T_ext'][hoy]  # exterior air temperature
    temp_mech_vent = tsd['theta_ve_mech'][
        hoy]  # air temperature of mechanical ventilation air

    # indoor air set point
    t5 = temp_zone_set

    if m_ve_mech > 0:  # mechanical ventilation system is active, ventilation air and recirculation air gets conditioned

        # State No. 1
        w1 = calc_w(temp_ext, rel_humidity_ext)  # outdoor moisture (kg/kg)

        # ventilation air properties
        # State No. 2
        t2 = temp_mech_vent
        w2 = min(w1,
                 calc_w(t2,
                        100))  # inlet air moisture (kg/kg), Eq. (4.24) in [1]

        # State No. 3
        # Assuming that AHU does not modify the air humidity
        w3v = w2  # virtual moisture content at state 3

        # determine virtual state in the zone without moisture conditioning
        # moisture balance accounting for internal moisture load, see also Eq. (4.32) in [1]
        w5_prime = (wint + w3v * m_ve_mech) / m_ve_mech

        # supply air condition
        t3 = gv.temp_sup_cool_hvac

        # room supply moisture content:
        # algorithm for cooling case
        w3 = calc_w3_cooling_case(t5, w2, t3, w5_prime)

        # State of Supply
        ts = t3  # minus expected delta T rise in the ducts TODO: check and document value of temp decrease
        ws = w3

        # actual room condition
        w5 = (wint + w3 * m_ve_mech) / m_ve_mech
        h_w5_t5 = calc_h(t5, w5)

        # now the energy of dehumidification can be calculated
        h_t2_ws = calc_h(t2, ws)
        h_t2_w2 = calc_h(t2, w2)
        qe_dehum = m_ve_mech * (
            h_t2_ws - h_t2_w2
        )  # (kW) # (kW) energy for dehumidification / latent cooling demand

        # cooling load provided by conditioning ventilation air
        h_t2_w2 = calc_h(t2, w2)
        h_ts_w2 = calc_h(ts, w2)
        q_cs_sen_mech_vent = m_ve_mech * (h_ts_w2 - h_t2_w2)

    elif m_ve_mech == 0:  # mechanical ventilation system is not active, only recirculation air gets conditioned

        # supply air condition
        t3 = gv.temp_sup_cool_hvac

        # State of Supply
        ts = t3  # minus expected delta T rise in the ducts TODO: check and document value of temp decrease
        w5 = wint
        h_w5_t5 = calc_h(t5, w5)

        # No dehumidification of recirculation air as there is no model yet for internal humidity assessment
        qe_dehum = 0
        q_cs_sen_mech_vent = 0
        t2 = temp_mech_vent

    else:
        raise

    # calculate the part of the sensible load that is supplied by conditioning the recirculation air
    # = additional load that has to be covered by conditioning room air through recirculation
    # additional load can not be smaller than 0, over cooling situation
    q_cs_sen_recirculation = min(qe_sen - q_cs_sen_mech_vent, 0)  # (kW)
    h_ts_w5 = calc_h(ts, w5)
    m_ve_hvac_recirculation = q_cs_sen_recirculation / (h_ts_w5 - h_w5_t5)

    # output parameters
    q_cs_sen_hvac = (q_cs_sen_mech_vent + q_cs_sen_recirculation) * 1000
    q_cs_lat_hvac = qe_dehum * 1000
    ma_sup_cs = m_ve_mech + m_ve_hvac_recirculation
    ta_sup_cs = ts
    ta_re_cs = (
        m_ve_mech * t2 + m_ve_hvac_recirculation *
        t5) / ma_sup_cs  # temperature mixing proportional to mass flow rates

    # construct output dict
    air_con_model_loads_flows_temperatures = {
        'q_cs_sen_hvac': q_cs_sen_hvac,
        'q_cs_lat_hvac': q_cs_lat_hvac,
        'ma_sup_cs': ma_sup_cs,
        'ta_sup_cs': ta_sup_cs,
        'ta_re_cs': ta_re_cs,
        'm_ve_hvac_recirculation': m_ve_hvac_recirculation
    }

    if m_ve_mech + m_ve_hvac_recirculation < 0:
        raise ValueError

    return air_con_model_loads_flows_temperatures