Пример #1
0
    def bolt_design(self):
        """Calculate bolt capacities, distances and layout.

        Args:

        Returns:

        """
        self.root_clearance_sa = 1.5 * self.bolt_diameter
        self.root_clearance_col = 1.5 * self.bolt_diameter
        self.bolt_hole_clearance_value = self.bolt_hole_clearance(
            self.bolt_hole_type, self.bolt_diameter)
        self.bolt_hole_diameter = self.bolt_diameter + self.bolt_hole_clearance_value

        self.thickness_governing_min = min(self.column_f_t, self.angle_t)
        self.calculate_distances(self.bolt_diameter, self.bolt_hole_diameter,
                                 self.min_edge_multiplier,
                                 self.thickness_governing_min,
                                 self.is_environ_corrosive)
        self.max_spacing = min(self.max_spacing,
                               32 * self.thickness_governing_min)
        self.edge_dist = self.min_edge_dist
        self.end_dist = self.min_end_dist
        self.pitch = self.min_pitch
        self.edge_dist = ConnectionCalculations.round_up_5(self.edge_dist)
        self.end_dist = ConnectionCalculations.round_up_5(self.end_dist)

        self.calculate_kb()

        # Bolt capacity
        if self.is_hsfg is False:
            self.bolt_shear_capacity = ConnectionCalculations.bolt_shear(
                bolt_diameter=self.bolt_diameter,
                number_of_bolts=1,
                bolt_fu=self.bolt_fu)
            self.bolt_bearing_capacity = ConnectionCalculations.bolt_bearing(
                bolt_diameter=self.bolt_diameter,
                number_of_bolts=1,
                thickness_plate=self.thickness_governing_min,
                k_b=self.k_b,
                plate_fu=self.beam_fu)
            self.bolt_value = min(self.bolt_shear_capacity,
                                  self.bolt_bearing_capacity)
        elif self.is_hsfg:
            self.bolt_shear_capacity = ConnectionCalculations.bolt_shear_hsfg(
                self.bolt_diameter, self.bolt_fu, self.mu_f, self.n_e,
                self.bolt_hole_type)
            self.bolt_bearing_capacity = 0.000
            self.bolt_value = self.bolt_shear_capacity
        # Check for long joints is not applicable for seated angle connection
        self.bolts_required = int(
            math.ceil(float(self.shear_force) / self.bolt_value))
Пример #2
0
def cleat_connection(ui_obj):
    global logger
    beam_sec = ui_obj['Member']['BeamSection']
    column_sec = ui_obj['Member']['ColumSection']
    connectivity = ui_obj['Member']['Connectivity']
    beam_fu = float(ui_obj['Member']['fu (MPa)'])
    beam_fy = float(ui_obj['Member']['fy (MPa)'])

    shear_load = float(ui_obj['Load']['ShearForce (kN)'])

    bolt_dia = int(ui_obj['Bolt']['Diameter (mm)'])
    bolt_type = ui_obj["Bolt"]["Type"]
    bolt_grade = float(ui_obj['Bolt']['Grade'])
    bolt_HSFG_slip_factor = ui_obj["bolt"]["slip_factor"]
    gap = float(ui_obj["detailing"]["gap"])

    mu_f = float(ui_obj["bolt"]["slip_factor"])
    dp_bolt_hole_type = ui_obj["bolt"]["bolt_hole_type"]

    cleat_length = str(ui_obj['cleat']['Height (mm)'])
    if cleat_length == '':
        cleat_length = 0
    else:
        cleat_length = int(cleat_length)

    cleat_fu = float(ui_obj['Member']['fu (MPa)'])
    cleat_fy = float(ui_obj['Member']['fy (MPa)'])
    cleat_sec = ui_obj['cleat']['section']

    dictbeamdata = get_beamdata(beam_sec)
    beam_w_t = float(dictbeamdata["tw"])
    beam_f_t = float(dictbeamdata["T"])
    beam_d = float(dictbeamdata["D"])
    beam_R1 = float(dictbeamdata["R1"])
    beam_B = float(dictbeamdata["B"])
    beam_D = float(dictbeamdata["D"])

    if connectivity == "Column web-Beam web" or connectivity == "Column flange-Beam web":
        dictcolumndata = get_columndata(column_sec)
        column_w_t = float(dictcolumndata["tw"])
        column_f_t = float(dictcolumndata["T"])
        column_R1 = float(dictcolumndata["R1"])
        column_D = float(dictcolumndata["D"])
        column_B = float(dictcolumndata["B"])
    else:
        dictcolumndata = get_beamdata(column_sec)
        column_w_t = float(dictcolumndata["tw"])
        column_f_t = float(dictcolumndata["T"])
        column_R1 = float(dictcolumndata["R1"])
        column_D = float(dictcolumndata["D"])
        column_B = float(dictcolumndata["B"])

    dict_cleat_data = get_angledata(cleat_sec)
    cleat_legsizes = str(dict_cleat_data["AXB"])
    cleat_legsize_A = int(cleat_legsizes.split('x')[0])
    cleat_legsize_B = int(cleat_legsizes.split('x')[1])
    cleat_legsize = int(cleat_legsize_A)
    cleat_legsize_1 = int(cleat_legsize_B)
    cleat_thk = int(dict_cleat_data["t"])
    # ####################Calculation Begins########################
    pitch = 0.0
    gauge = 0.0
    eccentricity = 0.0
    dia_hole = 0
    thinner = 0.0
    bolt_shear_capacity = 0.0
    bolt_bearing_capacity_c = 0.0
    bearing_capacity_column = 0.0
    bearing_capacity_cleat_c = 0.0
    bearing_capacity_c = 0.0

    ##################################################################
    design_status = True
    if connectivity == 'Column flange-Beam web':
        avbl_space = column_B
        # required_space = 2 * cleat_legsize_1 + beam_w_t
        required_space = 2 * cleat_legsize_B + beam_w_t
        max_leg_size = int((avbl_space - beam_w_t) / 10) * 5
        if avbl_space < required_space:
            design_status = False
            logger.error(
                ':Column cannot accommodate the given cleat angle due to space restriction  '
            )
            logger.warning(
                ':Cleat leg should be less than or equal to %2.2f mm' %
                (max_leg_size))
            logger.info(':Decrease the cleat leg')

    elif connectivity == 'Column web-Beam web':
        avbl_space = column_D - 2 * (column_f_t + column_R1)
        #required_space = 2 * cleat_legsize_1 + beam_w_t
        required_space = 2 * cleat_legsize_B + beam_w_t
        max_leg_size = int((avbl_space - beam_w_t) / 10) * 5
        if avbl_space < required_space:
            design_status = False
            logger.error(
                ':Column cannot accommodate the given cleat angle due to space restriction'
            )
            logger.warning(
                ':Cleat leg should be less than or equal to %2.2f mm' %
                (max_leg_size))
            logger.info(':Decrease the cleat leg')
    else:
        # Always feasible in this case.No checks required
        pass
    ################################################################################

