コード例 #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 top_angle_section(self):
        """Identify appropriate top angle size based on beam depth.

        Args:            

        Returns:
            top_angle(string): top angle section

        Note:
            Assumptions:
                Calculating top angle dimensions based on thumb rules:
                    top_angle_side = beam_depth/4
                    top_angle_thickness = top_angle_side/10
                Select the nearest available equal angle as the top angle.
                Equal angles satisfying both these thumb rules are selected for this function from steel tables
        """
        # minimum length of leg of top angle is twice edge distance + angle thickness.
        # as the side length is rounded up in the next step, ignoring angle thickness while calculating
        # minimum length of side
        top_angle_side_minimum = 2 * self.min_edge_multiplier * self.bolt_hole_diameter  # twice edge distance
        top_angle_side = max(float(self.beam_d) / 4, top_angle_side_minimum)
        # round up to nearest 5 mm. '+2' for conservative round up.
        top_angle_side = ConnectionCalculations.round_up_5(top_angle_side + 2)

        try:
            top_angle = {
                20:
                "20 20 X 3",  # does not satisfy min edge dist req for 12 mm bolt
                25:
                "25 25 X 3",  # does not satisfy min edge dist req for 12 mm bolt
                30:
                "30 30 X 3",  # does not satisfy min edge dist req for 12 mm bolt
                35:
                "35 35 X 4",  # does not satisfy min edge dist req for 12 mm bolt
                40: "40 40 X 4",
                45: "45 45 X 5",
                50: "50 50 X 5",
                55: "55 55 X 6",
                60: "60 60 X 6",
                65: "65 65 X 6",
                70: "70 70 X 7",
                75: "75 75 X 8",
                80: "80 80 X 8",
                90: "90 90 X 10",
                100: "100 100 X 10"
            }[top_angle_side]
        except KeyError:
            top_angle = " cannot compute"
        return top_angle
