r'''A rough equation presented in the HEDH for estimating
    the number of tubes in a tube bundle of differing geometries and tube
    sizes. No accuracy estimation given. Only 1 pass is supported.

    .. math::
        N = \frac{0.78(D_{bundle} - D_o)^2}{C_1(\text{pitch})^2}
        
    C1 = 0.866 for 30° and 60° layouts, and 1 for 45 and 90° layouts.
        
    Parameters
    ----------
    DBundle : float
        Outer diameter of tube bundle, [m]
    Do : float
        Tube outer diameter, [m]
    pitch : float
        Pitch; distance between two orthogonal tube centers, [m]
    angle : float
        The angle the tubes are positioned; 30, 45, 60 or 90, [degrees]

    Returns
    -------
    N : float
        Number of tubes, [-]

    Notes
    -----
    Seems reasonably accurate.

    Examples
    --------
    >>> Ntubes_HEDH(DBundle=1.184, Do=.028, pitch=.036, angle=30)
    928

    References
    ----------
    .. [1] Schlunder, Ernst U, and International Center for Heat and Mass
       Transfer. Heat Exchanger Design Handbook. Washington:
       Hemisphere Pub. Corp., 1983.

def Ntubes_HEDH(DBundle=None, Do=None, pitch=None, angle=30):
    r'''A rough equation presented in the HEDH for estimating
    the number of tubes in a tube bundle of differing geometries and tube
    sizes. No accuracy estimation given. Only 1 pass is supported.

    .. math::
        N = \frac{0.78(D_{bundle} - D_o)^2}{C_1(\text{pitch})^2}
        
    C1 = 0.866 for 30° and 60° layouts, and 1 for 45 and 90° layouts.
        
    Parameters
    ----------
    DBundle : float
        Outer diameter of tube bundle, [m]
    Do : float
        Tube outer diameter, [m]
    pitch : float
        Pitch; distance between two orthogonal tube centers, [m]
    angle : float
        The angle the tubes are positioned; 30, 45, 60 or 90, [degrees]

    Returns
    -------
    N : float
        Number of tubes, [-]

    Notes
    -----
    Seems reasonably accurate.

    Examples
    --------
    >>> Ntubes_HEDH(DBundle=1.184, Do=.028, pitch=.036, angle=30)
    928

    References
    ----------
    .. [1] Schlunder, Ernst U, and International Center for Heat and Mass
       Transfer. Heat Exchanger Design Handbook. Washington:
       Hemisphere Pub. Corp., 1983.
    '''
    if angle == 30 or angle == 60:
        C1 = 13/15.
    elif angle == 45 or angle == 90:
        C1 = 1.
    else:
        raise Exception('Only 30, 60, 45 and 90 degree layouts are supported')
    Dctl = DBundle - Do
    N = 0.78*Dctl**2/C1/pitch**2
    return int(N)