# Bolt design:
#     design_status = True
# I: Check for number of bolts -------------------
    bolt_fu = int(bolt_grade) * 100
    bolt_fy = (bolt_grade - int(bolt_grade)) * bolt_fu

    t_thinner_b = min(beam_w_t.real, cleat_thk.real)
    bolt_shear_capacity = 0

    if bolt_type == 'HSFG':
        # bolt_shear_capacity = HSFG_bolt_shear(bolt_HSFG_slip_factor, bolt_dia, 2, bolt_fu)
        mu_f = mu_f
        n_e = 2
        bolt_hole_type = dp_bolt_hole_type
        bolt_shear_capacity = ConnectionCalculations.bolt_shear_hsfg(
            bolt_dia, bolt_fu, mu_f, n_e, bolt_hole_type)
        bearing_capacity_b = 'N/A'
        bolt_bearing_capacity = 'N/A'
        bearing_capacity_beam = 'N/A'
        bearing_capacity_plt = 'N/A'
        bolt_capacity = bolt_shear_capacity

    elif bolt_type == 'Bearing Bolt':
        bolt_shear_capacity = black_bolt_shear(bolt_dia, 2, bolt_fu)

        bolt_bearing_capacity = bearing_capacity(bolt_dia, beam_w_t, bolt_fu,
                                                 beam_fu)
        bearing_capacity_beam = bearing_capacity(bolt_dia, beam_w_t, beam_fu,
                                                 beam_fu)
        bearing_capacity_plt = bearing_capacity(bolt_dia, cleat_thk, cleat_fu,
                                                beam_fu)
        bearing_capacity_b = min(bolt_bearing_capacity, bearing_capacity_beam,
                                 bearing_capacity_plt)
        bolt_capacity = min(bolt_shear_capacity, bearing_capacity_b)
        bolt_capacity = (bolt_capacity / 2.0)

    if shear_load != 0:
        bolts_required = int(math.ceil(shear_load / (2 * bolt_capacity)))
    else:
        bolts_required = 0
        while bolts_required == 0:
            design_status = False
            break
    if (bolts_required < 3) and (bolts_required > 0):
        bolts_required = 3

    dia_hole = ui_obj["bolt"]["bolt_hole_clrnce"] + bolt_dia

    min_pitch = int(2.5 * bolt_dia)
    min_gauge = int(2.5 * bolt_dia)
    min_edge_dist = int(1.7 * dia_hole)
    max_edge_dist = int((12 * t_thinner_b * math.sqrt(250 / bolt_fy))) - 1

    kbchk1 = min_edge_dist / float(3 * dia_hole)
    kbchk2 = min_pitch / float(3 * dia_hole) - 0.25
    kbchk3 = bolt_fu / float(beam_fu)
    kbchk4 = 1
    kb = min(kbchk1, kbchk2, kbchk3, kbchk4)
    kb = round(kb, 3)

    # ##########################Capacity Details for column bolts #######################################
    bolt_shear_capacity_c = bolt_shear_capacity / 2
    if connectivity == 'Column web-Beam web' or connectivity == "Beam-Beam":
        thinner = min(column_w_t, cleat_thk)
        bolt_bearing_capacity_c = bearing_capacity(bolt_dia, thinner, bolt_fu,
                                                   beam_fu)
        bearing_capacity_column = bearing_capacity(bolt_dia, column_w_t,
                                                   beam_fu, beam_fu)
        bearing_capacity_cleat_c = bearing_capacity(bolt_dia, cleat_thk,
                                                    beam_fu, beam_fu)
        if bolt_type == 'HSFG':
            bearing_capacity_c = 'N/A'
        else:
            bearing_capacity_c = min(bolt_bearing_capacity_c,
                                     bearing_capacity_column,
                                     bearing_capacity_cleat_c)

    else:
        thinner = min(column_f_t, cleat_thk)
        bolt_bearing_capacity_c = bearing_capacity(bolt_dia, thinner, bolt_fu,
                                                   beam_fu)
        bearing_capacity_column = bearing_capacity(bolt_dia, column_f_t,
                                                   beam_fu, beam_fu)
        bearing_capacity_cleat_c = bearing_capacity(bolt_dia, cleat_thk,
                                                    beam_fu, beam_fu)
        if bolt_type == 'HSFG':
            bearing_capacity_c = 'N/A'
        else:
            bearing_capacity_c = min(bolt_bearing_capacity_c,
                                     bolt_bearing_capacity_c,
                                     bearing_capacity_column)

    bolt_capacity_c = min(bolt_shear_capacity_c, bearing_capacity_c)

    if shear_load != 0:
        bolts_required_c = int(math.ceil(shear_load / (2 * bolt_capacity_c)))
    else:
        bolts_required_c = 0
    if bolts_required_c < 3:
        bolts_required_c = 3
    # ####################local variable #################
    no_row_b = 0
    no_col_b = 0
    pitch_b = 0.0
    gauge_b = 0.0
    edge_dist_b = 0.0
    end_dist_b = 0.0
    cleat_length_b = 0.0

    no_row_c = 0
    no_col_c = 0
    pitch_c = 0.0
    gauge_c = 0.0
    edge_dist_c = 0.0
    end_dist_c = 0.0
    cleat_length_c = 0.0
    c_eccentricity = 0.0

    # ############################Length of the cleat angle given ######################
    # #################Beam Connection #################################################
    if cleat_length != 0:
        no_row = bolts_required
        no_col = 1
        avbl_length = (cleat_length - 2 * min_edge_dist)
        pitch = avbl_length / (no_row - 1)
        test = True
        if pitch < min_pitch:
            test = False
            no_col = 2
            if no_row % 2 == 0:
                no_row = no_row / 2
            else:
                no_row = (no_row + 1) / 2
            if no_row <= 2:
                no_row = 2
            gauge = min_gauge
            #eccentricity = cleat_legsize - (min_edge_dist + gauge / 2)
            eccentricity = cleat_legsize_A - (min_edge_dist + gauge / 2)
            pitch = avbl_length / (no_row - 1)
        else:
            no_col = 1
            gauge = 0
            #eccentricity = cleat_legsize - min_edge_dist
            eccentricity = cleat_legsize_A - min_edge_dist

        if shear_load != 0:
            crit_shear = critical_bolt_shear(shear_load, eccentricity, pitch,
                                             gauge, no_row)
            if crit_shear > bolt_capacity:
                if no_col == 1:
                    while crit_shear > bolt_capacity and pitch > min_pitch:
                        no_row = (no_row + 1)
                        pitch = avbl_length / (no_row - 1)
                        crit_shear = critical_bolt_shear(
                            shear_load, eccentricity, pitch, gauge, no_row)
                    if pitch < min_pitch:
                        no_col = 2
                    elif bolt_capacity > crit_shear and pitch > min_pitch:
                        pass

                if no_col == 2:  # Call math.ceil(x)
                    if test is True:
                        test = False
                        if no_row % 2 == 0:
                            no_row = (no_row / 2)
                        else:
                            no_row = (no_row + 1) / 2
                    if no_row < 2:
                        no_row = 2
                    pitch = avbl_length / (no_row - 1)
                    gauge = min_gauge
                    #eccentricity = cleat_legsize - (min_edge_dist + gauge / 2)
                    eccentricity = cleat_legsize_A - (min_edge_dist +
                                                      gauge / 2)
                    crit_shear = critical_bolt_shear(shear_load, eccentricity,
                                                     pitch, gauge, no_row)
                    if crit_shear > bolt_capacity:

                        while crit_shear > bolt_capacity and pitch > min_pitch:
                            no_row = (no_row + 1)
                            pitch = avbl_length / (no_row - 1)
                            crit_shear = critical_bolt_shear(
                                shear_load, eccentricity, pitch, gauge, no_row)
                        if pitch < min_pitch:
                            design_status = False
                            logger.error(
                                ':Critical shear force on the bolts exceeds the bolt capacity'
                            )
                            logger.warning(
                                ':Bolt capacity of the critical bolt should be greater than %2.2f KN'
                                % (crit_shear))
                            logger.info(
                                ':Re-design with increased bolt diameter or bolt grade'
                            )
                        elif bolt_capacity > crit_shear and pitch > min_pitch:
                            pass
        else:
            crit_shear = 0