コード例 #3
0
    def seat_angle_connection(self, input_dict):
        """ Perform design and detailing checks based for seated angle connection.

        Args:
            input_dict (dictionary)

        Returns:
            output_dict (dictionary)

        Note:
            Algorithm:
            1) Initialise variables to use
            2) Bolt Design (layout and spacing)
            3) Determine length of outstanding leg of seated angle
            4) Determine shear strength of outstanding leg and compare with capacity

        """

        self.sa_params(input_dict)

        self.clear_col_space = self.column_d - 2 * self.column_f_t - 2 * self.column_R1 - 2 * self.root_clearance_col
        if self.connectivity == "Column web-Beam flange" and self.beam_b > self.clear_col_space:
            self.safe = False
            logger.error(": Compatibility failure")
            logger.warning(": Beam width (%s mm) is greater than the clear space available" + \
                           " between column flanges (%s mm)" % self.clear_col_space, self.beam_b)
            logger.info(": Select compatible beam and column sizes")

        self.bolt_design()

        if self.top_angle_recommended != self.top_angle:
            logger.warning(
                ": Based on thumb rules, a top angle of size %s is sufficient to provide stability to %s ",
                self.top_angle_recommended, self.beam_section)

        self.top_angle_end_dist_column = (
            float(self.top_angle_A) - self.top_angle_t - self.top_angle_R1 -
            self.top_angle_R2) / 2 + self.top_angle_R2
        self.top_angle_end_dist_beam = (
            float(self.top_angle_B) - self.top_angle_t - self.top_angle_R1 -
            self.top_angle_R2) / 2 + self.top_angle_R2
        self.seat_angle_end_dist_beam = (float(self.angle_B) - self.angle_t -
                                         self.angle_R1 -
                                         self.angle_R2) / 2 + self.angle_R2

        self.top_angle_end_dist_column = ConnectionCalculations.round_up_5(
            self.top_angle_end_dist_column)
        self.top_angle_end_dist_beam = ConnectionCalculations.round_up_5(
            self.top_angle_end_dist_beam)
        self.seat_angle_end_dist_beam = ConnectionCalculations.round_up_5(
            self.seat_angle_end_dist_beam)

        if self.top_angle_end_dist_column < self.min_end_dist:
            self.safe = False
            logger.error(": Detailing failure for the top angle")
            logger.warning(
                ": Minimum end distance for the selected bolt is %2.2f mm [cl. 10.2.2] "
                % self.min_end_dist)
            logger.info(
                ": Select bolt with lower grade/diameter to reduce minimum end distances"
            )
            logger.info(": or increase leg A of the top angle")

        if self.top_angle_end_dist_beam < self.min_end_dist:
            self.safe = False
            logger.error(": Detailing failure for the top angle")
            logger.warning(
                ": Minimum end distance for the selected bolt is %2.2f mm [cl. 10.2.2] "
                % self.min_end_dist)
            logger.info(
                ": Select bolts with a lower grade/diameter to reduce the minimum end distances required"
            )
            logger.info(": or Increase leg B of the top angle")

        if self.seat_angle_end_dist_beam < self.min_end_dist:
            self.safe = False
            logger.error(": Detailing failure for the seat angle")
            logger.warning(
                ": Minimum end distance for the selected bolt is %2.2f mm [cl. 10.2.2] "
                % self.min_end_dist)
            logger.info(
                ": Select bolts with a lower grade/diameter to reduce the minimum end distances required"
            )
            logger.info(": or increase leg B of the seat angle")

        # To avoid bolts intersecting the column web in CFBF connectivity:
        if self.connectivity == "Column flange-Beam flange":
            if self.bolts_required == 3:
                self.bolts_required = 4
            elif self.bolts_required == 5:
                self.bolts_required = 8
                logger.info(": 5 bolts are required but 8 are being provided")
                logger.info(": Select bolts with a higher grade/diameter")
            elif self.bolts_required == 6:
                self.bolts_required = 8
                logger.info(": 6 bolts are required but 8 are being provided")
                logger.info(
                    ": It is recommended to increase the bolt grade or bolt diameter"
                )
            elif self.bolts_required == 7:
                self.bolts_required = 8
                logger.info(": 7 bolts are required but 8 are being provided")
                logger.info(
                    ": It is recommended to increase the bolt grade or bolt diameter"
                )

        self.bolt_group_capacity = round(self.bolts_required * self.bolt_value,
                                         1)

        if self.connectivity == "Column web-Beam flange":
            limiting_angle_length = self.column_d - 2 * self.column_f_t - 2 * self.column_R1 - self.root_clearance_col

            self.angle_l = int(
                math.ceil(min(self.beam_b, limiting_angle_length)))
        elif self.connectivity == "Column flange-Beam flange":
            self.angle_l = int(math.ceil(min(self.beam_b, self.column_b)))

        if self.angle_t < 6:
            logger.warning(
                ": Minimum thickness of 6 mm is recommended for the seat angle"
            )
            logger.warning(": Please revise the seat angle section")

        # Determine single or double line of bolts
        length_avail = (self.angle_l - 2 * self.edge_dist)

        # Determine gauge for two bolts (to be used for top angle)
        self.gauge_two_bolt = length_avail

        self.num_rows = 1
        self.num_cols = max(self.bolts_required, 2)
        self.gauge = round(int(math.ceil(length_avail / (self.num_cols - 1))),
                           3)

        if self.gauge < self.min_gauge:
            self.num_rows = 2
            if self.bolts_required % 2 == 1:
                self.bolts_provided = self.bolts_required + 1
            else:
                self.bolts_provided = self.bolts_required
            self.num_cols = self.bolts_provided / 2
            if self.num_cols == 1:
                self.safe = False
                logger.error(": Detailing failure")
                logger.warning(
                    ": Minimum gauge distance for selected bolt is %2.2f mm [cl. 10.2.2] "
                    % self.min_gauge)
                logger.warning(
                    ": Minimum edge distance for selected bolt is %2.2f mm [cl. 10.2.4.2]"
                    % self.min_edge_dist)
                logger.warning(
                    ": Available length of the seat angle is %2.2f mm " %
                    self.angle_l)
                logger.warning(
                    ": 2 bolts of the selected diameter cannot fit in the available length of the seat angle"
                )
                logger.info(
                    ": Select bolts with a lower grade/diameter to reduce minimum gauge and edge distances required)"
                )
            else:
                self.gauge = int(math.ceil(length_avail / (self.num_cols - 1)))
                if self.gauge < self.min_gauge:
                    self.safe = False
                    logger.error(": Detailing failure")
                    logger.error(
                        ": Bolt gauge %2.0f mm is less than the minimum gauge distance [cl. 10.2.2]"
                        % self.gauge)
                    logger.warning(
                        ": Bolt gauge should be more than %2.2f mm " %
                        self.min_gauge)
                    logger.warning(
                        ": Maximum gauge distance allowed is %2.2f mm " %
                        self.max_spacing)
                    logger.info(
                        ": Select bolts with a higher grade/diameter to reduce the number of bolts)"
                    )
        if self.gauge > self.max_spacing:
            """
            Assumption: keeping minimum edge distance the same and increasing the number of bolts,
                to meet the max spacing requirement.
            1) set gauge = max spacing
            2) get approx (conservative) number of bolts per line based on this gauge
            3) use the revised number of bolts per line to get revised gauge distance

            The engineer can choose to use a different logic by keeping the number of bolts same,
                and increasing the edge distance.
            # gauge = max_spacing
            # edge_distance = (angle_l - (bolts_per_line-1)*gauge)/2
            """
            self.gauge = int(math.ceil(self.max_spacing))
            self.num_cols = int(math.ceil((length_avail / self.gauge) + 1))
            self.gauge = round(
                int(math.ceil(length_avail / (self.num_cols - 1))), 3)

        # End-user-developers may uncomment the below lines for an additional compatibility check
        # if self.connectivity == "Column flange-Beam flange":
        #     if self.gauge < self.column_w_t + 2*self.column_R1:
        #         self.safe = False
        #         logger.error(": Detailing failure")
        #         logger.warning(": Bolt passes through the column root")
        #         logger.info(": Increase the bolt gauge by reducing the number of bolts")

        if self.min_pitch > self.max_pitch:
            """
            Assumption: This unlikely case could occur when the minimum pitch (which is governed by the bolt diameter), 
            is greater than the maximum pitch (which is governed by thickness of connected member(s)).
            It is recommended to decrease the bolt diameter or increase the thickness of the connected members.
            """
            self.safe = False
            logger.error(
                ": Calculated minimum pitch is greater than calculated (rounded) maximum pitch"
            )
            logger.warning(": Bolt pitch should be more than  %2.2f mm " %
                           self.min_pitch)
            logger.warning(": Bolt pitch should be less than  %2.2f mm " %
                           self.max_pitch)
            logger.info(": Select bolts with a smaller diameter OR")
            logger.info(
                ": Select a connected member with a greater thickness.)")

        self.bolts_provided = self.num_cols * self.num_rows
        self.bolt_group_capacity = round(self.bolts_provided * self.bolt_value,
                                         1)

        if self.num_rows == 1:
            self.pitch = 0
        elif self.num_rows == 2:
            self.pitch = self.min_pitch
        self.end_dist = self.angle_A - self.angle_t - self.angle_R1 - self.root_clearance_sa - self.pitch
        self.end_dist = ConnectionCalculations.round_down_5(self.end_dist)
        self.pitch = (self.angle_A - self.angle_t - self.angle_R1 - self.root_clearance_sa - self.end_dist) * \
                     (self.num_rows - 1)
        if self.end_dist < self.min_end_dist:
            self.safe = False
            logger.error(": Detailing error")
            logger.error(
                ": Calculated bolt end distance is smaller than the minimum end distance"
            )
            logger.warning(": End distance should be more than  %2.2f mm " %
                           self.min_end_dist)
            logger.info(": Select bolts with a smaller diameter OR")
            logger.info(": Select a seat angle with longer vertical leg.")

        root_3 = math.sqrt(3)

        # Approximate shear capacity of beam, Vd = A_v*F_yw/root_3/gamma_m0 cl. 8.4.1
        self.beam_shear_strength = round(
            self.beam_d * self.beam_w_t * float(self.beam_fy) / root_3 /
            self.gamma_m0 / 1000, 1)

        if self.beam_shear_strength < float(self.shear_force):
            self.safe = False
            logger.error(
                ": Shear capacity of the supported beam is not sufficient [cl. 8.4.1]"
            )
            logger.warning(
                ": Shear capacity of the supported beam should be at least %2.2f kN"
                % float(self.shear_force))
            logger.warning(": Beam design is outside the scope of this module")

        # length of bearing required at the root line of beam (b) = R*gamma_m0/t_w*f_yw
        # Rearranged equation from cl. 8.7.4
        bearing_length = round((float(self.shear_force) * 1000) *
                               self.gamma_m0 / self.beam_w_t / self.angle_fy,
                               3)
        # logger.info(": Length of the bearing required at the root line of beam = " + str(bearing_length))

        # Required length of outstanding leg = bearing length + beam_col_clear_gap - beam_flange_thickness
        # (-beam_flange_thickness) comes from the 45 degree dispersion, but is conservatively not taken into account
        # while calculating the outstanding_leg_length
        self.outstanding_leg_length_required = bearing_length + self.beam_col_clear_gap

        if self.outstanding_leg_length_required > self.angle_B:
            self.safe = False
            logger.error(
                ": Length of the outstanding leg of the seat angle is less than the required bearing length [cl. 8.7.4]"
            )
            logger.warning(
                ": Outstanding leg length should be more than %2.2f mm" %
                self.outstanding_leg_length_required)
            logger.info(": Select seated angle with longer outstanding leg")
        """ comparing 0.6*shear strength (0.6*V_d) vs shear force V for calling moment capacity routine
        Shear capacity check cl. 8.4.1
        Shear capacity of the outstanding leg of cleat = A_v * f_yw / root_3 / gamma_m0
         = w*t*fy/gamma_m0/root_3
        """

        self.outstanding_leg_shear_capacity = round(
            self.angle_l * self.angle_t * self.angle_fy * 0.001 / root_3 *
            self.gamma_m0, 1)  # kN

        if self.outstanding_leg_shear_capacity < self.shear_force:
            self.safe = False
            required_angle_thickness_shear = math.ceil(
                self.shear_force * self.angle_t /
                self.outstanding_leg_shear_capacity)
            logger.error(
                ": Shear capacity of outstanding leg of seated angle is insufficient [cl. 8.4.1]"
            )
            logger.warning(
                ": Shear capacity of outstanding leg of seated angle is %2.2f kN"
                % float(self.outstanding_leg_shear_capacity))
            logger.warning(
                ": Shear capacity should be more than factored shear force %2.2f kN"
                % float(self.shear_force))
            logger.info(
                ": Select a seat angle with thickness greater than %2.1f mm" %
                required_angle_thickness_shear)

        # based on 45 degree dispersion cl. 8.7.1.3, stiff bearing length (b1) is calculated as
        # (stiff) bearing length on cleat (b1) = b - T_f (beam flange thickness) - r_b (root radius of beam flange)
        b1 = max(bearing_length - self.beam_f_t - self.beam_R1,
                 bearing_length / 2)

        # Distance from the end of bearing on cleat to root angle OR A TO B in Fig 5.31 in Subramanian's book
        b2 = max(b1 + self.beam_col_clear_gap - self.angle_t - self.angle_R1,
                 0)
        """Check moment capacity of outstanding leg

        Assumption:
            1) load is uniform over the stiff bearing length (b1)
            2) Moment (demand) is calculated at root of angle (at location B)
                due to load on the right of location B

        Shear force is compared against 0.6*shear capacity of outstanding leg to
            use appropriate moment capacity equation
        """

        if b1 > 0.1:
            self.moment_at_root_angle = round(
                float(self.shear_force) * (b2 / b1) * (b2 / 2), 1)

        if self.shear_force * self.shear_force < 1 or b2 == 0 or b1 < 0.1 or self.moment_at_root_angle < 0:
            self.safe = False
            logger.warning(
                ": Calculated moment demand on the angle leg is %s " %
                self.moment_at_root_angle)
            logger.debug(
                ": The algorithm used to calculate this moment could give erroneous values due to one or "
                + "more of the following:")
            logger.debug(": a) Very low value of shear force ")
            logger.debug(
                ": b) Large seat angle section and a low value of the gap between beam and column"
            )
            logger.debug(
                ": c) Large beam section and a low value of the shear force")
            logger.debug(": Please verify the results manually ")
            self.moment_at_root_angle = 0.0
        """
        Assumption
            1) beta_b (in the equation in cl. 8.2.1.2) = 1.0 as the outstanding leg is plastic section
            2) using Z_e (Elastic section modulus) for moment capacity
        """
        self.leg_moment_d = (self.angle_fy / self.gamma_m0) * (
            self.angle_l * self.angle_t**2 / 6) / 1000

        if float(
                self.shear_force) <= 0.6 * self.outstanding_leg_shear_capacity:
            angle_moment_capacity_clause = "cl. 8.2.1.2"
            self.is_shear_high = False
            # to avoid irreversible deformation (in case of cantilever),
            # under service-ability loads, moment_d shall be less than 1.5*Z_e*f_y/gamma_m0
            leg_moment_d_limiting = 1.5 * (self.angle_fy / self.gamma_m0) * (
                self.angle_l * self.angle_t**2 / 6) / 1000
            angle_outst_leg_mcapacity = min(self.leg_moment_d,
                                            leg_moment_d_limiting)
        else:
            self.is_shear_high = True
            angle_moment_capacity_clause = "cl. 8.2.1.3"
            """ cl. 8.2.1.3
            if shear force > 0.6 * shear strength of outstanding leg:
            The moment capacity of the outstanding leg is calculated as,
            M_d = M_dv (as defined in cl. 9.2)
            cl. 9.2.2 for plastic section

            Assumption :
            M_fd=0 as the shear resiting area and moment resisting area are the same,
                for the cross section of the outstanding leg
            Thus,
            M_dv = min ((1-beta)*M_d, 1.2*Z_e*f_y/gamma_m0)
            where, beta = ((2V/V_d) - 1)^2
            """
            leg_moment_d_limiting = 1.2 * (self.angle_fy / self.gamma_m0) * (
                self.angle_l * self.angle_t**2 / 6) / 1000
            beta_moment = ((2 * float(self.shear_force) /
                            self.outstanding_leg_shear_capacity) - 1)**2
            angle_outst_leg_mcapacity = min(
                (1 - beta_moment) * self.leg_moment_d, leg_moment_d_limiting)
            self.moment_high_shear_beta = beta_moment

        self.moment_capacity_angle = round(angle_outst_leg_mcapacity, 1)

        if self.moment_capacity_angle < self.moment_at_root_angle:
            self.safe = False
            logger.error(
                ": Moment capacity of the outstanding leg of the seat angle is not sufficient "
                + angle_moment_capacity_clause)
            logger.warning(": Moment capacity should be at least %2.2f kN-mm" %
                           self.moment_at_root_angle)
            logger.info(
                ": Increase thickness or decrease length of the outstanding leg of the seat angle"
            )
        """ Check for local buckling capacity of web of supported beam (cl. 8.7.3.1)
        Variables are prefixed with bwlb: beam web local buckling

        Assumptions:
                1) Effective length of web of supported beam (8.7.1.5) [KL = L]
                2) steel_E = 200000 MPa
                3) Effective sectional area for computing design compressive strength P_d (7.1.2)
                is taken as indicated in (8.7.3.1)
        """

        # Area of cross section of beam web:
        bwlb_b1 = b1  # width of stiff bearing on flange (8.7.1.3)

        # Dispersion of the load through the web at 45 degree, to the level of half the depth of the cross-section
        bwlb_n1 = self.beam_d / 2 - self.beam_R1 - self.beam_f_t

        # Effective length of web of supported beam (8.7.1.5) assumed KL = L
        bwlb_KL = self.beam_d - 2 * self.beam_f_t - 2 * self.beam_R1

        # For calculating design compressive strength of web of supported beam (7.1.2.1)
        steel_E = 200000  # MPa
        bwlb_lambda = (bwlb_KL * 2 * root_3 / self.beam_w_t /
                       math.pi) * math.sqrt(float(self.beam_fy) / steel_E)
        bwlb_alpha = 0.49  # Imperfection factor for buckling class 'c' (IS 800 - Table 7 and 8.7.3.1)
        bwlb_phi = 0.5 * (1 + bwlb_alpha *
                          (bwlb_lambda - 0.2) + bwlb_lambda**2)
        bwlb_chi = max((bwlb_phi + (bwlb_phi**2 - bwlb_lambda**2)**0.5)**(-1),
                       1.0)
        bwlb_f_cd = bwlb_chi * float(self.beam_fy) / self.gamma_m0

        # Design compressive strength (7.1.2)
        bwlb_P_d = (bwlb_b1 + bwlb_n1) * bwlb_f_cd
        self.beam_web_local_buckling_capacity = bwlb_P_d

        if self.beam_web_local_buckling_capacity < self.shear_force:
            self.safe = False
            logger.error(
                ": Local buckling capacity of the web of the supported beam is less than the shear force [cl. 8.7.3.1]"
            )
            logger.warning(": Local buckling capacity is %2.2f kN-mm" %
                           self.beam_web_local_buckling_capacity)
            logger.info(
                ": Increase the length of the outstanding leg of the seat angle to increase the stiff bearing length"
            )

        # End of calculation
        # ---------------------------------------------------------------------------
        self.sa_output()

        if self.output_dict['SeatAngle']['status'] is True:
            logger.info(": Overall seated angle connection design is safe")
            logger.debug(": =========End Of design===========")
        else:
            logger.error(": Design is not safe")
            logger.debug(": =========End Of design===========")

        return self.output_dict
コード例 #4
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
コード例 #5
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