def get_subs_minichp(p_nom, q_nom, v_tes):
    """
    Calculate BAFA subsidy for mini chp devices.

    Parameters
    ----------
    p_nom : chp el. power in kW
    q_nom : chp th. power in kW
    v_tes : volume of thermal energy storage in liter

    Returns
    -------
    bafa_subs_chp : subsidy for mini-chp
    """

    # BAFA subsidy for Mini-CHP (CHP device must be listed on BAFA-list)
    bafa_subs_chp = 0

    if v_tes > 0:

        # el.power smaller than 20 kW and TES-volume at least 60 l/kW_th
        if p_nom < 20 and v_tes/q_nom >= 60:

            if p_nom < 1:
                bafa_subs_chp = 1900

            elif p_nom < 4:
                bafa_subs_chp = 1900 + (p_nom / 1000 - 1) * 300

            elif p_nom < 10:
                bafa_subs_chp = 1900 + 3 * 300 + (p_nom / 1000 - 4) * 100

            else:  # bes.chp.pNominal < 20:
                bafa_subs_chp = 1900 + 3 * 300 + 6 * 100 + (p_nom / 1000 - 10) * 10

    return bafa_subs_chp