# #####################################Storing beam results to different variables########################################
        no_row_b = no_row
        no_col_b = no_col
        pitch_b = pitch
        gauge_b = gauge
        edge_dist_b = min_edge_dist
        end_dist_b = min_edge_dist
        cleat_length_b = cleat_length
        critboltshear_b = crit_shear
        b_eccentricity = eccentricity

        # ################################# Column Calculation ###############################################
        no_row = bolts_required_c
        no_col = 1
        avbl_length = (cleat_length - 2 * min_edge_dist)
        pitch = avbl_length / (no_row - 1)
        end_dist = min_edge_dist
        test = True
        if pitch < min_pitch:
            test = False
            no_col = 2
            if no_row % 2 == 0:
                no_row = no_row / 2
            else:
                no_row = (no_row + 1) / 2
            if no_row <= 2:
                no_row = 2
            gauge = min_gauge
            #if (cleat_legsize_1 + beam_w_t / 2 - end_dist - gauge) > 70:
            if (cleat_legsize_B + beam_w_t / 2 - end_dist - gauge) > 70:
                eccentricity = 70.0 + gauge / 2
                #end_dist = (cleat_legsize_1 + beam_w_t / 2) - (70.0 + gauge)
                end_dist = (cleat_legsize_B + beam_w_t / 2) - (70.0 + gauge)
            else:
                #eccentricity = (cleat_legsize_1 + beam_w_t / 2) - (min_edge_dist + gauge / 2)
                eccentricity = (cleat_legsize_B +
                                beam_w_t / 2) - (min_edge_dist + gauge / 2)
                end_dist = min_edge_dist
            pitch = avbl_length / (no_row - 1)
        else:
            no_col = 1
            gauge = 0
            #if (cleat_legsize_1 + beam_w_t / 2 - end_dist - gauge) > 70:
            if (cleat_legsize_B + beam_w_t / 2 - end_dist - gauge) > 70:
                eccentricity = 70.0 + gauge / 2
                #end_dist = (cleat_legsize_1 + beam_w_t / 2) - (70.0 + gauge)
                end_dist = (cleat_legsize_B + beam_w_t / 2) - (70.0 + gauge)
            else:
                #eccentricity = (cleat_legsize_1 + beam_w_t / 2) - (min_edge_dist + gauge / 2)
                eccentricity = (cleat_legsize_B +
                                beam_w_t / 2) - (min_edge_dist + gauge / 2)
                end_dist = min_edge_dist

        crit_shear = column_critical_shear(shear_load, eccentricity, pitch,
                                           gauge, no_row, min_edge_dist)
        if crit_shear > bolt_capacity_c:
            if no_col == 1:
                while crit_shear > bolt_capacity_c and pitch > min_pitch:
                    no_row = no_row + 1
                    pitch = avbl_length / (no_row - 1)
                    crit_shear = column_critical_shear(shear_load,
                                                       eccentricity, pitch,
                                                       gauge, no_row,
                                                       min_edge_dist)
                if pitch < min_pitch:
                    no_col = 2
                elif bolt_capacity_c > crit_shear and pitch > min_pitch:
                    pass

            if no_col == 2:  # Call math.ceil(x)
                if test is True:
                    test = False
                    if no_row % 2 == 0:
                        no_row = (no_row / 2)
                    else:
                        no_row = (no_row + 1) / 2
                if no_row < 2:
                    no_row = 2
                pitch = avbl_length / (no_row - 1)
                gauge = min_gauge
                #if (cleat_legsize_1 + beam_w_t / 2 - end_dist - gauge) > 70:
                if (cleat_legsize_B + beam_w_t / 2 - end_dist - gauge) > 70:
                    eccentricity = 70.0 + gauge / 2
                    #end_dist = (cleat_legsize_1 + beam_w_t / 2) - (70.0 + gauge)
                    end_dist = (cleat_legsize_B + beam_w_t / 2) - (70.0 +
                                                                   gauge)
                else:
                    #eccentricity = (cleat_legsize_1 + beam_w_t / 2) - (min_edge_dist + gauge / 2)
                    eccentricity = (cleat_legsize_B +
                                    beam_w_t / 2) - (min_edge_dist + gauge / 2)
                    end_dist = min_edge_dist

                crit_shear = column_critical_shear(shear_load, eccentricity,
                                                   pitch, gauge, no_row,
                                                   min_edge_dist)
                if crit_shear > bolt_capacity_c:

                    while crit_shear > bolt_capacity_c and pitch > min_pitch:
                        no_row = no_row + 1
                        pitch = avbl_length / (no_row - 1)
                        crit_shear = column_critical_shear(
                            shear_load, eccentricity, pitch, gauge, no_row,
                            min_edge_dist)
                    if pitch < min_pitch:
                        design_status = False
                        logger.error(
                            ':Critical shear force on the bolts exceeds the bolt capacity'
                        )
                        logger.warning(
                            ':Bolt capacity of the critical bolt should be greater than %2.2f KN'
                            % (crit_shear))
                        logger.info(
                            ':Re-design with increased bolt diameter or bolt grade'
                        )
                    elif bolt_capacity_c > crit_shear and pitch > min_pitch:
                        pass
    ##########################################################################
        no_row_c = no_row
        no_col_c = no_col
        pitch_c = pitch
        gauge_c = gauge
        edge_dist_c = min_edge_dist
        end_dist_c = end_dist
        cleat_length_c = cleat_length
        c_eccentricity = eccentricity
        critboltshear_c = crit_shear

# ########################################## length of the cleat angle not given #########################
    else:
        no_row = bolts_required
        no_col = 1
        cleat_length = (no_row - 1) * min_pitch + 2 * min_edge_dist
        pitch = min_pitch
        max_cleat_length = beam_D - 2 * (beam_f_t + beam_R1)
        edge_dist = min_edge_dist
        test = True
        if cleat_length > max_cleat_length:
            test = False
            no_col = 2
            if no_row % 2 == 0:
                no_row = (no_row / 2)
            else:
                no_row = (no_row + 1) / 2
            if no_row < 2:
                no_row = 2

            gauge = min_gauge
            #eccentricity = cleat_legsize - (gauge / 2 + min_edge_dist)
            eccentricity = cleat_legsize_A - (gauge / 2 + min_edge_dist)
        else:
            no_col = 1
            gauge = 0
            #eccentricity = cleat_legsize - (gauge / 2 + min_edge_dist)
            eccentricity = cleat_legsize_A - (gauge / 2 + min_edge_dist)
        if shear_load != 0:

            crit_shear = critical_bolt_shear(shear_load, eccentricity, pitch,
                                             gauge, no_row)
            if crit_shear > bolt_capacity:
                if no_col == 1:
                    while crit_shear > bolt_capacity and cleat_length < max_cleat_length:
                        no_row = no_row + 1
                        cleat_length = cleat_length + pitch
                        crit_shear = critical_bolt_shear(
                            shear_load, eccentricity, pitch, gauge, no_row)
                    if cleat_length > max_cleat_length:
                        no_col = 2
                    elif bolt_capacity > crit_shear and cleat_length < max_cleat_length:
                        pass

                if no_col == 2:  # Call math.ceil(x)
                    if test is True:
                        test = False
                        if no_row % 2 == 0:
                            no_row = no_row / 2
                        else:
                            no_row = (no_row + 1) / 2
                    if no_row <= 2:
                        no_row = 2

                    cleat_length = (no_row - 1) * min_pitch + 2 * min_edge_dist
                    #                 if cleat_length < 0.6 * beam_D:
                    #                     cleat_length = 0.6 * beam_D
                    #                     edge_dist = (cleat_length - (no_row -1) * pitch)/2
                    #                 else:
                    #                     edge_dist = min_edge_dist
                    gauge = min_gauge
                    #eccentricity = cleat_legsize - (gauge / 2 + min_edge_dist)
                    eccentricity = cleat_legsize_A - (gauge / 2 +
                                                      min_edge_dist)
                    crit_shear = critical_bolt_shear(shear_load, eccentricity,
                                                     pitch, gauge, no_row)
                    if crit_shear > bolt_capacity:

                        while crit_shear > bolt_capacity and cleat_length < max_cleat_length:
                            no_row = no_row + 1
                            cleat_length = cleat_length + pitch
                            crit_shear = critical_bolt_shear(
                                shear_load, eccentricity, pitch, gauge, no_row)
                        if cleat_length > max_cleat_length:
                            design_status = False
                            logger.error(
                                ':Critical shear force on the bolts exceeds the bolt capacity'
                            )
                            logger.warning(
                                ':Bolt capacity of the critical bolt should be greater than %2.2f KN'
                                % (crit_shear))
                            logger.info(
                                ':Re-design with increased bolt diameter or bolt grade'
                            )
                        elif bolt_capacity > crit_shear and cleat_length <= max_cleat_length:
                            pass
            #             if end_dist > min_edge_dist and cleat_length > 0.6 * beam_D :
            #                 end_dist = min_edge_dist
            #                 cleat_length = (no_row -1) * pitch + 2 * min_edge_dist

            if cleat_length < 0.6 * beam_D:
                cleat_length = 0.6 * beam_D
                edge_dist = (cleat_length - (no_row - 1) * pitch) / 2
        else:
            crit_shear = 0

