def equivalent_viscous_damping(mu, mtype='concrete', btype='frame'):
    """
    Calculate the equivalent viscous damping based on the ductility and structural type.
    :param mu: Displacement ductility
    :param mtype: material type
    :param btype: building type (e.g. frame or wall)
    :return:
    """
    pie = 3.141
    if mu < 1:
        return 0.05
    if mtype == 'concrete':
        if btype == 'frame':
            return 0.05 + 0.565 * (mu - 1) / (mu * pie)
        if btype == 'wall':
            return 0.05 + 0.444 * (mu - 1) / (mu * pie)
