def cal_pipe_equivalent_length(tot_bui_height_m, panel_prop, total_area_module):
    """
    To calculate the equivalent length of pipings in buildings
    :param tot_bui_height_m: total heights of buildings
    :type tot_bui_height_m: float
    :param panel_prop: properties of the solar panels
    :type panel_prop: dict
    :param total_area_module: total installed module area
    :type total_area_module: float
    :return: equivalent lengths of pipings in buildings
    :rtype: dict
    """

    # local variables
    lv = panel_prop['module_length_m']  # module length
    total_area_aperture = total_area_module * panel_prop['aperture_area_ratio']
    number_modules = round(total_area_module / panel_prop['module_area_m2'])  # this is an estimation

    # main calculation
    l_ext_mperm2 = (2 * lv * number_modules / total_area_aperture)  # pipe length within the collectors
    l_int_mperm2 = 2 * tot_bui_height_m / total_area_aperture  # pipe length from building substation to roof top collectors
    Leq_mperm2 = l_int_mperm2 + l_ext_mperm2  # in m/m2 aperture

    pipe_equivalent_lengths = {'Leq_mperm2': Leq_mperm2, 'l_ext_mperm2': l_ext_mperm2, 'l_int_mperm2': l_int_mperm2}

    return pipe_equivalent_lengths