# #####################################Storing beam results to different variables######################
        no_row_b = no_row
        no_col_b = no_col
        pitch_b = pitch
        gauge_b = gauge
        edge_dist_b = edge_dist
        end_dist_b = min_edge_dist
        cleat_length_b = cleat_length
        critboltshear_b = crit_shear
        b_eccentricity = eccentricity
        # ################################# Column Calculation ###############################################
        no_row = bolts_required_c
        no_col = 1
        cleat_length = (no_row - 1) * min_pitch + 2 * min_edge_dist
        pitch = min_pitch
        max_cleat_length = beam_D - 2 * (beam_f_t + beam_R1)
        edge_dist = min_edge_dist
        end_dist = min_edge_dist
        test = True
        if cleat_length > max_cleat_length:
            test = False
            no_col = 2
            if no_row % 2 == 0:
                no_row = no_row / 2
            else:
                no_row = (no_row + 1) / 2
            if no_row < 2:
                no_row = 2

            gauge = min_gauge
            #if (cleat_legsize_1 + beam_w_t / 2 - end_dist - gauge) > 70:
            if (cleat_legsize_B + beam_w_t / 2 - end_dist - gauge) > 70:
                eccentricity = 70.0 + gauge / 2
                #end_dist = (cleat_legsize_1 + beam_w_t / 2) - (70.0 + gauge)
                end_dist = (cleat_legsize_B + beam_w_t / 2) - (70.0 + gauge)
            else:
                #eccentricity = (cleat_legsize_1 + beam_w_t / 2) - (min_edge_dist + gauge / 2)
                eccentricity = (cleat_legsize_B +
                                beam_w_t / 2) - (min_edge_dist + gauge / 2)
                end_dist = min_edge_dist

        else:
            no_col = 1
            gauge = 0
            #if (cleat_legsize_1 + beam_w_t / 2 - end_dist - gauge) > 70:
            if (cleat_legsize_B + beam_w_t / 2 - end_dist - gauge) > 70:
                eccentricity = 70.0 + gauge / 2
                #end_dist = (cleat_legsize_1 + beam_w_t / 2) - (70.0 + gauge)
                end_dist = (cleat_legsize_B + beam_w_t / 2) - (70.0 + gauge)
            else:
                #eccentricity = (cleat_legsize_1 + beam_w_t / 2) - (min_edge_dist + gauge / 2)
                eccentricity = (cleat_legsize_B +
                                beam_w_t / 2) - (min_edge_dist + gauge / 2)
                end_dist = min_edge_dist

        crit_shear = column_critical_shear(shear_load, eccentricity, pitch,
                                           gauge, no_row, edge_dist)
        if crit_shear > bolt_capacity_c:
            if no_col == 1:
                while crit_shear > bolt_capacity_c and cleat_length < max_cleat_length:
                    no_row = no_row + 1
                    cleat_length = cleat_length + pitch
                    crit_shear = column_critical_shear(shear_load,
                                                       eccentricity, pitch,
                                                       gauge, no_row,
                                                       edge_dist)
                if cleat_length > max_cleat_length:
                    no_col = 2
                elif bolt_capacity_c > crit_shear and cleat_length < max_cleat_length:
                    pass

            if no_col == 2:  # Call math.ceil(x)
                if test is True:
                    test = False
                    if no_row % 2 == 0:
                        no_row = no_row / 2
                    else:
                        no_row = (no_row + 1) / 2
                if no_row < 2:
                    no_row = 2

                cleat_length = (no_row - 1) * min_pitch + 2 * min_edge_dist
                #                 if cleat_length < 0.6 * beam_D:
                #                     cleat_length = 0.6 * beam_D
                #                     edge_dist = (cleat_length - (no_row -1) * pitch)/2
                #                 else:
                #                 edge_dist = min_edge_dist
                gauge = min_gauge
                #if (cleat_legsize_1 + beam_w_t / 2 - end_dist - gauge) > 70:
                if (cleat_legsize_B + beam_w_t / 2 - end_dist - gauge) > 70:
                    eccentricity = 70.0 + gauge / 2
                    #end_dist = (cleat_legsize_1 + beam_w_t / 2) - (70.0 + gauge)
                    end_dist = (cleat_legsize_B + beam_w_t / 2) - (70.0 +
                                                                   gauge)
                else:
                    #eccentricity = (cleat_legsize_1 + beam_w_t / 2) - (min_edge_dist + gauge / 2)
                    eccentricity = (cleat_legsize_B +
                                    beam_w_t / 2) - (min_edge_dist + gauge / 2)
                    end_dist = min_edge_dist

                crit_shear = column_critical_shear(shear_load, eccentricity,
                                                   pitch, gauge, no_row,
                                                   edge_dist)
                if crit_shear > bolt_capacity_c:

                    while crit_shear > bolt_capacity_c and cleat_length < max_cleat_length:
                        no_row = no_row + 1
                        cleat_length = cleat_length + pitch
                        crit_shear = column_critical_shear(
                            shear_load, eccentricity, pitch, gauge, no_row,
                            edge_dist)
                    if cleat_length > max_cleat_length:
                        design_status = False
                        logger.error(
                            ':Shear force on the critical bolt exceeds the bolt capacity'
                        )
                        logger.warning(
                            ':Bolt capacity of the critical bolt should be greater than %2.2f KN'
                            % (crit_shear))
                        logger.info(
                            ':Re-design with increased bolt diameter or bolt grade'
                        )
                    elif bolt_capacity_c > crit_shear and cleat_length <= max_cleat_length:
                        pass
        #             if end_dist > min_edge_dist and cleat_length > 0.6 * beam_D :
        #                 end_dist = min_edge_dist
        #                 cleat_length = (no_row -1) * pitch + 2 * min_edge_dist
        if cleat_length < 0.6 * beam_D:
            cleat_length = 0.6 * beam_D
            edge_dist = (cleat_length - (no_row - 1) * pitch) / 2
# ###################################Storing to a Seperate Variables######################################
        no_row_c = no_row
        no_col_c = no_col
        pitch_c = pitch
        gauge_c = gauge
        edge_dist_c = edge_dist
        end_dist_c = end_dist
        cleat_length_c = cleat_length
        c_eccentricity = eccentricity
        critboltshear_c = crit_shear
# ################################################Deciding final Design outcomes based on column and beam connectivity design #######
    if cleat_length_b > cleat_length_c:
        cleat_length = cleat_length_b
        edge_dist_c = (cleat_length - (no_row_c - 1) * pitch_c) / 2
    else:
        cleat_length = cleat_length_c
        edge_dist_b = (cleat_length - (no_row_b - 1) * pitch_b) / 2

# ###########################################All the checks########################################################

    b_end_distance = cleat_legsize_A - (gap + min_edge_dist + gauge_b)
    if b_end_distance < min_edge_dist:  # is it neccessary to treat single and double line seperately?
        design_status = False
        logger.error(
            ':Edge distance in the beam web is less than the minimum required [cl. 10.2.4.2]'
        )
        logger.warning(':Minimum cleat leg required is %s mm' %
                       (str(2 * min_edge_dist + gap + gauge_b)))
        logger.info(':Increase the cleat leg')  # change reference
    b_gauge = (2 * cleat_legsize_B + beam_w_t) - 2 * (end_dist_c + gauge_c)
    connection = "column"
    if connectivity == "Beam-Beam":
        connection = "primary beam"

    if b_gauge < 90:

        design_status = False
        logger.error(
            ':Cross center distance between bolt lines in %s on either side of the supported beam is less than the specified gauge '
            '[reference-JSC:ch.4 check-1]' % (str(connection)))
        logger.warning(':Minimum specified cross center gauge is 90 mm')
        logger.info(':Increase the cleat leg size')
    if b_gauge > 140:
        design_status = False
        logger.error(
            ':Cross center distance between vertical bolt lines in %s on either side of the supported beam is greater than the specified gauge'
            '[reference-JSC:ch.4 check-1]' % (str(connection)))
        logger.warning(':Maximum specified cross center gauge is 140 mm')
        logger.info(':Decrease the cleat leg')

    # block shear

    min_thk_b = min(beam_w_t, cleat_thk)
    min_thk_c = min(column_w_t, cleat_thk)

    Tdb_B = blockshear(no_row_b, no_col_b, dia_hole, beam_fy, beam_fu,
                       end_dist_b, edge_dist_b, pitch_b, gauge_b, cleat_thk)
    Tdb_C = blockshear(no_row_c, no_col_c, dia_hole, beam_fy, beam_fu,
                       end_dist_c, edge_dist_c, pitch_c, gauge_c, cleat_thk)

    Tdb = min(Tdb_B, Tdb_C)
    if Tdb_B <= shear_load or Tdb_C <= shear_load:
        design_status = False
        logger.error(
            ": Block shear capacity of the cleat angle is less than the applied shear force [cl. 6.4.1]"
        )
        logger.warning(": Minimum block shear capacity required is %2.2f KN " %
                       (shear_load))
        logger.info(":Block shear capacity of the cleat angle is %2.2f KN" %
                    (Tdb))
        logger.info(": Increase the cleat angle thickness")
    # ##############Moment Demand and Moment Capacity ##################
    moment_demand_c = 0.5 * shear_load * c_eccentricity / 1000
    moment_capacity_c = 1.2 * cleat_fy * cleat_thk * cleat_length * cleat_length / 1000000
    if moment_capacity_c < moment_demand_c:
        design_status = False
        logger.error(
            ":Moment capacity of the cleat leg is less than the moment demand [cl. 8.2.1.2]"
        )
        logger.info(":Re-design with increased plate or cleat dimensions")
    moment_demand_b = 0.5 * shear_load * b_eccentricity / 1000
    moment_capacity_b = 1.2 * cleat_fy * cleat_thk * cleat_length * cleat_length / 1000000
    if moment_capacity_b < moment_demand_b:
        design_status = False
        logger.error(
            ":Moment capacity of the cleat angle leg  is less than the moment demand [cl. 8.2.1.2]"
        )
        logger.info(":Re-design with increased plate or cleat dimensions")

    ##### Shear yeild check #####

    h_0 = beam_d - beam_f_t - beam_R1
    A_v = h_0 * beam_w_t  # shear area of secondry beam
    V_d = shear_yeilding_b(A_v, beam_fy)
    if connectivity == "Beam-Beam":
        if V_d < shear_load:
            design_status = False
            logger.error(
                ": Secondary beam fails in shear yielding [cl. 8.4.1]/ AISC Steel Construction Manual, 14th Edition"
            )
            logger.warning(
                ": Minimum shear yielding capacity required is %2.2f kN" %
                (shear_load))
            logger.info(": Use a deeper section for the secondary beam")

    ### Check for shear rupture ##

    A_vn = beam_w_t * (h_0 - (bolts_required * dia_hole))
    if A_vn <= ((beam_fy / beam_fu) * (1.25 / 1.10) * (A_v / 0.9)):
        A_vn = ((beam_fy / beam_fu) * (1.25 / 1.10) * (A_v / 0.9))
    R_n = shear_rupture_b(A_vn, beam_fu)
    if connectivity == "Beam-Beam":
        if R_n < shear_load:
            design_status = False
            logger.error(
                ": Capacity of the secondary beam in shear rupture is less than the applied shear force AISC Steel Construction Manual, 14th Edition/[cl.8.4.1.1]"
            )
            logger.warning(
                ": Minimum shear rupture capacity required is %2.2f kN" %
                (shear_load))
            logger.info(" : Use a deeper section for the secondary beam")

