def cal_higher_mode_factor(n_storeys, btype='frame'):
    """
    Calculates the higher mode factor according to DDBD12 CL.
    :param n_storeys:
    :param btype:
    :return:
    """
    if btype == 'frame':
        if n_storeys < 6:
            factor = 1.0
        elif n_storeys <= 16:
            factor = 1.0 - 0.15 * float(n_storeys - 6.0) / (16.0 - 6.0)
        else:
            factor = 0.85
    elif n_storeys < 10:
        factor = 1.0
    elif n_storeys <= 16:
        factor = 1.0 - 0.06 * float(n_storeys - 10.0) / (16.0 - 10.0)
    else:
        factor = 0.85
    return factor