# ----------------------------------------------------- Check for cleat_height against secondry beam depth -----------------------------------------------------------------------------------------------
    max_cleat_length = beam_D - 2 * (beam_f_t + beam_R1)

    if connectivity == "Beam-Beam":
        notch_offset = max([column_f_t, beam_f_t]) + max(
            [column_R1, beam_R1]) + max([(column_f_t / 2), (beam_f_t / 2), 10])
        clearDepth = beam_D - (beam_R1 + beam_f_t + column_R1 + column_f_t)
        available_depth_beam = (notch_offset + cleat_length_b)
        if available_depth_beam > max_cleat_length:
            design_status = False
            logger.error(
                ": Calculated cleat height exceeds depth of secondry beam")
            logger.warning(": Mamimum depth of cleat is %2.2f mm" %
                           (clearDepth))
            logger.info(": Use a deeper section for the secondry beam")
    else:
        clearDepth = beam_D - 2 * (beam_f_t + beam_R1 + 5)
        if cleat_length > max_cleat_length:
            design_status = False
            logger.error(": Calculated cleat height exceeds depth of beam")
            logger.warning(": Maximum depth of cleat is %2.2f mm" %
                           (clearDepth))
            logger.info(": Use a deeper section for the beam")

    # ########################feeding output to array ###############
    output_obj = {}
    output_obj['Bolt'] = {}
    output_obj['Bolt']['status'] = design_status
    output_obj['Bolt']['shearcapacity'] = round(bolt_shear_capacity, 3)

    if bolt_type == "HSFG":
        output_obj['Bolt']['bearingcapacity'] = str(bearing_capacity_b)
        output_obj['Bolt']['bearingcapacitybeam'] = str(bearing_capacity_beam)
        output_obj['Bolt']['bearingcapacitycleat'] = str(bearing_capacity_plt)
        output_obj['Bolt']['boltbearingcapacity'] = str(bolt_bearing_capacity)
        output_obj['Bolt']['boltcapacity'] = round(
            bolt_capacity, 3
        )  # removed 2 to display only bolt_capacity in capacity details of supported member
        output_obj['Bolt']['boltgrpcapacity'] = round(
            bolt_capacity * no_row_b * no_col_b, 3)  # mulipled by 2

    else:
        output_obj['Bolt']['bearingcapacity'] = round(bearing_capacity_b, 3)
        output_obj['Bolt']['bearingcapacitybeam'] = round(
            bearing_capacity_beam, 3)
        output_obj['Bolt']['bearingcapacitycleat'] = round(
            bearing_capacity_plt, 3)
        output_obj['Bolt']['boltbearingcapacity'] = round(
            bolt_bearing_capacity, 3)
        output_obj['Bolt']['boltcapacity'] = round(2 * bolt_capacity,
                                                   3)  #multiple by 2
        output_obj['Bolt']['boltgrpcapacity'] = round(
            2 * bolt_capacity * no_row_b * no_col_b, 3)  # mulipled by 2

    output_obj['Bolt']['externalmoment'] = round(moment_demand_b, 3)
    output_obj['Bolt']['momentcapacity'] = round(moment_capacity_b, 3)

    output_obj['Bolt']['blockshear'] = round(Tdb_B, 3)
    output_obj['Bolt']['critshear'] = round(critboltshear_b, 3)
    output_obj['Bolt']['numofbolts'] = no_row_b * no_col_b
    output_obj['Bolt']['numofrow'] = int(no_row_b)
    output_obj['Bolt']['numofcol'] = int(no_col_b)
    output_obj['Bolt']['pitch'] = int(pitch_b)
    output_obj['Bolt']['enddist'] = int(end_dist_b)
    output_obj['Bolt']['edge'] = int(edge_dist_b)
    output_obj['Bolt']['gauge'] = int(gauge_b)
    output_obj['Bolt']['thinner'] = float(t_thinner_b)
    output_obj['Bolt']['diahole'] = float(dia_hole)
    output_obj['Bolt']['kb'] = float(kb)

    #     output_obj['Bolt']['grade'] = bolt_grade

    output_obj['cleat'] = {}
    output_obj['cleat']['numofbolts'] = 2 * no_row_c * no_col_c
    output_obj['cleat']['height'] = float(cleat_length)
    output_obj['cleat']['externalmoment'] = round(moment_demand_c, 3)
    output_obj['cleat']['momentcapacity'] = round(moment_capacity_c, 3)
    output_obj['cleat']['numofrow'] = no_row_c
    output_obj['cleat']['numofcol'] = no_col_c

    output_obj['cleat']['pitch'] = int(pitch_c)
    output_obj['cleat']['guage'] = int(gauge_c)
    output_obj['cleat']['edge'] = edge_dist_c
    output_obj['cleat']['end'] = end_dist_c
    #output_obj['cleat']['legsize'] = cleat_legsize_1
    output_obj['cleat']['legsize'] = cleat_legsize_B
    output_obj['cleat']['thinner'] = float(thinner)

    output_obj['cleat']['shearcapacity'] = round(bolt_shear_capacity_c, 3)

    if bolt_type == 'HSFG':
        output_obj['cleat']['bearingcapacity'] = str(bearing_capacity_c)
    else:
        output_obj['cleat']['bearingcapacity'] = round(bearing_capacity_c, 3)

    output_obj['cleat']['boltcapacity'] = round(bolt_capacity_c, 3)
    output_obj['cleat']['bearingcapacitycolumn'] = round(
        bearing_capacity_column, 3)
    output_obj['cleat']['bearingcapacitycleat'] = round(
        bearing_capacity_cleat_c, 3)
    output_obj['cleat']['boltgrpcapacity'] = round(
        2 * bolt_capacity_c * no_row_c * no_col_c, 3)
    output_obj['cleat']['boltbearingcapacity'] = round(bolt_bearing_capacity_c,
                                                       3)
    output_obj['cleat']['blockshear'] = round(Tdb_C, 3)
    output_obj['cleat']['critshear'] = round(critboltshear_c, 3)

    # TODO commented in order to execute faulty report
    # if bolts_required == 0 or bolts_required_c == 0:
    #     for k in output_obj.keys():
    #         for key in output_obj[k].keys():
    #             output_obj[k][key] = ""
    #
    # if design_status is False:
    #     for k in output_obj.keys():
    #         for key in output_obj[k].keys():
    #             output_obj[k][key] = ""

    # if design_status is True:
    if output_obj['Bolt']['status'] == True:
        logger.info(": Overall cleat angle connection design is safe \n")
        logger.debug(" :=========End Of design===========")

    else:
        logger.error(": Design is not safe \n ")
        logger.debug(" :=========End Of design===========")

    return output_obj
Пример #3
0
def end_connection(ui_obj):

    global logger
    beam_sec = ui_obj['Member']['BeamSection']
    column_sec = ui_obj['Member']['ColumSection']
    connectivity = ui_obj['Member']['Connectivity']
    beam_fu = float(ui_obj['Member']['fu (MPa)'])
    beam_fy = float(ui_obj['Member']['fy (MPa)'])

    shear_load = float(str(ui_obj['Load']['ShearForce (kN)']))

    bolt_dia = int(ui_obj['Bolt']['Diameter (mm)'])
    bolt_type = ui_obj["Bolt"]["Type"]
    bolt_grade = float(ui_obj['Bolt']['Grade'])

    mu_f = float(ui_obj["bolt"]["slip_factor"])
    dp_bolt_hole_type = str(ui_obj['bolt']['bolt_hole_type'])
    gamma_mw = float(ui_obj["weld"]["safety_factor"])
    weld_type = ui_obj['weld']['typeof_weld']

    end_plate_t = float(ui_obj['Plate']['Thickness (mm)'])
    end_plate_w = str(ui_obj['Plate']['Width (mm)'])
    if end_plate_w == '':
        end_plate_w = 0
    else:
        end_plate_w = float(end_plate_w)

    end_plate_l = str(ui_obj['Plate']['Height (mm)'])
    if end_plate_l == '':
        end_plate_l = 0
    else:
        end_plate_l = int(end_plate_l)

    web_plate_fu = float(ui_obj['Member']['fu (MPa)'])
    web_plate_fy = float(ui_obj['Member']['fy (MPa)'])

    user_height = end_plate_l
    user_width = end_plate_w

    weld_t = float(ui_obj["Weld"]['Size (mm)'])
    weld_fu = 410
    # weld_fu = float(ui_obj["Weld"]["weld_fu"])

    bolt_planes = 1
    # check input database required or not?
    dictbeamdata = get_beamdata(beam_sec)
    beam_w_t = float(dictbeamdata["tw"])
    beam_f_t = float(dictbeamdata["T"])
    beam_depth = float(dictbeamdata["D"])
    beam_R1 = float(dictbeamdata["R1"])

    old_beam_section = get_oldbeamcombolist()
    old_col_section = get_oldcolumncombolist()

    if beam_sec in old_beam_section:
        logger.warning(
            " : You are using a section (in red color) that is not available in latest version of IS 808"
        )
    if column_sec in old_col_section:
        logger.warning(
            " : You are using a section (in red color) that is not available in latest version of IS 808"
        )

    if connectivity == "Column web-Beam web" or connectivity == "Column flange-Beam web":
        dictcolumndata = get_columndata(column_sec)
        column_w_t = float(dictcolumndata["tw"])
        column_f_t = float(dictcolumndata["T"])
        column_R1 = float(dictcolumndata["R1"])
        column_d = float(dictcolumndata["D"])
        column_b = float(dictcolumndata["B"])
    else:
        dictcolumndata = get_beamdata(column_sec)
        column_w_t = float(dictcolumndata["tw"])
        column_f_t = float(dictcolumndata["T"])
        column_R1 = float(dictcolumndata["R1"])
        column_d = float(dictcolumndata["D"])
        column_b = float(dictcolumndata["B"])

    if connectivity == "Beam-Beam":
        notch_ht = max([column_f_t, beam_f_t]) + max(
            [column_R1, beam_R1]) + max([(column_f_t / 2), (beam_f_t / 2), 10])
        if notch_ht < (beam_depth / 5):
            pass
        else:
            logger.warning(
                " : Depth of coping should preferably be less than D/5 (D: Secondary beam depth)"
            )

    design_check = True

    sectional_gauge = 0.0
    gauge = 0.0
    pitch = 0.0
    eccentricity = 0.0
    dia_hole = 0
    bolt_shear_capacity = 0.0

    # Plate thickness check
    min_end_plate_t = end_plate_t_min(beam_depth, bolt_grade, bolt_dia)
    if end_plate_t < min_end_plate_t:
        end_plate_t = min_end_plate_t
        design_check = False
        logger.error(
            ": Chosen end plate thickness is less than the minimum plate thickness [Design of Steel Structures by N. Subramanian, OUP, 2014, page 372]"
        )
        logger.warning(" : Minimum required thickness %2.2f mm" %
                       (min_end_plate_t))
        logger.info(" : Increase plate thickness")

# ############# BOLT CAPACITY ###############
#    0 def boltDesign(end_plate_l):
# I: Check for number of bolts -------------------

    bolt_fu = int(bolt_grade) * 100
    bolt_fy = (bolt_grade - int(bolt_grade)) * bolt_fu

    if connectivity == "Column web-Beam web":
        t_thinner = min(column_w_t.real, end_plate_t.real)
    elif connectivity == "Column flange-Beam web":
        t_thinner = min(column_f_t.real, end_plate_t.real)
    else:
        t_thinner = min(column_w_t.real, end_plate_t.real)

    # Spacing of bolts for web plate -------------------
    # ######## According to IS 800 - 2007, table 9, clause no. 10.2.1 ##########################

    dia_hole = ui_obj["bolt"]["bolt_hole_clrnce"] + bolt_dia

    # Minimum/maximum pitch and gauge
    min_pitch = int(2.5 * bolt_dia)
    min_gauge = int(2.5 * bolt_dia)
    if min_pitch % 10 != 0 or min_gauge % 10 != 0:
        min_pitch = (min_pitch / 10) * 10 + 10
        min_gauge = (min_gauge / 10) * 10 + 10
    else:
        min_pitch = min_pitch
        min_gauge = min_gauge

    # ########## MAX SPACING BETWEEN BOLTS #####################
    max_spacing = int(min(100 + 4 * end_plate_t, 200))  # clause 10.2.3.3 is800

    # ############ END AND EDGE DISTANCES ###################
    if ui_obj["detailing"]["typeof_edge"] == "a - Sheared or hand flame cut":
        min_end_dist = int(float(1.7 * (dia_hole)))
    else:
        min_end_dist = int(1.5 * (dia_hole))
    min_edge_dist = min_end_dist

    kbchk1 = min_end_dist / float(3 * dia_hole)
    kbchk2 = min_pitch / float(3 * dia_hole) - 0.25
    kbchk3 = bolt_fu / float(beam_fu)
    kbchk4 = 1
    kb = min(kbchk1, kbchk2, kbchk3, kbchk4)
    kb = round(kb, 3)

    max_edge_dist = int(
        (12 * end_plate_t * cmath.sqrt(250 / beam_fy)).real) - 1
    max_end_dist = int((12 * end_plate_t * cmath.sqrt(250 / beam_fy)).real) - 1

    if bolt_type == 'HSFG':
        muf = mu_f
        n_e = 1  # number of effective interfaces offering frictional resistance
        bolt_hole_type = dp_bolt_hole_type  # 1 - standard hole, 0.85 - oversize hole
        bolt_shear_capacity = ConnectionCalculations.bolt_shear_hsfg(
            bolt_dia, bolt_fu, muf, n_e, bolt_hole_type)
        bolt_bearing_capacity = 'N/A'
        bolt_capacity = bolt_shear_capacity

    elif bolt_type == "Bearing Bolt":
        bolt_shear_capacity = black_bolt_shear(bolt_dia, bolt_planes, bolt_fu)
        bolt_bearing_capacity = bolt_bearing(bolt_dia, t_thinner, kb,
                                             beam_fu).real
        bolt_capacity = min(bolt_shear_capacity, bolt_bearing_capacity)

    # def bolt_bearing(dia, t, fu, kb):

    if shear_load != 0:
        #                 bolts_required = int(math.ceil(shear_load/(2*bolt_capacity)))
        bolts_required = float(math.ceil(
            shear_load /
            bolt_capacity))  # changing no of bolts into multiple of 4
        if bolts_required <= 3:
            bolts_required = 4
        elif bolts_required % 2 == 0:
            bolts_required = bolts_required
        elif bolts_required % 2 != 0:
            bolts_required = bolts_required + 1
    else:
        bolts_required = 0
        while bolts_required == 0:
            design_check = False
            break

    # ###################################################### CHECK 1: DETAILING PRACTICE ###############################################################
    if end_plate_l != 0:
        no_row = (bolts_required / 2)
        no_col = 1
        avbl_length = (end_plate_l - 2 * min_end_dist)
        pitch = avbl_length / (no_row - 1)
        end_dist = min_end_dist
        edge_dist = min_edge_dist

        test = True
        if pitch < min_pitch:
            test = False
            no_col = 2
            if no_row % 2 == 0:
                no_row = no_row / 2
            else:
                no_row = (no_row + 1) / 2
            if no_row < 3:
                no_row = 2
            gauge = min_gauge
            if end_plate_w != 0:
                if (end_plate_w / 2 - edge_dist - gauge) > 70:
                    eccentricity = gauge / 2 + 70
                    edge_dist = end_plate_w / 2 - (70 + gauge)
                else:
                    eccentricity = (end_plate_w / 2 - edge_dist - gauge / 2)
            else:
                eccentricity = gauge / 2 + 50

            pitch = avbl_length / (no_row - 1)
        else:
            gauge = 0
            if end_plate_w != 0:
                if (end_plate_w / 2 - edge_dist - gauge) > 70:
                    eccentricity = gauge / 2 + 70
                    edge_dist = end_plate_w / 2 - (70 + gauge)
                else:
                    eccentricity = (end_plate_w / 2 - edge_dist - gauge / 2)
            else:
                eccentricity = gauge / 2 + 50

            no_col = 1
        # ########################### check critical bolt shear capacity #######################

        crit_shear = critical_bolt_shear(shear_load, eccentricity, pitch,
                                         gauge, no_row)
        if crit_shear > bolt_capacity:
            if no_col == 1:
                while crit_shear > bolt_capacity and pitch > min_pitch:
                    no_row = no_row + 1
                    pitch = avbl_length / (no_row - 1)
                    crit_shear = critical_bolt_shear(shear_load, eccentricity,
                                                     pitch, gauge, no_row)
                if pitch < min_pitch:
                    no_col = 2
                elif bolt_capacity > crit_shear and pitch > min_pitch:
                    pass

            if no_col == 2:  # Call math.ceil(x)
                if test is True:
                    if no_row % 2 == 0:
                        no_row = no_row / 2
                    else:
                        no_row = (no_row + 1) / 2
                if no_row == 1:
                    no_row = 2
                pitch = avbl_length / (no_row - 1)
                gauge = min_gauge
                if end_plate_w != 0:
                    if (end_plate_w / 2 - edge_dist - gauge) > 70:
                        eccentricity = gauge / 2 + 70
                        edge_dist = end_plate_w / 2 - (70 + gauge)
                    else:
                        eccentricity = (end_plate_w / 2 - edge_dist -
                                        gauge / 2)
                else:
                    eccentricity = gauge / 2 + 50
                crit_shear = critical_bolt_shear(shear_load, eccentricity,
                                                 pitch, gauge, no_row)
                if crit_shear > bolt_capacity:

                    while crit_shear > bolt_capacity and pitch > min_pitch:
                        no_row = no_row + 1
                        pitch = avbl_length / (no_row - 1)
                        crit_shear = critical_bolt_shear(
                            shear_load, eccentricity, pitch, gauge, no_row)
                    if pitch < min_pitch:
                        design_check = False
                        logger.error(
                            ": Shear force on the critical bolt due to external load is more than the bolt capacity"
                        )
                        logger.warning(
                            ": Bolt capacity of the critical bolt is %2.2f" %
                            (bolt_capacity))
                        logger.info(
                            ": Increase the diameter of the bolt or bolt grade"
                        )

                    elif bolt_capacity > crit_shear and pitch > min_pitch:
                        pass

        min_end_plate_l = 2 * min_end_dist + (no_row - 1) * min_pitch
        max_end_plate_l = beam_depth - 2 * (beam_f_t + beam_R1)

        if connectivity == "Column web-Beam web":
            max_end_plate_w = column_d - 2 * (column_f_t + column_R1)
        elif connectivity == "Column flange-Beam web":
            max_end_plate_w = column_b
        else:
            pass
        if end_plate_w != 0:
            if no_col == 1:
                sectional_gauge = end_plate_w - (2 * min_edge_dist)
                min_end_plate_w = 100 + (2 * min_edge_dist)
            else:
                sectional_gauge = end_plate_w - 2 * (min_edge_dist + gauge)
                min_end_plate_w = 100 + 2 * (min_edge_dist + gauge)
            if connectivity == "Column flange-Beam web":
                if sectional_gauge < max(90, (column_w_t + (2 * column_R1) +
                                              (2 * min_edge_dist))):
                    design_check = False
                    logger.error(
                        ": Cross center distance between the vertical bolt lines on either side of the beam is less than "
                        "specified gauge [reference JSC : chap. 5 check 1]")
                    logger.warning(
                        ": Minimum required cross center gauge is %2.2f mm" %
                        (max(90, (column_w_t + (2 * column_R1) +
                                  (2 * min_edge_dist)))))
                    logger.info(": Increase the plate width")
                else:
                    pass
            else:
                if sectional_gauge < 90:
                    design_check = False
                    logger.error(
                        ": Cross center distance between the bolt lines on either side of the beam is less than "
                        "specified gauge [reference JSC : chap. 5 check 1]")
                    logger.warning(
                        ": Minimum required cross center gauge is 90 mm")
                    logger.info(": Increase the plate width")
                else:
                    pass

            if sectional_gauge > 140:
                design_check = False
                logger.error(
                    ": Cross center distance between the vertical bolt lines on either side of the beam is greater than "
                    "specified gauge [reference JSC : chap. 5 check 1]")
                logger.warning(
                    ": Maximum permissible cross center gauge is 140 mm")
                logger.info(": Decrease the plate width")

        if end_plate_w == 0:
            min_end_plate_w = 100 + 2 * (min_edge_dist + gauge)
            end_plate_w = min_end_plate_w
            sectional_gauge = 100

            if connectivity != "Beam-Beam":
                if min_end_plate_w > max_end_plate_w:
                    design_check = False
                    logger.error(
                        ": Calculated width of the end plate exceeds the width of the column"
                    )
                    logger.warning(": Minimum end plate width is %2.2f" %
                                   (min_end_plate_w))

    else:

        no_row = bolts_required / 2
        no_col = 1

        end_plate_l = (no_row - 1) * min_pitch + 2 * min_end_dist
        pitch = min_pitch
        max_end_plate_l = beam_depth - 2 * (beam_f_t + beam_R1)
        end_dist = min_end_dist
        edge_dist = min_edge_dist
        test = True
        if end_plate_l > max_end_plate_l:
            test = False
            no_col = 2
            if no_row % 2 == 0:
                no_row = no_row / 2
            else:
                no_row = (no_row + 1) / 2
            if no_row < 2:
                no_row = 2

            if end_plate_w != 0:
                if (end_plate_w / 2 - edge_dist - gauge) > 70:
                    eccentricity = gauge / 2 + 70
                    edge_dist = end_plate_w / 2 - (70 + gauge)
                else:
                    eccentricity = (end_plate_w / 2 - edge_dist - gauge / 2)
            else:
                eccentricity = gauge / 2 + 50
        else:
            no_col = 1
            gauge = 0
            if end_plate_w != 0:
                if (end_plate_w / 2 - edge_dist - gauge) > 70:
                    eccentricity = gauge / 2 + 70
                    edge_dist = end_plate_w / 2 - (70 + gauge)
                else:
                    eccentricity = (end_plate_w / 2 - edge_dist - gauge / 2)
            else:
                eccentricity = gauge / 2 + 50

# ############################################### check critical bolt shear capacity ################################################3
        if shear_load != 0:
            crit_shear = critical_bolt_shear(shear_load, eccentricity, pitch,
                                             gauge, no_row)

            if crit_shear > bolt_capacity:
                if no_col == 1:
                    while crit_shear > bolt_capacity and end_plate_l < max_end_plate_l:
                        no_row = no_row + 1
                        end_plate_l = end_plate_l + pitch
                        crit_shear = critical_bolt_shear(
                            shear_load, eccentricity, pitch, gauge, no_row)
                    if end_plate_l > max_end_plate_l:
                        no_col = 2
                    elif bolt_capacity > crit_shear and end_plate_l < max_end_plate_l:
                        pass

                if no_col == 2:  # Call math.ceil(x)
                    if test is True:
                        test = False
                        if no_row % 2 == 0:
                            no_row = no_row / 2
                        else:
                            no_row = (no_row + 1) / 2
                    if no_row == 1:
                        no_row = 2

                    end_plate_l = (no_row - 1) * min_pitch + 2 * min_end_dist
                    gauge = min_gauge
                    if end_plate_w != 0:
                        if (end_plate_w / 2 - edge_dist - gauge) > 70:
                            eccentricity = gauge / 2 + 70
                            edge_dist = end_plate_w / 2 - (70 + gauge)
                        else:
                            eccentricity = (end_plate_w / 2 - edge_dist -
                                            gauge / 2)
                    else:
                        eccentricity = gauge / 2 + 50
                    crit_shear = critical_bolt_shear(shear_load, eccentricity,
                                                     pitch, gauge, no_row)
                    if crit_shear > bolt_capacity:

                        while crit_shear > bolt_capacity and end_plate_l < max_end_plate_l:
                            no_row = no_row + 1
                            end_plate_l = end_plate_l + pitch
                            crit_shear = critical_bolt_shear(
                                shear_load, eccentricity, pitch, gauge, no_row)
                        if end_plate_l > max_end_plate_l:
                            design_check = False
                            logger.error(
                                ": Shear force on the critical bolt due to external load is more than the bolt capacity"
                            )
                            logger.warning(
                                ": Capacity of the critical bolt is %2.2f" %
                                (bolt_capacity))
                            logger.info(
                                ": Increase the diameter of the bolt or bolt grade"
                            )
                        elif bolt_capacity > crit_shear and end_plate_l <= max_end_plate_l:
                            pass
        else:
            crit_shear = 0

# ############################ check end plate length ##########################################

        if end_plate_l < 0.6 * beam_depth:
            end_plate_l = 0.6 * beam_depth
            end_dist = (end_plate_l - (no_row - 1) * pitch) / 2

# ############################ check end plate width ##########################################
        if connectivity == "Column web-Beam web":
            max_end_plate_w = column_d - 2 * (column_f_t + column_R1)
        elif connectivity == "Column flange-Beam web":
            max_end_plate_w = column_b
        else:
            pass
        if end_plate_w != 0:
            sectional_gauge = end_plate_w - 2 * (min_edge_dist + gauge)
            min_end_plate_w = 100 + 2 * (min_edge_dist + gauge)
            if sectional_gauge < 90:
                design_check = False
                logger.error(
                    ": Cross center distance between the vertical bolt lines on either side of the beam is less than"
                    " specified gauge [reference JSC : chap. 5 check 1]")
                logger.warning(
                    ": Minimum required cross center gauge is 90 mm")
                logger.info(": Increase the plate width")

            if sectional_gauge > 140:
                design_check = False
                logger.error(
                    ": Cross center distance between the vertical bolt lines on either side of the beam is greater than "
                    "specified gauge [reference JSC : chap. 5 check 1]")
                logger.warning(
                    ": Maximum required cross center gauge is 140 mm")

        if end_plate_w == 0:
            min_end_plate_w = 100 + 2 * (min_edge_dist + gauge)
            end_plate_w = min_end_plate_w
            sectional_gauge = 100
            if connectivity != "Beam-Beam":

                if min_end_plate_w > max_end_plate_w:
                    design_check = False
                    logger.error(
                        ": Calculated width of the end plate exceeds the width of the column"
                    )
                    logger.warning(": Minimum end plate width is %2.2f mm" %
                                   (min_end_plate_w))

######### Check for shear capacity of bolt after multiplying the reduction factors (beta_l_g and beta_l_j) #####

    bolt_shear_capacity = get_reduction_factor(bolt_shear_capacity,
                                               connectivity, bolt_dia,
                                               bolts_required, pitch,
                                               end_plate_t, column_f_t,
                                               column_w_t, beam_w_t)

    # ################ CHECK 2: SHEAR CAPACITY OF BEAM WEB ####################

    shear_capacity_beam = 0.6 * beam_fy * 0.9 * end_plate_l * beam_w_t / 1000

    if shear_load > shear_capacity_beam:
        design_check = False
        logger.error(
            ": Shear capacity of the beam web at the end plate is less than the external load"
        )
        logger.warning(": Shear capacity of the beam web is %2.2f KN" %
                       (shear_capacity_beam))
        logger.info(
            ": Increase the end plate height if possible, else select a deeper beam section"
        )

# ################ CHECK 3: BLOCK SHEAR ####################
    min_thk = min(end_plate_t, beam_w_t)
    Tdb = blockshear(no_row, no_col, dia_hole, beam_fy, beam_fy, min_edge_dist,
                     end_dist, pitch, gauge, min_thk)

    if Tdb < shear_load:
        design_check = False
        logger.error(
            ": Block shear capacity of the plate is less than the applied shear force [cl. 6.4.1]"
        )
        logger.warning(": Minimum block shear capacity required is % 2.2f KN" %
                       (shear_load))
        logger.info(": Increase the plate thickness")

# ################ CHECK 4: FILLET WELD ####################

    weld_l = end_plate_l - 2 * weld_t
    Vy1 = (shear_load) / float(2 * weld_l)
    Vy1 = round(Vy1, 3)
    weld_strength = 0.7 * weld_t * weld_fu / (math.sqrt(3) * 1000 * gamma_mw)
    weld_strength = round(weld_strength, 3)
    if Vy1 > weld_strength:
        design_check = False
        logger.error(
            ": Weld strength is less than the shear demand [cl. 10.5.9]")
        logger.warning(": Weld strength should be greater than %2.2f kN/mm" %
                       (weld_strength))
        logger.info(": Increase the weld size")

    ############## Check for minimum weld thickness: Table 21; IS 800 ###########
    # Here t_thicker indicates thickness of thicker part

    if connectivity == "Column web-Beam web":
        t_thicker = max(column_w_t.real, end_plate_t.real)
    elif connectivity == "Column flange-Beam web":
        t_thicker = max(column_f_t.real, end_plate_t.real)
    else:
        t_thicker = max(column_w_t.real, end_plate_t.real)

    if float(t_thicker) > 0 or float(t_thicker) <= 10:
        weld_t_min = int(3)
    elif float(t_thicker) > 10 or float(t_thicker) <= 20:
        weld_t_min = int(5)
    elif float(t_thicker) >= 20 or float(t_thicker) <= 32:
        weld_t_min = int(6)
    else:
        weld_t_min = int(10)

    weld_t_req = weld_t_min

    # if weld_t_req != int(weld_t_req):
    #     weld_t_req = int(weld_t_req) + 1
    # else:
    #     weld_t_req = weld_t_req

    if weld_t < weld_t_req:
        design_check = False
        logger.error(
            ": Weld thickness is not sufficient [cl. 10.5.2.3 and Table 21]")
        logger.warning(": Minimum weld thickness required is %2.2f mm " %
                       (weld_t_req))
        logger.info(
            ": Increase the weld thickness or the length of weld/end plate")

    # End of calculation
    output_obj = {}
    output_obj['Bolt'] = {}
    output_obj['Bolt']['status'] = design_check
    output_obj['Bolt']['shearcapacity'] = bolt_shear_capacity
    output_obj['Bolt']['bearingcapacity'] = bolt_bearing_capacity
    output_obj['Bolt']['boltcapacity'] = bolt_capacity
    output_obj['Bolt']['numofbolts'] = int(2 * no_col * no_row)
    output_obj['Bolt']['boltgrpcapacity'] = float(bolt_capacity * 2 * no_col *
                                                  no_row)
    output_obj['Bolt']['numofrow'] = int(no_row)
    output_obj['Bolt']['numofcol'] = int(2 * no_col)
    output_obj['Bolt']['pitch'] = float(pitch)
    output_obj['Bolt']['enddist'] = float(end_dist)
    output_obj['Bolt']['edge'] = float(edge_dist)
    output_obj['Bolt']['gauge'] = float(gauge)
    output_obj['Bolt']['thinner'] = float(t_thinner)
    output_obj['Bolt']['dia_hole'] = float(dia_hole)
    output_obj['Bolt']['bolt_fu'] = float(bolt_fu)
    output_obj['Bolt']['bolt_fy'] = float(bolt_fy)
    output_obj['Bolt']['critshear'] = float(round(crit_shear, 3))
    output_obj['Bolt']['kb'] = float(kb)

    output_obj['Weld'] = {}
    output_obj['Weld']['weldshear'] = Vy1
    output_obj['Weld']['weldlength'] = weld_l
    output_obj['Weld']['weldstrength'] = weld_strength
    output_obj['Weld']['thickness'] = weld_t_req
    output_obj['Weld']['thicknessprovided'] = weld_t

    output_obj['Plate'] = {}
    output_obj['Plate']['height'] = float(end_plate_l)
    output_obj['Plate']['width'] = float(end_plate_w)
    output_obj['Plate']['MinThick'] = float(min_end_plate_t)
    output_obj['Plate']['MinWidth'] = float(min_end_plate_w)
    output_obj['Plate']['blockshear'] = float(Tdb)
    output_obj['Plate']['Sectional Gauge'] = float(sectional_gauge)

    if weld_type == 'Shop weld':
        if weld_t < 6:
            logger.warning(
                " : Minimum recommended weld thickness for shop weld is 6 mm")
    else:
        if weld_t < 8:
            logger.warning(
                " : Minimum recommended weld thickness for field weld is 8 mm")

    if output_obj['Bolt']['status'] is True:

        logger.info(": Overall end plate connection design is safe \n")
        logger.debug(" :=========End Of design===========")

    else:
        logger.error(": Design is not safe \n ")
        logger.debug(" :=========End Of design===========")
    return output_obj